Java WindowBuilder on different screen resolution - java

I am making a java program for Windows with GUI using windowbuilder.
I set the sizes of the components so that it would match a screen resolution of 3200x1800.
After I built the program I ran it on a different computer with a screen resolution of 1366x768. All of the components were much bigger than running the program in the high screen resolution screen.
How can I set the components to be in the same size for all screen resolutions (the components will match the screen resolution)?

dear #amitai you must have to use some layout provided by Java like gridBagLayout, BorderLayout and FlowLayout bla bla bla Adjust your components as per Layout recommendation. If you will success to adjust your components in Layout your problem will automatically solved.
These Layouts are developed for the purpose of adjusting components in a sequences for different type of resolutions. Layout are working as a container.
For brief discussion follow reference link below:
http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html
http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

Related

Can't scale and move components in IntelliJ

I can't scale and move components in IntelliJ with its GridLayout. The problem is when I move/scale components they don't move to the exact place.
Picture (But I think you'd better check the vid out)
I uploaded a video on youtube
Here it is https://www.youtube.com/watch?time_continue=9&v=X6CF7TJ7GJg (sorry for a non-english speech)
You should learn how Java Swing Layouts work. Most layout managers do not allow you to place the components where you want (there is so called Null-layout, but it's not supported by IntelliJ IDEA).
You normally use splits, spacers and constraints to define where the components will appear and how they will resize when the form is resized.

Unable to open the frame (swing) in full screen mode in xming

I've developed an app in Java Swing which is running absolutely fine in windows but the same when ran in linux (RedHat 64 bit) doesn't open in full screen mode because of which some of the components aren't visible at all and hence inaccessible. I'd appreciate your suggestion.!
..some of the components aren't visible at all and hence inaccessible. I'd appreciate your suggestion!
Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or combinations of them1, along with layout padding & borders for white space2.

set layout to resize the control in java designed using netbeans

I am designing the swing JFrame form using NetBeans . I am not sure about the layout setting in JFrame form .When we change the resolution of the windows the forms are not adjusted automatically
but i want the forms and control designed on forms should be re
sized automatically. How is it possible
You can change the LayoutManager in by right clicking your panel. Look at this Layout Manager guide to find which suits best for your program.
Or: For the default NetBeans Layout Manager, you need to "anchor" the components for auto-resizing. And setting them resizable, too (but it is the default).
For any component that you want to add layout below images will guide you:
You need to choose layout that fit to your requirements.
Also you can customize the layout, to do that:
Also you can do it manualy or you can change the properties from Customize code.
To do that like the above image right click on the component and go to customie code(Cannot do it for JFrame).

Java Swing GUI Size under cross-platform

I have a swing gui which has proper JPanel and JDialog size on windows platform with screen size from 13inch to 15inch. What I refer as proper size is that all the components in JPanel and messages at JDialog are properly shown.
However, when running under Ubuntu linux with Genome/Kde desktop, I find the not all components or messages are fully shown and it appears that either width or height is not enough and the GUI interface is cropped
Anybody has ideas of how to fix it?
To have consistent UIs in multiple platforms you have to use LayoutManagers.
http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
There are several graphical editors that support creating swing user interfaces using LayoutMaganers. One example is WindowBuilder for Eclipse: http://www.eclipse.org/windowbuilder/
Call Window.pack() for your JDialog before showing it to make the window just big enough to fit all the components in it. This requires that you are using layout managers.

What type of Java / Swing Layout can do Docking and or Anchoring?

I'm new to Java coming from .Net . Java seems to have lots of Layout Managers to choose from. Which one can anchor like in .Net and which one can dock like in .Net?
Thanks!
I have not used .Net, but if I understand you correctly, the Docking layout manager is provided by the BorderLayout.
A BorderLayout has 4 borders (North, South, East, West) and a Center panel. A JToolBar that has been set to Floatable, can float, or can be docked to one of the 4 borders of the border layout.
From what I have just read about the anchor layout, and how it resizes as the screen resizes (i.e. the percentage of space allocated to the component), then the Swing equivalent is the GridBagLayout. It is extremely configurable and capable, but many people find it difficult to get to grips with.
JToolBar is one such component, as shown in How to Use Tool Bars.
You can find all the layout manager well described here A Visual Guide to Layout Managers and chose the one the better fits your needs (I don't know how anchor/dock work in .Net). I find pretty useful GroupLayout together with components preferred size and SpringLayout if you need to design a complex layout (but SpringLayout is usually verbose and a bit annoying to maintain).
The most similar environment to winforms in Java is the GroupLayout(aka Matisse). It works much like the winforms designer in visual studio. It is not meant to be hand coded, but is built to be used by tools. The most popular IDE that uses the GroupLayout is Netbeans, but other implementations exist for Eclipse and possibly IntelliJ.
FreeLayout, used by the Matisse GUI builder in the NetBeans IDE: that's what you're looking for.
(You don't want to code FreeLayout by hand: that is a layout meant for code-generating WYSIWYG visual designers like Matisse.)

Categories

Resources