java synth实例
今天给大家做了个button的synth实例。 首先要创建一个java文件,定义一个button的类,并且在类里面初始化button。画出来 代码如下: import java.awt.Dimension; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.plaf.synth.SynthLookAndFeel; public class MyButton { JFrame frame = new JFrame("Test synth"); JButton btn = new JButton("Sure"); public MyButton(){ frame.setLayout(new FlowLayout()); frame.setPreferredSize(new Dimension(300, 300)); frame.setBounds(400, 400, 0, 0); btn.setPreferredSize(new Dimension(100,100)); frame.getContentPane().add(btn); } public void show()