sv_in
sv_in

Reputation: 14049

Resizable Java component

I would like to have a Java component which has a resize icon on the bottom right of the component so that when I drag that icon, the component will automatically resize with it.

By resize icon, I mean the following:

resize icon in Google Talk

The above image contains the resize icon in the Google Talk messenger's main window. Is there any Java component which provides this facility?

Upvotes: 1

Views: 1779

Answers (3)

VonC
VonC

Reputation: 1329092

You will find in this article how to add an icon looking like the resize icon you are referring to.

PixelPushing PixelPushing

Google Talk Styled Form

Upvotes: 1

Malcolm
Malcolm

Reputation:

ummm putting an image there is not hard... the resizing is. you'll want to use (once you have some sort of button) code like this:

private void buttonMousePressed(java.awt.event.MouseEvent evt) {
        sx = evt.getX();
        sy = evt.getY();
}

private void buttonMouseDragged(java.awt.event.MouseEvent evt) {
        if(!evt.isMetaDown()){
                Point p = getLocation();

                locX = p.x + evt.getX()-sx;
                locY = p.y + evt.getY()-sy;
                setLocation(locX, locY);
        }
}

...except instead of Setlocation you'll want to use something like setBounds or setSize... and you'll have to modify the code a bit. What I have is for dragging it, but the principle is the same.

Upvotes: 0

Frederic Morin
Frederic Morin

Reputation: 8963

the JStatusBar ?

Upvotes: 0

Related Questions