Example usage for java.awt CardLayout show

List of usage examples for java.awt CardLayout show

Introduction

In this page you can find the example usage for java.awt CardLayout show.

Prototype

public void show(Container parent, String name) 

Source Link

Document

Flips to the component that was added to this layout with the specified name , using addLayoutComponent .

Usage

From source file:xtrememp.XtremeMP.java

@Override
public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == openMenuItem) {
        playlistManager.addFilesDialog(true);
    } else if (source == openURLMenuItem) {
        String url = JOptionPane.showInputDialog(mainFrame, tr("Dialog.OpenURL.Message"), tr("Dialog.OpenURL"),
                JOptionPane.INFORMATION_MESSAGE);
        if (url != null && Utilities.startWithProtocol(url)) {
            boolean isPlaylistFile = false;
            for (String ext : PlaylistFileFilter.PlaylistFileExt) {
                if (url.endsWith(ext)) {
                    isPlaylistFile = true;
                }// w  ww . j  a v a  2s  .  co  m
            }
            if (isPlaylistFile) {
                playlistManager.clearPlaylist();
                playlistManager.loadPlaylist(url);
                playlist.begin();
            } else {
                PlaylistItem newPli = new PlaylistItem(url, url, -1, false);
                playlistManager.add(newPli);
                playlist.setCursor(newPli);
            }
            acOpenAndPlay();
        }
    } else if (source == openPlaylistMenuItem) {
        playlistManager.openPlaylistDialog();
    } else if (source == savePlaylistMenuItem) {
        playlistManager.savePlaylistDialog();
    } else if (source == preferencesMenuItem) {
        PreferencesDialog preferencesDialog = new PreferencesDialog(audioPlayer, this);
        preferencesDialog.setVisible(true);
    } else if (source == exitMenuItem) {
        exit();
    } else if (source == playPauseMenuItem || source == playPauseButton) {
        acPlayPause();
    } else if (source == previousMenuItem || source == previousButton) {
        acPrevious();
    } else if (source == nextMenuItem || source == nextButton) {
        acNext();
    } else if (source == randomizePlaylistMenuItem) {
        playlistManager.randomizePlaylist();
    } else if (source == stopMenuItem || source == stopButton) {
        acStop();
    } else if (source == playlistManagerMenuItem) {
        if (visualizationManager.isVisible()) {
            visualizationManager.setDssEnabled(false);
            CardLayout cardLayout = (CardLayout) (mainPanel.getLayout());
            cardLayout.show(mainPanel, Utilities.PLAYLIST_MANAGER);
            playlistManagerMenuItem.setSelected(true);
            Settings.setLastView(Utilities.PLAYLIST_MANAGER);
        }
    } else if (source == visualizationMenuItem) {
        if (playlistManager.isVisible()) {
            visualizationManager.setDssEnabled(true);
            CardLayout cardLayout = (CardLayout) (mainPanel.getLayout());
            cardLayout.show(mainPanel, Utilities.VISUALIZATION_PANEL);
            visualizationMenuItem.setSelected(true);
            Settings.setLastView(Utilities.VISUALIZATION_PANEL);
        }
    } else if (source == updateMenuItem) {
        SoftwareUpdate.checkForUpdates(true);
        SoftwareUpdate.showCheckForUpdatesDialog();
    } else if (source == aboutMenuItem) {
        Object[] options = { tr("Button.Close") };
        Desktop desktop = null;
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
            if (desktop.isSupported(Desktop.Action.BROWSE)) {
                options = new Object[] { tr("Button.Close"), tr("Button.Website") };
            }
        }
        StringBuffer message = new StringBuffer();
        message.append("<html><b><font color='red' size='5'>").append(tr("Application.title"));
        message.append("</font></b><br>").append(tr("Application.description"));
        message.append("<br>Copyright  2005-2014 The Xtreme Media Player Project");
        message.append("<br><br><b>").append(tr("Dialog.About.Authors")).append(": </b>")
                .append(tr("Application.authors"));
        message.append("<br><b>").append(tr("Dialog.About.Version")).append(": </b>").append(currentVersion);
        message.append("<br><b>").append(tr("Dialog.About.Codename")).append(": </b>")
                .append(currentVersion.getCodename());
        message.append("<br><b>").append(tr("Dialog.About.ReleaseDate")).append(": </b>")
                .append(currentVersion.getReleaseDate());
        message.append("<br><b>").append(tr("Dialog.About.Homepage")).append(": </b>")
                .append(tr("Application.homepage"));
        message.append("<br><br><b>").append(tr("Dialog.About.JavaVersion")).append(": </b>")
                .append(System.getProperty("java.version"));
        message.append("<br><b>").append(tr("Dialog.About.JavaVendor")).append(": </b>")
                .append(System.getProperty("java.vendor"));
        message.append("<br><b>").append(tr("Dialog.About.JavaHome")).append(": </b>")
                .append(System.getProperty("java.home"));
        message.append("<br><b>").append(tr("Dialog.About.OSName")).append(": </b>")
                .append(System.getProperty("os.name"));
        message.append("<br><b>").append(tr("Dialog.About.OSArch")).append(": </b>")
                .append(System.getProperty("os.arch"));
        message.append("<br><b>").append(tr("Dialog.About.UserName")).append(": </b>")
                .append(System.getProperty("user.name"));
        message.append("<br><b>").append(tr("Dialog.About.UserHome")).append(": </b>")
                .append(System.getProperty("user.home"));
        message.append("<br><b>").append(tr("Dialog.About.UserDir")).append(": </b>")
                .append(System.getProperty("user.dir"));
        message.append("</html>");
        int n = JOptionPane.showOptionDialog(mainFrame, message, tr("Dialog.About"),
                JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, Utilities.APP_256_ICON, options,
                options[0]);
        if (n == 1 && desktop != null) {
            try {
                URL url = new URL(tr("Application.homepage"));
                desktop.browse(url.toURI());
            } catch (IOException | URISyntaxException ex) {
                logger.error(ex.getMessage(), ex);
            }
        }
    } else if (source.equals(playModeRepeatNoneMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.REPEAT_NONE);
    } else if (source.equals(playModeRepeatOneMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.REPEAT_ONE);
    } else if (source.equals(playModeRepeatAllMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.REPEAT_ALL);
    } else if (source.equals(playModeShuffleMenuItem)) {
        playlist.setPlayMode(Playlist.PlayMode.SHUFFLE);
    }
}

