Example usage for javax.swing JTabbedPane add

List of usage examples for javax.swing JTabbedPane add

Introduction

In this page you can find the example usage for javax.swing JTabbedPane add.

Prototype

public void add(Component component, Object constraints) 

Source Link

Document

Adds a component to the tabbed pane.

Usage

From source file:org.intermine.modelviewer.swing.ModelViewer.java

/**
 * Lays out the components within this panel and wires up the relevant
 * event listeners./*from  w w w .  j  av a  2 s  . co  m*/
 */
private void init() {

    FileFilter xmlFilter = new XmlFileFilter();
    projectFileChooser = new JFileChooser();
    projectFileChooser.addChoosableFileFilter(xmlFilter);
    projectFileChooser.setAcceptAllFileFilterUsed(false);
    projectFileChooser.setFileFilter(xmlFilter);

    File lastProjectFile = MineManagerBackingStore.getInstance().getLastProjectFile();
    if (lastProjectFile != null) {
        projectFileChooser.setSelectedFile(lastProjectFile);
    }

    initButtonPanel();

    classTreeModel = new ClassTreeModel();
    classTree = new JTree(classTreeModel);
    classTree.setCellRenderer(new ClassTreeCellRenderer());
    classTree.setRootVisible(false);
    classTree.setShowsRootHandles(true);

    Box vbox = Box.createVerticalBox();
    vbox.add(new JScrollPane(classTree));
    vbox.add(buttonPanel);

    DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
    selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    classTree.setSelectionModel(selectionModel);

    classTree.addTreeSelectionListener(new ClassTreeSelectionListener());

    attributeTableModel = new AttributeTableModel();
    attributeTable = new AttributeTable(attributeTableModel);

    referenceTableModel = new ReferenceTableModel();
    referenceTable = new ReferenceTable(referenceTableModel);

    graphModel = new mxGraphModel();
    graph = new CustomisedMxGraph(graphModel);

    graphComponent = new mxGraphComponent(graph);
    graphComponent.setEscapeEnabled(true);

    JTabbedPane tableTab = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tableTab.add(Messages.getMessage("tab.attributes"), new JScrollPane(attributeTable));
    tableTab.add(Messages.getMessage("tab.references"), new JScrollPane(referenceTable));

    JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tableTab, graphComponent);

    JSplitPane mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, vbox, rightSplit);

    setOpaque(true);
    setLayout(new BorderLayout());
    add(mainSplit, BorderLayout.CENTER);

    rightSplit.setDividerLocation(150);
    mainSplit.setDividerLocation(200);

}

From source file:org.jcurl.demo.tactics.JCurlShotPlanner.java

@Override
protected void startup() {
    // set the window icon:
    {/*from   www . j a v  a  2 s .c  o m*/
        final Image img;
        if (true)
            img = getContext().getResourceMap().getImageIcon("Application.icon").getImage();
        else {
            final ResourceMap r = getContext().getResourceMap();
            if (true)
                try {
                    img = ImageIO.read(this.getClass()
                            .getResource("/" + r.getResourcesDir() + "/" + r.getString("Application.icon")));
                } catch (final IOException e) {
                    throw new RuntimeException("Unhandled", e);
                }
            else
                img = Toolkit.getDefaultToolkit().createImage(this.getClass()
                        .getResource("/" + r.getResourcesDir() + "/" + r.getString("Application.icon")));
        }
        getMainFrame().setIconImage(img);
        // SystemTray tray = SystemTray.getSystemTray();
    }

    // File Filter
    jcxzPat = gui.createFileFilter("fileFilterJcxz", "jcz", "jcx");
    pngPat = gui.createFileFilter("fileFilterPng", "png");
    svgPat = gui.createFileFilter("fileFilterSvg", "svgz", "svg");

    getMainFrame().setJMenuBar(createMenuBar());

    final JComponent c = new JPanel();
    c.setLayout(new BorderLayout());
    tactics.setPreferredSize(new Dimension(400, 600));
    c.add(tactics, BorderLayout.CENTER);
    c.add(url, BorderLayout.NORTH);
    {
        final JPanel b = new JPanel();
        b.setLayout(new BorderLayout());
        final JTabbedPane t = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
        t.add("Rock", broomSwing);
        t.setMnemonicAt(0, 'R');
        t.add("Ice", curlerSwing);
        t.setMnemonicAt(1, 'I');
        t.add("Collission", new JLabel("TODO: Collission settings"));
        t.setMnemonicAt(2, 'C');
        b.add(t, BorderLayout.NORTH);
        if (false)
            b.add(new JLabel("TODO: Bird's eye view"), BorderLayout.CENTER);
        else
            b.add(birdPiccolo, BorderLayout.CENTER);
        c.add(b, BorderLayout.EAST);
    }

    show(c);
    view12Foot();
}

