resize a JFrame .

hi,
I added to my application a status bar
and I added on the right corner of the status bar the resize Icon on JLabel,(like the one that you can see on Windows98/NT
platforms.

now the qustion is how can I resize the frame when pressing the Jlabel (resize) and dragging the mouse?

thanks.
sadounjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

expertmbCommented:
hi,
 try this

    Label.addMouseListener(new java.awt.event.MouseAdapter() {

      public void mouseClicked(MouseEvent e) {
   frame.setSize(new Dimension(width, height));
      }
    });


mb...
0
sadounjAuthor Commented:
yes thats right, but you have to calculate the new size all the time.
if you can be more specific I'l be Glad

thanks
0
expertmbCommented:
>> but you have to calculate the new size all the time.

 u can use getSize(); and then use setSize();

mb...
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

sadounjAuthor Commented:
sorry, I didn't understand. )-:
0
expertmbCommented:
  Dimension size = frame.getSize();

    int width = size.width;
    int height = size.height;

    this.setSize(new Dimension(width, height));

mb...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sadounjAuthor Commented:
how you can resize the frame in your way????
you take the size of the frame and set it back!!!!
you should consider the mouse movement..
sorry I don't understand


thanks.
0
expertmbCommented:

the label is on the status bar ok, u just alter the size of the frame on click of label i will get the frame  size and then set the  frame size


>> you should consider the mouse movement..

can u elaborate it.mb...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.