zoukankan      html  css  js  c++  java
  • 面板

     1 package Layout;
     2 import java.awt.*;
     3 import javax.swing.*;
     4 public class MyJPanel extends JFrame {
     5     private JPanel p1 = new JPanel();//面板默认流式布局
     6     private JPanel p2 = new JPanel();
     7     private JButton b1 = new JButton("B1");
     8     private JButton b2 = new JButton("B2");
     9     private JButton b3 = new JButton("B3");
    10     private JButton b4 = new JButton("B4");
    11     private JButton b5 = new JButton("B5");
    12     public MyJPanel(){
    13     this.setTitle("用户界面");
    14     this.setSize(500, 300);
    15     this.setLocation(600,400);
    16        p1.add(b1);
    17        p1.add(b2);
    18        p2.add(b4);
    19        p2.add(b5);
    20     this.add(p1,BorderLayout.NORTH);
    21     this.add(b3,BorderLayout.CENTER);
    22     this.add(p2,BorderLayout.SOUTH);
    23     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    24     this.setVisible(true);
    25     
    26     
    27 }
    28     public static void main(String[] args) {
    29     MyJPanel l = new MyJPanel();
    30 
    31     }
    32 
    33 }
  • 相关阅读:
    第七周总结
    结对开发nabcd
    第六周总结
    地铁售票设计思想及部分代码
    第二周总结
    进度总结(地铁查询购票)
    第三周总结
    冲刺四
    冲刺三
    冲刺2
  • 原文地址:https://www.cnblogs.com/the-wang/p/6752913.html
Copyright © 2011-2022 走看看