List of usage examples for java.awt CardLayout CardLayout
public CardLayout()
From source file:ec.ui.view.StabilityView.java
public StabilityView() { super();//from w w w . ja v a 2 s. com setLayout(new BorderLayout()); this.graphs_ = new LinkedHashMap<>(); meanRenderer = new XYLineAndShapeRenderer(true, false); meanRenderer.setAutoPopulateSeriesPaint(false); meanRenderer.setBasePaint(themeSupport.getLineColor(KnownColor.RED)); pointsRenderer = new XYLineAndShapeRenderer(false, true); pointsRenderer.setAutoPopulateSeriesPaint(false); pointsRenderer.setAutoPopulateSeriesShape(false); pointsRenderer.setBaseShape(new Ellipse2D.Double(-2, -2, 4, 4)); pointsRenderer.setBasePaint(themeSupport.getLineColor(KnownColor.BLUE)); pointsRenderer.setBaseShapesFilled(false); smoothRenderer = new XYLineAndShapeRenderer(true, false); smoothRenderer.setAutoPopulateSeriesPaint(false); smoothRenderer.setBasePaint(themeSupport.getLineColor(KnownColor.GREEN)); mainChart = createChart(); detailChart = createChart(); panel = new JChartPanel(null); errorPanel = new JPanel(new BorderLayout()); errorLabel = new JLabel(); errorLabel.setHorizontalAlignment(SwingConstants.CENTER); errorLabel.setFont(errorLabel.getFont().deriveFont(errorLabel.getFont().getSize2D() * 3 / 2)); errorPanel.add(errorLabel, BorderLayout.CENTER); panel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { indexSelected = -1; if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { double x = panel.getChartX(e.getX()); Graphs g = null; for (Bornes b : graphs_.keySet()) { indexSelected++; if (x >= b.min_ && x <= b.max_) { g = graphs_.get(b); break; } } if (g == null) { return; } showDetail(g); } else if (e.getButton() == MouseEvent.BUTTON3) { showMain(); indexSelected = -1; } } }); StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator() { final DecimalFormat format = new DecimalFormat("0.0000"); @Override public String generateToolTip(XYDataset dataset, int series, int item) { try { StabilityViewItem i = items.get(indexSelected == -1 ? series : indexSelected); int cpt = 0; for (Map.Entry<TsDomain, Double> e : i.data.entrySet()) { if (cpt == item) { TsDomain dom = e.getKey(); return "(" + dom.getStart().toString() + ", " + dom.getEnd().toString() + ") : " + format.format(e.getValue()); } cpt++; } } catch (IndexOutOfBoundsException e) { } return null; } }; pointsRenderer.setBaseToolTipGenerator(generator); cards = new JPanel(new CardLayout()); cards.add(MAIN_PANEL, panel); cards.add(ERROR_PANEL, errorPanel); add(cards, BorderLayout.CENTER); onColorSchemeChange(); }
From source file:it.imtech.configuration.StartWizard.java
/** * Creates a new wizard with active card (Select Language/Server) *///from www . j a va2 s . c o m public StartWizard() { Globals.setGlobalVariables(); ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); if (!checkAppDataFiles()) { JOptionPane.showMessageDialog(null, Utility.getBundleString("copy_appdata", bundle), Utility.getBundleString("copy_appdata_title", bundle), JOptionPane.ERROR_MESSAGE); System.exit(1); } DOMConfigurator.configure(Globals.LOG4J); logger = Logger.getLogger(StartWizard.class); logger.info("Starting Application Phaidra Importer"); mainFrame = new JFrame(); if (Utility.internetConnectionAvailable()) { Globals.ONLINE = true; } it.imtech.utility.Utility.cleanUndoDir(); XMLConfiguration internalConf = setConfiguration(); logger.info("Configuration path estabilished"); XMLConfiguration config = setConfigurationPaths(internalConf, bundle); headerPanel = new HeaderPanel(); footerPanel = new FooterPanel(); JButton nextButton = (JButton) footerPanel.getComponentByName("next_button"); JButton prevButton = (JButton) footerPanel.getComponentByName("prev_button"); nextButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (getCurrentCard() instanceof ChooseServer) { ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); try { mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Server selected = chooseServer.getSelectedServer(); logger.info("Selected Server = " + selected.getServername()); SelectedServer.getInstance(null).makeEmpty(); SelectedServer.getInstance(selected); if (Globals.ONLINE) { logger.info("Testing server connection..."); ChooseServer.testServerConnection(SelectedServer.getInstance(null).getBaseUrl()); } chooseFolder.updateLanguage(); MetaUtility.getInstance().preInitializeData(); logger.info("Preinitialization done (Vocabulary and Languages"); c1.next(cardsPanel); mainFrame.setCursor(null); } catch (Exception ex) { logger.error(ex.getMessage()); JOptionPane.showMessageDialog(new Frame(), Utility.getBundleString("preinitializemetadataex", bundle)); } } else if (getCurrentCard() instanceof ChooseFolder) { mainFrame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); boolean error = chooseFolder.checkFolderSelectionValidity(); if (error == false) { BookImporter x = BookImporter.getInstance(); mainFrame.setCursor(null); mainFrame.setVisible(false); } } } }); prevButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (getCurrentCard() instanceof ChooseServer) { ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); String title = Utility.getBundleString("dialog_1_title", bundle); String text = Utility.getBundleString("dialog_1", bundle); ConfirmDialog confirm = new ConfirmDialog(mainFrame, true, title, text, Utility.getBundleString("confirm", bundle), Utility.getBundleString("back", bundle)); confirm.setVisible(true); boolean close = confirm.getChoice(); confirm.dispose(); if (close == true) { mainFrame.dispose(); } } else { c1.previous(cardsPanel); } } }); cardsPanel = new JPanel(new CardLayout()); cardsPanel.setBackground(Color.WHITE); chooseServer = new ChooseServer(config); chooseFolder = new ChooseFolder(); cardsPanel.add(chooseServer, "1"); cardsPanel.add(chooseFolder, "2"); cardsPanel.setLayout(c1); c1.show(cardsPanel, "1"); //Main Panel style mainPanel = new JPanel(new BorderLayout()); mainPanel.add(BorderLayout.NORTH, headerPanel); mainPanel.add(BorderLayout.CENTER, cardsPanel); mainPanel.add(BorderLayout.PAGE_END, footerPanel); mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader); String title = Utility.getBundleString("dialog_1_title", bundle); String text = Utility.getBundleString("dialog_1", bundle); ConfirmDialog confirm = new ConfirmDialog(mainFrame, true, title, text, Utility.getBundleString("confirm", bundle), Utility.getBundleString("back", bundle)); confirm.setVisible(true); boolean close = confirm.getChoice(); confirm.dispose(); if (close == true) { mainFrame.dispose(); } } }); //Add Style mainFrame.getContentPane().setBackground(Color.white); mainFrame.getContentPane().setLayout(new BorderLayout()); mainFrame.getContentPane().setPreferredSize(new Dimension(640, 400)); mainFrame.getContentPane().add(BorderLayout.CENTER, mainPanel); mainFrame.pack(); //Center frame in the screen Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int x = (dim.width - mainFrame.getSize().width) / 2; int y = (dim.height - mainFrame.getSize().height) / 2; mainFrame.setLocation(x, y); mainFrame.setVisible(true); }
From source file:es.emergya.ui.gis.ControlPanel.java
public ControlPanel(final CustomMapView view) { super(new FlowLayout(FlowLayout.LEADING, 12, 0)); this.view = view; // Posicion: panel con un label de icono y un textfield JPanel posPanel = new JPanel(); posPanel.setOpaque(true);/*from w w w.j a v a 2 s .c om*/ posPanel.setVisible(true); JLabel mouseLocIcon = new JLabel(LogicConstants.getIcon("map_icon_coordenadas")); posPanel.add(mouseLocIcon); final JTextField posField = new JTextField(15); posField.setEditable(false); posField.setBorder(null); posField.setForeground(UIManager.getColor("Label.foreground")); posField.setFont(UIManager.getFont("Label.font")); posPanel.add(posField); view.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) { LatLon ll = ((ICustomMapView) e.getSource()).getLatLon(e.getX(), e.getY()); String position = ""; String format = LogicConstants.get("FORMATO_COORDENADAS_MAPA", "UTM"); if (format.equals(LogicConstants.COORD_UTM)) { UTM u = new UTM(LogicConstants.getInt("ZONA_UTM")); EastNorth en = u.latlon2eastNorth(ll); position = String.format("x: %.1f y: %.1f", en.getX(), en.getY()); } else { position = String.format("Lat: %.4f Lon: %.4f", ll.lat(), ll.lon()); } posField.setText(position); validate(); } @Override public void mouseDragged(MouseEvent e) { } }); posPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); add(posPanel); // Panel de centrado: label, desplegable y parte cambiante JPanel centerPanel = new JPanel(); centerPanel.add(new JLabel(i18n.getString("map.centerIn"))); centerOptions = new JComboBox(new String[] { i18n.getString("map.street"), i18n.getString("map.resource"), i18n.getString("map.incidence"), i18n.getString("map.location") }); centerPanel.add(centerOptions); centerData = new JPanel(new CardLayout()); centerPanel.add(centerData); JPanel centerStreet = new JPanel(); street = new JTextField(30); street.setName(i18n.getString("map.street")); autocompleteKeyListener = new AutocompleteKeyListener(street); street.addKeyListener(autocompleteKeyListener); street.addActionListener(this); centerStreet.add(street); centerData.add(centerStreet, i18n.getString("map.street")); JPanel centerResource = new JPanel(); resources = new JComboBox(avaliableResources); resources.setName(i18n.getString("map.resource")); resources.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); resources.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { isComboResourcesShowing = true; } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { isComboResourcesShowing = false; } @Override public void popupMenuCanceled(PopupMenuEvent e) { // view.repaint(); } }); centerResource.add(resources); centerData.add(centerResource, i18n.getString("map.resource")); centerResource = new JPanel(); incidences = new JComboBox(avaliableIncidences); incidences.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); incidences.setName(i18n.getString("map.incidence")); incidences.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { isComboIncidencesShowing = true; } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { isComboIncidencesShowing = false; } @Override public void popupMenuCanceled(PopupMenuEvent e) { } }); centerResource.add(incidences); centerData.add(centerResource, i18n.getString("map.incidence")); JPanel centerLocation = new JPanel(); cx = new JTextField(10); cx.setName("x"); cx.addActionListener(this); centerLocation.add(cx); cy = new JTextField(10); cy.setName("y"); cy.addActionListener(this); centerLocation.add(cy); centerData.add(centerLocation, i18n.getString("map.location")); centerOptions.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { ((CardLayout) centerData.getLayout()).show(centerData, (String) e.getItem()); } }); JButton centerButton = new JButton(i18n.getString("map.center")); centerButton.addActionListener(this); centerPanel.add(centerButton); add(centerPanel); }
From source file:com.qspin.qtaste.ui.MainPanel.java
public void genUI() { try {/*w w w .java 2 s.co 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:interfazGrafica.loginInterface.java
/** * Creates new form loginInterface/*from w w w .j a v a 2 s .c om*/ */ public loginInterface() { initComponents(); id_usuario_global = ""; tipoReporte = -1; //Inicializacion de paneles como no visibles panelContenedor.setVisible(true); panelContenedorJefe.setVisible(true); panelContenedorVendedor.setVisible(true); panelCrearUsuario.setVisible(false); panelModificarUsuario.setVisible(false); panelCrearSede.setVisible(false); panelModificarSede.setVisible(false); panelAgregarVehiculos.setVisible(false); panelModificarVehiculo.setVisible(false); panelAgregarPartes.setVisible(false); panelModificarPartes.setVisible(false); panelGenerarReportes.setVisible(false); //Adicion de paneles al card layout del gerente panelContenedor.setLayout(new CardLayout()); panelContenedor.add(panelVacio, "Inicio"); panelContenedor.add(panelCrearUsuario, "Crear Usuario"); panelContenedor.add(panelCrearSede, "Crear Sede"); panelContenedor.add(panelModificarUsuario, "Modificar Usuario"); panelContenedor.add(panelModificarSede, "Modificar Sede"); panelContenedor.add(panelAgregarVehiculos, "Agregar Vehiculo"); panelContenedor.add(panelModificarVehiculo, "Modificar Vehiculo"); panelContenedor.add(panelAgregarPartes, "Agregar Partes"); panelContenedor.add(panelModificarPartes, "Modificar Partes"); panelContenedor.add(panelGenerarReportes, "Generar reportes"); panelContenedor.add(panelConsultas, "Consultas"); panelContenedor.add(panelReporteFinal, "Reporte"); cl = (CardLayout) (panelContenedor.getLayout()); //Adicion de paneles al card layout del vendedor panelContenedorVendedor.setLayout(new CardLayout()); panelContenedorVendedor.add(panelVacio1, "Inicio"); panelContenedorVendedor.add(panelCrearCotizacion, "Crear cotizacion"); panelContenedorVendedor.add(panelConsultarCotizacion, "Consultar cotizacion"); panelContenedorVendedor.add(panelVender, "Vender"); clVendedor = (CardLayout) (panelContenedorVendedor.getLayout()); //Adicion de paneles al card layout del jefe de taller panelContenedorJefe.setLayout(new CardLayout()); panelContenedorJefe.add(panelVacio2, "Inicio"); panelContenedorJefe.add(panelCrearOrden, "Crear orden"); panelContenedorJefe.add(panelConsultarOrden, "Consultar orden"); clJefe = (CardLayout) panelContenedorJefe.getLayout(); //Adicion de paneles al cardlayout del panel de inventario panel.setLayout(new CardLayout()); panel.add(panelGestion, "Gestion"); panel.add(manejoVehiculos, "Vehiculos"); panel.add(manejoPartes, "Partes"); //System.out.println(""+panelContenedorInventario.getLayout()); clInventario = (CardLayout) panel.getLayout(); //Creacion de ButtonGroups modUsuario = new ButtonGroup(); agregarVehiculos = new ButtonGroup(); modVehiculos = new ButtonGroup(); tiempoReporte = new ButtonGroup(); espacioReporte = new ButtonGroup(); modUsuario.add(modificarActivoRB); modUsuario.add(modificarInactivoRB); agregarVehiculos.add(crearVehiculoNuevoRB); agregarVehiculos.add(crearVehiculoUsadoRB); modVehiculos.add(modificarVehiculoNuevoRB); modVehiculos.add(modificarVehiculoUsadoRB); tiempoReporte.add(semanalOpcionesReportes); tiempoReporte.add(todoOpcionesReportes); espacioReporte.add(sedesOpcionesReportes); espacioReporte.add(empresaOpcionesReportes); }
From source file:org.zaproxy.zap.extension.customFire.ExtensionCustomFire.java
private AbstractPanel getStatusPanel() { if (statusPanel == null) { statusPanel = new AbstractPanel(); statusPanel.setLayout(new CardLayout()); statusPanel.setName(Constant.messages.getString(PREFIX + ".panel.title")); statusPanel.setIcon(ICON);/* w w w. j a v a2 s.c om*/ JTextPane pane = new JTextPane(); pane.setEditable(false); pane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12)); pane.setContentType("text/html"); pane.setText(Constant.messages.getString(PREFIX + ".panel.msg")); statusPanel.add(pane); } return statusPanel; }
From source file:com.ixora.common.ui.ShowExceptionDialog.java
/** * Initializes this dialog./* w w w . j a va 2s.co m*/ */ private void initialize() { this.eventHandler = new EventHandler(); setSize(smallSize); setTitle(MessageRepository.get(Msg.COMMON_UI_TEXT_ERROR)); if (isDefaultLookAndFeelDecorated()) { getRootPane().setWindowDecorationStyle(JRootPane.ERROR_DIALOG); } textExceptionLong = UIFactoryMgr.createHtmlPane(); textExceptionLong.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); textExceptionLong.setEditable(false); textExceptionLong.addHyperlinkListener(this.eventHandler); textExceptionShort = UIFactoryMgr.createTextField(); textExceptionShort.setHorizontalAlignment(JTextField.CENTER); textExceptionShort.setBorder(null); textExceptionShort.setEditable(false); panel = new JPanel(new CardLayout()); JScrollPane s = UIFactoryMgr.createScrollPane(); s.setBorder(null); s.setViewportView(textExceptionLong); panel.add(s, "long"); panel.add(textExceptionShort, "short"); // set background color to the color of the panel textExceptionShort.setBackground(panel.getBackground()); textExceptionLong.setBackground(panel.getBackground()); buildContentPane(); }
From source file:org.apache.cayenne.modeler.editor.EditorView.java
private void initView() { // init widgets JButton collapseButton = getAction(CollapseTreeAction.class).buildButton(); collapseButton.setPreferredSize(new Dimension(30, 20)); JButton filterButton = getAction(FilterAction.class).buildButton(); filterButton.setPreferredSize(new Dimension(30, 20)); actionManager.getAction(CollapseTreeAction.class).setAlwaysOn(true); actionManager.getAction(FilterAction.class).setAlwaysOn(true); JToolBar barPanel = new JToolBar(); barPanel.setMinimumSize(new Dimension(75, 25)); barPanel.setBorder(BorderFactory.createEtchedBorder()); barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); barPanel.add(Box.createHorizontalStrut(3)); barPanel.add(filterButton);/*from ww w . ja va 2s . c om*/ barPanel.addSeparator(); barPanel.add(collapseButton); treePanel = new ProjectTreeView(eventController); treePanel.setMinimumSize(new Dimension(75, 180)); JPanel treeNavigatePanel = new JPanel(); treeNavigatePanel.setMinimumSize(new Dimension(75, 220)); treeNavigatePanel.setLayout(new BorderLayout()); treeNavigatePanel.add(treePanel, BorderLayout.CENTER); this.detailPanel = new JPanel(); this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); this.leftPanel = new JPanel(new BorderLayout()); // assemble... this.detailLayout = new CardLayout(); detailPanel.setLayout(detailLayout); // some but not all panels must be wrapped in a scroll pane // those that are not wrapped usually have there own scrollers // in subpanels... detailPanel.add(new JPanel(), EMPTY_VIEW); dataDomainView = new DataDomainTabbedView(eventController); detailPanel.add(dataDomainView, DOMAIN_VIEW); DataNodeEditor nodeController = new DataNodeEditor(eventController); detailPanel.add(nodeController.getView(), NODE_VIEW); dataNodeView = nodeController.getTabComponent(); dataMapView = new DataMapTabbedView(eventController); detailPanel.add(dataMapView, DATA_MAP_VIEW); procedureView = new ProcedureTabbedView(eventController); detailPanel.add(procedureView, PROCEDURE_VIEW); selectQueryView = new SelectQueryTabbedView(eventController); detailPanel.add(selectQueryView, SELECT_QUERY_VIEW); sqlTemplateView = new SQLTemplateTabbedView(eventController); detailPanel.add(sqlTemplateView, SQL_TEMPLATE_VIEW); Component procedureQueryView = new ProcedureQueryView(eventController); detailPanel.add(new JScrollPane(procedureQueryView), PROCEDURE_QUERY_VIEW); ejbqlQueryView = new EjbqlTabbedView(eventController); detailPanel.add(ejbqlQueryView, EJBQL_QUERY_VIEW); embeddableView = new EmbeddableTabbedView(eventController); detailPanel.add(embeddableView, EMBEDDABLE_VIEW); objDetailView = new ObjEntityTabbedView(eventController); detailPanel.add(objDetailView, OBJ_VIEW); dbDetailView = new DbEntityTabbedView(eventController); detailPanel.add(dbDetailView, DB_VIEW); leftPanel.add(barPanel, BorderLayout.NORTH); leftPanel.add(new JScrollPane(treeNavigatePanel), BorderLayout.CENTER); splitPane.setLeftComponent(leftPanel); splitPane.setRightComponent(detailPanel); setLayout(new BorderLayout()); add(splitPane, BorderLayout.CENTER); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewer.java
private void initComponents() { setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); 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); }/*from w w w . ja v a 2 s . c o m*/ }; 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][grow]", "[][23px]")); lblViewAllThe = new JLabel( "<html>View all the component series that combine to create the current series. Series can be viewed as:"); topPanel.add(lblViewAllThe, "cell 0 0 4 1"); JRadioButton btnTree2View = new JRadioButton("Flow chart"); btnTree2View.putClientProperty("cv.cardName", TREE2PANEL); btnTree2View.addActionListener(btnListener); group.add(btnTree2View); topPanel.add(btnTree2View, "cell 0 1,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 1,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 1,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); // 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()); setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.parosproxy.paros.view.MainFrame.java
/** * Constructs a {@code MainFrame} with the given options and request and response panels. * //w ww.j av a2 s .c om * @param options the options * @param requestPanel the main request panel * @param responsePanel the main response panel * @throws IllegalArgumentException if any of the parameters is {@code null}. * @since 2.5.0 */ public MainFrame(OptionsParam options, AbstractPanel requestPanel, AbstractPanel responsePanel) { super(); if (options == null) { throw new IllegalArgumentException("Parameter options must not be null"); } if (requestPanel == null) { throw new IllegalArgumentException("Parameter requestPanel must not be null"); } if (responsePanel == null) { throw new IllegalArgumentException("Parameter responsePanel must not be null"); } this.options = options; paneStandard = new WorkbenchPanel(options.getViewParam(), requestPanel, responsePanel); paneStandard.setLayout(new CardLayout()); paneStandard.setName("paneStandard"); initialize(); applyViewOptions(); }