titlepositioneditor.java
来自「java核心技术源代码」· Java 代码 · 共 39 行
JAVA
39 行
/**
@version 1.10 1997-10-27
@author Cay Horstmann
*/
import java.beans.*;
/**
A custom editor for the titlePosition property of the
ChartBean. The editor lets the user choose between
Left, Center, and Right
*/
public class TitlePositionEditor
extends PropertyEditorSupport
{
public String getAsText()
{
int value = ((Integer)getValue()).intValue();
return options[value];
}
public void setAsText(String s)
{
for (int i = 0; i < options.length; i++)
{
if (options[i].equals(s))
{
setValue(new Integer(i));
return;
}
}
}
public String[] getTags() { return options; }
private String[] options = { "Left", "Center", "Right" };
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?