J2SE demo
年隔十载,物是人非。
public class Demo extends JFrame { public Demo() { //setUndecorated(true); //无框显示 setTitle("U have a dream"); setLookAndFeel(); setSize(300, 100); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FlowLayout flowLayout = new FlowLayout(); setLayout(flowLayout); JButton button1 = new JButton("开始"); ImageIcon imageIcon = new ImageIcon("images/close.png"); button1.setIcon(imageIcon); JButton button2 = new JButton("停止"); button2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("hello world"); } }); add(button1); add(button2); setVisible(true); } private void setLookAndFeel() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { new Demo(); } }

浙公网安备 33010602011771号