From source file:coffeshop.PaymentPage.java

private void showPanel(String pnName) {
    CardLayout layout = (CardLayout) jpPaymentInput.getLayout();
    layout.show(jpPaymentInput, pnName);
}

From source file:com.openbravo.pos.sales.restaurant.JRetailTicketsBagRestaurantMap.java

private void showView(String view) {
    CardLayout cl = (CardLayout) (getLayout());
    cl.show(this, view);
}

From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java

/**
 * @param objWrapper//from  w w  w  . ja  va 2 s  . com
 * @param groupObjWrapper
 * @param selectedObjTitle
 */
/*private void showInfoPanel(final DataModelObjBaseWrapper objWrapperArg, 
                       final DataModelObjBaseWrapper userObjWrapperArg,
                       final DataModelObjBaseWrapper groupObjWrapperArg,
                       final DataModelObjBaseWrapper collectionWrapperArg,
                       final String selectedObjTitle)
{
String     className  = objWrapperArg.getType();
CardLayout cardLayout = (CardLayout)(infoCards.getLayout());
        
// This displays the panel that says they have all permissions
DataModelObjBaseWrapper wrpr = groupObjWrapperArg != null ? groupObjWrapperArg : objWrapperArg;
if (wrpr != null)
{
    Object dataObj = wrpr.getDataObj();
    if (dataObj instanceof SpPrincipal && ((SpPrincipal)dataObj).getGroupSubClass().equals(AdminPrincipal.class.getName()))
    {
        cardLayout.show(infoCards, AdminPrincipal.class.getCanonicalName());
        return;
    }
}
        
if (currentEditorPanel != null && currentEditorPanel.hasChanged())
{
    String[] optionLabels = new String[] {getResourceString("SaveChangesBtn"), 
                                          getResourceString("DiscardChangesBtn"), 
                                          getResourceString("CANCEL")};
            
    int rv = JOptionPane.showOptionDialog(UIRegistry.getTopWindow(),
                UIRegistry.getLocalizedMessage("SaveChanges", currentTitle),
                getResourceString("SaveChangesTitle"),
                JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                null,
                optionLabels,
                optionLabels[0]);
        
    if (rv == JOptionPane.YES_OPTION)
    {
        doSave(true);
    }
}
        
currentTitle = selectedObjTitle;
        
// show info panel that corresponds to the type of object selected
AdminInfoSubPanelWrapper panelWrapper = infoSubPanels.get(className);
        
currentEditorPanel  = editorPanels.get(className);
if (currentEditorPanel != null)
{
    currentEditorPanel.setHasChanged(false);
}
        
// fill form with object data
if (panelWrapper != null)
{
    currentDisplayPanel = panelWrapper;
    if (currentDisplayPanel.setData(objWrapperArg, userObjWrapperArg, groupObjWrapperArg, collectionWrapperArg, nodesDivision) && currentEditorPanel != null)
    {
        currentEditorPanel.setHasChanged(true);
    }
    cardLayout.show(infoCards, className);
}
        
objWrapper           = objWrapperArg;
groupObjWrapper      = groupObjWrapperArg;
collectionObjWrapper = collectionWrapperArg;
}*/

private void showInfoPanel(final DataModelObjBaseWrapper objWrapperArg,
        final DataModelObjBaseWrapper secondObjWrapperArg, final DataModelObjBaseWrapper collectionWrapperArg,
        final String selectedObjTitle) {
    String className = objWrapperArg.getType();
    CardLayout cardLayout = (CardLayout) (infoCards.getLayout());

    // This displays the panel that says they have all permissions
    DataModelObjBaseWrapper wrpr = secondObjWrapperArg != null ? secondObjWrapperArg : objWrapperArg;
    if (wrpr != null) {
        Object dataObj = wrpr.getDataObj();
        if (dataObj instanceof SpPrincipal
                && ((SpPrincipal) dataObj).getGroupSubClass().equals(AdminPrincipal.class.getName())) {
            cardLayout.show(infoCards, AdminPrincipal.class.getCanonicalName());
            return;
        }
    }

    if (currentEditorPanel != null && currentEditorPanel.hasChanged()) {
        String[] optionLabels = new String[] { getResourceString("SaveChangesBtn"),
                getResourceString("DiscardChangesBtn"), getResourceString("CANCEL") };

        int rv = JOptionPane.showOptionDialog(UIRegistry.getTopWindow(),
                UIRegistry.getLocalizedMessage("SaveChanges", currentTitle),
                getResourceString("SaveChangesTitle"), JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE, null, optionLabels, optionLabels[0]);

        if (rv == JOptionPane.YES_OPTION) {
            doSave(true);
        }
    }

    currentTitle = selectedObjTitle;

    // show info panel that corresponds to the type of object selected
    AdminInfoSubPanelWrapper panelWrapper = infoSubPanels.get(className);

    currentEditorPanel = editorPanels.get(className);
    if (currentEditorPanel != null) {
        currentEditorPanel.setHasChanged(false);
    }

    // fill form with object data
    if (panelWrapper != null) {
        currentDisplayPanel = panelWrapper;
        if (currentDisplayPanel.setData(objWrapperArg, secondObjWrapperArg, collectionWrapperArg, nodesDivision)
                && currentEditorPanel != null) {
            currentEditorPanel.setHasChanged(true);
        }
        cardLayout.show(infoCards, className);
    }

    objWrapper = objWrapperArg;
    secondObjWrapper = secondObjWrapperArg;
    collectionWrapper = collectionWrapperArg;
}

From source file:ca.uhn.hl7v2.testpanel.ui.conn.Hl7ConnectionPanelBackup.java

