I tried to do something like:
public static void main(final String[] 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);
}
});
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.