Netbeans GUI Designer & Fixed-Size Application Panels
I'm having a problem, creating a fixed-size overall panel for a touchscreen GUI application that has to take up the entire screen. In a nutshell, the touchscreen is 800 x 600 pixels, and therefore I want the main GUI panel to be that size.
When I start a new GUI project in NetBeans, I set the properties of the main panel for min/max/preferred size to 800 x 600, and the panel within the 'Design' view changes size. However, when I launch the app, it is resized to the original default size.
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've peeked into all of the resource files and cannot seem to find values that would override these (which seems somewhat impossible anyway, given that I'm setting them after initComponents() does its work). I'm using the FreeDesign layout, because I wanted complete control over where I put things.
I suspect the layout manager is resizing things based upon how many widgets I have on the screen, because different prototyped screens come in at differing sizes.
Help is appreciated!
Asked by: Vivian428 | Posted: 23-01-2022
Answer 1
Have you tried java full screen mode?
Answered by: Anna539 | Posted: 24-02-2022Answer 2
I use this method to complete the task, not sure if its the best and you need to wait calling it until the frame is actually on the screen.
protected void growBig()
{
int screenWidth = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;
int screenHeight = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height;
Rectangle rectangle = getFrame().getBounds();
rectangle.setSize(screenWidth, screenHeight);
getFrame().setBounds(0, 0, screenWidth, screenHeight);
getFrame().setSize(screenWidth, screenHeight);
getFrame().doLayout();
getFrame().validate();
updateUI();
}
Answered by: Madaline979 | Posted: 24-02-2022
Answer 3
I'm not sure how your touchscreen device works. But if you use Netbeans preview your panel is put in some outer container like JFrame/JWindow. And just maybe you set the frame to 800x600.
If so, then the problem might be that the frame eats a few pixels for its own border, leaving your panel size < 800x600. And in that case your panel will be unable to use your min/max settings and revert to default sizes.
Answered by: Chester619 | Posted: 24-02-2022Similar questions
windows - IE6 generated strange worksheet name when doing export from java application
I am encountering error like
test(10)[1].csv file cannot be found at
C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW
When trying to do export of CSV file using the following codes.
Anyone have any idea what could be wrong? This issue does not occur in IE7 / Firefox and is only specific to IE6.
response.setContentType("applicati...
c# - Embedding Flash Player in a C++ or Java application?
I would like to embed Flash Player directly inside a C++ or Java application.
I found an article that describes how to do this for C#:
http://www.adobe.com/devnet/flash/articles/stock_history03.html
Unfortunately, I have no experience with C#, COM or ActiveX. I need someone to translate this code to C++, allowing ...
java - How best to implement user selectable variables in web application
I have a Java based web-application and a new requirement to allow Users to place variables into text fields that are replaced when a document or other output is produced. How have others gone about this?
I was thinking of having a pre-defined set of variables such as :
@BOOKING_NUMBER@
@INVOICE_NUMBER@
Then when a user enters some text they can specify a variable inline ...
java - BIRT in a desktop application
Did someone ever used a BIRT report in a desktop application. I'm comming from the .NET environment and there you can use Crystal Reports to show reports in desktop apps. Is this possible with BIRT too, without having to set up a server environment?
Can you give me some advice how to reach this goal?
Thanks in advance.
which library better for faster java application swt or swing?
which library better for faster java application swt or swing?
java - Which is the best Open source application server?
java - Access spring bean that is exposed using http invoker from GWT application
Can I access spring bean that exposed using http invoker (server) from GWT application (client)?
If so is there any example / tutorial for that?
How to close a Java Swing application from the code
What is the proper way to terminate a Swing application from the code, and what are the pitfalls?
I'd tried to close my application automatically after a timer fires. But just calling dispose() on the JFrame didn't do the trick - the window vanished but the application did not terminate. However when closing the window with the close button, the application does terminate. What should I do...
java - How best can I isolate my application from an unreliable database?
I have a Java SOAP data service which sits on top of a Sybase database which, for reasons out of my control, has unreliable performance. The database is part of a vendor package which has been modified by an internal team and most of the issues are caused by slow response times at certain times of the day.
The SOAP service provides data to a calculation grid and when I request data, I need the response time to be ...
How do I create a "Hello World" application in java for an iphone?
I'd like to create a basic "Hello World" style application for the IPhone using Java - can anyone tell me how?
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)