List of usage examples for java.awt CardLayout CardLayout
public CardLayout()
From source file:org.zaproxy.zap.view.ContextTechnologyPanel.java
/** * This method initializes this//from w w w . jav a 2 s . c om * * @return void */ private void initialize() { this.setLayout(new CardLayout()); this.setName(getPanelName(getContextIndex())); this.add(getPanelSession(), getPanelSession().getName()); }
From source file:edu.ku.brc.af.ui.forms.MenuSwitcherPanel.java
/** * @param mvParentArg//from w ww . j a v a2s. co m * @param viewArg * @param altViewArg * @param altViewsListArg */ public MenuSwitcherPanel(final MultiView mvParent, final AltViewIFace altView, final Vector<AltViewIFace> altViewsList) { super(); setOpaque(false); switcherHash = new Hashtable<String, DropDownButtonStateful>(); selectorValHash = new Hashtable<String, Vector<AltViewIFace>>(); isSelector = StringUtils.isNotEmpty(altView.getSelectorName()); if (isSelector) { setLayout(cardLayout = new CardLayout()); for (AltViewIFace av : altViewsList) { Vector<AltViewIFace> avList = selectorValHash.get(av.getSelectorValue()); if (avList == null) { avList = new Vector<AltViewIFace>(); selectorValHash.put(av.getSelectorValue(), avList); } avList.add(av); } for (String selectorVal : selectorValHash.keySet()) { Vector<AltViewIFace> avList = selectorValHash.get(selectorVal); DropDownButtonStateful switcherUI = createSwitcher(mvParent, avList); switcherUI.setOpaque(false); add(switcherUI, selectorVal); switcherHash.put(selectorVal, switcherUI); } } else { setLayout(new BorderLayout()); DropDownButtonStateful switcherUI = createSwitcher(mvParent, altViewsList); switcherUI.setOpaque(false); add(switcherUI, BorderLayout.CENTER); switcherHash.put("0", switcherUI); selectorValHash.put("0", altViewsList); } }
From source file:com.polivoto.vistas.AnalistaLocal.java
/** * Creates new form AnalistaD/* ww w .j av a 2 s .c o m*/ * * @param accionesConsultor */ public AnalistaLocal(AccionesConsultor accionesConsultor) { this.accionesConsultor = accionesConsultor; initComponents(); cardsPreguntas = new CardLayout(); panelPreguntas.setLayout(cardsPreguntas); setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); panelVotando.setVisible(true); Panel3.setVisible(false); try { String startupDataString = this.accionesConsultor.consultaParametrosIniciales(); json = new JSONObject(startupDataString); this.accionesConsultor.consultaPreguntas(); long tFinal = json.getLong("tiempo_final"); cronometro = new Cronometro(lblhrs, lblmin, lblseg, tFinal); cronometro.iniciarCronometro(); System.out.println("Startup data: " + startupDataString); escuchar = new RecibirVotos(); poblacion = json.getInt("poblacion"); votos = json.getInt("votos"); System.out.println("" + json.toString()); } catch (IOException | JSONException ignore) { ignore.printStackTrace(); } // Obtener el nombre de la zona panelMain.setLayout(cardLayout); panelMain.add(Panel1, "1"); panelMain.add(Panel2, "2"); panelMain.add(Panel3, "3"); cardLayout.show(panelMain, "1"); System.out.println("Startup dada: " + json.toString()); escuchar.iniciarEscucha(votos, poblacion, lblvotos_totales, lblporcentaje, pnlgrafica); Service service = new Service(); service.start(); setPreguntasText(); timerPaneles = new Timer(6000, new PanelesPreguntas()); timerPaneles.start(); }
From source file:org.ut.biolab.medsavant.client.view.list.MasterView.java
public MasterView(String page, DetailedListModel model, DetailedView view, DetailedListEditor editor) { pageName = page;/*from w ww . ja va 2 s . co m*/ detailedModel = model; detailedView = view; detailedEditor = editor; setLayout(new CardLayout()); WaitPanel wp = new WaitPanel("Getting list"); wp.setBackground(ViewUtil.getTertiaryMenuColor()); add(wp, CARD_WAIT); showCard = new JPanel(); add(showCard, CARD_SHOW); JPanel errorPanel = new JPanel(); errorPanel.setLayout(new BorderLayout()); errorMessage = new JLabel("An error occurred:"); errorPanel.add(errorMessage, BorderLayout.NORTH); add(errorPanel, CARD_ERROR); buttonPanel = ViewUtil.getClearPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = GridBagConstraints.RELATIVE; gbc.gridy = 0; gbc.insets = new Insets(3, 3, 3, 3); if (detailedEditor.doesImplementAdding()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.ADD_ON_TOOLBAR)); butt.setToolTipText("Add"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.addItems(); // In some cases, such as uploading/publishing variants, the addItems() method may have logged us out. if (LoginController.getInstance().isLoggedIn()) { refreshList(); } } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementImporting()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.IMPORT)); butt.setToolTipText("Import"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.importItems(); refreshList(); } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementExporting()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPORT)); butt.setToolTipText("Export"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.exportItems(); refreshList(); } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementDeleting()) { JLabel butt = ViewUtil.createIconButton( IconFactory.getInstance().getIcon(IconFactory.StandardIcon.REMOVE_ON_TOOLBAR)); butt.setToolTipText("Remove selected"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.deleteItems(selectionGrabber.getSelectedItems()); // In some cases, such as removing/publishing variants, the deleteItems() method may have logged us out. if (LoginController.getInstance().isLoggedIn()) { refreshList(); } } }); buttonPanel.add(butt, gbc); } if (detailedEditor.doesImplementEditing()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EDIT)); butt.setToolTipText("Edit selected"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (selectionGrabber.getSelectedItems().size() > 0) { detailedEditor.editItem(selectionGrabber.getSelectedItems().get(0)); refreshList(); } else { DialogUtils.displayMessage("Please choose one item to edit."); } } }); buttonPanel.add(butt, gbc); } // Only for SavedFiltersPanel if (detailedEditor.doesImplementLoading()) { JLabel butt = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LOAD_ON_TOOLBAR)); butt.setToolTipText("Load selected"); butt.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { detailedEditor.loadItems(selectionGrabber.getSelectedItems()); } }); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.anchor = GridBagConstraints.EAST; buttonPanel.add(butt, gbc); } showWaitCard(); fetchList(); }
From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.table.JPanCMTableArea.java
private void initialize() { layout = new CardLayout(); this.setLayout(layout); this.add(getJScrollPaneFileTable(), FILE_TABLE_LAYER); this.add(getJScrollPaneFolderTable(), FOLDER_TABLE_LAYER); this.add(getJScrollPaneMultipleFileTable(), MULTIPLE_FILE_TABLE_LAYER); }
From source file:interpolation.InteractiveRegression.java
public void Card() { CardLayout cl = new CardLayout(); panelCont.setLayout(cl);//from www .ja v a 2 s . co m 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(); }
From source file:org.codinjutsu.tools.mongo.view.QueryPanel.java
public QueryPanel(Project project) { this.project = project; setLayout(new BorderLayout()); add(mainPanel);/*from ww w .j av a2 s .c o m*/ queryCardLayout = new CardLayout(); queryContainerPanel.setLayout(queryCardLayout); filterPanel = createFilterPanel(); queryContainerPanel.add(filterPanel, FILTER_PANEL); aggregationPanel = createAggregationPanel(); queryContainerPanel.add(aggregationPanel, AGGREGATION_PANEL); toggleToFind(); Disposer.register(project, this); }
From source file:com.frostwire.gui.components.slides.MultimediaSlideshowPanel.java
private void setupUI() { layout = new CardLayout(); setLayout(layout); }
From source file:ui.frame.KAIQRFrame.java
public KAIQRFrame() { // init frames super("KAI QR Code Generator"); mouseDownCompCoords = null;/*w w w. ja v a2 s .c o m*/ addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) { mouseDownCompCoords = null; } public void mousePressed(MouseEvent e) { mouseDownCompCoords = e.getPoint(); } public void mouseExited(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } }); addMouseMotionListener(new MouseMotionListener() { public void mouseMoved(MouseEvent e) { } public void mouseDragged(MouseEvent e) { Point currCoords = e.getLocationOnScreen(); setLocation(currCoords.x - mouseDownCompCoords.x, currCoords.y - mouseDownCompCoords.y); } }); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); menuPanel = p.createPanel(Layouts.grid, 5, 1); btnLogOut = b.createButton("Logout"); btnLogOut.setPreferredSize(new Dimension(100, 50)); btnLogOut.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { APICall api = new APICall(); try { JSONObject response = new JSONObject(api.logout(Data.targetURL, Data.sessionKey)); if (response.getString("result").equals("ok")) { UILogin login = new UILogin(); Data.mainFrame.setVisible(false); } } catch (JSONException e1) { e1.printStackTrace(); } } }); menuPanel.add(btnLogOut); cardPanel = p.createPanel(Layouts.card); cardLayout = new CardLayout(); cardPanel.setLayout(cardLayout); getContentPane().setBackground(CustomColor.NavyBlue.returnColor()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); setLocationRelativeTo(null); add(menuPanel, BorderLayout.WEST); add(cardPanel, BorderLayout.CENTER); pack(); }
From source file:savant.plugin.Tool.java
@Override public void init(JPanel panel) { mainPanel = panel;/* w ww .java 2s . c o m*/ panel.setLayout(new CardLayout()); JPanel settingsPanel = new ToolSettingsPanel(this); panel.add(new JScrollPane(settingsPanel), "Settings"); JPanel waitCard = new JPanel(); waitCard.setLayout(new GridBagLayout()); // Left side filler. GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(5, 100, 0, 100); waitCard.add(new JLabel(getDescriptor().getName()), gbc); progressBar = new JProgressBar(); progressBar.setPreferredSize(new Dimension(240, progressBar.getPreferredSize().height)); waitCard.add(progressBar, gbc); progressInfo = new JLabel(); progressInfo.setAlignmentX(1.0f); Font f = progressInfo.getFont(); f = f.deriveFont(f.getSize() - 2.0f); progressInfo.setFont(f); waitCard.add(progressInfo, gbc); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (toolProc != null) { Process p = toolProc; toolProc = null; p.destroy(); } showCard("Settings"); } }); gbc.fill = GridBagConstraints.NONE; waitCard.add(cancelButton, gbc); // Console output at the bottom. console = new JTextArea(); console.setFont(f); console.setLineWrap(false); console.setEditable(false); JScrollPane consolePane = new JScrollPane(console); consolePane.setPreferredSize(new Dimension(800, 200)); gbc.weighty = 1.0; gbc.insets = new Insets(30, 5, 5, 5); gbc.fill = GridBagConstraints.BOTH; waitCard.add(consolePane, gbc); panel.add(waitCard, "Progress"); }