⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flowlayoutframe.java~13~

📁 jbuilder2006一书的所有源代码
💻 JAVA~13~
字号:
package layout;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class FlowLayoutFrame extends JFrame {  JPanel contentPane;  //创建FlowLayout布局  FlowLayout flowLayout1 = new FlowLayout();  //创建15个按钮  JButton jButton1 = new JButton();  JButton jButton2 = new JButton();  JButton jButton3 = new JButton();  JButton jButton4 = new JButton();  JButton jButton5 = new JButton();  JButton jButton6 = new JButton();  JButton jButton7 = new JButton();  JButton jButton8 = new JButton();  JButton jButton9 = new JButton();  JButton jButton10 = new JButton();  JButton jButton11 = new JButton();  JButton jButton12 = new JButton();  JButton jButton13 = new JButton();  JButton jButton14 = new JButton();  JButton jButton15 = new JButton();  public FlowLayoutFrame() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception  {    contentPane = (JPanel) this.getContentPane();    contentPane.setLayout(flowLayout1);    this.setSize(new Dimension(400, 300));    this.setTitle("FlowLayout示例");    flowLayout1.setHgap(10);    flowLayout1.setVgap(10);    jButton1.setText("jButton1");    jButton2.setText("jButton2");    jButton3.setText("jButton3");    jButton4.setText("jButton4");    jButton5.setText("jButton5");    jButton6.setText("jButton6");    jButton7.setText("jButton7");    jButton8.setText("jButton8");    jButton9.setText("jButton9");    jButton10.setText("jButton10");    jButton11.setText("jButton11");    jButton12.setText("jButton12");    jButton13.setPreferredSize(new Dimension(120, 25));    jButton13.setText("jButton13");    jButton14.setText("jButton14");    jButton15.setText("jButton15");    contentPane.add(jButton1, null);    contentPane.add(jButton2, null);    contentPane.add(jButton3, null);    contentPane.add(jButton4, null);    contentPane.add(jButton5, null);    contentPane.add(jButton6, null);    contentPane.add(jButton7, null);    contentPane.add(jButton8, null);    contentPane.add(jButton9, null);    contentPane.add(jButton10, null);    contentPane.add(jButton11, null);    contentPane.add(jButton12, null);    contentPane.add(jButton13, null);    contentPane.add(jButton14, null);    contentPane.add(jButton15, null);  }  protected void processWindowEvent(WindowEvent e) {    if (e.getID() == WindowEvent.WINDOW_CLOSING) {      System.exit(0);    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -