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:com.a544jh.kanamemory.ui.ProfileChooserPanel.java

private void loadSelectedProfile() {
    PlayerProfile profile = JsonFileReader.loadProfile((String) profilesList.getSelectedValue(), "profiles");
    CardLayout cl = (CardLayout) getParent().getLayout();
    MainMenuPanel mainmenu = new MainMenuPanel();
    mainmenu.setProfile(profile);// w ww  . j  ava  2s  .  c om
    getParent().add(mainmenu, "MainMenu");
    cl.show(getParent(), "MainMenu");
    getParent().remove(this);
}

From source file:net.landora.video.manager.ManagerFrame.java

private void checkInfoPanels() {
    MultiValueMap completeContext = UIUtils.createCompleteContextByClass(context);

    int index = -1;
    for (int i = 0; i < infoPanels.size(); i++) {
        InfoPanel panel = infoPanels.get(i);
        if (index < 0 && panel.supportsContext(completeContext)) {
            index = i;//  w  ww  . jav a 2s. c om
            panel.loadContext(completeContext);
        } else {
            panel.clearCurrentContext();
        }
    }

    String cardLayoutName;
    if (index >= 0) {
        cardLayoutName = String.valueOf(index);
    } else {
        cardLayoutName = "no_info";
    }

    CardLayout layout = (CardLayout) pnlInfo.getLayout();
    layout.show(pnlInfo, cardLayoutName);

}

From source file:ec.ui.view.StabilityView.java

private void showMain() {
    panel.setChart(mainChart);//from   w ww  .  j ava  2 s .  co  m
    onColorSchemeChange();
    CardLayout cl = (CardLayout) cards.getLayout();
    cl.show(cards, MAIN_PANEL);
}

From source file:ec.ui.view.StabilityView.java

/**
 * Displays an exception message in place of the graph
 *///from   ww  w  .  ja  va  2 s . c o  m
public void showException(String msg) {
    errorLabel.setText(msg);
    CardLayout cl = (CardLayout) cards.getLayout();
    cl.show(cards, ERROR_PANEL);
}

From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.filtering.FilteringController.java

/**
 * Initialize the main view: the filtering panel (the two sub-views are kept
 * in two separate controllers)./*from ww  w  . j a v a  2s.c om*/
 */
private void initFilteringPanel() {
    // make a new view
    filteringPanel = new FilteringPanel();
    // make a new radio button group for the radio buttons
    ButtonGroup radioButtonGroup = new ButtonGroup();
    radioButtonGroup.add(filteringPanel.getSingleCutOffRadioButton());
    radioButtonGroup.add(filteringPanel.getMultipleCutOffRadioButton());
    // select the first one as default
    filteringPanel.getMultipleCutOffRadioButton().setSelected(true);

    // set icon for question button
    Icon questionIcon = UIManager.getIcon("OptionPane.questionIcon");
    ImageIcon scaledQuestionIcon = GuiUtils.getScaledIcon(questionIcon);
    filteringPanel.getQuestionButton().setIcon(scaledQuestionIcon);

    // action listeners
    // info button
    filteringPanel.getQuestionButton().addActionListener((ActionEvent e) -> {
        // pack and show info dialog
        GuiUtils.centerDialogOnFrame(singleCellPreProcessingController.getMainFrame(), filteringInfoDialog);
        filteringInfoDialog.setVisible(true);
    });

    // which criterium for the filtering?
    filteringPanel.getMultipleCutOffRadioButton().addActionListener((ActionEvent e) -> {
        // need to reset the conditions list back to active
        singleCellPreProcessingController.getConditionsList().setEnabled(true);
        // set as the current condition the first one in the list
        singleCellPreProcessingController
                .setCurrentCondition(singleCellPreProcessingController.getPlateConditionList().get(0));
        singleCellPreProcessingController.getAnalysisPlatePanel()
                .setCurrentCondition(singleCellPreProcessingController.getPlateConditionList().get(0));
        singleCellPreProcessingController.getAnalysisPlatePanel().repaint();

        // get the layout from the bottom panel and show the appropriate one
        CardLayout layout = (CardLayout) filteringPanel.getBottomPanel().getLayout();
        layout.show(filteringPanel.getBottomPanel(), filteringPanel.getMultipleCutOffParentPanel().getName());

        multipleCutOffFilteringController.plotRawKdeMultipleCutOff(getCurrentCondition());
        setMedianDisplForCondition(getCurrentCondition());
        setMedianDisplForExperiment();
    });

    filteringPanel.getSingleCutOffRadioButton().addActionListener((ActionEvent e) -> {
        // need to disable the conditions list
        singleCellPreProcessingController.getConditionsList().clearSelection();
        singleCellPreProcessingController.getConditionsList().setEnabled(false);
        singleCellPreProcessingController.setCurrentCondition(null);
        singleCellPreProcessingController.getAnalysisPlatePanel().setCurrentCondition(null);
        singleCellPreProcessingController.getAnalysisPlatePanel().repaint();
        // get the layout from the bottom panel and show the appropriate one
        CardLayout layout = (CardLayout) filteringPanel.getBottomPanel().getLayout();
        layout.show(filteringPanel.getBottomPanel(), filteringPanel.getSingleCutOffParentPanel().getName());

        singleCutOffFilteringController.plotRawKdeSingleCutOff();
        setMedianDisplForExperiment();
        singleCutOffFilteringController.showMedianDisplInList();

    });

    // add view to parent container
    singleCellPreProcessingController.getSingleCellAnalysisPanel().getFilteringParentPanel().add(filteringPanel,
            gridBagConstraints);
}