From source file:org.jcurl.demo.tactics.TacticsApp.java

public TacticsApp() {
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            TacticsApp.this.cmdExit();
        }/*from   w  ww . j av  a  2s  . co m*/
    });
    master = new RockEditDisplay();
    master.setPos(mod_locations);
    master.setSpeed(mod_speeds);
    final PositionDisplay pnl2 = new PositionDisplay();
    pnl2.setPos(mod_locations);
    pnl2.setZoom(Zoomer.HOG2HACK);

    final Container con = getContentPane();
    {
        final JPanel p = new JPanel(new BorderLayout());
        p.add(new SumWaitDisplay(mod_locations), "West");
        p.add(master, "Center");
        p.add(new SumShotDisplay(mod_locations), "East");
        con.add(p, "Center");
    }
    // con.add(new SumWaitDisplay(mod_locations), "West");
    con.add(new SumOutDisplay(mod_locations), "West");
    {
        final Box b1 = Box.createHorizontalBox();
        b1.add(Box.createRigidArea(new Dimension(0, 75)));
        b1.add(pnl2);
        con.add(b1, "South");
    }
    final JTabbedPane t = new JTabbedPane();
    con.add(t, "East");
    {
        final Box b0 = Box.createHorizontalBox();
        t.add("Rock", b0);
        {
            final JPanel b1 = new JPanel(new BorderLayout());
            final Box b2 = Box.createVerticalBox();
            b2.add(new JComboBox(new String[] { "Dark", "Light" }));
            b2.add(new JLabel("Broom", SwingConstants.LEFT));
            b1.add(b2, "North");
            JSlider s = new JSlider(-2000, 2000, 0);
            s.setOrientation(SwingConstants.VERTICAL);
            s.setMajorTickSpacing(1000);
            s.setMinorTickSpacing(100);
            s.setPaintLabels(true);
            s.setPaintTicks(true);
            b1.add(s, "Center");

            final Box b3 = Box.createHorizontalBox();
            b3.add(new JFormattedTextField());
            b3.add(new JLabel("mm", SwingConstants.LEFT));
            b1.add(b3, "South");
            b0.add(b1);
        }
        {
            final JPanel b1 = new JPanel(new BorderLayout());
            final Box b2 = Box.createVerticalBox();
            b2.add(new JComboBox(new String[] { "1", "2", "3", "4", "5", "6", "7", "8" }));
            b2.add(new JLabel("Splittime", SwingConstants.LEFT));
            b1.add(b2, "North");
            JSlider s = new JSlider(500, 2500, 1500);
            s.setOrientation(SwingConstants.VERTICAL);
            s.setMajorTickSpacing(1000);
            s.setMinorTickSpacing(100);
            s.setPaintLabels(true);
            s.setPaintTicks(true);
            b1.add(s, "Center");

            final Box b3 = Box.createHorizontalBox();
            b3.add(new JSpinner());
            b3.add(new JLabel("ms", SwingConstants.LEFT));
            b1.add(b3, "South");
            b0.add(b1);
        }
    }
    {
        final Box b0 = Box.createHorizontalBox();
        t.add("Ice", b0);
        {
            final JPanel b1 = new JPanel(new BorderLayout());
            b1.add(new JLabel("Curl"), "North");
            JSlider s = new JSlider(0, 5000, 0);
            s.setOrientation(SwingConstants.VERTICAL);
            s.setMajorTickSpacing(1000);
            s.setMinorTickSpacing(100);
            s.setPaintLabels(true);
            s.setPaintTicks(true);
            b1.add(s, "Center");

            final JSpinner s1 = new JSpinner();
            b1.add(s1, "South");
            b0.add(b1);
        }
        {
            final JPanel b1 = new JPanel(new BorderLayout());
            b1.add(new JLabel("DrawToTee"), "North");
            JSlider s = new JSlider(15000, 30000, 25000);
            s.setOrientation(SwingConstants.VERTICAL);
            s.setMajorTickSpacing(5000);
            s.setMinorTickSpacing(1000);
            s.setPaintLabels(true);
            s.setPaintTicks(true);
            b1.add(s, "Center");

            final JSpinner s1 = new JSpinner();
            b1.add(s1, "South");
            b0.add(b1);
        }
    }
    setJMenuBar(createMenu());
    refreshTitle();
    this.setSize(900, 400);

    new SpeedController(mod_locations, mod_speeds, master);
    new LocationController(mod_locations, pnl2);
    lastSaved = mod_locations.getLastChanged();
}

