Problem with position and size of components

I'm making a program using the wizard, the famous "click and drag". Much of the project I'm doing on my computer, and I use the command to maximize the screen in the frame, and I set the panels right so that everything fits, but when I continue the project on the computer of my service for example, the size changes completely and is cutting as if it did not fit on the screen.

This is the screen that is on the service computer

this is the screen that sits on my notebook

I wanted to know if it has any form to standardize this, regardless of the computer, make the screen open in full screen and fit as per the desktop.

Author: Aline Batista, 2018-03-27

2 answers

If you want to set the sizes relatively, so that the positions are respected regardless of the screen, you need to use the layout managers. They serve as organizers of components on the screen or within other components on your own screen. With this, you will always have the same organization independent of the screen resolution of the user who is running the application.

How to keep the size of JFrame relative to the screen size of the user, in this answer there is a solution that can work.

Since you did not present a minimal, complete and verifiable example, you can not suggest anything specific to the presented screen, but the solution for sure is the use of one or more managers.

Just to demonstrate the power of layout managers, along with the hint of the linked answer, see the example below where I made a screen with proportions relative to half of my screen, and even resizing, the components do not get disorganized, only the table adapts thanks to JScrollPane.:

insert the description of the image here

The NetBeans wizard may seem tempting, but using it without knowing the swing API and its operation will cast you in this IDE and trap you to problems like the one you face in this question. I suggest that before playing drag and drop, learn the basics about swing and its components, since it is essential to have a sense of how to create screens and organize components without relying on IDEs, no matter how much the netbeans screen builder or windowbuilder in eclipse make this process much easier.

 3
Author: , 2018-03-29 13:56:25

Make a window with fewer pixels than when increasing windows itself corrects. but if the window is too large it can not do this so as not to lose information.

You used the click and drag options on your computer, but you need to make a smaller pattern so that it fits on all possible screens. try setting your monitor at Click and drag time to 1024x768 for example. it is a bad resolution but will fit on any computer. After you go back to size normal the screen will get better.

But the right thing is not to use the click and drag even haha

 -3
Author: Andrade, 2018-03-27 23:15:32