-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMinimizeButton.java
More file actions
47 lines (42 loc) · 1.17 KB
/
MinimizeButton.java
File metadata and controls
47 lines (42 loc) · 1.17 KB
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
39
40
41
42
43
44
45
46
47
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
/**
* The '-' minimize button.
*
* @author Michael Nipper
*
*/
public class MinimizeButton extends Button implements ActionListener {
private JFrame window;
/**
* @param x
* x-coordinate for the button
* @param y
* y-coordinate for the button
* @param width
* width of the button
* @param height
* height of the button
* @param upImage
* image to show when the button is not being pressed
* @param downImage
* image to show when the button is being pressed
* @param frame
* the JFrame object for the button to minimize
*/
public MinimizeButton(int x, int y, int width, int height,
ImageIcon upImage, ImageIcon downImage, JFrame frame) {
super(x, y, upImage, downImage);
addActionListener(this);
this.setWidth(width);
this.setHeight(height);
window = frame;
}
@Override
public void actionPerformed(ActionEvent e) {
window.setState(Frame.ICONIFIED);
}
}