List of usage examples for javax.swing JPanel setVisible
@BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag)
From source file:de.main.sessioncreator.ReportingHelper.java
public void addReport(JPanel jp) { jp.removeAll();// w ww.j av a2s . c o m PieDataset dataset = createDataset(); // based on the dataset we create the chart JFreeChart chart = createChart(dataset, "Sessions by Tester"); // we put the chart into a panel ChartPanel chartPanel = new ChartPanel(chart); chartPanel.updateUI(); chartPanel.setSize(490, 350); jp.revalidate(); jp.setOpaque(true); jp.add(chartPanel); jp.revalidate(); jp.setVisible(true); jp.setSize(700, 500); jp.revalidate(); jp.repaint(); }
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);/*ww w .j av a 2s . c o m*/ 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.floreantpos.main.SetUpWindow.java
private JPanel createUserPanel() { JPanel userPanel = new JPanel(new MigLayout("fill,hidemode 3", "[150px][fill, grow]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ userPanel.setVisible(false); userPanel.setBorder(new TitledBorder(Messages.getString("SetUpWindow.16"))); //$NON-NLS-1$ lblId = new JLabel(); lblFirstName = new JLabel(); lblLastName = new JLabel(); lblSecretKey = new JLabel(); lblConfirmSecretKey = new JLabel(); tfPassword1 = new JPasswordField(new FixedLengthDocument(16), "", 5); //$NON-NLS-1$ tfPassword2 = new JPasswordField(new FixedLengthDocument(16), "", 5); //$NON-NLS-1$ tfUserId = new FixedLengthTextField(); tfFirstName = new FixedLengthTextField(); tfFirstName.setColumns(20);/*from w w w . j a va2 s .c o m*/ tfFirstName.setLength(30); tfLastName = new FixedLengthTextField(); tfLastName.setLength(30); tfLastName.setColumns(20); lblId.setText("ID"); //$NON-NLS-1$ userPanel.add(lblId, "aligny center"); //$NON-NLS-1$ userPanel.add(tfUserId, "growx,aligny center,wrap"); //$NON-NLS-1$ lblFirstName.setText("First Name"); //$NON-NLS-1$ userPanel.add(lblFirstName, "aligny center"); //$NON-NLS-1$ userPanel.add(tfFirstName, "growx,aligny center,split 3"); //$NON-NLS-1$ lblLastName.setText("Last Name"); //$NON-NLS-1$ userPanel.add(lblLastName, "aligny center"); //$NON-NLS-1$ userPanel.add(tfLastName, "growx,aligny ,w 200!,center,wrap"); //$NON-NLS-1$ lblSecretKey.setText("Secret Key"); //$NON-NLS-1$ userPanel.add(lblSecretKey, "aligny center"); //$NON-NLS-1$ userPanel.add(tfPassword1, "growx,aligny center,split 3"); //$NON-NLS-1$ lblConfirmSecretKey.setText("Confirm Secret Key"); //$NON-NLS-1$ userPanel.add(lblConfirmSecretKey, "aligny center"); //$NON-NLS-1$ userPanel.add(tfPassword2, "growx,w 200!,aligny center"); //$NON-NLS-1$ return userPanel; }
From source file:aplicarFiltros.PanelResultado.java
public void graficar() { //Grafico de cantidad de Pixeles JFreeChart chartPixel = ChartFactory.createPieChart("Clasificacin", datasetPixel, true, true, false); chartPixel.setBackgroundPaint(Color.ORANGE); PiePlot plotPixel = (PiePlot) chartPixel.getPlot(); //Color de las etiquetas plotPixel.setLabelBackgroundPaint(Color.ORANGE); //Color de el fondo del grfico plotPixel.setBackgroundPaint(Color.WHITE); plotPixel.setNoDataMessage("No hay data"); ChartPanel panelPixel = new ChartPanel(chartPixel); final JPanel contentPixel = new JPanel(new BorderLayout()); contentPixel.add(panelPixel);//from ww w . j a va2 s. c o m //panelPixel.setPreferredSize(new java.awt.Dimension(500, 250)); panelGraficoPixel.setPreferredSize(new java.awt.Dimension(500, 180)); this.panelGraficoPixel.setLayout(new BorderLayout()); this.panelGraficoPixel.add(contentPixel); contentPixel.setVisible(true); this.panelGraficoPixel.setVisible(true); }
From source file:lcmc.common.ui.EditableInfo.java
protected final void enableSection(final String section, final boolean enable, final boolean wizard) { if (enable) { disabledSections.remove(section); } else {/*w w w . j a v a2 s .co m*/ disabledSections.add(section); } final JPanel p = getSectionPanel(section, wizard); if (p != null) { p.setVisible(enable); } }
From source file:ca.phon.plugins.praat.export.TextGridExportWizard.java
@Override public void finish() { final JPanel glassPane = new JPanel(); glassPane.setLayout(null);/*from ww w. ja v a2 s.c o m*/ glassPane.setOpaque(false); final Rectangle exportsRect = exportsTree.getBounds(); final JXBusyLabel busyLabel = new JXBusyLabel(new Dimension(32, 32)); final Point busyPoint = new Point((exportsRect.x + exportsRect.width) - 42, 10); busyLabel.setLocation(busyPoint); glassPane.add(busyLabel); final PhonTaskListener busyListener = new PhonTaskListener() { @Override public void statusChanged(PhonTask task, TaskStatus oldstatus, TaskStatus status) { if (status == TaskStatus.RUNNING) { busyLabel.setBusy(true); glassPane.setVisible(true); } else { busyLabel.setBusy(false); glassPane.setVisible(false); generateTask.removeTaskListener(this); TextGridExportWizard.super.finish(); } } @Override public void propertyChanged(PhonTask arg0, String arg1, Object arg2, Object arg3) { } }; generateTask.addTaskListener(busyListener); final PhonWorker worker = PhonWorker.getInstance(); worker.invokeLater(generateTask); }
From source file:lcmc.common.ui.EditableInfo.java
/** Hide/Show advanced panels. */ @Override/*from w w w . java 2 s . c o m*/ public void updateAdvancedPanels() { super.updateAdvancedPanels(); final boolean advancedMode = access.isAdvancedMode(); boolean advanced = false; for (final JPanel apl : advancedPanelList) { swingUtils.invokeLater(new Runnable() { @Override public void run() { apl.setVisible(advancedMode); } }); advanced = true; } for (final String section : advancedOnlySectionList) { final JPanel p = sectionPanels.get(section, Boolean.toString(!WIZARD)); final JPanel pw = sectionPanels.get(section, Boolean.toString(WIZARD)); swingUtils.invokeLater(new Runnable() { @Override public void run() { final boolean v = advancedMode && isSectionEnabled(section); p.setVisible(v); if (pw != null) { pw.setVisible(v); } } }); advanced = true; } final boolean a = advanced; swingUtils.invokeLater(new Runnable() { @Override public void run() { moreOptionsPanel.setVisible(a && !advancedMode); } }); }
From source file:lcmc.gui.resources.EditableInfo.java
/** Hide/Show advanced panels. */ @Override/* ww w . j av a2 s . c om*/ public void updateAdvancedPanels() { super.updateAdvancedPanels(); final boolean advancedMode = Tools.getConfigData().isAdvancedMode(); boolean advanced = false; for (final JPanel apl : advancedPanelList) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { apl.setVisible(advancedMode); } }); advanced = true; } for (final JPanel p : advancedOnlySectionList) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { p.setVisible(advancedMode); } }); advanced = true; } final boolean a = advanced; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { moreOptionsPanel.setVisible(a && !advancedMode); } }); }
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
protected void createUI(final ChartPanel chartPanel, final JPanel optionsPanel, BindingContext bindingContext) { roiMaskSelector = new RoiMaskSelector(bindingContext); final JPanel extendedOptionsPanel = GridBagUtils.createPanel(); GridBagConstraints extendedOptionsPanelConstraints = GridBagUtils.createConstraints( "insets.left=4,insets.right=2,anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1"); GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "gridy=0"); GridBagUtils.addToPanel(extendedOptionsPanel, roiMaskSelector.createPanel(), extendedOptionsPanelConstraints, "gridy=1,insets.left=-4"); GridBagUtils.addToPanel(extendedOptionsPanel, new JPanel(), extendedOptionsPanelConstraints, "gridy=1,insets.left=-4"); GridBagUtils.addToPanel(extendedOptionsPanel, optionsPanel, extendedOptionsPanelConstraints, "insets.left=0,insets.right=0,gridy=2,fill=VERTICAL,fill=HORIZONTAL,weighty=1"); GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "insets.left=4,insets.right=2,gridy=5,anchor=SOUTHWEST"); final SimpleScrollPane optionsScrollPane = new SimpleScrollPane(extendedOptionsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); optionsScrollPane.setBorder(null);/*w w w .j av a 2s .c o m*/ optionsScrollPane.getVerticalScrollBar().setUnitIncrement(20); final JPanel rightPanel = new JPanel(new BorderLayout()); rightPanel.add(createTopPanel(), BorderLayout.NORTH); rightPanel.add(optionsScrollPane, BorderLayout.CENTER); rightPanel.add(createChartBottomPanel(chartPanel), BorderLayout.SOUTH); final ImageIcon collapseIcon = UIUtils.loadImageIcon("icons/PanelRight12.png"); final ImageIcon collapseRolloverIcon = ToolButtonFactory.createRolloverIcon(collapseIcon); final ImageIcon expandIcon = UIUtils.loadImageIcon("icons/PanelLeft12.png"); final ImageIcon expandRolloverIcon = ToolButtonFactory.createRolloverIcon(expandIcon); hideAndShowButton = ToolButtonFactory.createButton(collapseIcon, false); hideAndShowButton.setToolTipText("Collapse Options Panel"); hideAndShowButton.setName("switchToChartButton"); hideAndShowButton.addActionListener(new ActionListener() { public boolean rightPanelShown; @Override public void actionPerformed(ActionEvent e) { rightPanel.setVisible(rightPanelShown); if (rightPanelShown) { hideAndShowButton.setIcon(collapseIcon); hideAndShowButton.setRolloverIcon(collapseRolloverIcon); hideAndShowButton.setToolTipText("Collapse Options Panel"); } else { hideAndShowButton.setIcon(expandIcon); hideAndShowButton.setRolloverIcon(expandRolloverIcon); hideAndShowButton.setToolTipText("Expand Options Panel"); } rightPanelShown = !rightPanelShown; } }); backgroundPanel = new JPanel(new BorderLayout()); backgroundPanel.add(chartPanel, BorderLayout.CENTER); backgroundPanel.add(rightPanel, BorderLayout.EAST); JLayeredPane layeredPane = new JLayeredPane(); layeredPane.add(backgroundPanel, new Integer(0)); layeredPane.add(hideAndShowButton, new Integer(1)); add(layeredPane); }
From source file:org.esa.beam.visat.toolviews.stat.ChartPagePanel.java
protected void createUI(final ChartPanel chartPanel, final JPanel optionsPanel, BindingContext bindingContext) { roiMaskSelector = new RoiMaskSelector(bindingContext); final JPanel extendedOptionsPanel = GridBagUtils.createPanel(); GridBagConstraints extendedOptionsPanelConstraints = GridBagUtils.createConstraints( "insets.left=4,insets.right=2,anchor=NORTHWEST,fill=HORIZONTAL,insets.top=2,weightx=1"); GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "gridy=0"); GridBagUtils.addToPanel(extendedOptionsPanel, roiMaskSelector.createPanel(), extendedOptionsPanelConstraints, "gridy=1,insets.left=-4"); GridBagUtils.addToPanel(extendedOptionsPanel, optionsPanel, extendedOptionsPanelConstraints, "insets.left=0,insets.right=0,gridy=2,fill=VERTICAL,fill=HORIZONTAL,weighty=1"); GridBagUtils.addToPanel(extendedOptionsPanel, new JSeparator(), extendedOptionsPanelConstraints, "insets.left=4,insets.right=2,gridy=5,anchor=SOUTHWEST"); final JScrollPane optionsScrollPane = new SimpleScrollPane(extendedOptionsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); optionsScrollPane.setBorder(null);//w w w . j av a2 s. com final JPanel rightPanel = new JPanel(new BorderLayout()); rightPanel.add(createTopPanel(), BorderLayout.NORTH); rightPanel.add(optionsScrollPane, BorderLayout.CENTER); rightPanel.add(createChartBottomPanel(chartPanel), BorderLayout.SOUTH); final ImageIcon collapseIcon = UIUtils.loadImageIcon("icons/PanelRight12.png"); final ImageIcon collapseRolloverIcon = ToolButtonFactory.createRolloverIcon(collapseIcon); final ImageIcon expandIcon = UIUtils.loadImageIcon("icons/PanelLeft12.png"); final ImageIcon expandRolloverIcon = ToolButtonFactory.createRolloverIcon(expandIcon); hideAndShowButton = ToolButtonFactory.createButton(collapseIcon, false); hideAndShowButton.setToolTipText("Collapse Options Panel"); hideAndShowButton.setName("switchToChartButton"); hideAndShowButton.addActionListener(new ActionListener() { public boolean rightPanelShown; @Override public void actionPerformed(ActionEvent e) { rightPanel.setVisible(rightPanelShown); if (rightPanelShown) { hideAndShowButton.setIcon(collapseIcon); hideAndShowButton.setRolloverIcon(collapseRolloverIcon); hideAndShowButton.setToolTipText("Collapse Options Panel"); } else { hideAndShowButton.setIcon(expandIcon); hideAndShowButton.setRolloverIcon(expandRolloverIcon); hideAndShowButton.setToolTipText("Expand Options Panel"); } rightPanelShown = !rightPanelShown; } }); backgroundPanel = new JPanel(new BorderLayout()); backgroundPanel.add(chartPanel, BorderLayout.CENTER); backgroundPanel.add(rightPanel, BorderLayout.EAST); JLayeredPane layeredPane = new JLayeredPane(); layeredPane.add(backgroundPanel, new Integer(0)); layeredPane.add(hideAndShowButton, new Integer(1)); add(layeredPane); }