返回列表 發帖
  1. import javax.swing.JFrame;
  2. import javax.swing.JLabel;
  3. public class Ch75 {

  4.         public static void main(String[] args) {
  5.                 JFrame fm1031=new JFrame("視窗一");
  6.             JLabel l1=new JLabel("預設");
  7.             JLabel l2=new JLabel("靠左",JLabel.LEFT);
  8.             JLabel l3=new JLabel("置中",JLabel.CENTER);
  9.             JLabel l4=new JLabel("靠右",JLabel.RIGHT);
  10.             JLabel l5=new JLabel("其他");
  11.             l1.setBounds(8, 0, 180, 30);
  12.         l2.setBounds(8, 35, 180, 30);
  13.         l3.setBounds(8, 70, 180, 30);
  14.         l4.setBounds(8, 105, 180, 30);
  15.         l5.setBounds(50, 140, 100, 30);
  16.                 fm1031.setBounds(100, 100, 200, 200);
  17.         fm1031.setVisible(true);
  18.         fm1031.setResizable(false);
  19.         fm1031.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  20.         fm1031.setLayout(null);
  21.         fm1031.add(l1);
  22.         fm1031.add(l2);
  23.         fm1031.add(l3);
  24.         fm1031.add(l4);
  25.         fm1031.add(l5);
  26.         }

  27. }
複製代碼

TOP

返回列表