本文整理汇总了Java中javax.swing.JDialog.getPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JDialog.getPreferredSize方法的具体用法?Java JDialog.getPreferredSize怎么用?Java JDialog.getPreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JDialog
的用法示例。
在下文中一共展示了JDialog.getPreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.JDialog; //导入方法依赖的package包/类
public void actionPerformed( final ActionEvent e ) {
String command = e.getActionCommand();
if ( COMMAND_OK.equals( command ) ) {
// Call the OK option listener
ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
public Object run() {
okOptionListener.actionPerformed( e ); // XXX maybe create new event
actionPerformed(e, categories);
return null;
}
});
final ProgressHandle handle = ProgressHandleFactory.createHandle(NbBundle.getMessage(CustomizerDialog.class, "LBL_Saving_Project_data_progress"));
JComponent component = ProgressHandleFactory.createProgressComponent(handle);
Frame mainWindow = WindowManager.getDefault().getMainWindow();
final JDialog dialog = new JDialog(mainWindow,
NbBundle.getMessage(CustomizerDialog.class, "LBL_Saving_Project_data"), true);
SavingProjectDataPanel panel = new SavingProjectDataPanel(component);
dialog.getContentPane().add(panel);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.pack();
Rectangle bounds = mainWindow.getBounds();
int middleX = bounds.x + bounds.width / 2;
int middleY = bounds.y + bounds.height / 2;
Dimension size = dialog.getPreferredSize();
dialog.setBounds(middleX - size.width / 2, middleY - size.height / 2, size.width, size.height);
// Call storeListeners out of AWT EQ
RequestProcessor.getDefault().post(new Runnable() {
@Override
public void run() {
try {
ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
@Override
public Object run() {
FileUtil.runAtomicAction(new Runnable() {
@Override
public void run() {
handle.start();
if (storeListener != null) {
storeListener.actionPerformed(e);
}
storePerformed(e, categories);
// #97998 related
saveModifiedProject();
}
});
return null;
}
});
} finally {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
dialog.setVisible(false);
dialog.dispose();
}
});
}
}
});
dialog.setVisible(true);
}
}