Reputation: 11
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?
Upvotes: 1
Views: 412
Reputation: 2208
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.
Upvotes: 3
Reputation: 1143
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/
Upvotes: 3