第一次用 Java寫UI
阿新 • • 發佈:2019-01-23
以後還是要用Eclipse 作為GUI的Framework:)
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class LookAndFeel extends JFrame{
public LookAndFeel()
{
super("Look And Feel");
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
cp.add(new JButton("JButton"));
cp.add(new JButton("JTextField"));
}
public static void main(String[] args)
{
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
}
LookAndFeel f = new LookAndFeel();
f.setSize(200,200);
f.setVisible(true);
}
}