[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

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.
0
sadounj
Asked:
sadounj
  • 4
  • 3
1 Solution
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now