From source file:org.optaplanner.examples.coachshuttlegathering.swingui.CoachShuttleGatheringPanel.java

public CoachShuttleGatheringPanel() {
    setLayout(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    coachShuttleGatheringWorldPanel = new CoachShuttleGatheringWorldPanel(this);
    coachShuttleGatheringWorldPanel.setPreferredSize(PREFERRED_SCROLLABLE_VIEWPORT_SIZE);
    tabbedPane.add("World", coachShuttleGatheringWorldPanel);
    add(tabbedPane, BorderLayout.CENTER);
}

From source file:org.optaplanner.examples.meetingscheduling.swingui.MeetingSchedulingPanel.java

public MeetingSchedulingPanel() {
    setLayout(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    roomsPanel = new TimeTablePanel<>();
    tabbedPane.add("Rooms", new JScrollPane(roomsPanel));
    personsPanel = new TimeTablePanel<>();
    tabbedPane.add("Persons", new JScrollPane(personsPanel));
    add(tabbedPane, BorderLayout.CENTER);
    setPreferredSize(PREFERRED_SCROLLABLE_VIEWPORT_SIZE);
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.pdf.PdfExportDialog.java

private void initializeComponents() {
    setTitle(getResources().getString("pdfsavedialog.dialogtitle")); //$NON-NLS-1$

    txAuthor = new JTextField();
    txAuthor.setColumns(40);/*www  .ja  v  a2  s.c om*/
    txTitle = new JTextField();
    txTitle.setColumns(40);
    txKeywords = new JTextField();
    txKeywords.setColumns(40);
    txDescription = new JTextField();
    txDescription.setColumns(40);

    rbSecurityNone = new JRadioButton(getResources().getString("pdfsavedialog.securityNone")); //$NON-NLS-1$
    rbSecurity40Bit = new JRadioButton(getResources().getString("pdfsavedialog.security40bit")); //$NON-NLS-1$
    rbSecurity128Bit = new JRadioButton(getResources().getString("pdfsavedialog.security128bit")); //$NON-NLS-1$

    final Action securitySelectAction = new ActionSecuritySelection();
    rbSecurityNone.addActionListener(securitySelectAction);
    rbSecurity40Bit.addActionListener(securitySelectAction);
    rbSecurity128Bit.addActionListener(securitySelectAction);

    rbSecurity128Bit.setSelected(true);

    txUserPassword = new JPasswordField();
    txConfUserPassword = new JPasswordField();
    txOwnerPassword = new JPasswordField();
    txConfOwnerPassword = new JPasswordField();

    cxAllowCopy = new JCheckBox(getResources().getString("pdfsavedialog.allowCopy")); //$NON-NLS-1$
    cbAllowPrinting = new JComboBox(getPrintingComboBoxModel());
    cxAllowScreenReaders = new JCheckBox(getResources().getString("pdfsavedialog.allowScreenreader")); //$NON-NLS-1$

    cxAllowAssembly = new JCheckBox(getResources().getString("pdfsavedialog.allowAssembly")); //$NON-NLS-1$
    cxAllowModifyContents = new JCheckBox(getResources().getString("pdfsavedialog.allowModifyContents")); //$NON-NLS-1$
    cxAllowModifyAnnotations = new JCheckBox(getResources().getString("pdfsavedialog.allowModifyAnnotations")); //$NON-NLS-1$
    cxAllowFillIn = new JCheckBox(getResources().getString("pdfsavedialog.allowFillIn")); //$NON-NLS-1$

    txFilename = new JTextField();
    txFilename.setColumns(40);
    statusBar = new JStatusBar();

    encodingModel = EncodingComboBoxModel.createDefaultModel(Locale.getDefault());
    encodingModel.sort();

    cbEncoding = new JComboBox(encodingModel);
    cxEmbedded = new JCheckBox(getResources().getString("pdfsavedialog.embedfonts"));

    getFormValidator().registerTextField(txFilename);
    getFormValidator().registerTextField(txConfOwnerPassword);
    getFormValidator().registerTextField(txConfUserPassword);
    getFormValidator().registerTextField(txUserPassword);
    getFormValidator().registerTextField(txOwnerPassword);

    final JPanel exportPane = createExportPanel();
    final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();
    final boolean advancedSettingsTabAvail = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.gui.pdf.AdvancedSettingsAvailable"));
    final boolean metaDataSettingsTabAvail = "true".equals(config.getConfigProperty(
            "org.pentaho.reporting.engine.classic.core.modules.gui.pdf.MetaDataSettingsAvailable"));
    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add(getResources().getString("pdfsavedialog.export-settings"), exportPane); //$NON-NLS-1$
    tabbedPane.add(getResources().getString("pdfsavedialog.parameters"), getParametersPanel());

    if (metaDataSettingsTabAvail) {
        tabbedPane.add(getResources().getString("pdfsavedialog.metadata-settings"), createMetaDataPanel()); //$NON-NLS-1$
    }
    if (advancedSettingsTabAvail) {
        tabbedPane.add(getResources().getString("pdfsavedialog.advanced-settings"), createAdvancedPanel()); //$NON-NLS-1$
    }
    setContentPane(createContentPane(tabbedPane));

}

From source file:org.zaproxy.zap.extension.autoupdate.AddOnDependencyChecker.java

private boolean confirmChanges(Component parent, AddOnChangesResult changesResult, boolean updating) {
    Set<AddOn> selectedAddOnsJavaIssue = new HashSet<>();
    for (AddOn addOn : changesResult.getSelectedAddOns()) {
        if (!addOn.canRunInCurrentJavaVersion()) {
            selectedAddOnsJavaIssue.add(addOn);
        }//  w  ww. j  a  v  a  2 s  .  c  o  m
    }

    String question;

    Set<AddOn> installs = new HashSet<>(changesResult.getInstalls());
    Set<AddOn> updates = new HashSet<>(changesResult.getNewVersions());

    Set<AddOn> dependents = getDependents(updates, changesResult.getUninstalls());

    if (updating) {
        question = Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUpdate");
        updates.removeAll(changesResult.getSelectedAddOns());
    } else {
        question = Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithInstallation");
        installs.removeAll(changesResult.getSelectedAddOns());
    }

    if (changesResult.getUninstalls().isEmpty() && updates.isEmpty() && installs.isEmpty()
            && dependents.isEmpty() && changesResult.getOptionalAddOns().isEmpty()
            && changesResult.getSoftUnloadExtensions().isEmpty()
            && changesResult.getUnloadExtensions().isEmpty()) {
        // No other changes required.
        if (selectedAddOnsJavaIssue.isEmpty()) {
            // No need to ask for confirmation.
            return true;
        }

        int size = changesResult.getSelectedAddOns().size();
        if (size == 1) {
            String baseMessage = MessageFormat.format(
                    Constant.messages
                            .getString("cfu.confirmation.dialogue.message.selectedAddOnNewerJavaVersion"),
                    changesResult.getSelectedAddOns().iterator().next().getMinimumJavaVersion());
            return JOptionPane.showConfirmDialog(parent, baseMessage + question, Constant.PROGRAM_NAME,
                    JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
        }

        String mainMessage;
        if (selectedAddOnsJavaIssue.size() == size) {
            mainMessage = Constant.messages
                    .getString("cfu.confirmation.dialogue.message.addOnsNewerJavaVersion");
        } else {
            mainMessage = Constant.messages
                    .getString("cfu.confirmation.dialogue.message.someSelectedAddOnsNewerJavaVersion");
        }

        JLabel label = new JLabel(
                Constant.messages.getString("cfu.confirmation.dialogue.message.warnAddOnsNotRunJavaVersion"),
                ManageAddOnsDialog.ICON_ADD_ON_ISSUES, SwingConstants.LEADING);

        Object[] msgs = { mainMessage,
                createScrollableTable(
                        new AddOnTableModel(selectedAddOnsJavaIssue, selectedAddOnsJavaIssue.size())),
                label, question };

        return JOptionPane.showConfirmDialog(parent, msgs, Constant.PROGRAM_NAME,
                JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    }

    JPanel panel = new JPanel(new BorderLayout());
    JTabbedPane tabs = new JTabbedPane();
    panel.add(tabs);

    int issues = selectedAddOnsJavaIssue.size();

    if (!selectedAddOnsJavaIssue.isEmpty()) {
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.selectedAddOns"),
                createScrollableTable(
                        new AddOnTableModel(selectedAddOnsJavaIssue, selectedAddOnsJavaIssue.size())));
    }

    if (!changesResult.getUninstalls().isEmpty()) {
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.uninstallations"),
                createScrollableTable(new AddOnTableModel(changesResult.getUninstalls(), false)));
    }

    if (!updates.isEmpty()) {
        AddOnTableModel model = new AddOnTableModel(updates);
        issues += model.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.updats"),
                createScrollableTable(model));
    }

    if (!installs.isEmpty()) {
        AddOnTableModel model = new AddOnTableModel(installs);
        issues += model.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.installations"),
                createScrollableTable(model));
    }

    if (!dependents.isEmpty()) {
        AddOnTableModel model = new AddOnTableModel(dependents);
        issues += model.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.softUninstalls"),
                createScrollableTable(model));
    }

    SelectableAddOnTableModel optionalAddOnsTableModel = null;
    if (!changesResult.getOptionalAddOns().isEmpty()) {
        optionalAddOnsTableModel = new SelectableAddOnTableModel(changesResult.getOptionalAddOns());
        issues += optionalAddOnsTableModel.getMinimumJavaVersionIssues();
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.optionalAddOns"),
                createScrollableTable(optionalAddOnsTableModel));
    }

    if (!changesResult.getUnloadExtensions().isEmpty()) {
        ExtensionsTableModel model = new ExtensionsTableModel(changesResult.getUnloadExtensions());
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionUnloads"),
                createScrollableTable(model));
    }

    if (!changesResult.getSoftUnloadExtensions().isEmpty()) {
        ExtensionsTableModel model = new ExtensionsTableModel(changesResult.getSoftUnloadExtensions());
        tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionSoftUnloads"),
                createScrollableTable(model));
    }

    List<Object> optionPaneContents = new ArrayList<>();

    if (!changesResult.getOptionalAddOns().isEmpty() && changesResult.getUninstalls().isEmpty()
            && updates.isEmpty() && installs.isEmpty() && dependents.isEmpty()
            && changesResult.getSoftUnloadExtensions().isEmpty()
            && changesResult.getUnloadExtensions().isEmpty()) {
        optionPaneContents
                .add(Constant.messages.getString("cfu.confirmation.dialogue.message.suggestedChanges"));
    } else if (!changesResult.getOptionalAddOns().isEmpty()) {
        optionPaneContents
                .add(Constant.messages.getString("cfu.confirmation.dialogue.message.requiredSuggestedChanges"));
    } else {
        optionPaneContents
                .add(Constant.messages.getString("cfu.confirmation.dialogue.message.requiredChanges"));
    }

    optionPaneContents.add(panel);

    if (issues != 0) {
        String message;
        if (selectedAddOnsJavaIssue.size() == issues) {
            if (selectedAddOnsJavaIssue.size() == changesResult.getSelectedAddOns().size()) {
                message = Constant.messages
                        .getString("cfu.confirmation.dialogue.message.selectedAddOnsNewerJavaVersion");
            } else {
                message = Constant.messages.getString(
                        "cfu.confirmation.dialogue.message.someUnnamedSelectedAddOnsNewerJavaVersion");
            }
        } else if (issues == 1) {
            message = Constant.messages.getString("cfu.confirmation.dialogue.message.addOnNewerJavaVersion");
        } else {
            message = Constant.messages
                    .getString("cfu.confirmation.dialogue.message.someAddOnsNewerJavaVersion");
        }

        JLabel label = new JLabel(
                Constant.messages.getString(
                        "cfu.confirmation.dialogue.message.warnUnknownNumberAddOnsNotRunJavaVersion"),
                ManageAddOnsDialog.ICON_ADD_ON_ISSUES, SwingConstants.LEADING);

        optionPaneContents.add(message);
        optionPaneContents.add(label);
    }

    optionPaneContents.add(question);

    boolean confirmed = JOptionPane.showConfirmDialog(parent, optionPaneContents.toArray(),
            Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;

    if (confirmed && optionalAddOnsTableModel != null) {
        changesResult.getInstalls().addAll(optionalAddOnsTableModel.getSelectedAddOns());
    }

    return confirmed;
}

