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:de.cismet.cids.custom.objecteditors.utils.VermessungUmleitungPanel.java

/**
 * DOCUMENT ME!/*from   ww w.j  a  v  a2  s .  co  m*/
 *
 * @param  text       DOCUMENT ME!
 * @param  fireEvent  DOCUMENT ME!
 */
public void setLinkDocumentText(final String text, final boolean fireEvent) {
    if (!fireEvent) {
        tfName.getDocument().removeDocumentListener(this);
    }
    escapeText = text;
    tfName.setText(text);
    final CardLayout cl = (CardLayout) pnlControls.getLayout();
    cl.show(pnlControls, "card1");
    if (!fireEvent) {
        tfName.getDocument().addDocumentListener(this);
    }
}

From source file:de.cismet.cids.custom.objecteditors.utils.VermessungUmleitungPanel.java

/**
 * DOCUMENT ME!//from  w w  w . j  av  a 2 s .  c  om
 *
 * @param  createUmleitung  DOCUMENT ME!
 */
private void checkIfLinkDocumentExists(final boolean createUmleitung) {
    final SwingWorker<URL, Void> worker = new SwingWorker<URL, Void>() {

        @Override
        protected void done() {
            try {
                final URL file = get();
                if (createUmleitung) {
                    VermessungUmleitungPanel.this.createLinkFile();
                    return;
                }
                jXBusyLabel1.setBusy(false);
                final CardLayout cl = (CardLayout) pnlControls.getLayout();
                cl.show(pnlControls, "card3");
                if (file != null) {
                    lastCheckedURL = file;
                    editor.successAlert();
                    editor.reloadPictureFromUrl(file);
                } else {
                    // no file exists we need to show a warning...
                    lastCheckedURL = new URL(VermessungsrissWebAccessPictureFinder.getInstance()
                            .getObjectPath(true, getLinkDocument()));
                    editor.warnAlert();
                }
            } catch (InterruptedException ex) {
                LOG.error("Worker Thread interrupter", ex);
                showError();
            } catch (Exception ex) {
                LOG.error("Execution error", ex);
                showError();
            }
        }

        @Override
        protected URL doInBackground() throws Exception {
            final String input = getLinkDocument();
            //                if (!isNummerConsistent(input)) {
            //                    return null;
            //                }
            final boolean isPlatzhalter = input.toLowerCase().startsWith(PLATZHALTER_PREFIX);
            if ((mode == MODE.VERMESSUNGSRISS) && !isPlatzhalter) {
                return null;
            }
            if (isPlatzhalter) {
                return new URL(VermessungsrissWebAccessPictureFinder.getInstance()
                        .getObjectPath(mode == MODE.GRENZNIEDERSCHRIFT, input) + ".jpg");
            } else {
                final List<URL> res;
                final String[] props = parsePropertiesFromLink(input);

                // check if we need to format the flur and the blatt
                if (mode == MODE.VERMESSUNGSRISS) {
                    res = VermessungsrissWebAccessPictureFinder.getInstance().findVermessungsrissPicture(
                            props[0], Integer.parseInt(props[1]), props[2], props[3]);
                } else {
                    res = VermessungsrissWebAccessPictureFinder.getInstance().findGrenzniederschriftPicture(
                            props[0], Integer.parseInt(props[1]), props[2], props[3]);
                }
                if ((res == null) || res.isEmpty()) {
                    return null;
                }
                return res.get(0);
            }
        }
    };
    worker.execute();
}

From source file:davmail.ui.SettingsFrame.java

