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

📄 boxlayout2.java

📁 java经典的源代码 我非常喜欢这个源代码 对于编程很有好处
💻 JAVA
字号:
import java.awt.*;
import javax.swing.*;

public class BoxLayout2 extends JApplet {
   JButton  button1 = new JButton("Button 1"); 
   JButton  button2 = new JButton("Button 2"); 
   JButton  button3 = new JButton("Button 3");
   JButton  button4 = new JButton("Button 4"); 
   JButton  button5 = new JButton("Button 5");
   JPanel xP=new JPanel();
   JPanel yP=new JPanel();
   public void init() {
      
      Container cp = getContentPane();
      FlowLayout layout=new FlowLayout();
      cp.setLayout(layout);
      cp.add(xP);
      cp.add(yP);
      BoxLayout layout1=new BoxLayout(xP,BoxLayout.X_AXIS);
      xP.setLayout(layout1);
      xP.add(button1);
      xP.add(button2);
      xP.add(button3);
      BoxLayout layout2=new BoxLayout(yP,BoxLayout.Y_AXIS);
      yP.setLayout(layout2);
      yP.add(button4);
      yP.add(button5);
   }
} 

⌨️ 快捷键说明

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