private void updatePortsUi() {
    boolean changesAllowed = isChangesAllowed();
    CardLayout cl = (CardLayout) myInterfaceTypeCardPanel.getLayout();

    switch (myConnection.getTransport()) {
    case DUAL_PORT_MLLP: {
        mySinglePortRadio.setSelected(false);
        myDualPortRadio.setSelected(true);
        myHl7OverHttpRadioButton.setSelected(false);

        myDualIncomingTextBox.setText(portToString(myConnection.getIncomingOrSinglePort()));
        myDualOutgoingTextBox.setText(portToString(myConnection.getOutgoingPort()));

        mySinglePortTextBox.setEnabled(false);
        myDualIncomingTextBox.setEnabled(true && changesAllowed);
        myDualOutgoingTextBox.setEnabled(true && changesAllowed);
        myHoHUrlTextField.setEnabled(false);
        mySinglePortTextBox.repaint();/*  www  .j  a v  a2  s .com*/
        myDualIncomingTextBox.repaint();
        myDualOutgoingTextBox.repaint();

        cl.show(myInterfaceTypeCardPanel, Hl7ConnectionPanelBackup.IFACE_TYPE_CARD_MLLP);
        break;
    }
    case SINGLE_PORT_MLLP: {
        mySinglePortRadio.setSelected(true);
        myDualPortRadio.setSelected(false);
        myHl7OverHttpRadioButton.setSelected(false);

        mySinglePortTextBox.setText(portToString(myConnection.getIncomingOrSinglePort()));

        mySinglePortTextBox.setEnabled(true && changesAllowed);
        myDualIncomingTextBox.setEnabled(false);
        myDualOutgoingTextBox.setEnabled(false);
        myHoHUrlTextField.setEnabled(false);
        mySinglePortTextBox.repaint();
        myDualIncomingTextBox.repaint();
        myDualOutgoingTextBox.repaint();

        cl.show(myInterfaceTypeCardPanel, Hl7ConnectionPanelBackup.IFACE_TYPE_CARD_MLLP);
        break;
    }
    case HL7_OVER_HTTP: {
        mySinglePortTextBox.setEnabled(false);
        myDualIncomingTextBox.setEnabled(false);
        myDualOutgoingTextBox.setEnabled(false);
        mySinglePortRadio.setSelected(false);
        myDualPortRadio.setSelected(false);
        myHl7OverHttpRadioButton.setSelected(true);

        cl.show(myInterfaceTypeCardPanel, Hl7ConnectionPanelBackup.IFACE_TYPE_CARD_HOH);

        StringBuilder urlBuilder = new StringBuilder();
        urlBuilder.append((myConnection.isTls() ? "https://" : "http://"));
        urlBuilder.append(StringUtils.defaultString(myConnection.getHost(), "localhost"));
        urlBuilder.append(":").append(myConnection.getIncomingOrSinglePort());
        urlBuilder.append(StringUtils.defaultString(myConnection.getHttpUriPath(), "/"));
        String url = urlBuilder.toString();
        if (!myHohUrlTextFieldUpdating) {
            myHohUrlTextFieldUpdating = true;
            myHoHUrlTextField.setText(url);
            myHohUrlTextFieldUpdating = false;
        }

        myHoHUrlTextField.setEnabled(true && changesAllowed);

        break;
    }
    }
}

From source file:net.sf.jabref.gui.preftabs.PreferencesDialog.java

public PreferencesDialog(JabRefFrame parent) {
    super(parent, Localization.lang("JabRef preferences"), false);
    JabRefPreferences prefs = JabRefPreferences.getInstance();
    frame = parent;//  w ww  . j a v a2s.  c o m

    main = new JPanel();
    JPanel mainPanel = new JPanel();
    JPanel lower = new JPanel();

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    getContentPane().add(lower, BorderLayout.SOUTH);

    final CardLayout cardLayout = new CardLayout();
    main.setLayout(cardLayout);

    List<PrefsTab> tabs = new ArrayList<>();
    tabs.add(new GeneralTab(prefs));
    tabs.add(new NetworkTab(prefs));
    tabs.add(new FileTab(frame, prefs));
    tabs.add(new FileSortTab(prefs));
    tabs.add(new EntryEditorPrefsTab(frame, prefs));
    tabs.add(new GroupsPrefsTab(prefs));
    tabs.add(new AppearancePrefsTab(prefs));
    tabs.add(new ExternalTab(frame, this, prefs));
    tabs.add(new TablePrefsTab(prefs));
    tabs.add(new TableColumnsTab(prefs, parent));
    tabs.add(new LabelPatternPrefTab(prefs, parent.getCurrentBasePanel()));
    tabs.add(new PreviewPrefsTab(prefs));
    tabs.add(new NameFormatterTab(prefs));
    tabs.add(new ImportSettingsTab(prefs));
    tabs.add(new XmpPrefsTab(prefs));
    tabs.add(new AdvancedTab(prefs));

    // add all tabs
    tabs.forEach(tab -> main.add((Component) tab, tab.getTabName()));

    mainPanel.setBorder(BorderFactory.createEtchedBorder());

    String[] tabNames = tabs.stream().map(PrefsTab::getTabName).toArray(String[]::new);
    JList<String> chooser = new JList<>(tabNames);
    chooser.setBorder(BorderFactory.createEtchedBorder());
    // Set a prototype value to control the width of the list:
    chooser.setPrototypeCellValue("This should be wide enough");
    chooser.setSelectedIndex(0);
    chooser.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // Add the selection listener that will show the correct panel when
    // selection changes:
    chooser.addListSelectionListener(e -> {
        if (e.getValueIsAdjusting()) {
            return;
        }
        String o = chooser.getSelectedValue();
        cardLayout.show(main, o);
    });

    JPanel buttons = new JPanel();
    buttons.setLayout(new GridLayout(4, 1));
    buttons.add(importPreferences, 0);
    buttons.add(exportPreferences, 1);
    buttons.add(showPreferences, 2);
    buttons.add(resetPreferences, 3);

    JPanel westPanel = new JPanel();
    westPanel.setLayout(new BorderLayout());
    westPanel.add(chooser, BorderLayout.CENTER);
    westPanel.add(buttons, BorderLayout.SOUTH);
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(main, BorderLayout.CENTER);
    mainPanel.add(westPanel, BorderLayout.WEST);

    JButton ok = new JButton(Localization.lang("OK"));
    JButton cancel = new JButton(Localization.lang("Cancel"));
    ok.addActionListener(new OkAction());
    CancelAction cancelAction = new CancelAction();
    cancel.addActionListener(cancelAction);
    lower.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    ButtonBarBuilder buttonBarBuilder = new ButtonBarBuilder(lower);
    buttonBarBuilder.addGlue();
    buttonBarBuilder.addButton(ok);
    buttonBarBuilder.addButton(cancel);
    buttonBarBuilder.addGlue();

    // Key bindings:
    KeyBinder.bindCloseDialogKeyToCancelAction(this.getRootPane(), cancelAction);

    // Import and export actions:
    exportPreferences.setToolTipText(Localization.lang("Export preferences to file"));
    exportPreferences.addActionListener(e -> {
        String filename = FileDialogs.getNewFile(frame, new File(System.getProperty("user.home")),
                Collections.singletonList(".xml"), JFileChooser.SAVE_DIALOG, false);
        if (filename == null) {
            return;
        }
        File file = new File(filename);
        if (!file.exists() || (JOptionPane.showConfirmDialog(PreferencesDialog.this,
                Localization.lang("'%0' exists. Overwrite file?", file.getName()),
                Localization.lang("Export preferences"),
                JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION)) {

            try {
                prefs.exportPreferences(filename);
            } catch (JabRefException ex) {
                LOGGER.warn(ex.getMessage(), ex);
                JOptionPane.showMessageDialog(PreferencesDialog.this, ex.getLocalizedMessage(),
                        Localization.lang("Export preferences"), JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    importPreferences.setToolTipText(Localization.lang("Import preferences from file"));
    importPreferences.addActionListener(e -> {
        String filename = FileDialogs.getNewFile(frame, new File(System.getProperty("user.home")),
                Collections.singletonList(".xml"), JFileChooser.OPEN_DIALOG, false);
        if (filename != null) {
            try {
                prefs.importPreferences(filename);
                updateAfterPreferenceChanges();
                JOptionPane.showMessageDialog(PreferencesDialog.this,
                        Localization.lang("You must restart JabRef for this to come into effect."),
                        Localization.lang("Import preferences"), JOptionPane.WARNING_MESSAGE);
            } catch (JabRefException ex) {
                LOGGER.warn(ex.getMessage(), ex);
                JOptionPane.showMessageDialog(PreferencesDialog.this, ex.getLocalizedMessage(),
                        Localization.lang("Import preferences"), JOptionPane.ERROR_MESSAGE);
            }
        }
    });

    showPreferences.addActionListener(
            e -> new PreferencesFilterDialog(new JabRefPreferencesFilter(Globals.prefs), frame)
                    .setVisible(true));
    resetPreferences.addActionListener(e -> {
        if (JOptionPane.showConfirmDialog(PreferencesDialog.this,
                Localization.lang("Are you sure you want to reset all settings to default values?"),
                Localization.lang("Reset preferences"),
                JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
            try {
                prefs.clear();
                JOptionPane.showMessageDialog(PreferencesDialog.this,
                        Localization.lang("You must restart JabRef for this to come into effect."),
                        Localization.lang("Reset preferences"), JOptionPane.WARNING_MESSAGE);
            } catch (BackingStoreException ex) {
                LOGGER.warn(ex.getMessage(), ex);
                JOptionPane.showMessageDialog(PreferencesDialog.this, ex.getLocalizedMessage(),
                        Localization.lang("Reset preferences"), JOptionPane.ERROR_MESSAGE);
            }
            updateAfterPreferenceChanges();
        }
    });

    setValues();

    pack();

}

From source file:ca.uhn.hl7v2.testpanel.ui.conn.Hl7ConnectionPanel.java

private void updatePortsUi() {
    boolean changesAllowed = isChangesAllowed();
    CardLayout cl = (CardLayout) myInterfaceTypeCardPanel.getLayout();

    switch (myConnection.getTransport()) {
    case DUAL_PORT_MLLP: {
        mySinglePortRadio.setSelected(false);
        myDualPortRadio.setSelected(true);
        myHl7OverHttpRadioButton.setSelected(false);

        myDualIncomingTextBox.setText(portToString(myConnection.getIncomingOrSinglePort()));
        myDualOutgoingTextBox.setText(portToString(myConnection.getOutgoingPort()));

        mySinglePortTextBox.setEnabled(false);
        myDualIncomingTextBox.setEnabled(true && changesAllowed);
        myDualOutgoingTextBox.setEnabled(true && changesAllowed);
        myHoHUrlTextField.setEnabled(false);
        mySinglePortTextBox.repaint();/*from   www.j  a  v a 2s . c om*/
        myDualIncomingTextBox.repaint();
        myDualOutgoingTextBox.repaint();

        cl.show(myInterfaceTypeCardPanel, Hl7ConnectionPanel.IFACE_TYPE_CARD_MLLP);
        break;
    }
    case SINGLE_PORT_MLLP: {
        mySinglePortRadio.setSelected(true);
        myDualPortRadio.setSelected(false);
        myHl7OverHttpRadioButton.setSelected(false);

        mySinglePortTextBox.setText(portToString(myConnection.getIncomingOrSinglePort()));

        mySinglePortTextBox.setEnabled(true && changesAllowed);
        myDualIncomingTextBox.setEnabled(false);
        myDualOutgoingTextBox.setEnabled(false);
        myHoHUrlTextField.setEnabled(false);
        mySinglePortTextBox.repaint();
        myDualIncomingTextBox.repaint();
        myDualOutgoingTextBox.repaint();

        cl.show(myInterfaceTypeCardPanel, Hl7ConnectionPanel.IFACE_TYPE_CARD_MLLP);
        break;
    }
    case HL7_OVER_HTTP: {
        mySinglePortTextBox.setEnabled(false);
        myDualIncomingTextBox.setEnabled(false);
        myDualOutgoingTextBox.setEnabled(false);
        mySinglePortRadio.setSelected(false);
        myDualPortRadio.setSelected(false);
        myHl7OverHttpRadioButton.setSelected(true);

        cl.show(myInterfaceTypeCardPanel, Hl7ConnectionPanel.IFACE_TYPE_CARD_HOH);

        StringBuilder urlBuilder = new StringBuilder();
        urlBuilder.append((myConnection.isTls() ? "https://" : "http://"));
        urlBuilder.append(StringUtils.defaultString(myConnection.getHost(), "localhost"));
        urlBuilder.append(":").append(myConnection.getIncomingOrSinglePort());
        urlBuilder.append(StringUtils.defaultString(myConnection.getHttpUriPath(), "/"));
        String url = urlBuilder.toString();
        if (!myHohUrlTextFieldUpdating) {
            myHohUrlTextFieldUpdating = true;
            myHoHUrlTextField.setText(url);
            myHohUrlTextFieldUpdating = false;
        }

        myHoHUrlTextField.setEnabled(true && changesAllowed);

        break;
    }
    }
}

From source file:eu.apenet.dpt.standalone.gui.ead2edm.EdmOptionsPanel.java

private void createOptionPanel() {
    labels = dataPreparationToolGUI.getLabels();
    JPanel creativeCommonsPanel = new CreativeCommonsPanel();
    JPanel europeanaRightsPanel = new EuropeanaRightsPanel();
    JPanel emptyPanel = new JPanel();

    JPanel formPanel = new JPanel(new GridLayout(14, 1));

    JPanel extraLicenseCardLayoutPanel = new JPanel(new CardLayout());
    extraLicenseCardLayoutPanel.add(creativeCommonsPanel, CREATIVE_COMMONS);
    extraLicenseCardLayoutPanel.add(europeanaRightsPanel, EUROPEANA_RIGHTS_STATEMENTS);
    extraLicenseCardLayoutPanel.add(emptyPanel, EMPTY_PANEL);
    CardLayout cardLayout = (CardLayout) extraLicenseCardLayoutPanel.getLayout();
    cardLayout.show(extraLicenseCardLayoutPanel, EMPTY_PANEL);

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    conversionModeGroup = new ButtonGroup();
    JRadioButton radioButton;//from  w w w.jav a  2 s .  co m

    panel.add(new Label(this.labels.getString("edm.panel.label.choose.mode")));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.mode.minimal"));
    radioButton.setActionCommand(MINIMAL);
    radioButton.setSelected(true);
    radioButton.addActionListener(new ConversionModeListener());
    conversionModeGroup.add(radioButton);
    panel.add(radioButton);
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.mode.full"));
    radioButton.setActionCommand(FULL);
    radioButton.addActionListener(new ConversionModeListener());
    conversionModeGroup.add(radioButton);
    panel.add(radioButton);

    formPanel.add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    cLevelIdSourceButtonGroup = new ButtonGroup();

    panel.add(new Label(this.labels.getString("edm.generalOptionsForm.identifierSource.header")));
    radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.identifierSource.unitid"));
    radioButton.setActionCommand(UNITID);
    if (retrieveFromDb.retrieveCIdentifierSource().equals(radioButton.getActionCommand())) {
        radioButton.setSelected(true);
    }
    cLevelIdSourceButtonGroup.add(radioButton);
    panel.add(radioButton);
    radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.identifierSource.cid"));
    radioButton.setActionCommand(CID);
    if (retrieveFromDb.retrieveCIdentifierSource().equals(radioButton.getActionCommand())) {
        radioButton.setSelected(true);
    }
    cLevelIdSourceButtonGroup.add(radioButton);
    panel.add(radioButton);

    formPanel.add(panel);

    panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    sourceOfFondsTitleGroup = new ButtonGroup();

    determineDaoInformation();
    panel.add(new Label(this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle")));
    if (!this.batch && StringUtils.isBlank(ead2EdmInformation.getArchdescUnittitle())
            && StringUtils.isBlank(ead2EdmInformation.getTitlestmtTitleproper())) {
        panel.add(new Label(
                this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.noSourceAvailable")));
    } else {
        radioButton = new JRadioButton(
                this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.archdescUnittitle"));
        radioButton.setActionCommand(ARCHDESC_UNITTITLE);
        radioButton.setSelected(true);
        radioButton.addActionListener(new ConversionModeListener());
        sourceOfFondsTitleGroup.add(radioButton);
        panel.add(radioButton);
        radioButton = new JRadioButton(
                this.labels.getString("edm.generalOptionsForm.sourceOfFondsTitle.titlestmtTitleproper"));
        radioButton.setActionCommand(TITLESTMT_TITLEPROPER);
        radioButton.addActionListener(new ConversionModeListener());
        sourceOfFondsTitleGroup.add(radioButton);
        panel.add(radioButton);
    }
    formPanel.add(panel);

    panel = new JPanel(new GridLayout(2, 2));
    landingPageButtonGroup = new ButtonGroup();

    panel.add(new Label(this.labels.getString("edm.generalOptionsForm.landingPages.header")));
    radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.landingPages.ape"));
    radioButton.setActionCommand(APE);
    if (retrieveFromDb.retrieveLandingPageBase().equals(APE_BASE)) {
        radioButton.setSelected(true);
    }
    landingPageButtonGroup.add(radioButton);
    panel.add(radioButton);
    panel.add(new Label());
    JPanel otherPanel = new JPanel(new GridLayout(1, 2));
    radioButton = new JRadioButton(this.labels.getString("edm.generalOptionsForm.landingPages.other"));
    radioButton.setActionCommand(OTHER);
    landingPageButtonGroup.add(radioButton);
    otherPanel.add(radioButton);
    landingPageTextArea = new JTextArea();
    landingPageTextArea.setLineWrap(true);
    landingPageTextArea.setWrapStyleWord(true);
    if (!retrieveFromDb.retrieveLandingPageBase().equals(APE_BASE)) {
        radioButton.setSelected(true);
        landingPageTextArea.setText(retrieveFromDb.retrieveLandingPageBase());
    }
    JScrollPane lptaScrollPane = new JScrollPane(landingPageTextArea);
    lptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    otherPanel.add(lptaScrollPane);
    panel.add(otherPanel);

    formPanel.add(panel);

    panel = new JPanel(new GridLayout(1, 1));
    panel.add(new Label(labels.getString("ese.mandatoryFieldsInfo")));
    panel.add(new Label(""));
    panel.setBorder(BLACK_LINE);
    formPanel.add(panel);

    panel = new JPanel(new GridLayout(1, 3));
    panel.add(new Label(labels.getString("ese.dataProvider") + ":" + "*"));
    dataProviderTextArea = new JTextArea();
    dataProviderTextArea.setLineWrap(true);
    dataProviderTextArea.setWrapStyleWord(true);
    JScrollPane dptaScrollPane = new JScrollPane(dataProviderTextArea);
    dptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    panel.add(dptaScrollPane);
    useExistingRepoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileRepository"));
    useExistingRepoCheckbox.setSelected(true);
    useExistingRepoCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            //empty method on purpose
        }
    });
    JPanel panel2 = new JPanel(new GridLayout(1, 1));
    panel2.add(useExistingRepoCheckbox);
    if (!batch) {
        String repository = ead2EdmInformation.getRepository();
        if (repository != null && !repository.equals("")) {
            dataProviderTextArea.setText(repository);
        } else {
            if (archdescRepository != null) {
                dataProviderTextArea.setText(archdescRepository);
            } else {
                useExistingRepoCheckbox.setSelected(false);
            }
        }
    }
    panel.add(panel2);
    panel.setBorder(BLACK_LINE);
    formPanel.add(panel);

    /*        panel = new JPanel(new GridLayout(1, 3));
     panel.add(new Label(labels.getString("ese.provider") + ":" + "*"));
     providerTextArea = new JTextArea();
     providerTextArea.setLineWrap(true);
     providerTextArea.setWrapStyleWord(true);
     JScrollPane ptaScrollPane = new JScrollPane(providerTextArea);
     ptaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
     panel.add(ptaScrollPane);
     panel.add(new Label(""));
     panel.setBorder(BLACK_LINE);
     formPanel.add(panel);
     */
    panel = new JPanel(new GridLayout(5, 3));
    typeGroup = new ButtonGroup();

    panel.add(new Label(labels.getString("ese.type") + ":" + "*"));
    String currentRoleType;
    if (batch) {
        currentRoleType = "";
    } else {
        currentRoleType = ead2EdmInformation.getRoleType();
    }
    radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.text"));
    if (currentRoleType.equals(EdmOptionsPanel.TEXT)) {
        radioButton.setSelected(true);
    }
    radioButton.setActionCommand(TEXT);
    radioButton.addActionListener(new ConversionModeListener());
    typeGroup.add(radioButton);
    panel.add(radioButton);
    panel.add(new JLabel(""));

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.image"));
    if (currentRoleType.equals(EdmOptionsPanel.IMAGE)) {
        radioButton.setSelected(true);
    }
    radioButton.setActionCommand(IMAGE);
    radioButton.addActionListener(new ConversionModeListener());
    typeGroup.add(radioButton);
    panel.add(radioButton);
    panel.add(new JLabel(""));

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.video"));
    if (currentRoleType.equals(EdmOptionsPanel.VIDEO)) {
        radioButton.setSelected(true);
    }
    radioButton.setActionCommand(VIDEO);
    radioButton.addActionListener(new ConversionModeListener());
    typeGroup.add(radioButton);
    panel.add(radioButton);

    useExistingDaoRoleCheckbox = new JCheckBox(labels.getString("ese.takeFromFileDaoRole"));
    useExistingDaoRoleCheckbox.setSelected(true);
    useExistingDaoRoleCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
        }
    });
    panel.add(useExistingDaoRoleCheckbox);

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.sound"));
    if (currentRoleType.equals(EdmOptionsPanel.SOUND)) {
        radioButton.setSelected(true);
    }
    radioButton.setActionCommand(SOUND);
    radioButton.addActionListener(new ConversionModeListener());
    typeGroup.add(radioButton);
    panel.add(radioButton);
    panel.add(new JLabel(""));

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.dao.role.threed"));
    if (currentRoleType.equals(EdmOptionsPanel.THREE_D)) {
        radioButton.setSelected(true);
    }
    radioButton.setActionCommand(THREE_D);
    radioButton.addActionListener(new ConversionModeListener());
    typeGroup.add(radioButton);
    panel.add(radioButton);
    panel.add(new JLabel(""));

    panel.setBorder(GREY_LINE);
    formPanel.add(panel);

    if (this.batch) {
        panel = new JPanel(new GridLayout(1, 3));
        panel.add(new Label(labels.getString("ese.selectLanguage") + ":" + "*"));
        panel.add(languageBoxPanel);
        useExistingLanguageCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLanguage"));
        useExistingLanguageCheckbox.setSelected(true);
        useExistingLanguageCheckbox.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                //empty method on purpose
            }
        });
        panel.add(useExistingLanguageCheckbox);
        panel.setBorder(BLACK_LINE);
        formPanel.add(panel);
    } else {
        inheritLanguagePanel = new JPanel(new GridLayout(1, 3));
        inheritLanguagePanel.add(new Label(labels.getString("ese.inheritLanguage") + ":" + "*"));

        JPanel rbPanel = new JPanel(new GridLayout(4, 1));
        inheritLanguageGroup = new ButtonGroup();
        inhLanYesRadioButton = new JRadioButton(labels.getString("ese.yes"));
        inhLanYesRadioButton.setActionCommand(YES);
        inhLanYesRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel));
        inheritLanguageGroup.add(inhLanYesRadioButton);
        rbPanel.add(inhLanYesRadioButton);
        inhLanNoRadioButton = new JRadioButton(labels.getString("ese.no"), true);
        inhLanNoRadioButton.setActionCommand(NO);
        inhLanNoRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel));
        inheritLanguageGroup.add(inhLanNoRadioButton);
        rbPanel.add(inhLanNoRadioButton);
        inhLanProvideRadioButton = new JRadioButton(labels.getString("ese.provide"));
        inhLanProvideRadioButton.setActionCommand(PROVIDE);
        inhLanProvideRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel));
        inheritLanguageGroup.add(inhLanProvideRadioButton);
        rbPanel.add(inhLanProvideRadioButton);
        useExistingLanguageCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLanguage"));
        useExistingLanguageCheckbox.setSelected(true);
        useExistingLanguageCheckbox.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                //empty method on purpose
            }
        });
        rbPanel.add(useExistingLanguageCheckbox);
        inheritLanguagePanel.add(rbPanel, BorderLayout.WEST);

        languageBoxPanel.setVisible(true);
        inheritLanguagePanel.add(languageBoxPanel, BorderLayout.EAST);
        inheritLanguagePanel.setBorder(BLACK_LINE);
        inheritLanguagePanel.setVisible(true);
        formPanel.add(inheritLanguagePanel);
    }

    //        if (this.batch) {
    panel = new JPanel(new GridLayout(1, 3));
    panel.add(new JLabel(labels.getString("edm.panel.license.inheritLicense") + ":" + "*"));
    useExistingRightsInfoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLicense"));
    useExistingRightsInfoCheckbox.setSelected(true);
    useExistingRightsInfoCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            //empty method on purpose
        }
    });
    panel.add(useExistingRightsInfoCheckbox);
    panel.add(new JLabel());
    panel.setBorder(BLACK_LINE);
    panel.setVisible(true);
    formPanel.add(panel);
    //        } else {
    //            panel = new JPanel(new GridLayout(3, 3));
    //            inheritLicenseGroup = new ButtonGroup();
    //
    //            panel.add(new Label(labels.getString("edm.panel.license.inheritLicense") + ":" + "*"));
    //            inhLicYesRadioButton = new JRadioButton(labels.getString("ese.yes"));
    //            inhLicYesRadioButton.setActionCommand(YES);
    ////        inhLicYesRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel));
    //            inheritLicenseGroup.add(inhLicYesRadioButton);
    //            panel.add(inhLicYesRadioButton);
    //            panel.add(new JLabel());
    //
    //            panel.add(new JLabel());
    //            inhLicNoRadioButton = new JRadioButton(labels.getString("ese.no"), true);
    //            inhLicNoRadioButton.setActionCommand(NO);
    ////        inhLicNoRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel));
    //            inheritLicenseGroup.add(inhLicNoRadioButton);
    //            panel.add(inhLicNoRadioButton);
    //            useExistingRightsInfoCheckbox = new JCheckBox(labels.getString("ese.takeFromFileLicense"));
    //            useExistingRightsInfoCheckbox.setSelected(true);
    //            useExistingRightsInfoCheckbox.addItemListener(new ItemListener() {
    //                @Override
    //                public void itemStateChanged(ItemEvent e) {
    //                    //empty method on purpose
    //                }
    //            });
    //
    //            panel.add(useExistingRightsInfoCheckbox);
    //
    //            panel.add(new JLabel());
    //            inhLicProvideRadioButton = new JRadioButton(labels.getString("ese.provide"));
    //            inhLicProvideRadioButton.setActionCommand(PROVIDE);
    ////        inhLicProvideRadioButton.addActionListener(new ChangePanelActionListener(languageBoxPanel));
    //            inheritLicenseGroup.add(inhLicProvideRadioButton);
    //            panel.add(inhLicProvideRadioButton);
    //            panel.add(new JLabel());
    //
    //            panel.setBorder(BLACK_LINE);
    //            panel.setVisible(true);
    //            formPanel.add(panel);
    //        }

    JPanel mainLicensePanel = new JPanel(new BorderLayout());
    panel = new JPanel(new GridLayout(5, 2));
    licenseGroup = new ButtonGroup();
    //        String currentRightsInformation;
    //        if (batch) {
    //            currentRightsInformation = "";
    //        } else {
    //            currentRightsInformation = ead2EdmInformation.getArchdescLicenceType();
    //        }

    panel.add(new Label(labels.getString("ese.specifyLicense") + ":" + "*"));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc"));
    //        if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) {
    //            radioButton.setSelected(true);
    //        }
    radioButton.setActionCommand(CREATIVE_COMMONS);
    radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel));
    licenseGroup.add(radioButton);
    panel.add(radioButton);

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc.zero"));
    //        if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS_CC0)) {
    //            radioButton.setSelected(true);
    //        }
    radioButton.setActionCommand(CREATIVE_COMMONS_CC0);
    radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel));
    licenseGroup.add(radioButton);
    panel.add(radioButton);

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.cc.public"));
    //        if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS_PUBLIC_DOMAIN_MARK)) {
    //            radioButton.setSelected(true);
    //        }
    radioButton.setActionCommand(CREATIVE_COMMONS_PUBLIC_DOMAIN_MARK);
    radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel));
    licenseGroup.add(radioButton);
    panel.add(radioButton);

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.europeana.rights"));
    //        if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS)) {
    //            radioButton.setSelected(true);
    //        }
    radioButton.setActionCommand(EUROPEANA_RIGHTS_STATEMENTS);
    radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel));
    licenseGroup.add(radioButton);
    panel.add(radioButton);

    panel.add(new JLabel(""));
    radioButton = new JRadioButton(this.labels.getString("edm.panel.label.out.copyright"));
    //        if (currentRightsInformation.equals(EdmOptionsPanel.OUT_OF_COPYRIGHT)) {
    //            radioButton.setSelected(true);
    //        }
    radioButton.setActionCommand(EdmOptionsPanel.OUT_OF_COPYRIGHT);
    radioButton.addActionListener(new ChangePanelActionListener(extraLicenseCardLayoutPanel));
    licenseGroup.add(radioButton);
    panel.add(radioButton);
    mainLicensePanel.add(panel, BorderLayout.WEST);

    mainLicensePanel.add(extraLicenseCardLayoutPanel, BorderLayout.EAST);
    //        if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS) || currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) {
    //            cardLayout.show(extraLicenseCardLayoutPanel, currentRightsInformation);
    //            if (currentRightsInformation.equals(EdmOptionsPanel.EUROPEANA_RIGHTS_STATEMENTS)) {
    //                if (ead2EdmInformation.getArchdescLicenceLink().endsWith("rr-f/")) {
    //                    europeanaRightsComboBox.setSelectedIndex(0);
    //                } else if (ead2EdmInformation.getArchdescLicenceLink().endsWith("orphan-work-eu/")) {
    //                    europeanaRightsComboBox.setSelectedIndex(1);
    //                } else if (ead2EdmInformation.getArchdescLicenceLink().endsWith("rr-p/")) {
    //                    europeanaRightsComboBox.setSelectedIndex(2);
    //                } else {
    //                    europeanaRightsComboBox.setSelectedIndex(3);
    //                }
    //            } else if (currentRightsInformation.equals(EdmOptionsPanel.CREATIVE_COMMONS)) {
    //                // get respective items from EAD2EDMInfo and set panel items appropriately
    //            }
    //        }
    mainLicensePanel.setBorder(BLACK_LINE);
    formPanel.add(mainLicensePanel);

    panel = new JPanel(new GridLayout(1, 1));
    panel.add(new Label(labels.getString("ese.specifyAdditionalRightsInfo") + ":"));
    additionalRightsTextArea = new JTextArea();
    additionalRightsTextArea.setLineWrap(true);
    additionalRightsTextArea.setWrapStyleWord(true);
    JScrollPane artaScrollPane = new JScrollPane(additionalRightsTextArea);
    artaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    panel.add(artaScrollPane);
    panel.setBorder(GREY_LINE);
    formPanel.add(panel);

    inheritParentPanel = new JPanel(new GridLayout(2, 3));
    inheritParentCheckbox = new JCheckBox(labels.getString("ese.inheritParent") + ":" + "*");
    inheritParentCheckbox.setSelected(true);
    inheritParentCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                inhParYesRadioButton.setEnabled(true);
                inhParNoRadioButton.setEnabled(true);
            }
            if (e.getStateChange() == ItemEvent.DESELECTED) {
                inhParYesRadioButton.setEnabled(false);
                inhParNoRadioButton.setEnabled(false);
            }
        }
    });
    inheritParentPanel.add(inheritParentCheckbox);
    inheritParentGroup = new ButtonGroup();
    inhParYesRadioButton = new JRadioButton(labels.getString("ese.yes"));
    inhParYesRadioButton.setActionCommand(YES);
    inheritParentGroup.add(inhParYesRadioButton);
    inheritParentPanel.add(inhParYesRadioButton);
    inheritParentPanel.add(new JLabel(""));
    inhParNoRadioButton = new JRadioButton(labels.getString("ese.no"), true);
    inhParNoRadioButton.setActionCommand(NO);
    inheritParentGroup.add(inhParNoRadioButton);
    inheritParentPanel.add(inhParNoRadioButton);
    inheritParentPanel.setBorder(GREY_LINE);
    inheritParentPanel.setVisible(false);
    formPanel.add(inheritParentPanel);

    inheritOriginationPanel = new JPanel(new GridLayout(2, 3));
    inheritOriginationCheckbox = new JCheckBox(labels.getString("ese.inheritOrigination") + ":" + "*");
    inheritOriginationCheckbox.setSelected(true);
    inheritOriginationCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                inhOriYesRadioButton.setEnabled(true);
                inhOriNoRadioButton.setEnabled(true);
            }
            if (e.getStateChange() == ItemEvent.DESELECTED) {
                inhOriYesRadioButton.setEnabled(false);
                inhOriNoRadioButton.setEnabled(false);
            }
        }
    });
    inheritOriginationPanel.add(inheritOriginationCheckbox);
    inheritOriginationGroup = new ButtonGroup();
    inhOriYesRadioButton = new JRadioButton(labels.getString("ese.yes"));
    inhOriYesRadioButton.setActionCommand(YES);
    inheritOriginationGroup.add(inhOriYesRadioButton);
    inheritOriginationPanel.add(inhOriYesRadioButton);
    inheritOriginationPanel.add(new JLabel(""));
    inhOriNoRadioButton = new JRadioButton(labels.getString("ese.no"), true);
    inhOriNoRadioButton.setActionCommand(NO);
    inheritOriginationGroup.add(inhOriNoRadioButton);
    inheritOriginationPanel.add(inhOriNoRadioButton);
    inheritOriginationPanel.setBorder(BLACK_LINE);
    inheritOriginationPanel.setVisible(false);
    formPanel.add(inheritOriginationPanel);

    inheritUnittitlePanel = new JPanel(new GridLayout(2, 3));
    inheritUnittitleCheckbox = new JCheckBox(labels.getString("ese.inheritUnittitle") + ":" + "*");
    inheritUnittitleCheckbox.setSelected(true);
    inheritUnittitleCheckbox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                inhTitleYesRadioButton.setEnabled(true);
                inhTitleNoRadioButton.setEnabled(true);
            }
            if (e.getStateChange() == ItemEvent.DESELECTED) {
                inhTitleYesRadioButton.setEnabled(false);
                inhTitleNoRadioButton.setEnabled(false);
            }
        }
    });
    inheritUnittitlePanel.add(inheritUnittitleCheckbox);
    inheritUnittitleGroup = new ButtonGroup();
    inhTitleYesRadioButton = new JRadioButton(labels.getString("ese.yes"));
    inhTitleYesRadioButton.setActionCommand(YES);
    inheritUnittitleGroup.add(inhTitleYesRadioButton);
    inheritUnittitlePanel.add(inhTitleYesRadioButton);
    inheritUnittitlePanel.add(new JLabel(""));
    inhTitleNoRadioButton = new JRadioButton(labels.getString("ese.no"), true);
    inhTitleNoRadioButton.setActionCommand(NO);
    inheritUnittitleGroup.add(inhTitleNoRadioButton);
    inheritUnittitlePanel.add(inhTitleNoRadioButton);
    inheritUnittitlePanel.setBorder(BLACK_LINE);
    inheritUnittitlePanel.setVisible(false);
    formPanel.add(inheritUnittitlePanel);

    JButton createEdmBtn = new JButton(labels.getString("ese.createEseBtn"));
    JButton cancelBtn = new JButton(labels.getString("ese.cancelBtn"));

    createEdmBtn.addActionListener(new CreateEdmActionListener());
    cancelBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            for (Map.Entry<String, FileInstance> entry : fileInstances.entrySet()) {
                FileInstance fileInstance = entry.getValue();
                fileInstance.setEdm(false);
            }
            dataPreparationToolGUI.enableEdmConversionBtn();
            if (batch) {
                dataPreparationToolGUI.enableAllBatchBtns();
            }
            dataPreparationToolGUI.enableRadioButtons();
            close();
        }
    });

    JPanel buttonPanel = new JPanel(new GridLayout(1, 5));

    buttonPanel.add(new JLabel(""));
    buttonPanel.add(cancelBtn);
    buttonPanel.add(new JLabel(""));
    buttonPanel.add(createEdmBtn);
    buttonPanel.add(new JLabel(""));

    add(formPanel, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.SOUTH);
}

From source file:GUI.MainWindow.java

private void ViewModeTabPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ViewModeTabPaneStateChanged
    JTabbedPane sourceTabbedPane = (JTabbedPane) evt.getSource();
    int index = sourceTabbedPane.getSelectedIndex();
    String title = sourceTabbedPane.getTitleAt(index);
    System.out.println("Tab changed to: " + sourceTabbedPane.getTitleAt(index));

    Object layout = RightPanelCardLayout.getLayout();
    if (layout instanceof java.awt.CardLayout) {
        java.awt.CardLayout cl = (java.awt.CardLayout) layout;
        if (title.equalsIgnoreCase("Vuln View")) {
            // Show the vuln view card
            cl.show(RightPanelCardLayout, "vulnView");

        } else if (title.equalsIgnoreCase("Host View")) {
            DefaultMutableTreeNode hostRoot = new TreeUtils()
                    .convertVulnViewToHostView((DefaultMutableTreeNode) this.VulnTree.getModel().getRoot());
            DefaultTreeModel dtm = ((DefaultTreeModel) this.HostTree.getModel());
            dtm.setRoot(hostRoot);//  ww w.  ja  va 2  s .  c  o  m
            dtm.reload(hostRoot);
            // Expand all nodes to make everything visible
            new TreeUtils().expandAll(this.HostTree);
            // Show the host view card
            cl.show(RightPanelCardLayout, "hostView");
        }
    }

    //cardLayout.show(cardPanel, "CardToShow");
    //java.awt.CardLayout cl = (java.awt.CardLayout)(RightPanelCardLayout.getLayout()) ;
    //        

}

From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java

private void showErrorPane(String errorPaneName) {
    CardLayout cardLayout = (CardLayout) ErrorsCardPane.getLayout();

    cardLayout.show(ErrorsCardPane, errorPaneName);
}