本文整理匯總了Java中javax.swing.JDialog.setPreferredSize方法的典型用法代碼示例。如果您正苦於以下問題:Java JDialog.setPreferredSize方法的具體用法?Java JDialog.setPreferredSize怎麽用?Java JDialog.setPreferredSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JDialog
的用法示例。
在下文中一共展示了JDialog.setPreferredSize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setEnlargedView
import javax.swing.JDialog; //導入方法依賴的package包/類
/**
* This method shows the enlarged dialog for the current ontology class instances
* in order to provide an easier access for the end user.
*/
private void setEnlargedView() {
JDialog dialog = new JDialog(OntologyVisualisationConfiguration.getOwnerWindow());
dialog.setPreferredSize(new Dimension(100, 200));
dialog.setName("Ontology-Instance-Viewer");
dialog.setTitle(OntologyVisualisationConfiguration.getApplicationTitle() + ": Ontology-Instance-Viewer");
dialog.setModal(true);
dialog.setResizable(true);
dialog.setContentPane(getJContentPane());
// --- Size and center the dialog -----------------
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int diaWidth = (int) (screenSize.width*0.8);
int diaHeight = (int) (screenSize.height * 0.9);
int left = (screenSize.width - diaWidth) / 2;
int top = (screenSize.height - diaHeight) / 2;
dialog.setSize(new Dimension(diaWidth, diaHeight));
dialog.setLocation(left, top);
// --- Remind and remove THIS from the parent -----
this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
Container parentContainer = this.getParent();
parentContainer.remove(this);
parentContainer.validate();
parentContainer.repaint();
// --- Add THIS to the dialog ---------------------
this.removeEnlargeTab();
jPanel4TouchDown.add(this, BorderLayout.CENTER);
dialog.setVisible(true);
// - - - - - - - - - - - - - - - - - - - - - - - -
// - - User-Interaction - - - - - - - - - - - - -
// - - - - - - - - - - - - - - - - - - - - - - - -
this.addEnlargeTab();
// --- Add THIS again to the parent ---------------
this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
parentContainer.add(this);
parentContainer.validate();
parentContainer.repaint();
}