public class AbsolutePosition extends JFrame{ public AbsolutePosition() { // TODO Auto-generated constructor stub setTitle("本窗口使用绝对布局"); setLayout(null); setBounds(0,0,200,150); Container c = getContentPane(); JButton b1 = new JButton("按钮1"); JButton b2 = new JButton("按钮2"); b1.setBounds(10,30,80,30); b2.setBounds(60,70,100,20); c.add(b1); c.add(b2); setVisible(true); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } public static void main(String[] args) { // TODO Auto-generated method stub\ new AbsolutePosition(); } }
绝对布局(需要自定义每个原件的位置)
猜你喜欢
转载自www.cnblogs.com/dulute/p/10577474.html
今日推荐
周排行