1
BoxLayoutに2つのボタンがあるパネルがあります。私が望むのは、ボタンの間に垂直のスペースを追加することです。ここでBoxLayoutのJButton間に垂直方向のスペースを追加するには?
私のコードです:
frame = new JFrame("FreshPos baza podataka");
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
JPanel panel = new JPanel();
panel.setBounds(new Rectangle(0, 5, 0, 0));
panel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
frame.getContentPane().add(panel, BorderLayout.WEST);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
JButton btnNewButton_1 = new JButton("New button");
panel.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("New button");
panel.add(btnNewButton_2);
https://docs.oracle.com /javase/tutorial/uiswing/layout/box.html – matt