Teo
Teo

Reputation: 3442

java resizing methods

Could you tell me what methods are called upon a JFrame/JDialog after you resize it manually? ( after you resize it using the mouse cursor, while the frame is visible on the screen). I noticed that my JDialog is not valid eventhough I call validate() or revalidate() upon it, but after I resize it a bit, my frame becomes valid.

Upvotes: 2

Views: 1127

Answers (2)

A.Androulakis
A.Androulakis

Reputation: 1

With this code I am able to resize the width, height of 3 tables.

container.addControlListener(new ControlAdapter() {
            @Override
            public void controlResized(ControlEvent e) {
                tableJobs.setBounds(20, 143,container.getBounds().width-40, container.getBounds().height-20);
                tableMessages.setBounds(20, 143,container.getBounds().width-40, container.getBounds().height-20);
                tableSplfs.setBounds(20, 143,container.getBounds().width-40, container.getBounds().height-20);
            }
        });

Upvotes: 0

Pau Kiat Wee
Pau Kiat Wee

Reputation: 9505

I think it is java.awt.event.ComponentListener

The listener interface for receiving component events. When the component's size, location, or visibility changes, the relevant method in the listener object is invoked, and the ComponentEvent is passed to it.

For example:

public class MyFrame extends JFrame implements ComponentListener {

    @Override
    public void componentResized(ComponentEvent e) {
        // re compute?
        repaint();
    }
}

Upvotes: 1

Related Questions