protected JPanel getSmartCardPanel() {
    JPanel clientKeystorePanel = new JPanel(new GridLayout(2, 1));
    clientKeystorePanel.setLayout(new BoxLayout(clientKeystorePanel, BoxLayout.Y_AXIS));
    clientKeystorePanel//from w w  w .jav  a2 s  . c  o m
            .setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_CLIENT_CERTIFICATE")));

    clientKeystoreTypeCombo = new JComboBox(new String[] { "PKCS11", "JKS", "PKCS12" });
    clientKeystoreTypeCombo.setSelectedItem(Settings.getProperty("davmail.ssl.clientKeystoreType"));
    clientKeystoreFileField = new JTextField(Settings.getProperty("davmail.ssl.clientKeystoreFile"), 17);
    clientKeystorePassField = new JPasswordField(Settings.getProperty("davmail.ssl.clientKeystorePass"), 15);

    pkcs11LibraryField = new JTextField(Settings.getProperty("davmail.ssl.pkcs11Library"), 17);
    pkcs11ConfigField = new JTextArea(2, 17);
    pkcs11ConfigField.setText(Settings.getProperty("davmail.ssl.pkcs11Config"));
    pkcs11ConfigField.setBorder(pkcs11LibraryField.getBorder());
    pkcs11ConfigField.setFont(pkcs11LibraryField.getFont());

    JPanel clientKeystoreTypePanel = new JPanel(new GridLayout(1, 2));
    addSettingComponent(clientKeystoreTypePanel, BundleMessage.format("UI_CLIENT_KEY_STORE_TYPE"),
            clientKeystoreTypeCombo, BundleMessage.format("UI_CLIENT_KEY_STORE_TYPE_HELP"));
    clientKeystorePanel.add(clientKeystoreTypePanel);

    final JPanel cardPanel = new JPanel(new CardLayout());
    clientKeystorePanel.add(cardPanel);

    JPanel clientKeystoreFilePanel = new JPanel(new GridLayout(2, 2));
    addSettingComponent(clientKeystoreFilePanel, BundleMessage.format("UI_CLIENT_KEY_STORE"),
            clientKeystoreFileField, BundleMessage.format("UI_CLIENT_KEY_STORE_HELP"));
    addSettingComponent(clientKeystoreFilePanel, BundleMessage.format("UI_CLIENT_KEY_STORE_PASSWORD"),
            clientKeystorePassField, BundleMessage.format("UI_CLIENT_KEY_STORE_PASSWORD_HELP"));
    cardPanel.add(clientKeystoreFilePanel, "FILE");

    JPanel pkcs11Panel = new JPanel(new GridLayout(2, 2));
    addSettingComponent(pkcs11Panel, BundleMessage.format("UI_PKCS11_LIBRARY"), pkcs11LibraryField,
            BundleMessage.format("UI_PKCS11_LIBRARY_HELP"));
    addSettingComponent(pkcs11Panel, BundleMessage.format("UI_PKCS11_CONFIG"), pkcs11ConfigField,
            BundleMessage.format("UI_PKCS11_CONFIG_HELP"));
    cardPanel.add(pkcs11Panel, "PKCS11");

    ((CardLayout) cardPanel.getLayout()).show(cardPanel, (String) clientKeystoreTypeCombo.getSelectedItem());

    clientKeystoreTypeCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            CardLayout cardLayout = (CardLayout) (cardPanel.getLayout());
            if ("PKCS11".equals(event.getItem())) {
                cardLayout.show(cardPanel, "PKCS11");
            } else {
                cardLayout.show(cardPanel, "FILE");
            }
        }
    });
    updateMaximumSize(clientKeystorePanel);
    return clientKeystorePanel;
}

From source file:Gui.MainGuiBuilder.java

public void logout() {

    CardLayout card = (CardLayout) MainJpanel.getLayout();
    card.show(MainJpanel, "loginPanel");
}

From source file:org.tinymediamanager.ui.tvshows.TvShowPanel.java

/**
 * Instantiates a new tv show panel.//from w w w  .j ava2 s.c o  m
 */
public TvShowPanel() {
    super();

    treeModel = new TvShowTreeModel(tvShowList.getTvShows());
    tvShowSeasonSelectionModel = new TvShowSeasonSelectionModel();
    tvShowEpisodeSelectionModel = new TvShowEpisodeSelectionModel();

    // build menu
    menu = new JMenu(BUNDLE.getString("tmm.tvshows")); //$NON-NLS-1$
    JFrame mainFrame = MainWindow.getFrame();
    JMenuBar menuBar = mainFrame.getJMenuBar();
    menuBar.add(menu);

    setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("850px:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), }));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setContinuousLayout(true);
    add(splitPane, "2, 2, fill, fill");

    JPanel panelTvShowTree = new JPanel();
    splitPane.setLeftComponent(panelTvShowTree);
    panelTvShowTree.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("3px:grow"), FormFactory.RELATED_GAP_ROWSPEC,
                    FormFactory.DEFAULT_ROWSPEC, }));

    textField = EnhancedTextField.createSearchTextField();
    panelTvShowTree.add(textField, "4, 1, right, bottom");
    textField.setColumns(12);
    textField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(final DocumentEvent e) {
            applyFilter();
        }

        @Override
        public void removeUpdate(final DocumentEvent e) {
            applyFilter();
        }

        @Override
        public void changedUpdate(final DocumentEvent e) {
            applyFilter();
        }

        public void applyFilter() {
            TvShowTreeModel filteredModel = (TvShowTreeModel) tree.getModel();
            if (StringUtils.isNotBlank(textField.getText())) {
                filteredModel.setFilter(SearchOptions.TEXT, textField.getText());
            } else {
                filteredModel.removeFilter(SearchOptions.TEXT);
            }

            filteredModel.filter(tree);
        }
    });

    final JToggleButton btnFilter = new JToggleButton(IconManager.FILTER);
    btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$
    panelTvShowTree.add(btnFilter, "6, 1, default, bottom");

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    panelTvShowTree.add(scrollPane, "2, 3, 5, 1, fill, fill");

    JToolBar toolBar = new JToolBar();
    toolBar.setRollover(true);
    toolBar.setFloatable(false);
    toolBar.setOpaque(false);
    panelTvShowTree.add(toolBar, "2, 1");

    // toolBar.add(actionUpdateDatasources);
    final JSplitButton buttonUpdateDatasource = new JSplitButton(IconManager.REFRESH);
    // temp fix for size of the button
    buttonUpdateDatasource.setText("   ");
    buttonUpdateDatasource.setHorizontalAlignment(JButton.LEFT);
    // buttonScrape.setMargin(new Insets(2, 2, 2, 24));
    buttonUpdateDatasource.setSplitWidth(18);
    buttonUpdateDatasource.setToolTipText(BUNDLE.getString("update.datasource")); //$NON-NLS-1$
    buttonUpdateDatasource.addSplitButtonActionListener(new SplitButtonActionListener() {
        public void buttonClicked(ActionEvent e) {
            actionUpdateDatasources.actionPerformed(e);
        }

        public void splitButtonClicked(ActionEvent e) {
            // build the popupmenu on the fly
            buttonUpdateDatasource.getPopupMenu().removeAll();
            buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateDatasources2));
            buttonUpdateDatasource.getPopupMenu().addSeparator();
            for (String ds : TvShowModuleManager.SETTINGS.getTvShowDataSource()) {
                buttonUpdateDatasource.getPopupMenu()
                        .add(new JMenuItem(new TvShowUpdateSingleDatasourceAction(ds)));
            }
            buttonUpdateDatasource.getPopupMenu().addSeparator();
            buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateTvShow));
            buttonUpdateDatasource.getPopupMenu().pack();
        }
    });

    JPopupMenu popup = new JPopupMenu("popup");
    buttonUpdateDatasource.setPopupMenu(popup);
    toolBar.add(buttonUpdateDatasource);

    JSplitButton buttonScrape = new JSplitButton(IconManager.SEARCH);
    // temp fix for size of the button
    buttonScrape.setText("   ");
    buttonScrape.setHorizontalAlignment(JButton.LEFT);
    buttonScrape.setSplitWidth(18);
    buttonScrape.setToolTipText(BUNDLE.getString("tvshow.scrape.selected")); //$NON-NLS-1$

    // register for listener
    buttonScrape.addSplitButtonActionListener(new SplitButtonActionListener() {
        @Override
        public void buttonClicked(ActionEvent e) {
            actionScrape.actionPerformed(e);
        }

        @Override
        public void splitButtonClicked(ActionEvent e) {
        }
    });

    popup = new JPopupMenu("popup");
    JMenuItem item = new JMenuItem(actionScrape2);
    popup.add(item);
    // item = new JMenuItem(actionScrapeUnscraped);
    // popup.add(item);
    item = new JMenuItem(actionScrapeSelected);
    popup.add(item);
    item = new JMenuItem(actionScrapeNewItems);
    popup.add(item);
    buttonScrape.setPopupMenu(popup);
    toolBar.add(buttonScrape);
    toolBar.add(actionEdit);

    JButton btnMediaInformation = new JButton();
    btnMediaInformation.setAction(actionMediaInformation);
    toolBar.add(btnMediaInformation);

    // install drawing of full with
    tree = new ZebraJTree(treeModel) {
        private static final long serialVersionUID = 2422163883324014637L;

        @Override
        public void paintComponent(Graphics g) {
            width = this.getWidth();
            super.paintComponent(g);
        }
    };
    tvShowSelectionModel = new TvShowSelectionModel(tree);

    TreeUI ui = new TreeUI() {
        @Override
        protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds,
                TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) {
            bounds.width = width - bounds.x;
            super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
        }
    };
    tree.setUI(ui);

    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    tree.setCellRenderer(new TvShowTreeCellRenderer());
    tree.setRowHeight(0);
    scrollPane.setViewportView(tree);

    JPanel panelHeader = new JPanel() {
        private static final long serialVersionUID = -6914183798172482157L;

        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            JTattooUtilities.fillHorGradient(g, AbstractLookAndFeel.getTheme().getColHeaderColors(), 0, 0,
                    getWidth(), getHeight());
        }
    };
    scrollPane.setColumnHeaderView(panelHeader);
    panelHeader.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("center:20px"),
                    ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px") },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, }));

    JLabel lblTvShowsColumn = new JLabel(BUNDLE.getString("metatag.tvshow")); //$NON-NLS-1$
    lblTvShowsColumn.setHorizontalAlignment(JLabel.CENTER);
    panelHeader.add(lblTvShowsColumn, "2, 1");

    JLabel lblNfoColumn = new JLabel("");
    lblNfoColumn.setHorizontalAlignment(JLabel.CENTER);
    lblNfoColumn.setIcon(IconManager.INFO);
    lblNfoColumn.setToolTipText(BUNDLE.getString("metatag.nfo"));//$NON-NLS-1$
    panelHeader.add(lblNfoColumn, "4, 1");

    JLabel lblImageColumn = new JLabel("");
    lblImageColumn.setHorizontalAlignment(JLabel.CENTER);
    lblImageColumn.setIcon(IconManager.IMAGE);
    lblImageColumn.setToolTipText(BUNDLE.getString("metatag.images"));//$NON-NLS-1$
    panelHeader.add(lblImageColumn, "5, 1");

    JLabel lblSubtitleColumn = new JLabel("");
    lblSubtitleColumn.setHorizontalAlignment(JLabel.CENTER);
    lblSubtitleColumn.setIcon(IconManager.SUBTITLE);
    lblSubtitleColumn.setToolTipText(BUNDLE.getString("metatag.subtitles"));//$NON-NLS-1$
    panelHeader.add(lblSubtitleColumn, "6, 1");

    JPanel panel = new JPanel();
    panelTvShowTree.add(panel, "2, 5, 3, 1, fill, fill");
    panel.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC,
                    FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, },
            new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, }));

    JLabel lblTvShowsT = new JLabel(BUNDLE.getString("metatag.tvshows") + ":"); //$NON-NLS-1$
    panel.add(lblTvShowsT, "1, 2, fill, fill");

    lblTvShows = new JLabel("");
    panel.add(lblTvShows, "3, 2");

    JLabel labelSlash = new JLabel("/");
    panel.add(labelSlash, "5, 2");

    JLabel lblEpisodesT = new JLabel(BUNDLE.getString("metatag.episodes") + ":"); //$NON-NLS-1$
    panel.add(lblEpisodesT, "7, 2");

    lblEpisodes = new JLabel("");
    panel.add(lblEpisodes, "9, 2");

    JLayeredPane layeredPaneRight = new JLayeredPane();
    layeredPaneRight.setLayout(
            new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default"), ColumnSpec.decode("default:grow") },
                    new RowSpec[] { RowSpec.decode("default"), RowSpec.decode("default:grow") }));
    panelRight = new JPanel();
    layeredPaneRight.add(panelRight, "1, 1, 2, 2, fill, fill");
    layeredPaneRight.setLayer(panelRight, 0);

    // glass pane
    final TvShowExtendedSearchPanel panelExtendedSearch = new TvShowExtendedSearchPanel(treeModel, tree);
    panelExtendedSearch.setVisible(false);
    // panelMovieList.add(panelExtendedSearch, "2, 5, 2, 1, fill, fill");
    btnFilter.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (panelExtendedSearch.isVisible() == true) {
                panelExtendedSearch.setVisible(false);
            } else {
                panelExtendedSearch.setVisible(true);
            }
        }
    });
    // add a propertychangelistener which reacts on setting a filter
    tree.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if ("filterChanged".equals(evt.getPropertyName())) {
                if (Boolean.TRUE.equals(evt.getNewValue())) {
                    btnFilter.setIcon(IconManager.FILTER_ACTIVE);
                    btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options.active")); //$NON-NLS-1$
                } else {
                    btnFilter.setIcon(IconManager.FILTER);
                    btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$
                }
            }
        }
    });
    layeredPaneRight.add(panelExtendedSearch, "1, 1, fill, fill");
    layeredPaneRight.setLayer(panelExtendedSearch, 1);

    splitPane.setRightComponent(layeredPaneRight);
    panelRight.setLayout(new CardLayout(0, 0));

    JPanel panelTvShow = new TvShowInformationPanel(tvShowSelectionModel);
    panelRight.add(panelTvShow, "tvShow");

    JPanel panelTvShowSeason = new TvShowSeasonInformationPanel(tvShowSeasonSelectionModel);
    panelRight.add(panelTvShowSeason, "tvShowSeason");

    JPanel panelTvShowEpisode = new TvShowEpisodeInformationPanel(tvShowEpisodeSelectionModel);
    panelRight.add(panelTvShowEpisode, "tvShowEpisode");

    tree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            if (node != null) {
                // click on a tv show
                if (node.getUserObject() instanceof TvShow) {
                    TvShow tvShow = (TvShow) node.getUserObject();
                    tvShowSelectionModel.setSelectedTvShow(tvShow);
                    CardLayout cl = (CardLayout) (panelRight.getLayout());
                    cl.show(panelRight, "tvShow");
                }

                // click on a season
                if (node.getUserObject() instanceof TvShowSeason) {
                    TvShowSeason tvShowSeason = (TvShowSeason) node.getUserObject();
                    tvShowSeasonSelectionModel.setSelectedTvShowSeason(tvShowSeason);
                    CardLayout cl = (CardLayout) (panelRight.getLayout());
                    cl.show(panelRight, "tvShowSeason");
                }

                // click on an episode
                if (node.getUserObject() instanceof TvShowEpisode) {
                    TvShowEpisode tvShowEpisode = (TvShowEpisode) node.getUserObject();
                    tvShowEpisodeSelectionModel.setSelectedTvShowEpisode(tvShowEpisode);
                    CardLayout cl = (CardLayout) (panelRight.getLayout());
                    cl.show(panelRight, "tvShowEpisode");
                }
            } else {
                // check if there is at least one tv show in the model
                TvShowRootTreeNode root = (TvShowRootTreeNode) tree.getModel().getRoot();
                if (root.getChildCount() == 0) {
                    // sets an inital show
                    tvShowSelectionModel.setSelectedTvShow(null);
                }
            }
        }
    });

    addComponentListener(new ComponentAdapter() {
        @Override
        public void componentHidden(ComponentEvent e) {
            menu.setVisible(false);
            super.componentHidden(e);
        }

        @Override
        public void componentShown(ComponentEvent e) {
            menu.setVisible(true);
            super.componentHidden(e);
        }
    });

    // further initializations
    init();
    initDataBindings();

    // selecting first TV show at startup
    if (tvShowList.getTvShows() != null && tvShowList.getTvShows().size() > 0) {
        DefaultMutableTreeNode firstLeaf = (DefaultMutableTreeNode) ((DefaultMutableTreeNode) tree.getModel()
                .getRoot()).getFirstChild();
        tree.setSelectionPath(new TreePath(((DefaultMutableTreeNode) firstLeaf.getParent()).getPath()));
        tree.setSelectionPath(new TreePath(firstLeaf.getPath()));
    }
}

