I've created a java desktop application in which the UI has been designed using the layout managers in swing. The UI comes up fine in my monitor (18.5 inch). However, if I try to view the UI in a smaller screen (14 inch), the layout remains the same but the contents like label/text are not getting resized. The texts are broken (followed by ...) and is unreadable. Is there any way to resize the contents depending on the screen size?
Asked
Active
Viewed 442 times
1
-
You can pick a layout style to be fixed, fluid etc. This is why you see changes in different resolutions – Tom Nov 01 '12 at 05:15
-
Add you're content to a `JScrollPane` or adjust the font size – MadProgrammer Nov 01 '12 at 05:16
-
1for reference : [1] http://stackoverflow.com/questions/10709561/java-application-automatically-resize-to-fit-screen-resolution [2] http://stackoverflow.com/questions/2997812/how-to-make-a-swing-app-aware-of-screen-size-change – Mukul Goel Nov 01 '12 at 05:17
-
1Perhaps it would be better to look to the combined questions of 1) What does this GUI do? 2) How can it be reorganized to make it smaller on-screen (e.g. `CardLayout`, `JTabbedPane`, `JDesktopPane` and `JInternalPane` instances.. For further tips see [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/a/9554657/418556) – Andrew Thompson Nov 01 '12 at 05:28
1 Answers
0
You need to define or take panel and add all component like label, textfield etc are set in the panel and this panel add in frame then all component set in their perticular location and text are not broken.
Or also set fix panel size so that help to you to set same size of your application in different screen.

Angel
- 902
- 8
- 16
-
actually i am using panel only for my desktop application,each panel have to set one layout also.if the screen shrings then controls also shring. please help me – user1790413 Nov 01 '12 at 05:26
-
use setSize(int x, int y) to set frame size and it is not dynamically. So this is solve your problem. – Angel Nov 01 '12 at 05:31
-
its not dynamically means then how solve my problem,i want the screen have to change dynamically depends on the screen resolution.. please help me – user1790413 Nov 01 '12 at 05:46
-
ok,this is less possible but try using this 2 link to solve your problem stackoverflow.com/questions/11256427/auto-adjusting-of-ui-based-on-screen-size-ui-in-java-swing and http://stackoverflow.com/questions/6777135/java-jframe-size-according-to-screen-resolution – Angel Nov 01 '12 at 06:41