Có cách nào để thêm 0 margin/padding vào JPanel để nó phù hợp với màn hình WHOLE được giả sử không?0 lợi nhuận hàng đầu trên JPanel
Đây là những gì tôi đang nói về: (? Thấy dung lượng nhỏ trên bảng điều khiển tại sao nó không che đó là tốt?)
Dưới đây là cách nó thiết lập:
labelStatus = new JLabel("\n\nSorry, the server crashed!");
labelStatus.setForeground(Color.WHITE.brighter());
statusPanel = new JPanel();
statusPanel.setBackground(Color.RED.darker());
statusPanel.add(labelStatus);
statusPanel.setPreferredSize(new Dimension(513,352));
và đây là cách nó được iniated:
} catch (Exception rwe) {
// System.exit(0);
game.add(statusPanel);
game.remove(yPanel);
game.remove(xPanel);
game.remove(roomPanel);
game.remove(userPanel);
game.remove(titlePanel);
game.remove(introPanel);
statusPanel.setOpaque(true);
labelStatus.setVisible(true);
System.out.println("Server went down -- crap!");
c.append("\nServer crashed!");
rwe.printStackTrace();
}
Vì vậy .. làm thế nào để khắc phục điều đó khoảng cách nhỏ?