Hi! I have made a desktop application which is running perfectly. But i am facing problems with jframe size on different machines.
I have monitor of 'Gateway'. I am satisfied with my jframe size on my screen . But when i shifted it on laptop of 'hp' company then my jframe and its child components appears very small.
For example I have a jframe named 'Home.java'. I set size of this jframe by following code

 java.awt.Dimension screenSize =                    Toolkit.getDefaultToolkit().getScreenSize();
 setSize(screenSize.width,screenSize.height);

On my monitor it appears very well i-e it takes monitor's screen size and flatters according that. But When i runs my program on 'hp' laptop it also flatters according to laptop's screen size but its child components(buttons and labels) appears very small.

Similarly I have a jframe named Sale.java. I have set its property resizeable(false).I do not need it to appear according to monitor's screen size. I have made this frame by giving a static size according to my desire.
On my pc when I runs program it appears very well i-e according to my given size and font size. But When I ran it on 'hp' laptop this jframe and its child components appear very small.

When I ran my program on 'Dell' laptop then my jframes and child components also appear with different size but not as small as on 'hp' laptop.

Is there any way that my jframes and their internal components appears in a good size according to machines.

That's what many call "responsive." It's a concept you implement in your code and not something that is say, one line long or covered in a small answer.

Example priors: https://www.google.com/search?q=responsive+java
Graphic examples: http://imgur.com/gallery/3PE7T "GIFs That Explain Responsive Design Brilliantl"
Source: http://blog.froont.com/9-basic-principles-of-responsive-web-design/

You might counter this is about web design but it applies to apps as well.

This is why Swing has Layout Managers. You start with the components (text fields, drop-down lists, whatever) which Java sizes to fit the text in them - nb this depends on the font you are using and the screen resolution. You use a layout manager to add these to the JFrame according to where you want them to go (top, bottom, etc). The Layout Manager then sets the size of the JFrame to fit your components according to the layout you wanted. This is done at run time so when you run on a different machine the frame is still sized appropriately. There is a decent choice of Layouit Managers, some simple, some less simple giving you detailed control over how things are spaced out, how they share the space when the frame is re-sized etc.
See https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.