From source file:Gui.MainGuiBuilder.java

private void LoginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoginButtonActionPerformed
    // TODO add your handling code here:
    //check empty login

    if (loginText.getText().equals("")) {
        loginText.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
        msqLabel.setVisible(true);/*from w w  w  .  ja  va2  s.c o m*/
        msqLabel.setText("Merci de verifer les champs !");

    } else {
        loginText.setBorder(BorderFactory.createLineBorder(Color.GREEN, 2));
        msqLabel.setVisible(false);
    }
    // check pass
    if (passwordText.getText().equals("")) {
        passwordText.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
        msqLabel.setVisible(true);
        msqLabel.setText("Merci de verifer les champs !");
        return;
    } else {
        passwordText.setBorder(BorderFactory.createLineBorder(Color.GREEN, 2));
        msqLabel.setVisible(false);
    }

    // go for login 
    appUser = uService.loginByMail(loginText.getText(), passwordText.getText());
    //appUser = uService.loginByMail("Admin@admin.com", "1234");
    if (appUser != null) {
        CardLayout card = (CardLayout) MainJpanel.getLayout();
        card.show(MainJpanel, "containerPanel");
        tabContainer.setSelectedIndex(0);
        // 0 : offre 
        // 1 : stats
        // 2 : newletter 
        // 3 : gestion user 
        // 4  :mon compte 

        tabContainer.setEnabledAt(0, true);
        tabContainer.setEnabledAt(4, true);

        if (appUser.getUserType().equals("Admin")) {
            tabContainer.setEnabledAt(1, true);
            tabContainer.setEnabledAt(2, true);
            tabContainer.setEnabledAt(3, true);

        } else if (appUser.getUserType().equals("User")) {
            tabContainer.setEnabledAt(1, false);
            tabContainer.setEnabledAt(2, false);
            tabContainer.setEnabledAt(3, false);
        }

        welcomeWagon.setVisible(true);
        welcomeWagon.setText("Bonjour " + appUser.getNom());
    } else {
        loginText.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
        passwordText.setBorder(BorderFactory.createLineBorder(Color.RED, 2));
        msqLabel.setVisible(true);
        msqLabel.setText("Authentification choue !");
    }
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void chooseDateRange() {
    CardLayout layout = (CardLayout) cards.getLayout();
    if (date_chooser_visible) {
        layout.show(cards, HIDE_DATE_CHOOSER);
        date_chooser_visible = false;/*from w w w . j  av a 2 s .  com*/
        customToggleButton.setSelected(true);
        searchRecords();
    } else {
        layout.show(cards, SHOW_DATE_CHOOSER);
        date_chooser_visible = true;
    }
}

From source file:uk.chromis.pos.forms.JRootApp.java

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

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

/**
 * /*from w w w  . j a v a 2  s  . co  m*/
 */
private void clearPanels() {
    CardLayout cardLayout = (CardLayout) (infoCards.getLayout());
    cardLayout.show(infoCards, Collection.class.getCanonicalName());
}

From source file:interpolation.InteractiveRegression.java

public void Card() {

    CardLayout cl = new CardLayout();

    panelCont.setLayout(cl);//from   w ww . j a va  2s. com

    panelCont.add(panelFirst, "1");
    panelCont.add(panelSecond, "2");

    panelFirst.setName("Regression Polynomial Fits");

    /* Instantiation */
    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints c = new GridBagConstraints();

    final Scrollbar degreeSB = new Scrollbar(Scrollbar.HORIZONTAL, this.degreeInt, 1, MIN_SLIDER,
            MAX_SLIDER + 1);

    final Label degreeLabel = new Label("Degree of polynomial = " + this.degree, Label.CENTER);

    // Location
    panelFirst.setLayout(layout);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;

    ++c.gridy;
    c.insets = new Insets(30, 150, 0, 150);
    panelFirst.add(degreeSB, c);

    ++c.gridy;
    c.insets = new Insets(30, 150, 0, 150);
    panelFirst.add(degreeLabel, c);

    degreeSB.addAdjustmentListener(new DegreeListener(this, degreeLabel, degreeSB));

    panelFirst.setVisible(true);
    cl.show(panelCont, "1");
    Cardframe.add(panelCont, BorderLayout.CENTER);

    Cardframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Cardframe.pack();
    Cardframe.setVisible(true);
    updateRegression();
}