我试图让 JPane 填满它的给定空间,但它不会。这段代码应该是解释性的......
JPanel memWindow = new JPanel();
memWindow.setLayout(new GridLayout(1, 4));
memWindow.add(memField = new JTextField(10));
memWindow.add(memView = new JButton("VM"));
memWindow.add(memAdd = new JButton("M+"));
memWindow.add(memSub = new JButton("M-"));
JPanel memWindow2 = new JPanel();
memWindow.setLayout(new GridLayout(1, 4));
memWindow.add(mem2Field = new JTextField(10));
memWindow.add(mem2View = new JButton("VM"));
memWindow.add(mem2Add = new JButton("M+"));
memWindow.add(mem2Sub = new JButton("M-"));
JPanel memWindows = new JPanel();
memWindows.setLayout(new GridLayout(2, 1));
memWindows.add(memWindow, BorderLayout.SOUTH);
memWindows.add(memWindow2, BorderLayout.NORTH);
add(displayWindow, BorderLayout.NORTH);
add(memWindows);
add(inputWindow, BorderLayout.SOUTH);
这是我得到的图形用户界面...