开发者

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);
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