From source file:org.zaproxy.zap.extension.autoupdate.AddOnDependencyChecker.java

/**
 * Asks the user for confirmation of uninstall changes.
 * <p>/*from  w  w  w . j a  va2s  . c o  m*/
 * User will also be warned about add-ons that are being uninstalled which are required by add-ons being downloaded.
 *
 * @param parent the parent component of the confirmation dialogue
 * @param result the calculation result of the uninstallation
 * @param addOnsBeingDownloaded the add-ons being downloaded to check if depend on the add-ons being uninstalled
 * @return {@code true} if the user accept the changes, {@code false} otherwise
 */
public boolean confirmUninstallChanges(Component parent, UninstallationResult result,
        Set<AddOn> addOnsBeingDownloaded) {

    Set<AddOn> forcedUninstallations = new HashSet<>(result.getUninstallations());
    forcedUninstallations.removeAll(result.getSelectedAddOns());

    boolean dependencyDownloadFound = false;
    for (AddOn addOnDownloading : addOnsBeingDownloaded) {
        if (containsAny(addOnDownloading.getIdsAddOnDependencies(), forcedUninstallations)) {
            dependencyDownloadFound = true;
            break;
        }
    }

    if (!dependencyDownloadFound) {
        for (AddOn addOnDownloading : addOnsBeingDownloaded) {
            if (containsAny(addOnDownloading.getIdsAddOnDependencies(), result.getSelectedAddOns())) {
                dependencyDownloadFound = true;
                break;
            }
        }
    }

    if (dependencyDownloadFound) {
        if (JOptionPane.showConfirmDialog(parent, new Object[] {
                Constant.messages
                        .getString("cfu.confirmation.dialogue.message.uninstallsRequiredByAddOnsDownloading"),
                Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUninstallation") },
                Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
            return false;
        }
    }

    if (forcedUninstallations.isEmpty() && result.getExtensions().isEmpty()) {
        return JOptionPane.showConfirmDialog(parent, Constant.messages.getString("cfu.uninstall.confirm"),
                Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    }

    if (result.getExtensions().isEmpty()) {
        return JOptionPane.showConfirmDialog(parent,
                new Object[] { Constant.messages.getString("cfu.uninstall.dependentAddOns.confirm"),
                        createScrollableTable(new AddOnTableModel(forcedUninstallations, false)),
                        Constant.messages
                                .getString("cfu.confirmation.dialogue.message.continueWithUninstallation") },
                Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    }

    if (forcedUninstallations.isEmpty()) {
        return JOptionPane.showConfirmDialog(parent,
                new Object[] { Constant.messages.getString("cfu.uninstall.dependentExtensions.confirm"),
                        createScrollableTable(new ExtensionsTableModel(result.getExtensions())),
                        Constant.messages
                                .getString("cfu.confirmation.dialogue.message.continueWithUninstallation") },
                Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
    }

    JPanel panel = new JPanel(new BorderLayout());
    JTabbedPane tabs = new JTabbedPane();
    panel.add(tabs);

    tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.uninstallations"),
            createScrollableTable(new AddOnTableModel(forcedUninstallations, false)));

    tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionUnloads"),
            createScrollableTable(new ExtensionsTableModel(result.getExtensions())));

    List<Object> optionPaneContents = new ArrayList<>();
    optionPaneContents.add(Constant.messages.getString("cfu.uninstall.dependentAddonsAndExtensions.confirm"));
    optionPaneContents.add(panel);
    optionPaneContents
            .add(Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUninstallation"));

    return JOptionPane.showConfirmDialog(parent, optionPaneContents.toArray(), Constant.PROGRAM_NAME,
            JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}

From source file:pcgen.gui2.dialog.AboutDialog.java

/**
 * This method is called from within the constructor to
 * initialize the form.//from www.  j  a va 2s .co  m
 */
private void initComponents() {
    JTabbedPane mainPane = new JTabbedPane();
    mainPane.add(LanguageBundle.getString("in_abt_credits"), buildCreditsPanel()); //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_libraries"), buildIncludesPanel()); //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_license"), buildLicensePanel()); //$NON-NLS-1$
    mainPane.add(LanguageBundle.getString("in_abt_awards"), buildAwardsPanel()); //$NON-NLS-1$

    setLayout(new BorderLayout());

    add(mainPane, BorderLayout.CENTER);
    mainPane.setPreferredSize(new Dimension(640, 480));
}

From source file:pcgen.gui2.dialog.AboutDialog.java

/**
 * Construct the credits panel. This panel shows basic details
 * about PCGen and lists all involved in it's creation.
 *
 * @return The credits panel./*w ww .  j  ava  2 s . c om*/
 */
private JPanel buildCreditsPanel() {

    JLabel versionLabel = new JLabel();
    JLabel dateLabel = new JLabel();
    JLabel javaVersionLabel = new JLabel();
    JLabel leaderLabel = new JLabel();
    JLabel helperLabel = new JLabel();
    JLabel wwwLink = new JLabel();
    JLabel emailLabel = new JLabel();
    JTextField version = new JTextField();
    JTextField releaseDate = new JTextField();
    JTextField javaVersion = new JTextField();
    JTextField projectLead = new JTextField();
    wwwSite = new JButton();
    mailingList = new JButton();
    JTabbedPane monkeyTabPane = new JTabbedPane();

    JPanel aCreditsPanel = new JPanel();
    aCreditsPanel.setLayout(new GridBagLayout());

    // Labels

    versionLabel.setText(LanguageBundle.getString("in_abt_version")); //$NON-NLS-1$
    GridBagConstraints gridBagConstraints1 = buildConstraints(0, 0, GridBagConstraints.WEST);
    gridBagConstraints1.weightx = 0.2;
    aCreditsPanel.add(versionLabel, gridBagConstraints1);

    dateLabel.setText(LanguageBundle.getString("in_abt_release_date")); //$NON-NLS-1$
    gridBagConstraints1 = buildConstraints(0, 1, GridBagConstraints.WEST);
    aCreditsPanel.add(dateLabel, gridBagConstraints1);

    javaVersionLabel.setText(LanguageBundle.getString("in_abt_java_version")); //$NON-NLS-1$
    gridBagConstraints1 = buildConstraints(0, 2, GridBagConstraints.WEST);
    aCreditsPanel.add(javaVersionLabel, gridBagConstraints1);

    leaderLabel.setText(LanguageBundle.getString("in_abt_BD")); //$NON-NLS-1$
    gridBagConstraints1 = buildConstraints(0, 3, GridBagConstraints.WEST);
    aCreditsPanel.add(leaderLabel, gridBagConstraints1);

    wwwLink.setText(LanguageBundle.getString("in_abt_web")); //$NON-NLS-1$
    gridBagConstraints1 = buildConstraints(0, 4, GridBagConstraints.WEST);
    aCreditsPanel.add(wwwLink, gridBagConstraints1);

    emailLabel.setText(LanguageBundle.getString("in_abt_email")); //$NON-NLS-1$
    gridBagConstraints1 = buildConstraints(0, 5, GridBagConstraints.WEST);
    aCreditsPanel.add(emailLabel, gridBagConstraints1);

    helperLabel.setText(LanguageBundle.getString("in_abt_monkeys")); //$NON-NLS-1$
    gridBagConstraints1 = buildConstraints(0, 6, GridBagConstraints.NORTHWEST);
    aCreditsPanel.add(helperLabel, gridBagConstraints1);

    // Info

    version.setEditable(false);
    String versionNum = PCGenPropBundle.getVersionNumber();
    if (StringUtils.isNotBlank(PCGenPropBundle.getAutobuildNumber())) {
        versionNum += " autobuild #" + PCGenPropBundle.getAutobuildNumber();
    }
    version.setText(versionNum);
    version.setBorder(null);
    version.setOpaque(false);

    gridBagConstraints1 = buildConstraints(1, 0, GridBagConstraints.WEST);
    gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints1.weightx = 1.0;
    aCreditsPanel.add(version, gridBagConstraints1);

    releaseDate.setEditable(false);
    String releaseDateStr = PCGenPropBundle.getReleaseDate();
    if (StringUtils.isNotBlank(PCGenPropBundle.getAutobuildDate())) {
        releaseDateStr = PCGenPropBundle.getAutobuildDate();
    }
    releaseDate.setText(releaseDateStr);
    releaseDate.setBorder(new EmptyBorder(new Insets(1, 1, 1, 1)));
    releaseDate.setOpaque(false);

    gridBagConstraints1 = buildConstraints(1, 1, GridBagConstraints.WEST);
    gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
    aCreditsPanel.add(releaseDate, gridBagConstraints1);

    javaVersion.setEditable(false);
    javaVersion.setText(
            System.getProperty("java.runtime.version") + " (" + System.getProperty("java.vm.vendor") + ")");
    javaVersion.setBorder(new EmptyBorder(new Insets(1, 1, 1, 1)));
    javaVersion.setOpaque(false);

    gridBagConstraints1 = buildConstraints(1, 2, GridBagConstraints.WEST);
    gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
    aCreditsPanel.add(javaVersion, gridBagConstraints1);

    projectLead.setEditable(false);
    projectLead.setText(PCGenPropBundle.getHeadCodeMonkey());
    projectLead.setBorder(new EmptyBorder(new Insets(1, 1, 1, 1)));
    projectLead.setOpaque(false);

    gridBagConstraints1 = buildConstraints(1, 3, GridBagConstraints.WEST);
    gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
    aCreditsPanel.add(projectLead, gridBagConstraints1);

    // Web site button
    wwwSite.setText(PCGenPropBundle.getWWWHome());
    wwwSite.addActionListener(event -> {
        try {
            DesktopBrowserLauncher.viewInBrowser(new URL(wwwSite.getText()));
        } catch (IOException ioe) {
            Logging.errorPrint(LanguageBundle.getString("in_abt_browser_err"), ioe); //$NON-NLS-1$
        }
    });
    gridBagConstraints1 = buildConstraints(1, 4, GridBagConstraints.WEST);
    aCreditsPanel.add(wwwSite, gridBagConstraints1);

    // Mailing list button
    mailingList.setText(PCGenPropBundle.getMailingList());
    mailingList.addActionListener(event -> {
        try {
            DesktopBrowserLauncher.viewInBrowser(new URL(mailingList.getText()));
        } catch (IOException ioe) {
            Logging.errorPrint(LanguageBundle.getString("in_err_browser_err"), ioe); //$NON-NLS-1$
        }
    });
    gridBagConstraints1 = buildConstraints(1, 5, GridBagConstraints.WEST);
    aCreditsPanel.add(mailingList, gridBagConstraints1);

    // Monkey tabbed pane
    gridBagConstraints1 = buildConstraints(1, 6, GridBagConstraints.WEST);
    gridBagConstraints1.gridwidth = 2;
    gridBagConstraints1.weighty = 1.0;
    gridBagConstraints1.fill = GridBagConstraints.BOTH;
    aCreditsPanel.add(monkeyTabPane, gridBagConstraints1);

    monkeyTabPane.add(LanguageBundle.getString("in_abt_code_mky"), //$NON-NLS-1$
            buildMonkeyList(PCGenPropBundle.getCodeMonkeys()));
    monkeyTabPane.add(LanguageBundle.getString("in_abt_list_mky"), //$NON-NLS-1$
            buildMonkeyList(PCGenPropBundle.getListMonkeys()));
    monkeyTabPane.add(LanguageBundle.getString("in_abt_test_mky"), //$NON-NLS-1$
            buildMonkeyList(PCGenPropBundle.getTestMonkeys()));
    monkeyTabPane.add(LanguageBundle.getString("in_abt_eng_mky"), //$NON-NLS-1$
            buildMonkeyList(PCGenPropBundle.getEngineeringMonkeys()));

    // because there isn't one
    monkeyTabPane.setToolTipTextAt(2, LanguageBundle.getString("in_abt_easter_egg")); //$NON-NLS-1$

    return aCreditsPanel;
}