?? inverseeditor.java
字號:
package com.horstmann.corejava;
import java.awt.*;
import java.beans.*;
import javax.swing.*;
/**
* The property editor for the inverse property of the ChartBean. The inverse property toggles
* between colored graph bars and colored background.
* @version 1.30 2007-10-03
* @author Cay Horstmann
*/
public class InverseEditor extends PropertyEditorSupport
{
public Component getCustomEditor()
{
return new InverseEditorPanel(this);
}
public boolean supportsCustomEditor()
{
return true;
}
public boolean isPaintable()
{
return true;
}
public String getAsText()
{
return null;
}
public String getJavaInitializationString()
{
return "" + getValue();
}
public void paintValue(Graphics g, Rectangle bounds)
{
ImageIcon icon = (Boolean) getValue() ? inverseIcon : normalIcon;
int x = bounds.x + (bounds.width - icon.getIconWidth()) / 2;
int y = bounds.y + (bounds.height - icon.getIconHeight()) / 2;
g.drawImage(icon.getImage(), x, y, null);
}
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 + -