📄 burro.java
字号:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Burro extends Frame implements ActionListener, ItemListener {
TextArea ta;
public Burro () {
super ("Burro");
ta = new TextArea ();
ta.setEditable(false);
add (ta, BorderLayout.CENTER);
CheckboxGroup cb = new CheckboxGroup ();
Panel p = new Panel(new GridLayout (0, 1));
String fonts[] = getToolkit().getFontList();
Checkbox c;
for (int i=0;i<fonts.length;i++) {
p.add (c = new Checkbox (fonts[i], false, cb));
c.addItemListener (this);
}
add (p, BorderLayout.EAST);
TextField tf = new TextField ();
// Without this, 'null' echo char stops output
// If real life, should fix Valdez.inspect().
tf.setEchoChar ('*');
tf.addActionListener (this);
add (tf, BorderLayout.SOUTH);
List l = new List();
for (int i=0;i<fonts.length;i++) {
l.add (fonts[i]);
}
l.addItemListener (this);
add (l, BorderLayout.WEST);
add (new Label (
"Select something and see Bean Information in Text Area"),
BorderLayout.NORTH);
enableEvents (AWTEvent.WINDOW_EVENT_MASK);
pack ();
show();
}
public static void main (String args[]) {
Burro b = new Burro ();
}
public void itemStateChanged (ItemEvent e) {
inspectIt (e);
}
public void actionPerformed (ActionEvent e) {
inspectIt (e);
}
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING)
System.exit(0);
}
public void inspectIt (AWTEvent e) {
StringWriter sw = new StringWriter();
Valdez.inspect (e.getSource(), sw);
ta.setText(sw.toString());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -