List of usage examples for javax.swing DefaultComboBoxModel DefaultComboBoxModel
public DefaultComboBoxModel(Vector<E> v)
From source file:edu.harvard.mcz.imagecapture.GeoreferenceDialog.java
private void init() { setBounds(100, 100, 450, 560);//from w w w . ja v a 2s. co m getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new GridLayout(0, 2, 0, 0)); { JLabel lblLatitude = new JLabel("Latitude"); lblLatitude.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLatitude); } textFieldDecimalLat = new JTextField(); contentPanel.add(textFieldDecimalLat); textFieldDecimalLat.setColumns(10); JLabel lblLongitude = new JLabel("Longitude"); lblLongitude.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLongitude); { textFieldDecimalLong = new JTextField(); contentPanel.add(textFieldDecimalLong); textFieldDecimalLong.setColumns(10); } { JLabel lblDatum = new JLabel("Datum"); lblDatum.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblDatum); } @SuppressWarnings("unchecked") ComboBoxModel<String> datumModel = new ListComboBoxModel<String>(LatLong.getDatumValues()); cbDatum = new JComboBox<String>(datumModel); contentPanel.add(cbDatum); JLabel lblMethod = new JLabel("Method"); lblMethod.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblMethod); @SuppressWarnings("unchecked") ComboBoxModel<String> methodModel = new ListComboBoxModel<String>(LatLong.getGeorefMethodValues()); cbMethod = new JComboBox<String>(new DefaultComboBoxModel<String>(new String[] { "not recorded", "unknown", "GEOLocate", "Google Earth", "Gazeteer", "GPS", "MaNIS/HertNet/ORNIS Georeferencing Guidelines" })); cbMethod.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setState(); } }); contentPanel.add(cbMethod); JLabel lblAccuracy = new JLabel("GPS Accuracy"); lblAccuracy.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblAccuracy); txtGPSAccuracy = new JTextField(); txtGPSAccuracy.setColumns(10); contentPanel.add(txtGPSAccuracy); JLabel lblNewLabel_1 = new JLabel("Original Units"); lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblNewLabel_1); comboBoxOrigUnits = new JComboBox<String>(); comboBoxOrigUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setState(); } }); comboBoxOrigUnits.setModel(new DefaultComboBoxModel<String>( new String[] { "decimal degrees", "deg. min. sec.", "degrees dec. minutes", "unknown" })); contentPanel.add(comboBoxOrigUnits); lblErrorRadius = new JLabel("Error Radius"); lblErrorRadius.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblErrorRadius); txtErrorRadius = new JTextField(); txtErrorRadius.setColumns(10); contentPanel.add(txtErrorRadius); JLabel lblErrorRadiusUnits = new JLabel("Error Radius Units"); lblErrorRadiusUnits.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblErrorRadiusUnits); comboBoxErrorUnits = new JComboBox<String>(); comboBoxErrorUnits.setModel(new DefaultComboBoxModel<String>(new String[] { "m", "ft", "km", "mi", "yd" })); contentPanel.add(comboBoxErrorUnits); JLabel lblLatDegrees = new JLabel("Lat Degrees"); lblLatDegrees.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLatDegrees); txtLatDegrees = new JTextField(); txtLatDegrees.setColumns(4); contentPanel.add(txtLatDegrees); JLabel lblLatDecMin = new JLabel("Lat Dec Min"); lblLatDecMin.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLatDecMin); txtLatDecMin = new JTextField(); txtLatDecMin.setColumns(6); contentPanel.add(txtLatDecMin); JLabel lblLatMin = new JLabel("Lat Min"); lblLatMin.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLatMin); txtLatMin = new JTextField(); txtLatMin.setColumns(6); contentPanel.add(txtLatMin); JLabel lblLatSec = new JLabel("Lat Sec"); lblLatSec.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLatSec); txtLatSec = new JTextField(); txtLatSec.setColumns(6); contentPanel.add(txtLatSec); JLabel lblLatDir = new JLabel("Lat N/S"); lblLatDir.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLatDir); cbLatDir = new JComboBox<String>(); cbLatDir.setModel(new DefaultComboBoxModel<String>(new String[] { "N", "S" })); contentPanel.add(cbLatDir); JLabel lblLongDegrees = new JLabel("Long Degrees"); lblLongDegrees.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLongDegrees); txtLongDegrees = new JTextField(); txtLongDegrees.setColumns(4); contentPanel.add(txtLongDegrees); JLabel lblLongDecMin = new JLabel("Long Dec Min"); lblLongDecMin.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLongDecMin); txtLongDecMin = new JTextField(); txtLongDecMin.setColumns(6); contentPanel.add(txtLongDecMin); JLabel lblLongMin = new JLabel("Long Min"); lblLongMin.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLongMin); txtLongMin = new JTextField(); txtLongMin.setColumns(6); contentPanel.add(txtLongMin); JLabel lblLongSec = new JLabel("Long Sec"); lblLongSec.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLongSec); txtLongSec = new JTextField(); txtLongSec.setColumns(6); contentPanel.add(txtLongSec); JLabel lblLongDir = new JLabel("Long E/W"); lblLongDir.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblLongDir); cbLongDir = new JComboBox<String>(); cbLongDir.setModel(new DefaultComboBoxModel<String>(new String[] { "E", "W" })); contentPanel.add(cbLongDir); JLabel lblDetBy = new JLabel("Determined By"); lblDetBy.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblDetBy); textFieldDetBy = new JTextField(); contentPanel.add(textFieldDetBy); textFieldDetBy.setColumns(10); JLabel lblDetDate = new JLabel("Date Determined"); lblDetDate.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblDetDate); try { textDetDate = new JFormattedTextField(new MaskFormatter("####-##-##")); } catch (ParseException e1) { textDetDate = new JFormattedTextField(); } textDetDate.setToolTipText("Date on which georeference was made yyyy-mm-dd"); contentPanel.add(textDetDate); JLabel lblRef = new JLabel("Reference Source"); lblRef.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblRef); textRefSource = new JTextField(); contentPanel.add(textRefSource); textRefSource.setColumns(10); lblNewLabel = new JLabel("Remarks"); lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT); contentPanel.add(lblNewLabel); textFieldRemarks = new JTextField(); contentPanel.add(textFieldRemarks); textFieldRemarks.setColumns(10); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { lblErrorLabel = new JLabel("Message"); buttonPane.add(lblErrorLabel); } { okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { lblErrorLabel.setText(""); if (saveData()) { setVisible(false); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadData(); setVisible(false); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:org.geopublishing.atlasStyler.classification.FeatureClassification.java
/** * Return a cached {@link ComboBoxModel} that present all available * attributes. Its connected to the//from w w w. jav a 2 s . c om */ public ComboBoxModel getValueFieldsComboBoxModel() { if (valueAttribsComboBoxModel == null) valueAttribsComboBoxModel = new DefaultComboBoxModel( FeatureUtil.getNumericalFieldNames(getStyledFeatures().getSchema(), false).toArray()); return valueAttribsComboBoxModel; }
From source file:net.sf.taverna.t2.workbench.views.results.workflow.RenderedResultComponent.java
/** * Update the component based on the node selected from the * ResultViewComponent tree.//from w ww . j a v a 2 s. co m */ public void updateResult() { if (recognisedRenderersForMimeType == null) recognisedRenderersForMimeType = new ArrayList<>(); if (otherRenderers == null) otherRenderers = new ArrayList<>(); // Enable the combo box renderersComboBox.setEnabled(true); /* * Update the 'save result' buttons appropriately as the result node had * changed */ for (int i = 0; i < saveButtonsPanel.getComponents().length; i++) { JButton saveButton = (JButton) saveButtonsPanel.getComponent(i); SaveIndividualResultSPI action = (SaveIndividualResultSPI) saveButton.getAction(); // Update the action with the new result reference action.setResultReference(path); saveButton.setEnabled(true); } if (DataBundles.isValue(path) || DataBundles.isReference(path)) { // Enable refresh button refreshButton.setEnabled(true); List<MimeType> mimeTypes = new ArrayList<>(); try (InputStream inputstream = getInputStream(path)) { mimeTypes.addAll(getMimeTypes(inputstream)); } catch (IOException e) { logger.warn("Error getting mimetype", e); } if (mimeTypes.isEmpty()) // If MIME types is empty - add "plain/text" MIME type mimeTypes.add(new MimeType("text/plain")); else if (mimeTypes.size() == 1 && mimeTypes.get(0).toString().equals("chemical/x-fasta")) { /* * If MIME type is recognised as "chemical/x-fasta" only then * this might be an error from MIME magic (i.e., sometimes it * recognises stuff that is not "chemical/x-fasta" as * "chemical/x-fasta" and then Seq Vista renderer is used that * causes errors) - make sure we also add the renderers for * "text/plain" and "text/xml" as it is most probably just * normal xml text and push the "chemical/x-fasta" to the bottom * of the list. */ mimeTypes.add(0, new MimeType("text/plain")); mimeTypes.add(1, new MimeType("text/xml")); } for (MimeType mimeType : mimeTypes) { List<Renderer> renderersList = rendererRegistry.getRenderersForMimeType(mimeType.toString()); for (Renderer renderer : renderersList) if (!recognisedRenderersForMimeType.contains(renderer)) recognisedRenderersForMimeType.add(renderer); } // if there are no renderers then force text/plain if (recognisedRenderersForMimeType.isEmpty()) recognisedRenderersForMimeType = rendererRegistry.getRenderersForMimeType("text/plain"); /* * Add all other available renderers that are not recognised to be * able to handle the MIME type of the result */ otherRenderers = new ArrayList<>(rendererRegistry.getRenderers()); otherRenderers.removeAll(recognisedRenderersForMimeType); mimeList = new String[recognisedRenderersForMimeType.size() + otherRenderers.size()]; rendererList = new ArrayList<>(); /* * First add the ones that can handle the MIME type of the result * item */ for (int i = 0; i < recognisedRenderersForMimeType.size(); i++) { mimeList[i] = recognisedRenderersForMimeType.get(i).getType(); rendererList.add(recognisedRenderersForMimeType.get(i)); } // Then add the other renderers just in case for (int i = 0; i < otherRenderers.size(); i++) { mimeList[recognisedRenderersForMimeType.size() + i] = otherRenderers.get(i).getType(); rendererList.add(otherRenderers.get(i)); } renderersComboBox.setModel(new DefaultComboBoxModel<String>(mimeList)); if (mimeList.length > 0) { int index = 0; // Find the index of the current MIME type for this output port. for (int i = 0; i < mimeList.length; i++) if (mimeList[i].equals(lastUsedMIMEtype)) { index = i; break; } int previousindex = renderersComboBox.getSelectedIndex(); renderersComboBox.setSelectedIndex(index); /* * force rendering as setSelectedIndex will not fire an * itemstatechanged event if previousindex == index and we still * need render the result as we may have switched from a * different result item in a result list but the renderer index * stayed the same */ if (previousindex == index) renderResult(); // draw the rendered result component } } else if (DataBundles.isError(path)) { // Disable refresh button refreshButton.setEnabled(false); // Hide wrap text check box - only works for actual data wrapTextCheckBox.setVisible(false); // Reset the renderers as we have an error item recognisedRenderersForMimeType = null; otherRenderers = null; DefaultMutableTreeNode root = new DefaultMutableTreeNode("Error Trace"); try { ErrorDocument errorDocument = DataBundles.getError(path); try { buildErrorDocumentTree(root, errorDocument); } catch (IOException e) { logger.warn("Error building error document tree", e); } } catch (IOException e) { logger.warn("Error getting the error document", e); } JTree errorTree = new JTree(root); errorTree.setCellRenderer(new DefaultTreeCellRenderer() { @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component renderer = null; if (value instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; Object userObject = treeNode.getUserObject(); if (userObject instanceof ErrorDocument) renderer = renderErrorDocument(tree, selected, expanded, leaf, row, hasFocus, (ErrorDocument) userObject); } if (renderer == null) renderer = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); if (renderer instanceof JLabel) { JLabel label = (JLabel) renderer; label.setIcon(null); } return renderer; } private Component renderErrorDocument(JTree tree, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus, ErrorDocument errorDocument) { return super.getTreeCellRendererComponent(tree, "<html>" + escapeHtml(errorDocument.getMessage()) + "</html>", selected, expanded, leaf, row, hasFocus); } }); renderersComboBox.setModel(new DefaultComboBoxModel<>(new String[] { ERROR_DOCUMENT })); renderedResultPanel.removeAll(); renderedResultPanel.add(errorTree, CENTER); repaint(); } }
From source file:org.gwaspi.gui.reports.ManhattanPlotZoom.java
private void initGUI() { setCursor(CursorUtils.WAIT_CURSOR);/*from w ww .j av a2 s . co m*/ pnl_ChartNavigator = new JPanel(); pnl_Chart = new JPanel(); pnl_SearchDB = new JPanel(); cmb_SearchDB = new JComboBox(); scrl_Chart = new JScrollPane(); pnl_Footer = new JPanel(); pnl_FooterGroup1 = new JPanel(); btn_Save = new JButton(); btn_Reset = new JButton(); btn_Back = new JButton(); btn_Back2 = new JButton(); final String titlePlot; if (origMarkerKey == null) { titlePlot = ": Chr" + currentChr + " - Pos: " + startPhysPos + " to " + (startPhysPos + requestedPosWindow); } else { titlePlot = ": " + origMarkerKey.toString() + " - Chr" + currentChr; } pnl_ChartNavigator .setBorder(GWASpiExplorerPanel.createMainTitledBorder("Manhattan Plot Navigator" + titlePlot)); // NOI18N pnl_Chart.setBorder(GWASpiExplorerPanel.createLineBorder()); scrl_Chart.getViewport().add(zoomPanel); pnl_Chart.add(scrl_Chart, BorderLayout.CENTER); // <editor-fold defaultstate="expanded" desc="LAYOUT1"> GroupLayout pnl_ChartLayout = new GroupLayout(pnl_Chart); pnl_Chart.setLayout(pnl_ChartLayout); pnl_ChartLayout.setHorizontalGroup(pnl_ChartLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(scrl_Chart, GroupLayout.DEFAULT_SIZE, 812, Short.MAX_VALUE)); pnl_ChartLayout.setVerticalGroup(pnl_ChartLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(scrl_Chart, GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)); GroupLayout pnl_ChartNavigatorLayout = new GroupLayout(pnl_ChartNavigator); pnl_ChartNavigator.setLayout(pnl_ChartNavigatorLayout); pnl_ChartNavigatorLayout.setHorizontalGroup(pnl_ChartNavigatorLayout .createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, pnl_ChartNavigatorLayout .createSequentialGroup().addContainerGap().addComponent(pnl_Chart, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); pnl_ChartNavigatorLayout .setVerticalGroup(pnl_ChartNavigatorLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_ChartNavigatorLayout .createSequentialGroup().addContainerGap().addComponent(pnl_Chart, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); // </editor-fold> String lblChr = "Chr "; Long currPos = 0L; lblChr += currentChr; if (centerPhysPos > 0) { currPos = centerPhysPos; } else { currPos = Math.round((double) MARKERS_NUM_DEFAULT / 2); } //<editor-fold defaultstate="expanded" desc="TRACKER"> // pnl_Tracker.setBorder(GWASpiExplorerPanel.createRegularTitledBorder("Marker N on "+lblChr)); // // // slid_Tracker.setMaximum(max); // slid_Tracker.setValue(currPos); // slid_Tracker.addMouseListener(new event.MouseAdapter() { // public void mouseReleased(event.MouseEvent evt) { // actionSlide(); // } // }); // // GroupLayout pnl_TrackerLayout = new GroupLayout(pnl_Tracker); // pnl_Tracker.setLayout(pnl_TrackerLayout); // pnl_TrackerLayout.setHorizontalGroup( // pnl_TrackerLayout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(GroupLayout.Alignment.TRAILING, pnl_TrackerLayout.createSequentialGroup() // .addGap(18, 18, 18) // .addComponent(slid_Tracker, GroupLayout.DEFAULT_SIZE, 814, Short.MAX_VALUE) // .addContainerGap()) // ); // pnl_TrackerLayout.setVerticalGroup( // pnl_TrackerLayout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(pnl_TrackerLayout.createSequentialGroup() // .addContainerGap() // .addComponent(slid_Tracker, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) // ); //</editor-fold> //<editor-fold defaultstate="expanded" desc="EXTERNAL RESOURCE DBs"> pnl_SearchDB = new JPanel(); pnl_SearchDB.setBorder(GWASpiExplorerPanel.createRegularTitledBorder(Text.Reports.externalResourceDB)); cmb_SearchDB = new JComboBox(); cmb_SearchDB.setModel(new DefaultComboBoxModel(LinksExternalResouces.getLinkNames())); GroupLayout pnl_SearchDBLayout = new GroupLayout(pnl_SearchDB); pnl_SearchDB.setLayout(pnl_SearchDBLayout); pnl_SearchDBLayout.setHorizontalGroup(pnl_SearchDBLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_SearchDBLayout.createSequentialGroup().addContainerGap() .addComponent(cmb_SearchDB, 0, 614, Short.MAX_VALUE).addContainerGap())); pnl_SearchDBLayout.setVerticalGroup(pnl_SearchDBLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_SearchDBLayout .createSequentialGroup().addComponent(cmb_SearchDB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(14, Short.MAX_VALUE))); //</editor-fold> btn_Save.setAction(new SampleQAHetzygPlotZoom.SaveAsAction("zoom_" + origMarkerKey + ".png", scrl_Chart, zoomChart, this)); btn_Reset.setAction(new ResetAction(testOpKey)); btn_Back.setAction(new BackToTableAction()); btn_Back2.setAction(new BackToManhattanPlotAction()); // <editor-fold defaultstate="expanded" desc="FOOTER"> GroupLayout pnl_FooterGroup1Layout = new GroupLayout(pnl_FooterGroup1); pnl_FooterGroup1.setLayout(pnl_FooterGroup1Layout); pnl_FooterGroup1Layout.setHorizontalGroup(pnl_FooterGroup1Layout .createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterGroup1Layout.createSequentialGroup().addContainerGap() .addComponent(btn_Reset, GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(btn_Save, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE) .addContainerGap())); pnl_FooterGroup1Layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { btn_Reset, btn_Save }); pnl_FooterGroup1Layout .setVerticalGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterGroup1Layout.createSequentialGroup() .addGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(btn_Save).addComponent(btn_Reset)) .addContainerGap(16, Short.MAX_VALUE))); pnl_FooterGroup1Layout.linkSize(SwingConstants.VERTICAL, new Component[] { btn_Reset, btn_Save }); GroupLayout pnl_FooterLayout = new GroupLayout(pnl_Footer); pnl_Footer.setLayout(pnl_FooterLayout); pnl_FooterLayout.setHorizontalGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterLayout.createSequentialGroup().addContainerGap().addComponent(btn_Back) .addGap(18, 18, 18).addComponent(btn_Back2) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 368, Short.MAX_VALUE) .addComponent(pnl_FooterGroup1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); pnl_FooterLayout.setVerticalGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterLayout.createSequentialGroup().addContainerGap().addGroup(pnl_FooterLayout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterLayout.createSequentialGroup() .addGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(btn_Back).addComponent(btn_Back2)) .addGap(71, 71, 71)) .addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterLayout.createSequentialGroup() .addComponent(pnl_FooterGroup1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(55, 55, 55))))); // </editor-fold> // <editor-fold defaultstate="expanded" desc="LAYOUT"> // GroupLayout layout = new GroupLayout(this); // this.setLayout(layout); // layout.setHorizontalGroup( // layout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() // .addContainerGap() // .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) // .addComponent(pnl_Tracker, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) // .addComponent(pnl_ChartNavigator, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) // .addComponent(pnl_Footer, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) // .addContainerGap()) // ); // layout.setVerticalGroup( // layout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(layout.createSequentialGroup() // .addComponent(pnl_ChartNavigator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) // .addComponent(pnl_Tracker, GroupLayout.PREFERRED_SIZE, 86, GroupLayout.PREFERRED_SIZE) // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) // .addComponent(pnl_Footer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) // ); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pnl_SearchDB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(pnl_ChartNavigator, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnl_Footer, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pnl_ChartNavigator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnl_SearchDB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(pnl_Footer, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap())); // </editor-fold> setCursor(CursorUtils.DEFAULT_CURSOR); }
From source file:net.sf.taverna.t2.workbench.views.results.processor.RenderedProcessorResultComponent.java
/** * Update the component based on the node selected from the * ResultViewComponent tree.//w w w . j a v a 2 s . c o m */ public void updateResult() { if (recognisedRenderersForMimeType == null) recognisedRenderersForMimeType = new ArrayList<>(); if (otherRenderers == null) otherRenderers = new ArrayList<>(); ProcessorResultTreeNode result = (ProcessorResultTreeNode) node; // Reference to the result data path = result.getReference(); // Enable the combo box renderersComboBox.setEnabled(true); /* * Update the 'save result' buttons appropriately as the result node had * changed */ for (int i = 0; i < saveButtonsPanel.getComponents().length; i++) { JButton saveButton = (JButton) saveButtonsPanel.getComponent(i); SaveIndividualResultSPI action = (SaveIndividualResultSPI) (saveButton.getAction()); // Update the action with the new result reference action.setResultReference(path); saveButton.setEnabled(true); } if (DataBundles.isValue(path) || DataBundles.isReference(path)) { // Enable refresh button refreshButton.setEnabled(true); List<MimeType> mimeTypes = new ArrayList<>(); try (InputStream inputstream = RendererUtils.getInputStream(path)) { mimeTypes.addAll(getMimeTypes(inputstream)); } catch (IOException e) { logger.warn("Error getting mimetype", e); } if (mimeTypes.isEmpty()) { // If MIME types is empty - add "plain/text" MIME type mimeTypes.add(new MimeType("text/plain")); } else if (mimeTypes.size() == 1 && mimeTypes.get(0).toString().equals("chemical/x-fasta")) { /* * If MIME type is recognised as "chemical/x-fasta" only then * this might be an error from MIME magic (i.e., sometimes it * recognises stuff that is not "chemical/x-fasta" as * "chemical/x-fasta" and then Seq Vista renderer is used that * causes errors) - make sure we also add the renderers for * "text/plain" and "text/xml" as it is most probably just * normal xml text and push the "chemical/x-fasta" to the bottom * of the list. */ mimeTypes.add(0, new MimeType("text/plain")); mimeTypes.add(1, new MimeType("text/xml")); } for (MimeType mimeType : mimeTypes) for (Renderer renderer : rendererRegistry.getRenderersForMimeType(mimeType.toString())) if (!recognisedRenderersForMimeType.contains(renderer)) recognisedRenderersForMimeType.add(renderer); // if there are no renderers then force text/plain if (recognisedRenderersForMimeType.isEmpty()) recognisedRenderersForMimeType = rendererRegistry.getRenderersForMimeType("text/plain"); /* * Add all other available renderers that are not recognised to be * able to handle the MIME type of the result */ otherRenderers = rendererRegistry.getRenderers(); otherRenderers.removeAll(recognisedRenderersForMimeType); mimeList = new String[recognisedRenderersForMimeType.size() + otherRenderers.size()]; rendererList = new ArrayList<>(); /* * First add the ones that can handle the MIME type of the result * item */ for (int i = 0; i < recognisedRenderersForMimeType.size(); i++) { mimeList[i] = recognisedRenderersForMimeType.get(i).getType(); rendererList.add(recognisedRenderersForMimeType.get(i)); } // Then add the other renderers just in case for (int i = 0; i < otherRenderers.size(); i++) { mimeList[recognisedRenderersForMimeType.size() + i] = otherRenderers.get(i).getType(); rendererList.add(otherRenderers.get(i)); } renderersComboBox.setModel(new DefaultComboBoxModel<>(mimeList)); if (mimeList.length > 0) { int index = 0; // Find the index of the current MIME type for this output port. for (int i = 0; i < mimeList.length; i++) if (mimeList[i].equals(lastUsedMIMEtype)) { index = i; break; } int previousindex = renderersComboBox.getSelectedIndex(); renderersComboBox.setSelectedIndex(index); /* * force rendering as setSelectedIndex will not fire an * itemstatechanged event if previousindex == index and we still * need render the result as we may have switched from a * different result item in a result list but the renderer index * stayed the same */ if (previousindex == index) renderResult(); // draw the rendered result component } } else if (DataBundles.isError(path)) { // Disable refresh button refreshButton.setEnabled(false); @SuppressWarnings("unused") ErrorDocument errorDocument; try { errorDocument = DataBundles.getError(path); } catch (IOException e) { logger.warn("Error getting the error document", e); } // Reset the renderers as we have an error item recognisedRenderersForMimeType = null; otherRenderers = null; DefaultMutableTreeNode root = new DefaultMutableTreeNode("Error Trace"); // TODO handle error documents // ResultsUtils.buildErrorDocumentTree(root, errorDocument, referenceService); JTree errorTree = new JTree(root); errorTree.setCellRenderer(new DefaultTreeCellRenderer() { @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { Component renderer = null; if (value instanceof DefaultMutableTreeNode) { Object userObject = ((DefaultMutableTreeNode) value).getUserObject(); if (userObject instanceof ErrorDocument) renderer = getErrorDocumentRenderer(tree, selected, expanded, leaf, row, hasFocus, (ErrorDocument) userObject); } if (renderer == null) renderer = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); if (renderer instanceof JLabel) { JLabel label = (JLabel) renderer; label.setIcon(null); } return renderer; } private Component getErrorDocumentRenderer(JTree tree, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus, ErrorDocument errorDocument) { return super.getTreeCellRendererComponent(tree, "<html>" + escapeHtml(errorDocument.getMessage()) + "</html>", selected, expanded, leaf, row, hasFocus); } }); renderersComboBox.setModel(new DefaultComboBoxModel<>(new String[] { ERROR_DOCUMENT })); renderedResultPanel.removeAll(); renderedResultPanel.add(errorTree, CENTER); repaint(); } }
From source file:com.cch.aj.entryrecorder.frame.SettingsJFrame.java
private void UpdateTabMould(int id) { int selectedIndex = FillMouldComboBox(this.cbMould, id); if (selectedIndex >= 0) { Mould currentMould = ((ComboBoxItem<Mould>) this.cbMould.getSelectedItem()).getItem(); this.settingMouldId = currentMould.getId(); this.settingMould = currentMould; ///* w w w. ja v a 2 s . c o m*/ this.UpdateMouldUI(currentMould); } else { this.cbMould.setModel(new DefaultComboBoxModel(new ComboBoxItem[] {})); this.UpdateMouldUI(new Mould()); } if (this.cbMould.getSelectedItem() == null || ((ComboBoxItem<Mould>) this.cbMould.getSelectedItem()).getId() == 0) { this.pnlEditMould.setVisible(false); this.btnMouldDelete.setVisible(false); this.btnMouldDuplicate.setVisible(false); this.btnMouldSave.setVisible(false); this.btnMouldUndo.setVisible(false); } else { this.pnlEditMould.setVisible(true); this.btnMouldDelete.setVisible(true); this.btnMouldDuplicate.setVisible(true); this.btnMouldSave.setVisible(true); this.btnMouldUndo.setVisible(true); } }
From source file:com.all.login.LoginModule.java
private Window createLoaderWindow(Messages messages, LoginFrame originalFrame, LoginMainPanel loginPanel) { loaderFrame = new LoginFrame(messages); loaderFrame.getContentPane().setName("loginPanel"); loaderFrame.getContentPane().setLayout(new BorderLayout()); LoaderLoginPanel loaderLoginPanel = new LoaderLoginPanel(); loaderLoginPanel.internationalize(messages); loaderTopPanel = new TopPanelLogin(); loaderTopPanel.internationalize(messages); loaderTopPanel.getPasswordField().setText("a1b2c3d4e5f6"); loaderTopPanel.getUserComboBox().setEnabled(false); loaderTopPanel.getCheckBoxRemember().setEnabled(false); loaderTopPanel.getPasswordField().setEnabled(false); loaderTopPanel.getUserComboBox().setEnabled(false); loaderTopPanel.getForgotLabel().setEnabled(false); loaderFrame.add(loaderTopPanel, BorderLayout.NORTH); loaderFrame.add(loaderLoginPanel, BorderLayout.CENTER); if (originalFrame != null) { loaderFrame.setLocation(originalFrame.getLocation()); }/*from w ww .j a v a 2s . c om*/ if (loginPanel != null) { List<String> comboModel = new ArrayList<String>(); comboModel.add(loginPanel.getTopPanel().getUserComboBox().getSelectedItem().toString()); loaderTopPanel.getUserComboBox().setModel(new DefaultComboBoxModel(comboModel.toArray())); loaderTopPanel.getCheckBoxRemember() .setSelected(loginPanel.getTopPanel().getCheckBoxRemember().isSelected()); } return loaderFrame; }
From source file:cz.muni.fi.fresneleditor.common.reposconf.NamespacesConfigurationJPanel.java
/** * Loads the list of available repositories configurations from context * holder and sets this as a model to {@link #repositoriesCombo}. *//* ww w .j a v a2 s .c om*/ private void updateRepositoriesCombo() { ApplicationConfiguration appConf = ContextHolder.getInstance().getApplicationConfiguration(); List<String> v = new ArrayList<String>(); for (String repositoryName : appConf.getRepositoryConfigurations().keySet()) { RepositoryConfiguration repositoryConfiguration = appConf.getRepositoryConfigurations() .get(repositoryName); if (repositoryConfiguration.getLocation() != null && !"".equals(repositoryConfiguration.getLocation())) { v.add(repositoryName); } } Collections.sort(v); repositoriesCombo.setModel(new DefaultComboBoxModel(v.toArray())); if (!v.isEmpty()) { repositoriesCombo.setSelectedIndex(0); } }
From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java
/** * Initialize GUI components.// w w w .j a v a 2 s . c o m */ @SuppressWarnings({ "rawtypes", "unchecked" }) private void initGUI() { App.init(); // setBounds(100, 100, 972, 439); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setIconImage(Builder.getApplicationIcon()); setTitle("Sample Size Analysis"); getContentPane().setLayout(new MigLayout("", "[1136px,grow,fill]", "[30px][405px,grow]")); JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); getContentPane().add(toolBar, "cell 0 0,growx,aligny top"); JToolBarButton btnOpen = new JToolBarButton(actionBrowse); btnOpen.setIcon(Builder.getImageIcon("fileopen.png")); toolBar.add(btnOpen); JToolBarButton btnSave = new JToolBarButton(actionSaveTable); btnSave.setIcon(Builder.getImageIcon("save.png")); toolBar.add(btnSave); JToolBarButton btnExportPDF = new JToolBarButton(actionExportPDF); btnExportPDF.setIcon(Builder.getImageIcon("pdf.png")); toolBar.add(btnExportPDF); JToolBarButton btnExportPNG = new JToolBarButton(actionExportPNG); btnExportPNG.setIcon(Builder.getImageIcon("formatpng.png")); toolBar.add(btnExportPNG); toolBar.addSeparator(); JToolBarButton btnRun = new JToolBarButton(actionRun); btnRun.setIcon(Builder.getImageIcon("run.png")); toolBar.add(btnRun); JPanel panelMain = new JPanel(); getContentPane().add(panelMain, "cell 0 1,grow"); panelMain.setLayout(new BorderLayout(0, 0)); JSplitPane splitPaneMain = new JSplitPane(); splitPaneMain.setOneTouchExpandable(true); panelMain.add(splitPaneMain); JPanel panelParameters = new JPanel(); splitPaneMain.setLeftComponent(panelParameters); panelParameters.setLayout(new MigLayout("", "[grow,right]", "[][][][193.00,grow,fill][]")); JPanel panelInput = new JPanel(); panelInput.setBorder(new TitledBorder(null, "Input", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelParameters.add(panelInput, "cell 0 0,grow"); panelInput.setLayout(new MigLayout("", "[100px:100px:180px,right][grow,fill][]", "[]")); JLabel lblInputFile = new JLabel("Input file:"); panelInput.add(lblInputFile, "cell 0 0"); txtInputFile = new JTextField(); panelInput.add(txtInputFile, "cell 1 0,growx"); txtInputFile.setActionCommand("NewFileTyped"); txtInputFile.addActionListener(this); txtInputFile.setColumns(10); JButton btnBrowse = new JButton(""); panelInput.add(btnBrowse, "cell 2 0"); btnBrowse.setAction(actionBrowse); btnBrowse.setText(""); btnBrowse.setIcon(Builder.getImageIcon("fileopen16.png")); btnBrowse.setPreferredSize(new Dimension(25, 25)); btnBrowse.setMaximumSize(new Dimension(25, 25)); btnBrowse.putClientProperty("JButton.buttonType", "segmentedTextured"); btnBrowse.putClientProperty("JButton.segmentPosition", "middle"); JPanel panelAnalysisOptions = new JPanel(); panelAnalysisOptions.setBorder(new TitledBorder(null, "Analysis and filtering options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelParameters.add(panelAnalysisOptions, "cell 0 1,grow"); panelAnalysisOptions.setLayout(new MigLayout("", "[100px:100px:180px,right][grow][][]", "[][][][][]")); JLabel lblEventTypes = new JLabel("Event type:"); panelAnalysisOptions.add(lblEventTypes, "cell 0 0"); cboEventType = new JComboBox(); panelAnalysisOptions.add(cboEventType, "cell 1 0 3 1"); cboEventType.setModel(new DefaultComboBoxModel(EventTypeToProcess.values())); new EventTypeWrapper(cboEventType, PrefKey.EVENT_TYPE_TO_PROCESS, EventTypeToProcess.FIRE_EVENT); chkCommonYears = new JCheckBox("<html>Only analyze years all series have in common"); chkCommonYears.setEnabled(false); new CheckBoxWrapper(chkCommonYears, PrefKey.SSIZ_CHK_COMMON_YEARS, false); panelAnalysisOptions.add(chkCommonYears, "cell 1 1 3 1"); chkExcludeSeriesWithNoEvents = new JCheckBox("<html>Exclude series/segments with no events"); chkExcludeSeriesWithNoEvents.setEnabled(false); new CheckBoxWrapper(chkExcludeSeriesWithNoEvents, PrefKey.SSIZ_CHK_EXCLUDE_SERIES_WITH_NO_EVENTS, false); panelAnalysisOptions.add(chkExcludeSeriesWithNoEvents, "cell 1 2 3 1"); JLabel lblThresholdType = new JLabel("Threshold:"); panelAnalysisOptions.add(lblThresholdType, "cell 0 3"); cboThresholdType = new JComboBox(); panelAnalysisOptions.add(cboThresholdType, "cell 1 3"); cboThresholdType.setModel(new DefaultComboBoxModel(FireFilterType.values())); new FireFilterTypeWrapper(cboThresholdType, PrefKey.COMPOSITE_FILTER_TYPE_WITH_ALL_TREES, FireFilterType.NUMBER_OF_EVENTS); JLabel label = new JLabel(">="); panelAnalysisOptions.add(label, "flowx,cell 2 3"); spnThresholdValueGT = new JSpinner(); panelAnalysisOptions.add(spnThresholdValueGT, "cell 3 3"); spnThresholdValueGT.setModel(new SpinnerNumberModel(1, 1, 999, 1)); new SpinnerWrapper(spnThresholdValueGT, PrefKey.COMPOSITE_FILTER_VALUE, 1); chkEnableLessThan = new JCheckBox(""); chkEnableLessThan.setActionCommand("LessThanThresholdStatus"); chkEnableLessThan.addActionListener(this); panelAnalysisOptions.add(chkEnableLessThan, "flowx,cell 1 4,alignx right"); lblLessThan = new JLabel("<="); lblLessThan.setEnabled(false); panelAnalysisOptions.add(lblLessThan, "cell 2 4"); spnThresholdValueLT = new JSpinner(); spnThresholdValueLT.setEnabled(false); spnThresholdValueLT.setModel(new SpinnerNumberModel(1, 1, 999, 1)); panelAnalysisOptions.add(spnThresholdValueLT, "cell 3 4"); lblAnd = new JLabel("and"); panelAnalysisOptions.add(lblAnd, "cell 1 4"); JPanel panelSimulations = new JPanel(); panelSimulations.setBorder( new TitledBorder(null, "Simulations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelParameters.add(panelSimulations, "cell 0 2,grow"); panelSimulations.setLayout(new MigLayout("", "[100px:100px:180px,right][fill]", "[][][]")); JLabel lblSimulations = new JLabel("Simulations:"); panelSimulations.add(lblSimulations, "cell 0 0"); spnSimulations = new JSpinner(); panelSimulations.add(spnSimulations, "cell 1 0"); spnSimulations.setModel(new SpinnerNumberModel(new Integer(1000), new Integer(1), null, new Integer(1))); new SpinnerWrapper(spnSimulations, PrefKey.SSIZ_SIMULATION_COUNT, 1000); JLabel lblSeedNumber = new JLabel("Seed number:"); panelSimulations.add(lblSeedNumber, "cell 0 1"); spnSeed = new JSpinner(); panelSimulations.add(spnSeed, "cell 1 1"); spnSeed.setModel(new SpinnerNumberModel(new Integer(30188), null, null, new Integer(1))); new SpinnerWrapper(spnSeed, PrefKey.SSIZ_SEED_NUMBER, 30188); JLabel lblResampling = new JLabel("Resampling:"); panelSimulations.add(lblResampling, "cell 0 2"); cboResampling = new JComboBox(); panelSimulations.add(cboResampling, "cell 1 2"); cboResampling .setModel(new DefaultComboBoxModel(new String[] { "With replacement", "Without replacement" })); new ResamplingTypeWrapper(cboResampling, PrefKey.SSIZ_RESAMPLING_TYPE, ResamplingType.WITH_REPLACEMENT); segmentationPanel = new SegmentationPanel(); segmentationPanel.chkSegmentation.setText("Process subset or segments of dataset?"); segmentationPanel.chkSegmentation.setEnabled(false); panelParameters.add(segmentationPanel, "cell 0 3,growx"); JPanel panel_3 = new JPanel(); panelParameters.add(panel_3, "cell 0 4,grow"); panel_3.setLayout(new MigLayout("", "[left][grow][right]", "[]")); JButton btnReset = new JButton("Reset"); btnReset.setActionCommand("Reset"); btnReset.addActionListener(this); panel_3.add(btnReset, "cell 0 0,grow"); JButton btnRunAnalysis = new JButton("Run Analysis"); btnRunAnalysis.setAction(actionRun); panel_3.add(btnRunAnalysis, "cell 2 0,grow"); JPanel panelResults = new JPanel(); splitPaneMain.setRightComponent(panelResults); panelResults.setLayout(new BorderLayout(0, 0)); splitPaneResults = new JSplitPane(); splitPaneResults.setResizeWeight(0.5); splitPaneResults.setOneTouchExpandable(true); splitPaneResults.setDividerLocation(0.5d); panelResults.add(splitPaneResults, BorderLayout.CENTER); splitPaneResults.setOrientation(JSplitPane.VERTICAL_SPLIT); JPanel panelResultsTop = new JPanel(); splitPaneResults.setLeftComponent(panelResultsTop); panelResultsTop.setLayout(new BorderLayout(0, 0)); JPanel panelChartOptions = new JPanel(); panelChartOptions.setBackground(Color.WHITE); panelResultsTop.add(panelChartOptions, BorderLayout.SOUTH); panelChartOptions.setLayout(new MigLayout("", "[][][][][][grow][grow]", "[15px,center]")); JLabel lblNewLabel = new JLabel("Plot:"); panelChartOptions.add(lblNewLabel, "cell 0 0,alignx trailing,aligny center"); cboChartMetric = new JComboBox(); cboChartMetric.setEnabled(false); cboChartMetric.setModel(new DefaultComboBoxModel(MiddleMetric.values())); panelChartOptions.add(cboChartMetric, "cell 1 0,growx"); cboChartMetric.setBackground(Color.WHITE); JLabel lblOfSegment = new JLabel("of segment:"); panelChartOptions.add(lblOfSegment, "cell 2 0,alignx trailing"); cboSegment = new JComboBox(); cboSegment.setBackground(Color.WHITE); cboSegment.setActionCommand("UpdateChart"); cboSegment.addActionListener(this); panelChartOptions.add(cboSegment, "cell 3 0,growx"); cboChartMetric.setActionCommand("UpdateChart"); JLabel lblWithAsymptoteType = new JLabel("with asymptote type:"); panelChartOptions.add(lblWithAsymptoteType, "cell 4 0,alignx trailing"); JComboBox comboBox = new JComboBox(); comboBox.setEnabled(false); comboBox.setModel(new DefaultComboBoxModel(new String[] { "none", "Weibull", "Michaelis-Menten", "Modified Michaelis-Menten", "Logistic", "Modified exponential" })); comboBox.setBackground(Color.WHITE); panelChartOptions.add(comboBox, "cell 5 0,growx"); cboChartMetric.addActionListener(this); panelChart = new JPanel(); panelChart.setMinimumSize(new Dimension(200, 200)); panelResultsTop.add(panelChart, BorderLayout.CENTER); panelChart.setLayout(new BorderLayout(0, 0)); panelChart.setBackground(Color.WHITE); JTabbedPane panelResultsBottom = new JTabbedPane(JTabbedPane.BOTTOM); splitPaneResults.setRightComponent(panelResultsBottom); simulationsTable = new SSIZResultsTable(); simulationsTable.setEnabled(false); simulationsTable.addMouseListener(new TablePopClickListener()); simulationsTable.setVisibleRowCount(10); adapter = new JTableSpreadsheetByRowAdapter(simulationsTable); scrollPaneSimulations = new JScrollPane(); panelResultsBottom.addTab("Simulations", null, scrollPaneSimulations, null); scrollPaneSimulations.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPaneSimulations.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneSimulations.setViewportView(simulationsTable); JPanel panelAsymptote = new JPanel(); asymptoteTable = new AsymptoteTable(); asymptoteTable.setEnabled(false); // asymptoteTable.addMouseListener(new TablePopClickListener()); asymptoteTable.setVisibleRowCount(10); scrollPaneAsymptote = new JScrollPane(); scrollPaneAsymptote.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPaneAsymptote.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPaneAsymptote.setViewportView(asymptoteTable); panelAsymptote.setLayout(new BorderLayout()); panelAsymptote.add(scrollPaneAsymptote, BorderLayout.CENTER); panelResultsBottom.addTab("Asymptote", null, panelAsymptote, null); // Disable asymptote tab until it is implemented panelResultsBottom.setEnabledAt(1, false); panelProgressBar = new JPanel(); panelProgressBar.setLayout(new BorderLayout()); btnCancelAnalysis = new JButton("Cancel"); btnCancelAnalysis.setIcon(Builder.getImageIcon("delete.png")); btnCancelAnalysis.setVisible(false); btnCancelAnalysis.setActionCommand("CancelAnalysis"); btnCancelAnalysis.addActionListener(this); progressBar = new JProgressBar(); panelProgressBar.add(progressBar, BorderLayout.CENTER); panelProgressBar.add(btnCancelAnalysis, BorderLayout.EAST); progressBar.setStringPainted(true); fileDialogWasUsed = false; mouseListenersActive = false; this.setGUIForFHFileReader(); this.setGUIForThresholdStatus(); pack(); this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); setVisible(true); }
From source file:com.mycompany.listBoxer.panel.ListBoxerForm.java
private void AlphabeticCheckBoxActionPerformed(ActionEvent evt) { try {/*from w w w. ja v a2 s. c o m*/ jTextField1.setValue(StringUtils.EMPTY); factory.setDefaultFormatter((new MaskFormatter("????"))); jTextField1.setFormatterFactory(factory); } catch (ParseException e) { e.getMessage(); } RangeComboBox.setModel(new DefaultComboBoxModel<String>( new String[] { RangeType.ALL.getKey(), RangeType.AM.getKey(), RangeType.NZ.getKey() })); }