Java Code Examples for javax.swing.JDialog#validate()

The following examples show how to use javax.swing.JDialog#validate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogFactory.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
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;
    }
}
 
Example 2
Source File: InspectAndRefactorPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
            }
        }
    }
}
 
Example 3
Source File: JAbsrtactDialogPanel.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
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();
    }
}