I had a problem creating a common fixed-size panel for a touch-screen GUI application that should cover the entire screen. In a nutshell, the touch screen has a size of 800 x 600 pixels, so I want the main GUI panel to be that size.
When I start a new GUI project in NetBeans, I set the property of the main panel for min / max / preferred size to 800 x 600, and the panel in the size of the view changes in the "design". However, when I launch the application, it changes to its original size by default.
Adding this code after initComponents () does not help:
this.mainPanel.setSize(new Dimension(800,600));
this.mainPanel.setMaximumSize(new Dimension(800,600));
this.mainPanel.setMinimumSize(new Dimension(800,600));
this.mainPanel.repaint();
I looked at all the resources in the files and cannot seem to find the value that replaces these (which seems somewhat impossible anyway, given that I install them after initComponents () does its job). I use the FreeDesign layout because I need full control over where I put things.
I suspect that the layout manager is resizing based on how many widgets I have on the screen, because the different prototyped screens have different sizes.
Help is appreciated!
John
source
share