-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyButton.java
More file actions
38 lines (35 loc) · 1010 Bytes
/
MyButton.java
File metadata and controls
38 lines (35 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
/** Class extending JButton. Sets up JButton with color and size preferences.
*
* @author Gemma Smith <gemma.smith@tufts.edu>
* @version 1.0
* @since 2013-10-25
*/
public class MyButton extends JButton implements ActionListener
{
private String label;
private Color color;
/** Standard constructor. Creates JButton displaying l text and with color
* and font size preferences.
* @param l Text to display on button
* @param c Color of text
* @param fontSize Size of text (dictating size of button)
*/
public MyButton (String l, Color c, int fontSize)
{
label = l;
color = c;
setText(label);
setForeground (color);
setFont (new Font("SansSerif", Font.BOLD, fontSize));
}
/** Listener: not used in current version.
*/
public void actionPerformed(ActionEvent e)
{
}
}