From source file:com.qspin.qtaste.ui.MainPanel.java

public void genUI() {
    try {//from  w w w  .j  a v a  2  s.c  o  m
        getContentPane().setLayout(new BorderLayout());
        // prepare the top panel that contains the following panes:
        //   - logo
        //   - ConfigInfopanel
        //   - Current Date/time
        JPanel topanel = new JPanel(new BorderLayout());
        JPanel center = new JPanel(new GridBagLayout());
        ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin");
        JLabel iconlabel = new JLabel(topLeftLogo);

        mHeaderPanel = new ConfigInfoPanel(this);
        mTestCasePanel = new TestCasePane(this);
        mTestCampaignPanel = new TestCampaignMainPanel(this);

        mHeaderPanel.init();

        GridBagLineAdder centeradder = new GridBagLineAdder(center);
        JLabel sep = new JLabel("  ");
        sep.setFont(ResourceManager.getInstance().getSmallFont());
        sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor()));
        centeradder.setWeight(1.0f, 0.0f);
        centeradder.add(mHeaderPanel);

        // prepare the right panels containg the main information:
        // the right pane is selected through the tabbed pane:
        //    - Test cases: management of test cases and test suites
        //    - Test campaign: management of test campaigns
        //    - Interactive: ability to invoke QTaste verbs one by one

        mRightPanels = new JPanel(new CardLayout());

        mRightPanels.add(mTestCasePanel, "Test Cases");
        mRightPanels.add(mTestCampaignPanel, "Test Campaign");

        final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel();
        mRightPanels.add(testInterractivePanel, "Interactive");

        mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM);
        mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT));

        TestCaseTree tct = new TestCaseTree(mTestCasePanel);
        JScrollPane sp2 = new JScrollPane(tct);
        mTreeTabsPanel.addTab("Test Cases", sp2);

        // add tree view for test campaign definition
        com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree(
                mTestCampaignPanel.getTreeTable());
        JScrollPane sp3 = new JScrollPane(mtct);
        mTreeTabsPanel.addTab("Test Campaign", sp3);

        genMenu(tct);

        // add another tab contain used for Interactive mode
        TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel);
        JScrollPane spInter = new JScrollPane(jInteractive);
        mTreeTabsPanel.addTab("Interactive", spInter);

        // init will do the link between the tree view and the pane
        testInterractivePanel.init();

        // Define the listener to display the pane depending on the selected tab
        mTreeTabsPanel.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex());
                CardLayout rcl = (CardLayout) mRightPanels.getLayout();
                rcl.show(mRightPanels, componentName);
            }
        });
        mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (e.getID() == TestCampaignMainPanel.RUN_ID) {
                    if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) {
                        // open the tab test cases
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                mTreeTabsPanel.setSelectedIndex(0);
                                mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX);
                            }
                        });

                        // update the buttons
                        mTestCasePanel.setExecutingTestCampaign(true,
                                ((TestCampaignMainPanel) e.getSource()).getExecutionThread());
                        mTestCasePanel.updateButtons(true);
                    } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) {
                        mTestCasePanel.setExecutingTestCampaign(false, null);
                        mTestCasePanel.updateButtons();
                    }
                }
            }
        });

        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels);
        splitPane.setDividerSize(4);
        GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
        int mainHorizontalSplitDividerLocation = guiConfiguration
                .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285);
        splitPane.setDividerLocation(mainHorizontalSplitDividerLocation);

        splitPane.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals("dividerLocation")) {
                    GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
                    if (evt.getSource() instanceof JSplitPane) {
                        JSplitPane splitPane = (JSplitPane) evt.getSource();
                        guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY,
                                splitPane.getDividerLocation());
                        try {
                            guiConfiguration.save();
                        } catch (ConfigurationException ex) {
                            logger.error("Error while saving GUI configuration: " + ex.getMessage());
                        }
                    }
                }
            }
        });

        topanel.add(iconlabel, BorderLayout.WEST);
        topanel.add(center);

        getContentPane().add(topanel, BorderLayout.NORTH);
        getContentPane().add(splitPane);
        this.pack();

        this.setExtendedState(Frame.MAXIMIZED_BOTH);
        if (mTestSuiteDir != null) {
            DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir);
            if (testSuite != null) {
                testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour);
                setTestSuite(testSuite.getName());
                mTestCasePanel.runTestSuite(testSuite, false);
            }
        }
        setVisible(true);
        //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT));

    } catch (Exception e) {
        logger.fatal(e);
        e.printStackTrace();
        TestEngine.shutdown();
        System.exit(1);
    }

}

From source file:org.kepler.gui.ViewManager.java

public void showView(TableauFrame parent, String viewName) {
    JPanel viewArea = _viewAreas.get(parent);
    CardLayout cl = (CardLayout) (viewArea.getLayout());
    cl.show(viewArea, viewName);
    NamedObj reference = ((PtolemyFrame) parent).getModel();
    ViewPane viewPane = getViewPane(parent, viewName);
    StateChangeMonitor.getInstance().notifyStateChange(new ViewStateChangeEvent((Component) viewPane,
            ViewStateChangeEvent.SHOW_VIEW, reference, viewName));
}

From source file:org.nekorp.workflow.desktop.view.ServicioView.java

private void clienteSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clienteSelectorActionPerformed
    java.awt.CardLayout cardLayout = (java.awt.CardLayout) (datos.getLayout());
    cardLayout.show(datos, "cliente");
    servicioMetaData.getServicioActual().getPreferenciasEdicion().setCurrentTab("cliente");
}

From source file:org.nekorp.workflow.desktop.view.ServicioView.java

private void autoSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoSelectorActionPerformed
    java.awt.CardLayout cardLayout = (java.awt.CardLayout) (datos.getLayout());
    cardLayout.show(datos, "auto");
    servicioMetaData.getServicioActual().getPreferenciasEdicion().setCurrentTab("auto");
}

From source file:org.nekorp.workflow.desktop.view.ServicioView.java

private void bitacoraSelectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bitacoraSelectorActionPerformed
    java.awt.CardLayout cardLayout = (java.awt.CardLayout) (datos.getLayout());
    cardLayout.show(datos, "bitacora");
    servicioMetaData.getServicioActual().getPreferenciasEdicion().setCurrentTab("bitacora");
}