javax.swing.JDialog#validate ( )源码实例Demo

下面列出了javax.swing.JDialog#validate ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jmeter-plugins   文件: DialogFactory.java
public static JDialog getJDialogInstance(Frame owner, String title, boolean modal, JAbsrtactDialogPanel content, String imagePath) {
    if(!GraphicsEnvironment.isHeadless()) {
        JDialog ret = new JDialog(owner, title, modal);
        ret.add(content);
        ret.pack();
        Dimension size = ret.getPreferredSize();
        if(size.width < content.getMinWidth()) {
            size.width = content.getMinWidth();
        }
        ret.setSize(size);
        ret.validate();
        if(imagePath != null) {
            ImageIcon imageIcon = new ImageIcon(DialogFactory.class.getResource(imagePath));
            if(imageIcon != null) {
                ret.setIconImage(imageIcon.getImage());
            }
        }
        return ret;
    } else {
        return null;
    }
}
 
源代码2 项目: netbeans   文件: InspectAndRefactorPanel.java
private synchronized void manageRefactorings(boolean single) {
    HintsPanel panel;
    if (single) {
        panel = new HintsPanel((HintMetadata) singleRefactoringCombo.getSelectedItem(), null, cpBased);
    } else {
        panel = new HintsPanel((Configuration) configurationCombo.getSelectedItem(), cpBased);
    }
    DialogDescriptor descriptor = new DialogDescriptor(panel, NbBundle.getMessage(InspectAndRefactorPanel.class, "CTL_ManageRefactorings"), true, new Object[]{}, null, 0, null, null);
    
    JDialog dialog = (JDialog) DialogDisplayer.getDefault().createDialog(descriptor);
    dialog.validate();
    dialog.pack();
    dialog.setVisible(true);
    if (panel.isConfirmed()) {
        if (this.configurationRadio.isSelected()) {
            Configuration selectedConfiguration = panel.getSelectedConfiguration();
            if (selectedConfiguration != null) {
                configurationCombo.setSelectedItem(selectedConfiguration);
            }
        } else {
            HintMetadata selectedHint = panel.getSelectedHint();
            if (selectedHint != null) {
                if (panel.hasNewHints()) {
                    singleRefactoringCombo.setModel(new InspectionComboModel((allHints = Utilities.getBatchSupportedHints(cpBased)).keySet()));
                }
                singleRefactoringCombo.setSelectedItem(selectedHint);
            }
        }
    }
}
 
源代码3 项目: jmeter-plugins   文件: JAbsrtactDialogPanel.java
protected void repack() {
    JDialog dlgParent = getAssociatedDialog();
    if(dlgParent != null) {
        Dimension newSize = dlgParent.getPreferredSize();
        if(newSize.width < minWidth) {
            newSize.width = minWidth;
        }
        dlgParent.setSize(newSize);
        dlgParent.validate();
    }
}