?? inverseeditorpanel.java
字號:
package com.horstmann.corejava;
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
{
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 JButton button;
private PropertyEditorSupport editor;
private ImageIcon inverseIcon = new ImageIcon(getClass().getResource(
"ChartBean_INVERSE_16x16.gif"));
private ImageIcon normalIcon = new ImageIcon(getClass().getResource("ChartBean_MONO_16x16.gif"));
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -