I made a frame that is 1280x800. I'm using Absolute Positioning and when I add a panel or label that is 1280 pixels wide, it doesn't show about 8 pixels on the right side.
Why is the frame drawing at only 1272 pixels wide? I don't think it's the panel drawing at the wrong size, because I also have multiple panels across the middle and bottom of the frame that are lining up properly with the top panel.
|
Code:
|
JFrame lobbyFrame = new JFrame("Welcome to ...");
lobbyFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
lobbyFrame.setSize(1280, 800);
JPanel lobbyPanelTop = new JPanel();
lobbyFrame.add(lobbyPanelTop);
lobbyPanelTop.setLayout(null);
lobbyPanelTop.setOpaque(true);
lobbyPanelTop.setBackground(new Color(202, 102, 202));
lobbyPanelTop.setPreferredSize(new Dimension(1280, 120));
Dimension size = lobbyPanelTop.getPreferredSize();
lobbyPanelTop.setBounds(0, 0, size.width, size.height); |
And yes, I am intentionally using Absolute Positioning instead of a Layout Manager.