List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox(String text, Icon icon)
From source file:edu.ku.brc.specify.config.SpecifyExceptionTracker.java
@Override protected FeedBackSenderItem getFeedBackSenderItem(final Class<?> cls, final Exception exception) { CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,p,f:p:g", "p,8px,p,2px, p,4px,p,2px,f:p:g")); Vector<Taskable> taskItems = new Vector<Taskable>(TaskMgr.getInstance().getAllTasks()); Collections.sort(taskItems, new Comparator<Taskable>() { @Override/* w w w . j av a 2s . co m*/ public int compare(Taskable o1, Taskable o2) { return o1.getName().compareTo(o2.getName()); } }); final JTextArea commentsTA = createTextArea(3, 60); final JTextArea stackTraceTA = createTextArea(15, 60); final JCheckBox moreBtn; commentsTA.setWrapStyleWord(true); commentsTA.setLineWrap(true); //JLabel desc = createI18NLabel("UNHDL_EXCP", SwingConstants.LEFT); JEditorPane desc = new JEditorPane("text/html", getResourceString("UNHDL_EXCP")); desc.setEditable(false); desc.setOpaque(false); //desc.setFont(new Font(Font.SANS_SERIF, Font.BOLD, (new JLabel("X")).getFont().getSize())); JScrollPane sp = new JScrollPane(stackTraceTA, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); int y = 1; pb.add(desc, cc.xyw(1, y, 4)); y += 2; pb.add(createI18NFormLabel("UNHDL_EXCP_CMM"), cc.xy(1, y)); y += 2; pb.add(createScrollPane(commentsTA, true), cc.xyw(1, y, 4)); y += 2; forwardImgIcon = IconManager.getIcon("Forward"); //$NON-NLS-1$ downImgIcon = IconManager.getIcon("Down"); //$NON-NLS-1$ moreBtn = new JCheckBox(getResourceString("LOGIN_DLG_MORE"), forwardImgIcon); //$NON-NLS-1$ setControlSize(moreBtn); JButton copyBtn = createI18NButton("UNHDL_EXCP_COPY"); PanelBuilder innerPB = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,2px,p:g,2px,p")); innerPB.add(createI18NLabel("UNHDL_EXCP_STK"), cc.xy(1, 1)); innerPB.add(sp, cc.xyw(1, 3, 3)); innerPB.add(copyBtn, cc.xy(1, 5)); stackTracePanel = innerPB.getPanel(); stackTracePanel.setVisible(false); pb.add(moreBtn, cc.xyw(1, y, 4)); y += 2; pb.add(stackTracePanel, cc.xyw(1, y, 4)); y += 2; ByteArrayOutputStream baos = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(baos)); stackTraceTA.setText(baos.toString()); moreBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (stackTracePanel.isVisible()) { stackTracePanel.setVisible(false); moreBtn.setIcon(forwardImgIcon); } else { stackTracePanel.setVisible(true); moreBtn.setIcon(downImgIcon); } if (dlg != null) { dlg.pack(); } } }); copyBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String taskName = getTaskName(); FeedBackSenderItem item = new FeedBackSenderItem(taskName, "", "", commentsTA.getText(), stackTraceTA.getText(), cls.getName()); NameValuePair[] pairs = createPostParameters(item); StringBuilder sb = new StringBuilder(); for (NameValuePair pair : pairs) { if (!pair.getName().equals("bug")) { sb.append(pair.getName()); sb.append(": "); if (pair.getName().equals("comments") || pair.getName().equals("stack_trace")) { sb.append("\n"); } sb.append(pair.getValue()); sb.append("\n"); } } // Copy to Clipboard UIHelper.setTextToClipboard(sb.toString()); } }); pb.setDefaultDialogBorder(); dlg = new CustomDialog((Frame) null, getResourceString("UnhandledExceptionTitle"), true, CustomDialog.OK_BTN, pb.getPanel()); dlg.setOkLabel(getResourceString("UNHDL_EXCP_SEND")); dlg.createUI(); stackTracePanel.setVisible(false); centerAndShow(dlg); String taskName = getTaskName(); FeedBackSenderItem item = new FeedBackSenderItem(taskName, "", "", commentsTA.getText(), stackTraceTA.getText(), cls.getName()); return item; }
From source file:com.diversityarrays.kdxplore.curate.fieldview.InterceptFieldLayoutView.java
public void openFieldLayoutView(Component trigger, String title, @SuppressWarnings("rawtypes") MutableComboBoxModel comboBoxModel, CurationData curationData, CurationTableModel curationTableModel, SelectedValueStore selectedValueStore, PlotCellChoicesPanel plotCellChoicesPanel, JPopupMenu popuMenu, Font smallFont, Action curationHelpAction, MessagePrinter messages, Closure<String> selectionClosure, CurationContext curationContext, CurationMenuProvider curationMenuProvider, FieldLayoutTableModel fieldLayoutTableModel, CellSelectableTable fieldLayoutTable, FieldViewSelectionModel fieldViewSelectionModel, JButton undockButton) {/*from w w w . j a va2s . c o m*/ if (fieldLayoutFrame != null) { fieldLayoutFrame.toFront(); return; } JCheckBox alwaysOnTopOption = new JCheckBox(Msg.OPTION_KEEP_ON_TOP(), true); viewPanel = new FieldLayoutViewPanel(comboBoxModel, alwaysOnTopOption, curationData, curationTableModel, selectedValueStore, plotCellChoicesPanel, popuMenu, smallFont, curationHelpAction, messages, selectionClosure, curationContext, curationMenuProvider, fieldLayoutTableModel, fieldLayoutTable, fieldViewSelectionModel, undockButton); viewPanel.addRefreshListener(refreshListener); viewPanel.addTraitInstanceSelectionListener(itemListener); viewPanel.addCellSelectionListener(cellSelectionListener); fieldLayoutFrame = new JFrame(title); fieldLayoutFrame.setAlwaysOnTop(alwaysOnTopOption.isSelected()); fieldLayoutFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); fieldLayoutFrame.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { viewPanel.doPostOpenActions(); } @Override public void windowClosed(WindowEvent e) { try { viewPanel.removeCellSelectionListener(cellSelectionListener); } finally { fieldLayoutFrame.removeWindowListener(this); fieldLayoutFrame = null; } } }); fieldLayoutFrame.setContentPane(viewPanel); fieldLayoutFrame.pack(); fieldLayoutFrame.setLocationRelativeTo(trigger); fieldLayoutFrame.setVisible(true); fieldLayoutFrame.toFront(); alwaysOnTopOption.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fieldLayoutFrame.setAlwaysOnTop(alwaysOnTopOption.isSelected()); } }); }
From source file:org.esa.smos.gui.gridpoint.GridPointBtDataChartTopComponent.java
@Override protected JComponent createGridPointComponentOptionsComponent() { modeCheckers = new JCheckBox[] { new JCheckBox("X", true), new JCheckBox("Y", true), new JCheckBox("XY", true), }; final JPanel optionsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 2)); for (JCheckBox modeChecker : modeCheckers) { modeChecker.addActionListener(e -> updateGridPointBtDataComponent()); optionsPanel.add(modeChecker);/*from ww w .j a v a2 s .co m*/ } return optionsPanel; }
From source file:net.vanosten.dings.swing.SummaryView.java
private void initComponents() { chartP = new JPanel(); chartP.setLayout(new BorderLayout()); //to begin with we show an information JLabel infoL = new JLabel( "Choose the chart type belwo and press the \"Update View\" button to show statistics."); infoL.setEnabled(false); //only for display infoL.setHorizontalAlignment(SwingConstants.CENTER); chartP.add(infoL, BorderLayout.CENTER); Vector<String> items = new Vector<String>(); items.add("Entries by " + Toolbox.getInstance().getInfoPointer().getUnitLabel()); items.add("Entries by " + Toolbox.getInstance().getInfoPointer().getCategoryLabel()); items.add("Entries by Entry Type"); items.add("Entries by Score"); items.add("Entry Scores over Time"); //do not change sequence of elements, as showGraph() and checkChosenStattype rely on it chartTypeCB = new JComboBox(items); chartTypeCB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (4 == chartTypeCB.getSelectedIndex()) { chosenCB.setEnabled(false); } else { chosenCB.setEnabled(true); }/*from w w w. j ava 2 s .com*/ } }); chosenCB = new JCheckBox("Only Selected Entries", false); chosenCB.setMnemonic("O".charAt(0)); }
From source file:com.moteiv.trawler.Trawler.java
protected Box getControls() { java.util.Dictionary labels;/*w w w. j a va2s . c om*/ if (controls == null) { controls = Box.createVerticalBox(); JPanel runtimeControls = new JPanel(new GridLayout(0, 1)); runtimeControls.setBorder(BorderFactory.createTitledBorder("Runtime Controls")); vLog = new JCheckBox("Log packets", false); vLog.addActionListener(this); runtimeControls.add(vLog); runtimeControls.add(new JLabel("Edge persistence (sec)", JLabel.LEFT)); eDispose = new JSlider(0, 300, 10); eDispose.setMajorTickSpacing(100); eDispose.setMinorTickSpacing(10); eDispose.setPaintTicks(true); eDispose.setPaintTrack(true); // labels = eDispose.getLabelTable(); eDispose.setPaintLabels(true); eDispose.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { LinkData.setEdgeDelay((1 + eDispose.getValue()) * 1000); savePrefs(); } }); runtimeControls.add(eDispose); runtimeControls.add(new JLabel("Vertex persistence (sec)", JLabel.LEFT)); vDispose = new JSlider(0, 300, 30); vDispose.setMajorTickSpacing(100); vDispose.setMinorTickSpacing(10); vDispose.setPaintTicks(true); vDispose.setPaintTrack(true); vDispose.setPaintLabels(true); vDispose.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { NodeData.setNodeDelay((1 + vDispose.getValue()) * 1000); savePrefs(); } }); runtimeControls.add(vDispose); graphReset = new JButton("Reset Nodes"); graphReset.addActionListener(this); runtimeControls.add(graphReset); controls.add(runtimeControls); JPanel vertexControl = new JPanel(new GridLayout(0, 1)); vertexControl.setBorder(BorderFactory.createTitledBorder("Node display")); vLabels = new JCheckBox("Display vertex details", true); vLabels.addActionListener(this); vertexControl.add(vLabels); vBlink = new JCheckBox("Blink on incoming packets"); vBlink.addActionListener(this); vertexControl.add(vBlink); vSave = new JCheckBox("Save node locations", true); vSave.addActionListener(this); vertexControl.add(vSave); controls.add(vertexControl); JPanel edgeControl = new JPanel(new GridLayout(0, 1)); edgeControl.setBorder(BorderFactory.createTitledBorder("Link diplay")); eLabels = new JCheckBox("Display link quality", true); eLabels.addActionListener(this); edgeControl.add(eLabels); eFilter = new JCheckBox("Show alternate parents", true); eFilter.addActionListener(this); edgeControl.add(eFilter); controls.add(edgeControl); } return controls; }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultNumberAxisEditor.java
/** * Standard constructor: builds a property panel for the specified axis. * /*w w w .j ava2s . c o m*/ * @param axis * the axis, which should be changed. */ public DefaultNumberAxisEditor(NumberAxis axis) { super(axis); this.autoRange = axis.isAutoRange(); this.minimumValue = axis.getLowerBound(); this.maximumValue = axis.getUpperBound(); this.gridPaintSample = new PaintSample(Color.blue); this.gridStrokeSample = new StrokeSample(new BasicStroke(1.0f)); this.availableStrokeSamples = new StrokeSample[3]; this.availableStrokeSamples[0] = new StrokeSample(new BasicStroke(1.0f)); this.availableStrokeSamples[1] = new StrokeSample(new BasicStroke(2.0f)); this.availableStrokeSamples[2] = new StrokeSample(new BasicStroke(3.0f)); JTabbedPane other = getOtherTabs(); JPanel range = new JPanel(new LCBLayout(3)); range.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); range.add(new JPanel()); this.autoRangeCheckBox = new JCheckBox(localizationResources.getString("Auto-adjust_range"), this.autoRange); this.autoRangeCheckBox.setActionCommand("AutoRangeOnOff"); this.autoRangeCheckBox.addActionListener(this); range.add(this.autoRangeCheckBox); range.add(new JPanel()); range.add(new JLabel(localizationResources.getString("Minimum_range_value"))); this.minimumRangeValue = new JTextField(Double.toString(this.minimumValue)); this.minimumRangeValue.setEnabled(!this.autoRange); this.minimumRangeValue.setActionCommand("MinimumRange"); this.minimumRangeValue.addActionListener(this); this.minimumRangeValue.addFocusListener(this); range.add(this.minimumRangeValue); range.add(new JPanel()); range.add(new JLabel(localizationResources.getString("Maximum_range_value"))); this.maximumRangeValue = new JTextField(Double.toString(this.maximumValue)); this.maximumRangeValue.setEnabled(!this.autoRange); this.maximumRangeValue.setActionCommand("MaximumRange"); this.maximumRangeValue.addActionListener(this); this.maximumRangeValue.addFocusListener(this); range.add(this.maximumRangeValue); range.add(new JPanel()); other.add(localizationResources.getString("Range"), range); }
From source file:es.emergya.ui.plugins.LayerSelectionDialog.java
private void initOptions(final JPanel list) { SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() { @Override//from www . j a va 2 s .c om protected Object doInBackground() throws Exception { publish(new Object[0]); for (CapaInformacion ci : CapaConsultas.getAllOrderedByOrden()) { if (ci.getOpcional() && ci.getHabilitada()) { layers.add(new LayerElement(ci.getNombre(), ci.getUrl(), wasVisible(ci))); } } return null; } @Override protected void process(List<Object> chunks) { actualizando.setIcon(es.emergya.cliente.constants.LogicConstants.getIcon("anim_actualizando")); } @Override protected void done() { super.done(); actualizando.setIcon(null); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); for (LayerElement le : layers) { JCheckBox cb = new JCheckBox(le.name, le.active); cb.setBackground(Color.WHITE); cb.addActionListener(LayerSelectionDialog.this); list.add(cb); list.revalidate(); } // self.pack(); } }; sw.execute(); }
From source file:ucar.unidata.idv.control.chart.ChartHolder.java
/** * get properties widgets/*ww w . java2 s .c o m*/ * * @param comps widgets */ protected void getPropertiesComponents(List comps) { // showThumbnailCbx = new JCheckBox("Thumbnail", showThumbnail); showTitleCbx = new JCheckBox("Title", showTitle); comps.add(GuiUtils.rLabel("Show:")); // comps.add(GuiUtils.left(GuiUtils.hbox(showThumbnailCbx,showTitleCbx))); comps.add(GuiUtils.left(showTitleCbx)); }
From source file:ucar.unidata.idv.control.chart.PlotWrapper.java
/** * Create the properties contents//ww w . j a v a 2s . c o m * * @param comps List of components * @param tabIdx Which tab */ protected void getPropertiesComponents(List comps, int tabIdx) { super.getPropertiesComponents(comps, tabIdx); if (tabIdx != 1) { autoRangeCbx = new JCheckBox("", autoRange); comps.add(GuiUtils.rLabel("Auto Range: ")); comps.add(autoRangeCbx); return; } if (canDoColors()) { XmlObjectStore store; if (this.displayControl != null) { store = this.displayControl.getStore(); } else { store = McIDASV.getStaticMcv().getStore(); } backgroundSwatch = GuiUtils.makeColorSwatchWidget(store, backgroundColor, "")[0]; dataAreaSwatch = GuiUtils.makeColorSwatchWidget(store, dataAreaColor, "")[0]; comps.add(GuiUtils.rLabel("Color: ")); List colorComps = Misc.newList(new JLabel("Background:"), backgroundSwatch, new JLabel("Data Area:"), dataAreaSwatch); comps.add(GuiUtils.left(GuiUtils.hbox(colorComps, 4))); comps.add(GuiUtils.rLabel("Domain Lines: ")); comps.add(domainLineState.getPropertyContents(store)); comps.add(GuiUtils.rLabel("Range Lines: ")); comps.add(rangeLineState.getPropertyContents(store)); } }
From source file:es.emergya.ui.gis.popups.SummaryDialog.java
public SummaryDialog(Recurso r) { super();// w ww. java 2s .com r = (r == null) ? null : RecursoConsultas.getByIdentificador(r.getIdentificador()); setAlwaysOnTop(true); setResizable(false); setName(r.getIdentificador()); setBackground(Color.WHITE); setSize(600, 400); setTitle(i18n.getString("Resources.summary.titleWindow") + " " + r.getIdentificador()); try { setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getIconImage()); } catch (Throwable e) { LOG.error("There is no icon image", e); } JPanel base = new JPanel(); base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS)); base.setBackground(Color.WHITE); r = RecursoConsultas.getByIdentificador(r.getIdentificador()); // Icono del titulo JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING)); final JLabel labelTitle = new JLabel(i18n.getString("Resources.summary.title") + " " + r.getIdentificador(), LogicConstants.getIcon("tittleficha_icon_recurso"), JLabel.LEFT); labelTitle.setFont(LogicConstants.deriveBoldFont(12f)); title.setBackground(Color.WHITE); title.add(labelTitle); base.add(title); // Nombre JPanel mid = new JPanel(new SpringLayout()); mid.setBackground(Color.WHITE); mid.add(new JLabel(i18n.getString("Resources.name"), JLabel.RIGHT)); JTextField name = new JTextField(25); if (r != null) name.setText(r.getIdentificador()); name.setEditable(false); mid.add(name); // Patrulla mid.add(new JLabel(i18n.getString("Resources.squad"), JLabel.RIGHT)); // JComboBox squads = new // JComboBox(PatrullaConsultas.getAll().toArray()); JTextField squads = new JTextField(r.getPatrullas() == null ? null : r.getPatrullas().getNombre()); // squads.setSelectedItem(r.getPatrullas()); squads.setEditable(false); squads.setColumns(21); // squads.setEnabled(false); mid.add(squads); // Tipo mid.add(new JLabel(i18n.getString("Resources.type"), JLabel.RIGHT)); JTextField types = new JTextField(r.getTipo()); types.setEditable(false); mid.add(types); // Estado Eurocop mid.add(new JLabel(i18n.getString("Resources.status"), JLabel.RIGHT)); JTextField status = new JTextField(); if (r.getEstadoEurocop() != null) status.setText(r.getEstadoEurocop().getIdentificador()); status.setEditable(false); mid.add(status); // Subflota mid.add(new JLabel(i18n.getString("Resources.subfleet"), JLabel.RIGHT)); JTextField subfleets = new JTextField(r.getFlotas() == null ? null : r.getFlotas().getNombre()); subfleets.setEditable(false); mid.add(subfleets); // Referencia Humana mid.add(new JLabel(i18n.getString("Resources.incidences"), JLabel.RIGHT)); JTextField rHumana = new JTextField(); // if (r.getIncidencias() != null) // rHumana.setText(r.getIncidencias().getReferenciaHumana()); rHumana.setEditable(false); mid.add(rHumana); // dispositivo mid.add(new JLabel(i18n.getString("Resources.device"), JLabel.RIGHT)); JTextField issi = new JTextField(); issi.setEditable(false); mid.add(issi); mid.add(new JLabel(i18n.getString("Resources.enabled"), JLabel.RIGHT)); JCheckBox enabled = new JCheckBox("", true); enabled.setEnabled(false); enabled.setOpaque(false); if (r.getDispositivo() != null) { final String valueOf = String.valueOf(r.getDispositivo()); try { issi.setText(String.format(FORMAT, r.getDispositivo())); } catch (Throwable t) { issi.setText(valueOf); } enabled.setSelected(r.getHabilitado()); } mid.add(enabled); // Fecha ultimo gps mid.add(new JLabel(i18n.getString("Resources.lastPosition"), JLabel.RIGHT)); JTextField lastGPS = new JTextField(); final Date lastGPSDateForRecurso = HistoricoGPSConsultas.lastGPSDateForRecurso(r); if (lastGPSDateForRecurso != null) { lastGPS.setText(SimpleDateFormat.getDateTimeInstance().format(lastGPSDateForRecurso)); } lastGPS.setEditable(false); mid.add(lastGPS); // Espacio en blanco mid.add(Box.createHorizontalGlue()); mid.add(Box.createHorizontalGlue()); // Espacio en blanco mid.add(Box.createHorizontalGlue()); mid.add(Box.createHorizontalGlue()); SpringUtilities.makeCompactGrid(mid, 5, 4, 6, 6, 6, 18); base.add(mid); // informacion adicional JPanel infoPanel = new JPanel(new SpringLayout()); JTextField info = new JTextField(25); info.setText(r.getInfoAdicional()); info.setEditable(false); infoPanel.setOpaque(false); infoPanel.add(new JLabel(i18n.getString("Resources.info"))); infoPanel.add(info); SpringUtilities.makeCompactGrid(infoPanel, 1, 2, 6, 6, 6, 18); base.add(infoPanel); JPanel buttons = new JPanel(); buttons.setBackground(Color.WHITE); JButton accept = new JButton(i18n.getString("Buttons.ok"), LogicConstants.getIcon("button_accept")); accept.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); buttons.add(accept); base.add(buttons); getContentPane().add(base); pack(); int x; int y; Container myParent; try { myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame() .getContentPane(); java.awt.Point topLeft = myParent.getLocationOnScreen(); Dimension parentSize = myParent.getSize(); Dimension mySize = getSize(); if (parentSize.width > mySize.width) x = ((parentSize.width - mySize.width) / 2) + topLeft.x; else x = topLeft.x; if (parentSize.height > mySize.height) y = ((parentSize.height - mySize.height) / 2) + topLeft.y; else y = topLeft.y; setLocation(x, y); } catch (Throwable e1) { LOG.error("There is no basic window!", e1); } }