JAVA怎么在一个布局管理器中在添加一个布局管理器如下代码 在CENTER里面在添加一个网格布局
importjavax.swing.*;importjava.awt.*;//引入布局管理器publicclassBorderLayoutTest{publicstati...
import javax.swing.*;
import java.awt.*; // 引入布局管理器
public class BorderLayoutTest {
public static void main(String[] args) {
JFrame frame = new JFrame("布局管理器");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JPanel panel3 = new JPanel();
panel1.setBackground(new Color(0, 255, 0));
panel2.setBackground(new Color(255, 0, 0));
panel3.setBackground(new Color(0, 0, 255));
frame.add(BorderLayout.NORTH,panel1);
frame.add(BorderLayout.CENTER,panel2);
frame.add(BorderLayout.EAST,panel3);
frame.setLocation(400, 200);
frame.setSize(320, 240);
frame.setVisible(true);
}import javax.swing.*;
import java.awt.*; // 引入布局管理器
public class BorderLayoutTest {
public static void main(String[] args) {
JFrame frame = new JFrame("布局管理器");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JPanel panel3 = new JPanel();
panel1.setBackground(new Color(0, 255, 0));
panel2.setBackground(new Color(255, 0, 0));
panel3.setBackground(new Color(0, 0, 255));
frame.add(BorderLayout.NORTH,panel1);
frame.add(BorderLayout.CENTER,panel2);
frame.add(BorderLayout.EAST,panel3);
frame.setLocation(400, 200);
frame.setSize(320, 240);
frame.setVisible(true);
} 展开
import java.awt.*; // 引入布局管理器
public class BorderLayoutTest {
public static void main(String[] args) {
JFrame frame = new JFrame("布局管理器");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JPanel panel3 = new JPanel();
panel1.setBackground(new Color(0, 255, 0));
panel2.setBackground(new Color(255, 0, 0));
panel3.setBackground(new Color(0, 0, 255));
frame.add(BorderLayout.NORTH,panel1);
frame.add(BorderLayout.CENTER,panel2);
frame.add(BorderLayout.EAST,panel3);
frame.setLocation(400, 200);
frame.setSize(320, 240);
frame.setVisible(true);
}import javax.swing.*;
import java.awt.*; // 引入布局管理器
public class BorderLayoutTest {
public static void main(String[] args) {
JFrame frame = new JFrame("布局管理器");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
JPanel panel3 = new JPanel();
panel1.setBackground(new Color(0, 255, 0));
panel2.setBackground(new Color(255, 0, 0));
panel3.setBackground(new Color(0, 0, 255));
frame.add(BorderLayout.NORTH,panel1);
frame.add(BorderLayout.CENTER,panel2);
frame.add(BorderLayout.EAST,panel3);
frame.setLocation(400, 200);
frame.setSize(320, 240);
frame.setVisible(true);
} 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询