📄 inverseeditor.java
字号:
/**
* @version 1.10 1997-10-27
* @author Cay Horstmann
*/
import java.awt.*;
import java.beans.*;
public class InverseEditor extends PropertyEditorSupport
{ public Component getCustomEditor()
{ return new InverseEditorPanel(this);
}
public boolean supportsCustomEditor()
{ return true;
}
public boolean isPaintable()
{ return true;
}
public void paintValue(Graphics g, Rectangle box)
{ boolean isInverse = ((Boolean)getValue()).booleanValue();
String s = isInverse ? "Inverse" : "Normal";
g.setColor(isInverse ? Color.black : Color.white);
g.fillRect(box.x, box.y, box.width, box.height);
g.setColor(isInverse ? Color.white : Color.black);
FontMetrics fm = g.getFontMetrics();
int w = fm.stringWidth(s);
int x = box.x;
if (w < box.width) x += (box.width - w) / 2;
int y = box.y + (box.height - fm.getHeight()) / 2
+ fm.getAscent();
g.drawString(s, x, y);
}
public String getAsText()
{ return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -