![]() |
![]() |
![]() |
![]() |
![]() |
|
To assist in your experiments with layout managers, you need to define a
component with appropriate getMinimumSize and getPreferredSize
methods defined. One convenient way to define such a component is to extend
the JButton class, shadowing the getMinimumSize and
getPreferredSize methods:
import java.awt.*;
import javax.swing.*;
public class TestButton extends JButton {
public TestButton (String t) {
super(t);
}
public Dimension getMinimumSize() {return new Dimension(50, 30);}
public Dimension getPreferredSize() {return new Dimension(50, 30);}
}