关于JAVA画图的问题,求救。先致谢了!
我想在一个JPanel内放置几个按钮JButton。然后我希望JButton能随着JPanel的SIZE变化自动变化尺寸。请问该如何实现?package aa;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class MyPanel extends JPanel{
public MyPanel (){
add(new JButton("aa"));
add(new JButton("aa"));
//我希望按钮的高度是5
setSize(50,5);
}
public static void main(String args[])
{
MyPanel c = new MyPanel();
JOptionPane.showMessageDialog(null, c);
}
}