java - How make jcomponents change its sizes according to the screen resolution -


i've created application using jframes , jinternal frames. wanted make custom close , minimize buttons made jframe decorated. , made fit screen of given resolution using below codes.

public dimension screensize = toolkit.getdefaulttoolkit().getscreensize();    public rectangle winsize = graphicsenvironment.getlocalgraphicsenvironment().getmaximumwindowbounds(); public int taskbarheight = screensize.height - winsize.height;                public int width = (int) screensize.getwidth(); public int height = (int) screensize.getheight()-taskbarheight; 

in constructor ive typed

this.setsize(width, height); 

and way managed make decorated jframe fit screen. want make other components in side jframe change sizes according screen resolution.is there way make components change sizes, instead of assigning dimensions each every components separately.
i.e

 jdesktoppane1.setpreferredsize(new dimension(width*9/10, height*88/100)); 

i found difficult arrange components according way wanted. didnt pay attention layouts.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -