简体   繁体   中英

JDialog does not open to it's set size?

Why when I launch my JDialog it pops up in a shrunken manner! I would have to resize it to see its contents and some of the contents like the labels don't show at all! Is there any settings that I should do?

I don't know whether you guy saw my comment under Andrew's solution. I just wanted to say that the pack() method solved the issue of jDialog showing in a shrunken way, however, I still have this problem that some of my controllers within this jDialog either don't show at all or shown in a randomly resized way. If you could also provide a remedy for this situation I would be very much thankful!

jDialog_DSCredentials = new javax.swing.JDialog();

jDialog_DSCredentials.setTitle(resourceMap.getString("jDialog_DSCredentials.title")); // NOI18N

jDialog_DSCredentials.setLocationByPlatform(true);

jDialog_DSCredentials.setName("jDialog_DSCredentials"); // NOI18N

jDialog_DSCredentials.getContentPane().setLayout(new java.awt.CardLayout());

// Code of sub-components and layout - not shown here  (I can send these if nec.)

and here is how it's called from an event method

jDialog_DSCredentials.pack();
jDialog_DSCredentials.revalidate();        
jDialog_DSCredentials.setVisible(true);

要使顶级组件成为显示内容所需的最小尺寸,请调用:

dialog.pack();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM