[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

how to use the current frame size.

Posted on 2002-05-11
8
Medium Priority
?
224 Views
Last Modified: 2010-03-31
I set a frame to initial value (500,700);

But I allow the user to resize it by draging the edges.

How can I continue to use this new size for all the other frames that wud come along??

and also as and when they start up again??


0
Comment
Question by:TLTEO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 7003374
1. listen for ComponentEvents (add ComponentListener to Frame)
2. save new size in some sort of .ini file.
0
 

Author Comment

by:TLTEO
ID: 7005118
do you have any example to do it??
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 7005427
no,

what part do you need help with ?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:TLTEO
ID: 7006840
for example, this frame will be use most of the time.
The old frame is diposed by mainFrame.dispose() method

public Myapp {
.
.
.

mainFrame = new JFrame("This 1st frame");
mainFrame.setSize(700,580);
content=mainFrame.getContentPane();
content.setLayout(new BorderLayout());

if I resize to (800,700) ..   how can I get the resized 'size' and pass it to the next frame (which is actually previous.dispose(); Or rather how to use this new resized value thruout??

what is the syntax to get the new size?



0
 
LVL 16

Expert Comment

by:heyhey_
ID: 7007807
// member
 Dimension lastSize = new Dimension (700, 800);
 
 // before disposing old frame save the size
 lastSize = frame.getSize();
 
 
 // after creating Frame - save the size
 frame.setSize(lastSize.width, lastSize.height);
 
0
 

Author Comment

by:TLTEO
ID: 7009253
so actually I will also save the lastsize in .ini,  and before the application starts , I will look into the .ini for the lastsize??
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 7010365
> so actually I will also save the lastsize in .ini,  and before the application starts , I will look into the .ini for the lastsize.


yes - that's exactly what I suggested.


0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 400 total points
ID: 7010371
you can use Properties object to quickly load and save configuration data.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question