-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathInverseEditorPanel.java
More file actions
51 lines (46 loc) · 1.25 KB
/
Copy pathInverseEditorPanel.java
File metadata and controls
51 lines (46 loc) · 1.25 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
48
49
50
51
package chart;
import java.awt.event.*;
import java.beans.*;
import javax.swing.*;
/**
* The panel for setting the inverse property. It contains a button to toggle between normal and
* inverse coloring.
* @version 1.30 2007-10-03
* @author Cay Horstmann
*/
public class InverseEditorPanel extends JPanel
{
private JButton button;
private PropertyEditorSupport editor;
private ImageIcon normalIcon = new ImageIcon(getClass().getResource("ChartBean_MONO_16x16.gif"));
public InverseEditorPanel(PropertyEditorSupport ed)
{
editor = ed;
button = new JButton();
updateButton();
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
editor.setValue(!(Boolean) editor.getValue());
updateButton();
}
});
add(button);
}
private void updateButton()
{
if ((Boolean) editor.getValue())
{
button.setIcon(inverseIcon);
button.setText("Inverse");
}
else
{
button.setIcon(normalIcon);
button.setText("Normal");
}
}
private ImageIcon inverseIcon = new ImageIcon(getClass().getResource(
"ChartBean_INVERSE_16x16.gif"));
}