7

setPreferredSizeおよびsetSizeメソッドを試しましたが、ダイアログはまだ最小サイズで開きます。

private void method() {
    commandDialog.setPreferredSize(new Dimension(100,100));
    - - - 
    - - -   //Components added to dialogPanel

    commandDialog.add(dialogPanel);

    // Tried this as well: commandDialog.setSize(40, 40);     
    commandDialog.validate();
    commandDialog.setVisible(true);
}
4

2 に答える 2

6

試しましたか

commandDialog.setSize(new Dimension(100, 100));
commandDialog.setResizable(false);

?

于 2013-11-29T21:01:40.637 に答える