473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Automatically set screen size according to monitor size using swing

126 64KB
I have created a desktop application using java swing on a system with resolution- 1920 x 1080. When i run this application on a lower resolution screen the screen size seems to be to large to be visible on the lower screen resolution sizes. How do i overcome this problem using programming?

I have tried below code, which is not satisfying
Expand|Select|Wrap|Line Numbers
  1. Toolkit t = Toolkit.getDefaultToolkit();
  2.         Dimension d = t.getScreenSize();
  3.         int h = d.height;
  4.         int w = d.width;
  5.         this.setSize( 1200 , 950 );

Any other options please..
May 30 '13 #1
3 14507
Nepomuk
3,112 Expert 2GB
You set the size to 1200x950 no matter what? Shouldn't that be
Expand|Select|Wrap|Line Numbers
  1. this.setSize(w, h);
then?

Also, what exactly is what you want it to do? Go fullscreen? If so, maybe
Expand|Select|Wrap|Line Numbers
  1. this.setExtendedState(JFrame.MAXIMIZED_BOTH);
will be the easiest solution.
May 30 '13 #2
PreethiGowri
126 64KB
i shall try this and get back to you.
May 31 '13 #3
Try this...
Select all components of JFrame, right click, select 'Auto Resizing', check for both Horizontal and Vertical, close .
Jun 18 '16 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Oleg Konovalov | last post by:
Hi, I am trying to implement an application administrative tool with interactive console (i.e. showing some info to the user and taking user input) using Swing and JDK 1.4. Up until now I...
8
by: jrefactors | last post by:
I want to maximize the browser window when I open a new window. Now I do the following, but different monitor size will yield different width and height values. ...
4
by: Valerie Hough | last post by:
Does anyone have an example of how to get the PHYSICAL monitor size in C#? In C++ I used to use GetDeviceCaps( dc, HORZSIZE ) which returns the monitor size in mm, then I converted it to inches....
2
by: dpicella | last post by:
I have a semi-urgent need to solve a problem in Java. I have three small images that I need to hold to a constant size (e.g., 1 inch) regardless of both monitor size and resolution. Basically...
1
by: aalves | last post by:
Hi, I am new to this website, so I hope I am posting this in the right spot. I have been developing this interface fpr a program, but I developed it while using a big monitor and now when I went to...
1
by: igalep132 | last post by:
Hey all, I was trying to resize control size to the form size. I'm changing my form size according to current Screen Size by using Screen.PrimaryScreen.WorkingArea; and then I'm making a...
2
by: igalep132 | last post by:
Hey all, I was trying to resize control size to the form size. I'm changing my form size according to current Screen Size by using Screen.PrimaryScreen.WorkingArea; and then I'm making a...
1
by: sdanda | last post by:
Hi, I am using vb.net windows applications.I am adding controls dynimically.Is there any possibility to increase the form size according to the controls that i added dynimically.
5
by: Polaris | last post by:
Hi Experts: Using C#, is there a way to get the display monitor's size in inches (for example, I'd like to know if the monitor size is 15", 17" or whatever)? Thanks in Advance Polaris
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.