List of usage examples for java.awt CardLayout CardLayout
public CardLayout()
From source file:op.care.med.structure.PnlMed.java
/** * This method is called from within the constructor to * initialize the form.//from w w w . j a v a2 s .c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new JScrollPane(); treeMed = new JTree(); panel1 = new JPanel(); label1 = new JLabel(); //======== this ======== setLayout(new CardLayout()); //======== jScrollPane1 ======== { //---- treeMed ---- treeMed.setFont(new Font("Arial", Font.PLAIN, 14)); treeMed.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { treeMedMousePressed(e); } }); jScrollPane1.setViewportView(treeMed); } add(jScrollPane1, "card1"); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); //---- label1 ---- label1.setText("text"); label1.setIcon(null); panel1.add(label1); } add(panel1, "card2"); }
From source file:org.kepler.gui.ViewManager.java
/** * Instantiate all of the ViewPanes that are specified in configuration.xml * //from www .j ava 2 s . c om * @param parent */ public void initializeViews(TableauFrame parent) { try { ViewPaneFactory VPfactory = (ViewPaneFactory) parent.getConfiguration().getAttribute("ViewPaneFactory"); if (VPfactory == null) { VPfactory = new ViewPaneFactory(parent.getConfiguration(), "ViewPaneFactory"); } if (VPfactory != null) { boolean success = VPfactory.createViewPanes(parent); if (!success) { System.out.println("error: ViewPane is null. " + "This " + "problem can be fixed by adding a viewPaneFactory " + "property in the configuration.xml file."); } } else { System.out.println( "error: ViewPane is " + "null. This " + "problem can be fixed by adding a viewPaneFactory " + "property in the configuration.xml file."); } } catch (ptolemy.kernel.util.NameDuplicationException nde) { } catch (Exception e) { System.out.println("Could not create the ViewPaneFactory: " + e.getMessage()); e.printStackTrace(); return; } // Create the view area and add all the viewpanes to it JPanel viewArea = new JPanel(new CardLayout()); Vector<ViewPane> frameViews = getFrameViews(parent); String[] viewsList = new String[frameViews.size()]; for (int i = 0; i < frameViews.size(); i++) { ViewPane vp = frameViews.elementAt(i); viewArea.add((Component) vp, vp.getViewName()); viewsList[i] = vp.getViewName(); if (isDebugging) log.debug("add one element to viewsList:" + viewsList[i]); } try { addConfiguredTabPanes(parent); } catch (Exception e) { e.printStackTrace(); } // while( e. hasMoreElements() ){ // TableauFrame tableFrame = (TableauFrame)(e.nextElement()); // System.out.println("getContainer in _viewAreas:"+ // tableFrame.getTableau().getContainer()); // System.out.println("isMaster in _viewAreas:"+ // tableFrame.getTableau().isMaster()); // if (tableFrame.getTableau().getContainer()==null && // tableFrame.getTableau().isMaster()) // { // _viewAreas.remove(tableFrame); // System.out.println("one element is in _viewAreas removed"); // _viewComboBoxes.remove(tableFrame); // System.out.println("one element is in _viewComboBoxes removed"); // } // // } _viewAreas.put(parent, viewArea); if (isDebugging) { log.debug("_viewAreas:" + _viewAreas.size()); log.debug("_viewAreas key set:" + _viewAreas.keySet()); } JComboBox viewComboBox = new JComboBox(viewsList); if (viewComboBox != null && viewComboBox.getItemCount() > 0) { viewComboBox.setSelectedIndex(0); viewComboBox.addActionListener(new ViewComboBoxListener()); _viewComboBoxes.put(parent, viewComboBox); if (isDebugging) log.debug("_viewComboBoxes:" + _viewComboBoxes.size()); } }
From source file:pt.lsts.neptus.console.plugins.planning.VerticalFormationWizard.java
/** * @param console// w w w. j a v a2 s .com */ public VerticalFormationWizard(ConsoleLayout console) { super(console); setLayout(new BorderLayout()); btnAdvance = new JButton(I18n.text("Next")); btnBack = new JButton(I18n.text("Previous")); btnCancel = new JButton(I18n.text("Cancel")); btnAdvance.addActionListener(this::advance); btnBack.addActionListener(this::back); btnCancel.addActionListener(this::cancel); JPanel btns = new JPanel(new BorderLayout()); JPanel flow1 = new JPanel(new FlowLayout()); flow1.add(btnBack); JPanel flow2 = new JPanel(new FlowLayout()); flow2.add(btnCancel); flow2.add(btnAdvance); btns.add(flow1, BorderLayout.WEST); btns.add(flow2, BorderLayout.EAST); add(btns, BorderLayout.SOUTH); lblTop.setPreferredSize(new Dimension(60, 60)); lblTop.setMinimumSize(lblTop.getPreferredSize()); lblTop.setOpaque(true); lblTop.setBackground(Color.white); lblTop.setFont(new Font("Helvetica", Font.BOLD, 18)); add(lblTop, BorderLayout.NORTH); planSelection = new PlanSelectionPage(console.getMission(), false); vehicleSelection = new VehicleSelectionPage(new ArrayList<VehicleType>(), true); pages.add(planSelection); pages.add(vehicleSelection); pages.add(options); main = new JPanel(new CardLayout()); pages.forEach(p -> main.add(p, p.getTitle())); add(main, BorderLayout.CENTER); lblTop.setText(pages.get(0).getTitle()); }
From source file:org.zeromeaner.gui.reskin.StandaloneFrame.java
public StandaloneFrame() { setTitle("zeromeaner " + Version.getBuildVersion()); if (!Version.getBuildRevision().isEmpty()) setTitle(getTitle() + " rev " + Version.getBuildRevision()); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLayout(new BorderLayout()); add(toolbar = createToolbar(), BorderLayout.EAST); add(content = new JPanel(contentCards = new CardLayout()), BorderLayout.CENTER); netLobby = new KNetPanel(Session.getUser(), false); netLobby.setPreferredSize(new Dimension(800, 250)); netLobby.addKNetPanelListener(new KNetPanelAdapter() { @Override//ww w .ja va 2s. c o m public void knetPanelShutdown(KNetPanelEvent e) { content.remove(netLobby); content.revalidate(); content.repaint(); } @Override public void knetPanelJoined(KNetPanelEvent e) { if (e.getChannel().getId() != KNetChannelInfo.LOBBY_CHANNEL_ID && e.getSource().getClient().getCurrentChannel() != null) { startNewGame(e.getChannel().getRule().resourceName, null, e.getChannel().getMode(), e); gamePanel.displayWindow(); } } @Override public void knetPanelParted(KNetPanelEvent e) { gamePanel.shutdown(); try { gamePanel.shutdownWait(); } catch (InterruptedException ex) { } } }); gamePanel = new StandaloneGamePanel(this); createCards(); setMinimumSize(new Dimension(900, 550)); }
From source file:de.huxhorn.lilith.swing.preferences.PreferencesDialog.java
private void createUI() { generalPanel = new GeneralPanel(this); startupShutdownPanel = new StartupShutdownPanel(this); windowsPanel = new WindowsPanel(this); soundsPanel = new SoundsPanel(this); sourcesPanel = new SourcesPanel(this); sourceListsPanel = new SourceListsPanel(this); sourceFilteringPanel = new SourceFilteringPanel(this); conditionsPanel = new ConditionsPanel(this); loggingLevelPanel = new LoggingLevelPanel(this); accessStatusTypePanel = new AccessStatusTypePanel(this); TroubleshootingPanel troubleshootingPanel = new TroubleshootingPanel(this); comboBoxModel = new DefaultComboBoxModel<>(); for (Panes current : Panes.values()) { comboBoxModel.addElement(current); }/*from w w w . ja v a2s.c o m*/ comboBox = new JComboBox<>(comboBoxModel); comboBox.setRenderer(new MyComboBoxRenderer()); comboBox.setEditable(false); comboBox.addItemListener(new ComboItemListener()); cardLayout = new CardLayout(); content = new JPanel(cardLayout); content.setPreferredSize(new Dimension(600, 500)); content.add(generalPanel, Panes.General.toString()); content.add(startupShutdownPanel, Panes.StartupShutdown.toString()); content.add(windowsPanel, Panes.Windows.toString()); content.add(soundsPanel, Panes.Sounds.toString()); content.add(sourcesPanel, Panes.Sources.toString()); content.add(sourceListsPanel, Panes.SourceLists.toString()); content.add(sourceFilteringPanel, Panes.SourceFiltering.toString()); content.add(conditionsPanel, Panes.Conditions.toString()); content.add(loggingLevelPanel, Panes.LoggingLevels.toString()); content.add(accessStatusTypePanel, Panes.AccessStatus.toString()); content.add(troubleshootingPanel, Panes.Troubleshooting.toString()); // Main buttons JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); OkAction okAction = new OkAction(); buttonPanel.add(new JButton(okAction)); buttonPanel.add(new JButton(new ApplyAction())); buttonPanel.add(new JButton(new ResetAction())); CancelAction cancelAction = new CancelAction(); buttonPanel.add(new JButton(cancelAction)); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(comboBox, BorderLayout.NORTH); contentPane.add(content, BorderLayout.CENTER); contentPane.add(buttonPanel, BorderLayout.SOUTH); KeyStrokes.registerCommand(content, okAction, "OK_ACTION"); KeyStrokes.registerCommand(buttonPanel, okAction, "OK_ACTION"); KeyStrokes.registerCommand(content, cancelAction, "CANCEL_ACTION"); KeyStrokes.registerCommand(buttonPanel, cancelAction, "CANCEL_ACTION"); }
From source file:org.n52.ifgicopter.spf.gui.FrameworkCorePanel.java
/** * default constructor to create the framework core panel. *///from ww w. ja v a 2 s .co m public FrameworkCorePanel() { /* * INPUT PLUGIN LIST */ this.pluginsPanel = new JPanel(); this.pluginsPanel.setLayout(new GridBagLayout()); this.pluginsPanel.setBackground(DEFAULT_COLOR); this.globalGBC = new GridBagConstraints(); this.globalGBC.gridx = 0; this.globalGBC.gridy = 0; this.globalGBC.weightx = 0.0; this.globalGBC.weighty = 0.0; this.globalGBC.anchor = GridBagConstraints.NORTHWEST; this.globalGBC.fill = GridBagConstraints.HORIZONTAL; this.pluginsPanel.add( new JLabel("<html><body><div><strong>" + "Active Plugins</strong></div></body></html>"), this.globalGBC); this.globalGBC.gridy++; this.globalGBC.gridwidth = GridBagConstraints.REMAINDER; this.globalGBC.insets = new Insets(0, 0, 5, 0); this.pluginsPanel.add(new JSeparator(), this.globalGBC); this.globalGBC.insets = new Insets(0, 0, 0, 0); this.globalGBC.weightx = 1.0; this.globalGBC.gridy = 0; this.globalGBC.gridx = 1; this.pluginsPanel.add(Box.createHorizontalGlue(), this.globalGBC); this.globalGBC.weightx = 0.0; this.globalGBC.gridx = 0; this.globalGBC.gridy = 1; /* * the contentpanel */ this.contentPanel = new JPanel(); this.contentPanel.setLayout(new CardLayout()); this.contentPanel.setBorder(BorderFactory.createEtchedBorder()); this.contentPanel.add(WelcomePanel.getInstance(), WELCOME_PANEL); // ((CardLayout) contentPanel.getLayout()).show(contentPanel, WELCOME_PANEL); JScrollPane startupS = new JScrollPane(this.contentPanel); startupS.setViewportBorder(null); /* * wrap the plugins to ensure top alignment */ JPanel pluginsPanelWrapper = new JPanel(new BorderLayout()); pluginsPanelWrapper.add(this.pluginsPanel, BorderLayout.NORTH); pluginsPanelWrapper.add(Box.createVerticalGlue(), BorderLayout.CENTER); pluginsPanelWrapper.setBorder(BorderFactory.createEtchedBorder()); pluginsPanelWrapper.setBackground(this.pluginsPanel.getBackground()); JScrollPane wrapperS = new JScrollPane(pluginsPanelWrapper); wrapperS.setViewportBorder(null); /* * add both scroll panes to the split pane */ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, wrapperS, startupS); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); splitPane.setContinuousLayout(true); Dimension minimumSize = new Dimension(100, 100); startupS.setMinimumSize(minimumSize); this.setLayout(new BorderLayout()); this.add(splitPane); }
From source file:savant.plugin.builtin.SAFEBrowser.java
private void init() { this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); this.setResizable(true); this.setLayout(new BorderLayout()); container = new JPanel(); this.add(container, BorderLayout.CENTER); layout = new CardLayout(); container.setLayout(layout);//w ww. j av a 2 s . c om loginCard = new SAFELoginPanel(this); safeCard = new JPanel(); container.add(loginCard, "login"); container.add(safeCard, "safe"); this.setPreferredSize(new Dimension(800, 500)); this.pack(); setLocationRelativeTo(getParent()); }
From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.IntHistogramVisualizer.java
@Override protected JComponent addSettingsPanels(JTabbedPane aPanel) { addTab(aPanel, Messages.DI_GENERAL, new SettingsPanel(general), Messages.TT_GENSETTINGS); addTab(aPanel, Messages.DI_AXES, new SettingsPanel(settings.axes), Messages.TT_AXESSETTINGS); addTab(aPanel, Messages.DI_GRID, new SettingsPanel(settings.grid), Messages.TT_GRIDSETTINGS); boolean useScatter = settings.useScatter(); final Box histPanel = Box.createVerticalBox(); final JComboBox choiceCombo = addChoice(histPanel, useScatter ? 1 : 0); final CardLayout innerLayout = new CardLayout(); final JPanel innerPanel = new JPanel(innerLayout); histPanel.add(innerPanel);/* ww w . j a va2 s. c om*/ aPanel.addTab(Messages.DI_HISTOGRAM, null, histPanel, Messages.TT_HISTSETTINGS); ItemListener listener = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { innerLayout.next(innerPanel); } } }; choiceCombo.addItemListener(listener); innerPanel.add(new SettingsPanel(settings.bars), "0"); innerPanel.add(new SettingsPanel(settings.scatter), "1"); if (useScatter) { innerLayout.next(innerPanel); } return choiceCombo; }
From source file:org.zaproxy.zap.extension.httppanel.HttpPanel.java
private JPanel getPanelContent() { if (panelContent == null) { panelContent = new JPanel(new CardLayout()); }//from www.ja v a 2 s.c om return panelContent; }
From source file:org.zaproxy.zap.extension.bruteforce.BruteForcePanel.java
/** This method initializes this */ @SuppressWarnings("deprecation") private void initialize() { this.setLayout(new CardLayout()); this.setSize(474, 251); this.setName(Constant.messages.getString("bruteforce.panel.title")); this.setIcon(new ImageIcon(BruteForcePanel.class.getResource(ExtensionBruteForce.HAMMER_ICON_RESOURCE))); this.setDefaultAccelerator(KeyStroke.getKeyStroke( // TODO Remove warn suppression and use View.getMenuShortcutKeyStroke with // newer ZAP (or use getMenuShortcutKeyMaskEx() with Java 10+) KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | KeyEvent.ALT_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK, false));/*from ww w. j a v a 2 s . c om*/ this.setMnemonic(Constant.messages.getChar("bruteforce.panel.mnemonic")); this.add(getPanelCommand(), getPanelCommand().getName()); // Wont need to do this if/when this class is changed to extend ScanPanel scanStatus = new ScanStatus( new ImageIcon(BruteForcePanel.class.getResource(ExtensionBruteForce.HAMMER_ICON_RESOURCE)), Constant.messages.getString("bruteforce.panel.title")); if (View.isInitialised()) { View.getSingleton().getMainFrame().getMainFooterPanel() .addFooterToolbarRightLabel(scanStatus.getCountLabel()); } }