stringsupport.java
字号:
package piy.support;
import java.awt.event.*;
import java.awt.*;
import piy.*;
import javax.swing.*;
import java.awt.Dimension;
/**
* Support for properties of String type.
* @author David Vivash
* @version 1.0, 08/02/01
*/
public class StringSupport extends ClassSupport implements KeyListener
{
private String value = null;
private JTextField textField;
public StringSupport(Property property) {
super(property);
value = (String)property.getValue();
setLayout(new BorderLayout());
add(textField = new JTextField(value), BorderLayout.CENTER);
textField.addKeyListener(this);
setBackground(Color.red);
}
public static Class getSupportedClass() { return String.class; }
public Dimension getMinimumSize() { return new Dimension(10, 20); }
public Dimension getPreferredSize() { return new Dimension(100, 20); }
public Dimension getMaximumSize() { return new Dimension(10000, 20); }
//--------- KeyListener methods ------------
public void keyPressed(KeyEvent e) { /* ignore */ }
public void keyTyped(KeyEvent e) { /* ignore */ }
public void keyReleased(KeyEvent e) {
ProjectHandler.getInstance().projectChanged();
property.setValue(textField.getText());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -