Example usage for java.awt CardLayout CardLayout

List of usage examples for java.awt CardLayout CardLayout

Introduction

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

Prototype

public CardLayout() 

Source Link

Document

Creates a new card layout with gaps of size zero.

Usage

From source file:it.cnr.icar.eric.client.ui.swing.FindParamsPanel.java

private JPanel createParamEntryParentPanel() throws JAXRException {
    JPanel paramEntryParentPanel = new JPanel();
    cardLayout = new CardLayout();
    paramEntryParentPanel.setLayout(cardLayout);

    ConfigurationType uiConfigurationType = UIUtility.getInstance().getConfigurationType();

    //The panel used for business query based searches
    businessPanel = new BusinessQueryPanel(this, uiConfigurationType);
    paramEntryParentPanel.add(businessPanel, "businessPanel");

    //The panel used for ad hoc query based searches
    adhocPanel = new AdhocQuerySearchPanel(this, uiConfigurationType);
    paramEntryParentPanel.add(adhocPanel, "adhocPanel");

    return paramEntryParentPanel;
}

From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java

/**
 * Method returning a Panel that can be displayed the different chart panel
 *
 * @return cardPanel/* www  .  j  av a2 s.  com*/
 */
private JPanel getCardPanel() {
    if (cardPanel == null) {
        cardPanel = new JPanel();
        carder = new CardLayout();
        cardPanel.setLayout(carder);
        cardPanel.add("Pie Chart", new ClusterPieChart());
        cardPanel.add("Spider Chart", new SpiderWebChart());
        cardPanel.add("Pie Chart 3D", new PieChart3D());
        carder.show(cardPanel, "Pie Chart");
        LoggingManager.log(Level.FINER, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getCardPanel",
                "Charts added");
    }
    return cardPanel;
}

From source file:diet.gridr.g5k.gui.G5kSummaryChart.java

/**
 * CardPanel displaying the data for the Grid5000 summary view
 *
 * @return card panel//  w  w w  .  jav  a2s.  com
 */
private JPanel getCardPanel() {
    if (cardPanel == null) {
        cardPanel = new JPanel();
        carder = new CardLayout();
        cardPanel.setLayout(carder);
        cardPanel.add("Stack Bar Chart", new StackBarChart());
        cardPanel.add("Bar Chart 3D", new BarChart3D());
        cardPanel.add("Layered Bar Chart", new LayeredBarChart());
        cardPanel.add("Pie Chart", new PieChart());
        cardPanel.add("Pie Chart 3D", new PieChart3D());
        carder.show(cardPanel, "Stack Bar Chart");
        LoggingManager.log(Level.FINER, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getCardPanel",
                "Charts added");
    }
    return cardPanel;
}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

public LogViewMainFrame(DataConfiguration c) throws InitializationException {
    super();/* www .  j a  v a 2s  .  c om*/
    this.configuration = c;
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    String title = "OtrosLogViewer";
    try {
        title += ' ' + VersionUtil.getRunningVersion();
    } catch (Exception e) {
        LOGGER.warning("Can't load version of running OLV");
    }
    this.setTitle(title);
    try {
        String iconPath = "img/otros/logo16.png";
        if (System.getProperty("os.name").contains("Linux")) {
            iconPath = "img/otros/logo64.png";
        }
        BufferedImage icon = ImageIO.read(this.getClass().getClassLoader().getResourceAsStream(iconPath));
        this.setIconImage(icon);
    } catch (Exception e1) {
        LOGGER.warning("Can't load icon: " + e1.getMessage());
    }
    Exception modalDisplayException = null;
    // If non-terminal load problem occurs, queue to display for user on
    // top of the app UI.
    try {
        OtrosSplash.setMessage("Loading plugins");
        LvDynamicLoader.getInstance().setStatusObserver(OtrosSplash.getSplashStatusObserver());
        LvDynamicLoader.getInstance().loadAll();
        OtrosSplash.setMessage("Loading plugins loaded");
    } catch (IOException e) {
        LOGGER.severe("Problem with loading automatic markers, filter or log importers: " + e.getMessage());
        modalDisplayException = e;
    } catch (InitializationException ie) {
        // Details should have been logged at lower level
        modalDisplayException = ie;
    }
    OtrosSplash.setMessage("Initializing GUI");
    allPluginables = AllPluginables.getInstance();
    logImportersContainer = allPluginables.getLogImportersContainer();
    messageColorizercontainer = allPluginables.getMessageColorizers();
    searchResultColorizer = (SearchResultColorizer) messageColorizercontainer
            .getElement(SearchResultColorizer.class.getName());
    cardLayout = new CardLayout();
    cardLayoutPanel = new JPanel(cardLayout);
    JLabel statusLabel = new JLabel(" ");
    observer = new JLabelStatusObserver(statusLabel);
    logsTabbedPane = new JTabbedPane();
    enableDisableComponetsForTabs = new EnableDisableComponetsForTabs(logsTabbedPane);
    logsTabbedPane.addChangeListener(enableDisableComponetsForTabs);

    otrosApplication = new OtrosApplication();
    otrosApplication.setAllPluginables(AllPluginables.getInstance());
    otrosApplication.setApplicationJFrame(this);
    otrosApplication.setConfiguration(configuration);
    otrosApplication.setjTabbedPane(logsTabbedPane);
    otrosApplication.setStatusObserver(observer);
    otrosApplication.setOtrosVfsBrowserDialog(new JOtrosVfsBrowserDialog(getVfsFavoritesConfiguration()));
    otrosApplication.setServices(new ServicesImpl(otrosApplication));
    SingleInstanceRequestResponseDelegate.getInstance().setOtrosApplication(otrosApplication);
    ToolTipManager.sharedInstance().setDismissDelay(5000);

    JProgressBar heapBar = new JProgressBar();
    heapBar.setPreferredSize(new Dimension(190, 15));
    new Thread(new MemoryUsedStatsUpdater(heapBar, 1500), "MemoryUsedUpdater").start();
    JPanel statusPanel = new JPanel(new MigLayout("fill", "[fill, push, grow][right][right]", "[]"));
    statusPanel.add(statusLabel);
    final JButton ideConnectedLabel = new JButton(Ide.IDEA.getIconDiscounted());
    statusPanel.add(ideConnectedLabel);
    statusPanel.add(new JButton(new SwitchAutoJump(otrosApplication)));
    statusPanel.add(heapBar);

    initMenu();
    initToolbar();
    addEmptyViewListener();
    addMenuBarReloadListener();
    otrosApplication.setSearchField(searchField);
    cardLayoutPanel.add(logsTabbedPane, CARD_LAYOUT_LOGS_TABLE);
    EmptyViewPanel emptyViewPanel = new EmptyViewPanel(otrosApplication);
    final JScrollPane jScrollPane = new JScrollPane(emptyViewPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jScrollPane.getVerticalScrollBar().setValue(0);
        }
    });
    cardLayoutPanel.add(jScrollPane, CARD_LAYOUT_EMPTY);
    cardLayout.show(cardLayoutPanel, CARD_LAYOUT_EMPTY);
    enableDisableComponetsForTabs.stateChanged(null);
    Container cp = getContentPane();
    cp.setLayout(new BorderLayout());
    cp.add(toolBar, BorderLayout.NORTH);
    cp.add(cardLayoutPanel, BorderLayout.CENTER);
    cp.add(statusPanel, BorderLayout.SOUTH);
    initGlobalHotKeys();
    initPosition();
    if (configuration.getBoolean(ConfKeys.LOAD_EXPERIMENTAL_FEATURES, false)) {
        initExperimental();
    }
    setTransferHandler(new DragAndDropFilesHandler(otrosApplication));
    initPlugins();
    OtrosSplash.hide();
    setVisible(true);
    if (modalDisplayException != null)
        JOptionPane.showMessageDialog(this,
                "Problem with loading automatic markers," + "filter or log importers:\n"
                        + modalDisplayException.getMessage(),
                "Initialization Error", JOptionPane.ERROR_MESSAGE);
    // Check new version on start
    if (c.getBoolean(ConfKeys.VERSION_CHECK_ON_STARTUP, true)) {
        new ChekForNewVersionOnStartupAction(otrosApplication).actionPerformed(null);
    }
    new TipOfTheDay(c).showTipOfTheDayIfNotDisabled(this);
    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new EventQueueProxy());
    ListUncaughtExceptionHandlers listUncaughtExceptionHandlers = new ListUncaughtExceptionHandlers(//
            new LoggingExceptionHandler(), //
            new ShowErrorDialogExceptionHandler(otrosApplication), //
            new StatusObserverExceptionHandler(observer));
    Thread.setDefaultUncaughtExceptionHandler(listUncaughtExceptionHandlers);
    ListeningScheduledExecutorService listeningScheduledExecutorService = otrosApplication.getServices()
            .getTaskSchedulerService().getListeningScheduledExecutorService();
    listeningScheduledExecutorService.scheduleAtFixedRate(
            new IdeAvailabilityCheck(ideConnectedLabel, otrosApplication.getServices().getJumpToCodeService()),
            5, 5, TimeUnit.SECONDS);
    ideConnectedLabel.addActionListener(new IdeIntegrationConfigAction(otrosApplication));
}

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;// w  w  w  .  j a  v a2 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:diet.gridr.g5k.gui.GanttChart.java

/**
 * Method returning the card panel/* www  . j av a2 s  . c o  m*/
 *
 * @return the card panel
 */
private JPanel getCardPanel() {
    cardPanel = new JPanel();
    ganttChartLayout = new CardLayout();
    cardPanel.setLayout(ganttChartLayout);
    final WaitingFrame waiting = new WaitingFrame("Waiting frame",
            "Creating the gantt charts for this cluster ...", durationsStringArray.length + 1, true);
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Thread thread = new Thread(new Runnable() {
                public void run() {
                    waiting.setStatusText("Operation : ");
                    waiting.launch("running oar stat history command ...");
                    OarHistoryRunnable historyRunnable = null;
                    chartPanels = new JPanel[durationsStringArray.length];
                    for (int i = 0; i < durationsStringArray.length; i++) {
                        waiting.setStatusText("retrieving OAR history for " + durationsStringArray[i]);
                        waiting.incrementProgressBar();
                        Date startDate = GregorianCalendar.getInstance().getTime();
                        Date endDate = new Date(startDate.getTime() + HistoryUtil.durationsTimesArray[i]);
                        historyRunnable = new OarHistoryRunnable(connection, jobsList.get(i),
                                Config.getBatchScheduler(G5kSite.getIndexForSite(siteName)),
                                G5kSite.getInternalFrontalForSite(siteName), startDate, endDate);
                        Thread th = new Thread(historyRunnable);
                        th.start();
                        try {
                            th.join();
                        } catch (Exception e) {
                            LoggingManager.log(Level.WARNING, LoggingManager.RESOURCESTOOL,
                                    this.getClass().getName(), "run", e);
                        }
                        jobsList.set(i, historyRunnable.getJobsList());
                        //                            Iterator<String> iter = historyLines.iterator();
                        //                            /*
                        //                             * The history is separated into three parts:
                        //                             *
                        //                             *  - the first is the free nodes written as follows :
                        //                             *  'node1' 'weightOfNode1' 'node2' 'weightOfNode2' ...
                        //                             *   eg :
                        //                             *  'sagittaire-12.lyon.grid5000.fr' '2' 'sagittaire-13.lyon.grid5000.fr' '2'
                        //                             *
                        //                             *  - the second is a list of jobs :
                        //                             *  'job id' 'type' 'user' 'state' 'command' 'properties' 'start time' 'queue' 'submission time' 'end time' 'node1' 'weightOfNode1' 'node2' 'weightOfNode2' ...
                        //                             *   e.g. :
                        //                             *   '20081' 'PASSIVE' 'ssoudan' 'Running' '/bin/sleep 72000' '(p.deploy = "YES") AND p.deploy = "YES" ' '2007-03-23 10:18:48' 'deploy' '2007-03-23 10:19:03' '2007-03-24 06:18:48' 'sagittaire-19.lyon.grid5000.fr' '2' 'sagittaire-24.lyon.grid5000.fr' '2'
                        //                             *
                        //                             *  - the last one is a list of dead jobs :
                        //                             *  the last part as the same pattern as the jobs
                        //                             *  '0' 'Dead' 'oar' 'null' 'null' 'null' '0000-00-00 00:00:00' 'default' '2007-03-22 19:30:02' '2007-03-24 14:00:00' 'sagittaire-60.lyon.grid5000.fr' '2'
                        //                             *
                        //                             */
                        //                            // for all jobs
                        //                            while(iter.hasNext()){
                        //                                String historyLine = iter.next();
                        //                                historyLine = historyLine.replace("''","' '");
                        //                                StringTokenizer tokenizer = new StringTokenizer(historyLine,"'");
                        //                                ArrayList<String> information = new ArrayList<String>();
                        //                                while(tokenizer.hasMoreTokens()){
                        //                                    information.add(tokenizer.nextToken());
                        //                                }
                        //                                int jobNumber=-1;
                        //                                try{
                        //                                    // if no exception is thrown then it means that we are no! in the first
                        //                                    // part of the history
                        //                                    jobNumber = Integer.parseInt(information.get(0));
                        //                                }
                        //                                catch(Exception e){
                        //                                    LoggingManager.log(Level.FINE, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "run", e);
                        //                                }
                        //                                if(jobNumber == 0){
                        //                                    // this is a dead of absent node
                        //                                    GridJob aJob = new Oar1Job();
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_HOSTS, information.get(20));
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_ID, "0");
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_OWNER, "");
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_QUEUE, "");
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_STATE, "");
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_RESOURCES_COUNT, "1");
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_SCHEDTIME,
                        //                                            GanttChart.getOARDateFromDate(Calendar.getInstance().getTime()));//information.get(12);
                        //                                    aJob.setParameterValue(GridJob.KEY_GRID_JOB_WALLTIME,
                        //                                            getWallTimeFromDate(HistoryUtil.durationsTimesArray[i]));//ntheWallTime;
                        //                                    jobsList.get(i).add(aJob);
                        //                                }
                        //                                else if (jobNumber != -1){
                        //                                    // this is not a dead or absent or suspected job but a classical job
                        //                                    GridJob aJob = null;
                        //                                    //searching the job
                        //                                    for(int j = 0 ;j < jobsList.get(i).size() ; j++){
                        //                                        aJob = jobsList.get(i).get(j);
                        //                                        String firstParam = aJob.getParameterValue(GridJob.KEY_GRID_JOB_ID);
                        //                                        if(jobNumber == Integer.parseInt(firstParam)){
                        //                                            j=jobsList.get(i).size();
                        //                                        }
                        //                                    }
                        //                                    // if the job is waiting
                        //                                    if(aJob.getParameterValue(GridJob.KEY_GRID_JOB_STATE).substring(0, 1).equalsIgnoreCase("w")){
                        //                                        ArrayList<String> theNodes = new ArrayList<String>();
                        //                                        for(int index = 20 ; index < information.size() ; index +=4){
                        //                                            theNodes.add(information.get(index));
                        //                                        }
                        //
                        //                                        if(theNodes.size() >= 1){
                        ////                                            String nodesOfTheJob = theNodes.get(0);
                        ////                                            for(int anIndex = 1 ; anIndex < theNodes.size(); anIndex ++){
                        ////                                                nodesOfTheJob += "+" + theNodes.get(anIndex);
                        ////                                            }
                        //                                            // TODO: check this operation (don't understand how use it)
                        //                                            aJob.setHostsFromArray(theNodes.toArray(new String[0]));
                        //                                        }
                        //                                    }
                        //                                }
                        //                            }

                        waiting.setStatusText("creating chart for " + durationsStringArray[i]);
                        visualizationDuration = i;
                        chartPanels[i] = new ChartPanel(createChart(createDataset()));
                        chartPanels[i].setPreferredSize(new java.awt.Dimension(800, 600));
                        chartPanels[i].setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
                        cardPanel.add(durationsStringArray[i], chartPanels[i]);
                    }
                    visualizationDuration = ONE_DAY;
                    ganttChartLayout.show(cardPanel, durationsStringArray[visualizationDuration]);
                    waiting.dispose();
                    GanttChart.this.pack();
                    GanttChart.this.setVisible(true);
                    LoggingManager.log(Level.CONFIG, LoggingManager.RESOURCESTOOL, this.getClass().getName(),
                            "run", "GanttChart initialized");
                }
            });
            thread.start();
        }
    });
    LoggingManager.log(Level.CONFIG, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getCardPanel",
            "CardPanel initialized");
    return cardPanel;
}

From source file:org.parosproxy.paros.view.MainFrame.java

/**
 * This method initializes paneDisplay//from  ww  w .  ja v a  2  s .c  o  m
 *
 * @return JPanel
 */
public JPanel getPaneDisplay() {
    if (paneDisplay == null) {
        paneDisplay = new JPanel();
        paneDisplay.setLayout(new CardLayout());
        paneDisplay.setName("paneDisplay");
        paneDisplay.add(getWorkbench(), getWorkbench().getName());
    }
    return paneDisplay;
}

From source file:pl.piotrsukiennik.jbrain.gui.NewSimulationPanel.java

private void imageHolderMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imageHolderMouseClicked
    simulationController.showInputImageSelectDialog(new Handler<File>() {
        @Override//  w w w .  j a  va  2 s  .  c o  m
        public void handle(File file) {
            BufferedImage image = null;
            imageHolder.setLayout(new CardLayout());
            try {
                image = ImageIO.read(file);
            } catch (IOException e) {
                e.printStackTrace();
            }
            imageHolder.removeAll();
            imageHolder.add(new JLabel(new ImageIcon(image)));
            imageHolder.revalidate();
            imageHolder.repaint();
        }
    });
}

From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java

private void initComponents() {
    JLabel label;// ww w.j a  va 2s  . co m

    setLayout(new BorderLayout());

    // create button panel
    JPanel topPanel = new JPanel();
    label = new JLabel("View as: ");
    btnTreeView = new JRadioButton("tree");
    btnTreeView.putClientProperty("cv.cardName", TREEPANEL);
    btnTableView = new JRadioButton("table");
    btnTableView.putClientProperty("cv.cardName", TABLEPANEL);

    ActionListener btnListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // show the right layout panel
            String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName");
            if (v != null)
                ((CardLayout) contentPanel.getLayout()).show(contentPanel, v);
        }
    };
    btnTableView.addActionListener(btnListener);
    btnTreeView.addActionListener(btnListener);

    // connect buttons
    ButtonGroup group = new ButtonGroup();
    group.add(btnTreeView);
    group.add(btnTableView);
    topPanel.setLayout(new MigLayout("", "[64px][55px][62px][63px][][]", "[23px]"));

    // add it all to a panel
    topPanel.add(label, "cell 0 0,alignx left,aligny center");
    topPanel.add(btnTreeView, "cell 1 0,alignx left,aligny center");
    topPanel.add(btnTableView, "cell 2 0,alignx left,aligny center");

    topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8));

    add(topPanel, BorderLayout.NORTH);

    JButton btnOrder = new JButton("Order");
    btnOrder.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

        }

    });
    topPanel.add(btnOrder, "cell 5 0");

    // create status bar
    JPanel status = new JPanel();
    status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS));
    txtStatus = new JLabel("");
    pbStatus = new JProgressBar();
    pbStatus.setVisible(false);
    status.add(txtStatus);
    status.add(Box.createHorizontalStrut(8));
    status.add(pbStatus);
    status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));

    add(status, BorderLayout.SOUTH);

    contentPanel = new JPanel(new CardLayout());
    add(contentPanel, BorderLayout.CENTER);

    tablePanel = new JPanel(new BorderLayout());
    setupTable();
    tablePanel.add(new JScrollPane(table), BorderLayout.CENTER);

    treePanel = new JPanel(new BorderLayout());
    setupTree();
    treePanel.add(new JScrollPane(tree), BorderLayout.CENTER);

    tree2Panel = new JPanel(new BorderLayout());

    createTree();
    //setupTreeGUI();

    contentPanel.add(tablePanel, TABLEPANEL);
    contentPanel.add(treePanel, TREEPANEL);
    contentPanel.add(tree2Panel, TREE2PANEL);
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * /* www  .ja  v  a 2 s .  c  om*/
 */
public void buildUI() {
    setIgnoreChanges(true);

    fieldsList = createList(fieldsModel);

    fieldsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                getAllDataFromUI();
                fieldSelected();
            }
        }
    });

    fieldsList.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            super.focusLost(e);
            //lastIndex = fieldsList.getSelectedIndex();
        }
    });

    fieldDescText.addKeyListener(new LengthWatcher(255));
    // setting min and pref sizes to some bogus values so that textarea shrinks with dialog
    fieldNameText.addKeyListener(new LengthWatcher(64));

    CellConstraints cc = new CellConstraints();

    int y = 1;

    JScrollPane fldsp = UIHelper.createScrollPane(fieldsList);

    // LocalizableNameDescIFace
    PanelBuilder pb = new PanelBuilder(new FormLayout("max(200px;p),4px,p,2px,p,10px,p,2px,p,f:p:g",
            (includeHiddenUI ? "p,2px," : "") + (isDBSchema ? "p,2px,p,2px," : "")
                    + (includeFormatAndAutoNumUI ? "p,2px,p,2px," : "")
                    + "p,2px,p,2px,p,2px,p,2px,p,2px,p,2px,f:p:g"),
            this);

    pb.add(fldsp, cc.xywh(1, y, 1, 7 + (isDBSchema ? 4 : 0)));
    pb.add(fieldNameLbl = createI18NFormLabel("SL_LABEL", SwingConstants.RIGHT), cc.xy(3, y));
    pb.add(fieldNameText, cc.xywh(5, y, 6, 1));
    y += 2;

    if (includeHiddenUI) {
        pb.add(fieldHideChk, cc.xy(5, y));
        y += 2;
    }

    pb.add(fieldDescLbl = createI18NFormLabel("SL_DESC", SwingConstants.RIGHT), cc.xy(3, y));
    JScrollPane sp = new JScrollPane(fieldDescText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    pb.add(sp, cc.xywh(5, y, 6, 1));
    y += 2;
    fieldDescText.setLineWrap(true);
    fieldDescText.setWrapStyleWord(true);

    if (isDBSchema) {
        fieldTypeTxt = createLabel("");
        fieldLengthTxt = createLabel("");

        pb.add(fieldTypeLbl = createI18NFormLabel("SL_TYPE", SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(fieldTypeTxt, cc.xy(5, y));

        pb.add(fieldReqChk = createCheckBox(getResourceString("SL_REQ")), cc.xy(9, y));
        y += 2;

        pb.add(fieldLengthLbl = createI18NFormLabel("SL_LENGTH", SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(fieldLengthTxt, cc.xy(5, y));
        y += 2;

        fieldTypeTxt.setBackground(Color.WHITE);
        fieldLengthTxt.setBackground(Color.WHITE);
        fieldTypeTxt.setOpaque(true);
        fieldLengthTxt.setOpaque(true);
    }

    if (includeFormatAndAutoNumUI) {
        PanelBuilder inner = new PanelBuilder(new FormLayout("p,2px,p", "p"));

        formatSwitcherCombo = createComboBox();
        fmtCardLayout = new CardLayout();
        formatterPanel = new JPanel(fmtCardLayout);
        pb.add(formatLbl = createI18NFormLabel("SL_FMTTYPE", SwingConstants.RIGHT), cc.xy(3, y));

        inner.add(formatSwitcherCombo, cc.xy(1, 1));
        inner.add(formatterPanel, cc.xy(3, 1));

        pb.add(inner.getPanel(), cc.xywh(5, y, 6, 1));
        y += 2;

        ActionListener switchAL = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String item = (String) formatSwitcherCombo.getSelectedItem();
                if (item != null) {
                    fmtCardLayout.show(formatterPanel, item);
                    webLinkCombo.setEnabled(item.equals(SL_WEBLINK));

                    if (formatSwitcherCombo.getSelectedIndex() == 0) {
                        if (webLinkCombo.getModel().getSize() > 0) {
                            webLinkCombo.setSelectedIndex(0);
                        }
                        if (formatCombo.getModel().getSize() > 0) {
                            formatCombo.setSelectedIndex(0);
                        }
                        if (pickListCBX.getModel().getSize() > 0) {
                            pickListCBX.setSelectedIndex(0);
                        }
                    }
                }
            }
        };
        formatSwitcherCombo.addActionListener(switchAL);

        formatterPanel.add(SL_NONE, new JPanel());

        //--------------------------
        // UIFieldFormatter
        //--------------------------
        inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));

        formatCombo = createComboBox(new DefaultComboBoxModel());
        formatMoreBtn = createButton(ELIPSES);

        inner.add(formatCombo, cc.xy(1, 1));
        inner.add(formatMoreBtn, cc.xy(3, 1));

        formatMoreBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                UIFormatterListEdtDlg dlg = new UIFormatterListEdtDlg((Frame) UIRegistry.getTopWindow(),
                        fieldInfo, true, schemaPanel.getUiFieldFormatterMgrCache());
                dlg.setVisible(true);
                if (!dlg.isCancelled() && dlg.hasChanged()) {
                    //schemaPanel.setHasChanged(true);
                    formHasChanged();

                    //fillFormatBox(dlg.getSelectedFormat());
                    setSelectedFieldFormatter(dlg.getSelectedFormat());
                }
            }
        });

        formatterPanel.add(SL_FORMAT, inner.getPanel());

        ActionListener changed = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                formHasChanged();

                boolean hasFormat = formatCombo.getSelectedIndex() > 0;
                webLinkCombo.setEnabled(!hasFormat);
                if (hasFormat) {
                    webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1);
                    pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1);
                }
            }
        };
        formatCombo.addActionListener(changed);

        //--------------------------
        // WebLinks
        //--------------------------
        webLinkMoreBtn = createButton(ELIPSES);
        webLinkMoreBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                WebLinkDef selectedWL = (WebLinkDef) webLinkCombo.getSelectedItem();
                WebLinkConfigDlg dlg = webLinkMgrCache.editWebLinks(tableInfo, false);
                if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
                    fillWebLinkBox();

                    formHasChanged();

                    if (selectedWL != null && !selectedWL.getName().equals(SL_WEBLINK)) {
                        dlg.setWebLink(selectedWL.getName());
                    }
                    if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
                        setSelectedWebLink(dlg.getSelectedItem());
                    }
                }
            }
        });

        inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));
        webLinkCombo = createComboBox();
        DefaultComboBoxModel model = (DefaultComboBoxModel) webLinkCombo.getModel();
        model.addElement(webLinkDefNone);
        webLinkCombo.setSelectedIndex(0);

        inner.add(webLinkCombo, cc.xy(1, 1));
        inner.add(webLinkMoreBtn, cc.xy(3, 1));

        ActionListener wlchanged = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                formHasChanged();

                boolean hasWL = webLinkCombo.getSelectedIndex() > 0;
                webLinkCombo.setEnabled(hasWL);
                if (hasWL) {
                    formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1);
                    pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1);
                }
            }
        };
        webLinkCombo.addActionListener(wlchanged);

        formatterPanel.add(SL_WEBLINK, inner.getPanel());
    }

    //--------------------------
    // PickList
    //--------------------------

    pickListCBX = createComboBox(new DefaultComboBoxModel());
    pickListCBX.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            formHasChanged();
            if (formatCombo != null && pickListCBX.getSelectedIndex() > 0) {
                formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1);
                webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1);
            }
        }
    });
    pickListMoreBtn = createButton(ELIPSES);
    pickListMoreBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            LocalizableItemIFace currentField = prevField;
            prevField = getSelectedFieldItem();

            PickList selectedItem = (PickList) pickListCBX.getSelectedItem();

            PickListEditorDlg dlg = new PickListEditorDlg(
                    localizableIO.hasUpdatablePickLists() ? null : localizableIO, true, true);
            dlg.setTableInfo(tableInfo);
            dlg.setFieldInfo(fieldInfo);
            dlg.createUI();
            dlg.setSize(400, 500);
            dlg.setVisible(true);
            if (!dlg.isCancelled()) {
                if (dlg.hasChanged()) {
                    hasChanged = true;
                    Vector<PickList> list = dlg.getNewPickLists();
                    DefaultComboBoxModel plCbxModel = (DefaultComboBoxModel) pickListCBX.getModel();
                    for (int i = 0; i < plCbxModel.getSize(); i++) {
                        list.add((PickList) plCbxModel.getElementAt(i));
                    }
                    Collections.sort(list);
                    plCbxModel.removeAllElements();
                    plCbxModel.addElement(pickListNone);
                    int inx = -1;
                    int i = 0;
                    for (PickList pl : list) {
                        plCbxModel.addElement(pl);
                        if (inx == -1 && selectedItem != null
                                && ((selectedItem.getId() != null && pl.getId() != null
                                        && selectedItem.getId().equals(pl.getId()))
                                        || (selectedItem.getName() != null && pl.getName() != null
                                                && selectedItem.getName().equals(pl.getName())))) {
                            inx = i;
                        }
                        i++;
                    }
                    pickListCBX.setSelectedIndex(inx + 1);
                }
            }

            prevField = currentField;
        }
    });

    if (includeFormatAndAutoNumUI) {
        PanelBuilder inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));
        inner.add(pickListCBX, cc.xy(1, 1));
        inner.add(pickListMoreBtn, cc.xy(3, 1));

        formatterPanel.add(SL_PICKLIST, inner.getPanel());

    } else {
        pb.add(pickListLbl = createI18NFormLabel(SL_PICKLIST, SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(pickListCBX, cc.xy(5, y));
        pb.add(pickListMoreBtn, cc.xy(7, y));
        y += 2;
    }

    nxtBtn = createI18NButton("SL_NEXT");
    nxtEmptyBtn = createI18NButton("SL_NEXT_EMPTY");
    fldSpellChkBtn = createI18NButton("SL_SPELL_CHECK");

    //JPanel bbp = ButtonBarFactory.buildCenteredBar(adjustButtonArray(new JButton[] {nxtEmptyBtn, nxtBtn, fldSpellChkBtn}));
    //bbp.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    //pb.add(bbp,   cc.xywh(3, y, 8, 1));

    nxtBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            next();
        }
    });
    nxtEmptyBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            nextEmpty();
        }
    });

    fldSpellChkBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (checker != null) {
                checker.spellCheck(fieldDescText);
                checker.spellCheck(fieldNameText);
            }
        }

    });

    fieldHideChk.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            formHasChanged();
        }

    });

    fieldReqChk.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            formHasChanged();
        }

    });

    DocumentListener dl = new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            formHasChanged();
        }
    };

    fieldNameText.getDocument().addDocumentListener(dl);
    fieldDescText.getDocument().addDocumentListener(dl);
    /*        
            if (formatTxt != null)
            {
    formatTxt.getDocument().addDocumentListener(dl);
            }
    */
    SchemaI18NService.getInstance().checkCurrentLocaleMenu();

    enableUIControls(false);

    setIgnoreChanges(false);
}