Problem with position and size of components

3

I'm doing a program using the wizard, the famous "click and drag". Most 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 my service computer for example, the size changes completely and stays cutting as if it did not fit on the screen.

I wanted to know if you have any way to standardize this, regardless of the computer, make the screen open in full screen and fit according to the desktop.

    
asked by anonymous 28.03.2018 / 00:27

2 answers

4

If you want to define sizes relatively so that positions are respected regardless of the screen, you need to use the layouts managers . They serve as organizers for components on the screen or inside other components on the screen itself. With this, you will always have the same organization regardless of the screen resolution of the user who is running the application.

As for keeping the size of JFrame relative to the user's screen size, in this answer there is a solution that can work.

Since you did not submit a Minimum, Full, and Verifiable example , you can not suggest anything specific to the screen that appears , but the solution for sure is the use of one or more managers.

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

The netbeans wizard may seem tempting, but use it without knowing the swing API and its operation will get you in this IDE and will hold you to problems like what you face in this question. I suggest that before learning to drag and drop, learn the basics about swing and its components, because it is essential to have notion, how to create screens and organize components without relying on IDEs, no matter how the netbeans or windowbuilder screens builder in eclipse will greatly facilitate this process.

    
28.03.2018 / 04:34
-3

Make a window with fewer pixels than when raising windows itself fixes. but if the window is too large he can not do it so he will not lose information.

You have used the click and drag options for your computer, but you need to make a smaller pattern so that it fits all possible screens. try to set your monitor when clicking and drag to 1024x768 for example. is a poor resolution but will fit on any computer. Once you get back to normal size the screen will look better.

But it's okay not to use the click and drag even haha

    
28.03.2018 / 01:15