9 天
import javax.swing.*
JFrame PasswordFrame super setSize setDefaultCloseOperation setVisible pass.setVisible
JButton JPanel pane pane.add setContentPane(pane) JRadioButton
JComboBox JPanel JLabel JTextField JPasswordField JTextArea
comments.setLineWrap ImageIcon icon = new ImageIcon("3dman.gif");
String n = System.getProperty("java.library.path")
setBounds(250, 225, 300, 150)
JWindow
10天
import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
JOptionPane.showInputDialog
UIManager.setLookAndFeel
pack();
setLookAndFeel();
setVisible(true)
Thread runner pane.setLayout(new FlowLayout())
JProgressBar setStringPainted setValue Thread.sleep iterate
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
JSlider pickNum = new JSlider(JSlider.HORIZONTAL, 0, 30, 5); ImageIcon
12天
JPanel
implements ActionListener, FocusListener
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() instanceof JTextField)
frame.update(this);
public void focusLost(FocusEvent evt) {
frame.update(this);
}
public void focusGained(FocusEvent evt) { }
import java.awt.*;
import javax.swing.*;
implements ActionListener
public static void main(String arguments) {
JFrame frame = new Positive();
}
public void focusGained(FocusEvent evt) {
checkValue(evt.getSource());
}
public void focusLost(FocusEvent evt) {
checkValue(evt.getSource());
}
import java.awt.event.*;
void checkValue(Object source) {
JTextField field = (JTextField)source;
try {
int value = Integer.parseInt(field.getText());
if (value < 0) {
value = value * -1;
field.setText("" + value);
}
} catch (NumberFormatException exc) {
field.setText("0");
}
}
}
pick.addItemListener(this);
pick.addItem("Navigator");
pick.addItem("Internet Explorer");
pick.addItem("Opera");
pick.setEditable(false);
result.setHorizontalAlignment(SwingConstants.CENTER);
result.setEditable(false);