Primary Button
Took primaryButton class from corresponding branch. Implemented constructors in ChatWindow.
This commit is contained in:
		@@ -15,7 +15,6 @@ import java.util.logging.Level;
 | 
				
			|||||||
import java.util.logging.Logger;
 | 
					import java.util.logging.Logger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.swing.DefaultListModel;
 | 
					import javax.swing.DefaultListModel;
 | 
				
			||||||
import javax.swing.JButton;
 | 
					 | 
				
			||||||
import javax.swing.JFrame;
 | 
					import javax.swing.JFrame;
 | 
				
			||||||
import javax.swing.JList;
 | 
					import javax.swing.JList;
 | 
				
			||||||
import javax.swing.JOptionPane;
 | 
					import javax.swing.JOptionPane;
 | 
				
			||||||
@@ -63,8 +62,8 @@ public class ChatWindow extends JFrame {
 | 
				
			|||||||
	private JScrollPane		scrollPane				= new JScrollPane();
 | 
						private JScrollPane		scrollPane				= new JScrollPane();
 | 
				
			||||||
	private JTextPane		textPane				= new JTextPane();
 | 
						private JTextPane		textPane				= new JTextPane();
 | 
				
			||||||
	// private JCheckBox jCbChangeMode;
 | 
						// private JCheckBox jCbChangeMode;
 | 
				
			||||||
	private JButton	postButton		= new JButton("Post");
 | 
						private PrimaryButton	postButton;
 | 
				
			||||||
	private JButton	settingsButton	= new JButton("Settings");
 | 
						private PrimaryButton	settingsButton;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private static int space = 4;
 | 
						private static int space = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -155,7 +154,7 @@ public class ChatWindow extends JFrame {
 | 
				
			|||||||
		contentPane.add(messageEnterTextArea, gbc_messageEnterTextfield);
 | 
							contentPane.add(messageEnterTextArea, gbc_messageEnterTextfield);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Post Button
 | 
							// Post Button
 | 
				
			||||||
		postButton.setBorderPainted(false);
 | 
							postButton = new PrimaryButton("Post");
 | 
				
			||||||
		GridBagConstraints gbc_moveSelectionPostButton = new GridBagConstraints();
 | 
							GridBagConstraints gbc_moveSelectionPostButton = new GridBagConstraints();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		gbc_moveSelectionPostButton.fill	= GridBagConstraints.BOTH;
 | 
							gbc_moveSelectionPostButton.fill	= GridBagConstraints.BOTH;
 | 
				
			||||||
@@ -168,7 +167,7 @@ public class ChatWindow extends JFrame {
 | 
				
			|||||||
		contentPane.add(postButton, gbc_moveSelectionPostButton);
 | 
							contentPane.add(postButton, gbc_moveSelectionPostButton);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Settings Button
 | 
							// Settings Button
 | 
				
			||||||
		settingsButton.setBorderPainted(false);
 | 
							settingsButton = new PrimaryButton("Settings");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		GridBagConstraints gbc_moveSelectionSettingsButton = new GridBagConstraints();
 | 
							GridBagConstraints gbc_moveSelectionSettingsButton = new GridBagConstraints();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										61
									
								
								src/main/java/envoy/client/ui/PrimaryButton.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/main/java/envoy/client/ui/PrimaryButton.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package envoy.client.ui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.awt.Graphics;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.swing.JButton;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Project: <strong>envoy-clientChess</strong><br>
 | 
				
			||||||
 | 
					 * File: <strong>PrimaryButton.javaEvent.java</strong><br>
 | 
				
			||||||
 | 
					 * Created: <strong>07.12.2019</strong><br>
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author Kai S. K. Engelbart
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class PrimaryButton extends JButton {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private static final long serialVersionUID = 3662266120667728364L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private int arcSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Creates a primary button with a white text color and a purple background
 | 
				
			||||||
 | 
						 * color.
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param title the title of the button
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public PrimaryButton(String title) { this(title, 6); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Creates a primary button with a white text color and a purple background
 | 
				
			||||||
 | 
						 * color.
 | 
				
			||||||
 | 
						 * 
 | 
				
			||||||
 | 
						 * @param title the title of the button
 | 
				
			||||||
 | 
						 * @param the   size of the arc used to draw the round button edges
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public PrimaryButton(String title, int arcSize) {
 | 
				
			||||||
 | 
							super(title);
 | 
				
			||||||
 | 
							// setForeground(new Color(255, 255, 255));
 | 
				
			||||||
 | 
							// setBackground(new Color(102, 51, 153));
 | 
				
			||||||
 | 
							setBorderPainted(false);
 | 
				
			||||||
 | 
							setFocusPainted(false);
 | 
				
			||||||
 | 
							setContentAreaFilled(false);
 | 
				
			||||||
 | 
							this.arcSize = arcSize;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						protected void paintComponent(Graphics g) {
 | 
				
			||||||
 | 
							g.setColor(getBackground());
 | 
				
			||||||
 | 
							g.fillRoundRect(0, 0, getWidth(), getHeight(), arcSize, arcSize);
 | 
				
			||||||
 | 
							super.paintComponent(g);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * @return the arcSize
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public int getArcSize() { return arcSize; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * @param arcSize the arcSize to set
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public void setArcSize(int arcSize) { this.arcSize = arcSize; }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user