How can I set the MaximumSize on a JDialog?
I tried to do something like:
public static void main(final St开发者_Go百科ring[] args)
{
JDialog dialog = new JDialog();
dialog.add(new JButton("XXXXXXX"));
dialog.setVisible(true);
dialog.setSize(new Dimension(100,100));
dialog.setMaximumSize(new Dimension(100,100));
}
But I can still resize this dialog above the 100,100 limit I set. Any suggestions? Thanks!
Try this:
addComponentListener(new java.awt.event.ComponentAdapter()
{
public void componentResized(ComponentEvent event)
{
setSize(100,100);
}
});
精彩评论