/** * Initialize the contents * * @param showDialog true to show the dialog */ private void doMakeContents(boolean showDialog) { placementBox = new JComboBox(positions); colorSwatch = new ColorSwatchComponent( displayControl.getIdv().getStore(), myInfo.getLabelColor(), "Color Scale Label Color"); final JComponent colorComp = colorSwatch.getSetPanel(); visibilityCbx = new JCheckBox("", myInfo.getIsVisible()); unitCbx = new JCheckBox("Show Unit", myInfo.isUnitVisible()); alphaCbx = new JCheckBox("", myInfo.getUseAlpha()); fontSelector = new FontSelector(FontSelector.COMBOBOX_UI, false, false); fontSelector.setFont(myInfo.getLabelFont()); labelVisibilityCbx = new JCheckBox("Visible", myInfo.getLabelVisible()); labelVisibilityCbx.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { boolean showLabel = ((JCheckBox) e.getSource()).isSelected(); GuiUtils.enableTree(fontSelector.getComponent(), showLabel); GuiUtils.enableTree(colorComp, showLabel); } }); GuiUtils.tmpInsets = new Insets(4, 4, 4, 4); contents = GuiUtils.doLayout( new Component[] { GuiUtils.rLabel("Visible: "), visibilityCbx, // GuiUtils.leftRight(visibilityCbx, GuiUtils.flow( new Component[] {GuiUtils.rLabel(" // Show Transparency: "), alphaCbx})), GuiUtils.rLabel("Position: "), GuiUtils.leftRight(placementBox, GuiUtils.filler()), GuiUtils.rLabel("Labels: "), GuiUtils.leftRight(labelVisibilityCbx, GuiUtils.filler()), GuiUtils.filler(), GuiUtils.leftRight(unitCbx, GuiUtils.filler()), GuiUtils.filler(), GuiUtils.leftRight(GuiUtils.rLabel("Font: "), fontSelector.getComponent()), GuiUtils.filler(), GuiUtils.leftRight( GuiUtils.rLabel("Color: "), GuiUtils.leftRight(colorComp, GuiUtils.filler())), }, 2, GuiUtils.WT_NY, GuiUtils.WT_N); contents = GuiUtils.leftRight(contents, GuiUtils.filler()); if (showDialog) { JPanel buttons; if (displayControl != null) { buttons = GuiUtils.makeApplyOkCancelButtons(this); } else { buttons = GuiUtils.makeOkCancelButtons(this); } dialog.getContentPane().add(GuiUtils.centerBottom(contents, buttons)); GuiUtils.packInCenter(dialog); } }
/** * add to properties * * @param comps comps */ public void getPropertiesComponents(List comps) { super.getPropertiesComponents(comps); binWidthField = new TimeLengthField("Bin Width", true); binRoundToField = new TimeLengthField("Bin Round To", true); binWidthField.setTime(binWidth); binRoundToField.setTime(binRoundTo); List roundToItems = Misc.toList( new Object[] { new TwoFacedObject("Change", new Double(0)), new TwoFacedObject("On the hour", new Double(60)), new TwoFacedObject("5 after", new Double(5)), new TwoFacedObject("10 after", new Double(10)), new TwoFacedObject("15 after", new Double(15)), new TwoFacedObject("20 after", new Double(20)), new TwoFacedObject("30 after", new Double(30)), new TwoFacedObject("45 after", new Double(45)), new TwoFacedObject("10 to", new Double(50)), new TwoFacedObject("5 to", new Double(55)) }); roundToCbx = GuiUtils.makeComboBox( roundToItems, roundToItems.get(0), false, this, "setRoundToFromComboBox"); List widthItems = Misc.toList( new Object[] { new TwoFacedObject("Change", new Double(0)), new TwoFacedObject("5 minutes", new Double(5)), new TwoFacedObject("10 minutes", new Double(10)), new TwoFacedObject("15 minutes", new Double(15)), new TwoFacedObject("20 minutes", new Double(20)), new TwoFacedObject("30 minutes", new Double(30)), new TwoFacedObject("45 minutes", new Double(45)), new TwoFacedObject("1 hour", new Double(60)), new TwoFacedObject("6 hours", new Double(60 * 6)), new TwoFacedObject("12 hours", new Double(60 * 12)), new TwoFacedObject("1 day", new Double(60 * 24)) }); widthCbx = GuiUtils.makeComboBox(widthItems, widthItems.get(0), false, this, "setWidthFromComboBox"); comps.add(GuiUtils.filler()); comps.add(getPropertiesHeader("Time Binning")); comps.add(GuiUtils.rLabel("Bin Size:")); comps.add(GuiUtils.left(GuiUtils.hbox(binWidthField.getContents(), widthCbx, 5))); comps.add(GuiUtils.rLabel("Round To:")); comps.add(GuiUtils.left(GuiUtils.hbox(binRoundToField.getContents(), roundToCbx, 5))); }
/** * This method checks if the current server is valid. If it is valid then it checks if there is * authentication required * * @return true if the server exists and can be accessed */ protected boolean canAccessServer() { // Try reading the public.serv file to see if we need a username/proj JTextField projFld = null; JTextField userFld = null; JComponent contents = null; JLabel label = null; boolean firstTime = true; while (true) { int status = checkIfServerIsOk(); if (status == STATUS_OK) { break; } if (status == STATUS_ERROR) { setState(STATE_UNCONNECTED); return false; } if (projFld == null) { projFld = new JTextField("", 10); userFld = new JTextField("", 10); GuiUtils.tmpInsets = GuiUtils.INSETS_5; contents = GuiUtils.doLayout( new Component[] { GuiUtils.rLabel("User ID:"), userFld, GuiUtils.rLabel("Project #:"), projFld, }, 2, GuiUtils.WT_N, GuiUtils.WT_N); label = new JLabel(" "); contents = GuiUtils.topCenter(label, contents); contents = GuiUtils.inset(contents, 5); } String lbl = (firstTime ? "The server: " + getServer() + " requires a user ID & project number for access" : "Authentication for server: " + getServer() + " failed. Please try again"); label.setText(lbl); if (!GuiUtils.showOkCancelDialog(null, "ADDE Project/User name", contents, null)) { setState(STATE_UNCONNECTED); return false; } firstTime = false; String userName = userFld.getText().trim(); String project = projFld.getText().trim(); if ((userName.length() > 0) && (project.length() > 0)) { passwords.put(getServer(), new String[] {userName, project}); } } return true; }
/** * Add in any special control widgets to the current list of widgets. * * @param controlWidgets list of control widgets * @throws VisADException VisAD error * @throws RemoteException RMI error */ public void getControlWidgets(List controlWidgets) throws VisADException, RemoteException { super.getControlWidgets(controlWidgets); if (!usePoints) { JCheckBox textureToggle = GuiUtils.makeCheckbox("", this, "useTexture3D"); controlWidgets.add( new WrapperWidget( this, GuiUtils.rLabel("Use 3D Texture:"), GuiUtils.leftCenter(textureToggle, GuiUtils.filler()))); } else { controlWidgets.add( new WrapperWidget( this, GuiUtils.rLabel("Point Size:"), GuiUtils.left(doMakePointSizeWidget()))); } }
public void getPropertyComponents(List comps, final ObjectListener listener) { visibleCbx = new JCheckBox(getName(), visible); float[] rgb = color.get().getRGBComponents(null); slider = new JSlider(0, 100, (int) (rgb[0] * 100)); float[] xyz = new float[3]; direction.get(xyz); directionXFld = makeField("" + xyz[0], listener, "X Direction"); directionYFld = makeField("" + xyz[1], listener, "Y Direction"); directionZFld = makeField("" + xyz[2], listener, "Z Direction"); double[] pxyz = new double[3]; location.get(pxyz); locationXFld = makeField("" + pxyz[0], listener, ""); locationYFld = makeField("" + pxyz[1], listener, ""); locationZFld = makeField("" + pxyz[2], listener, ""); List fldComps = Misc.newList(GuiUtils.rLabel("Direction:"), directionXFld, directionYFld, directionZFld); // // fldComps.addAll(Misc.newList(GuiUtils.rLabel("Location:"),locationXFld,locationYFld,locationZFld)); comps.add(visibleCbx); GuiUtils.tmpInsets = new Insets(0, 2, 0, 0); comps.add( GuiUtils.vbox( slider, GuiUtils.left(GuiUtils.doLayout(fldComps, 4, GuiUtils.WT_N, GuiUtils.WT_N)))); if (listener != null) { visibleCbx.addActionListener(listener); slider.addChangeListener(listener); } }
/** * Create the properties contents * * @param comps List of components * @param tabIdx Which tab */ protected void getPropertiesComponents(List comps, int tabIdx) { super.getPropertiesComponents(comps, tabIdx); if (tabIdx != 0) { return; } propertiesNameFld = new JTextField(getName()); labelShownCbx = new JCheckBox("Label Shown", getLabelShown()); comps.add(GuiUtils.rLabel("Name: ")); comps.add(GuiUtils.centerRight(propertiesNameFld, labelShownCbx)); }
/** * Add to the given comps list all the status line and server components. * * @param comps List of comps to add to * @param extra The components after the server box if non-null. */ protected void addTopComponents(List comps, Component extra) { if (extra == null) { extra = GuiUtils.filler(); } comps.add(GuiUtils.rLabel(LABEL_SERVER)); GuiUtils.tmpInsets = GRID_INSETS; JPanel right = GuiUtils.doLayout( new Component[] {serverSelector, extra, getConnectButton()}, 3, GuiUtils.WT_YN, GuiUtils.WT_N); comps.add(GuiUtils.left(right)); }
/** * Add to the properties list * * @param comps List of label/widgets * @param compMap Optional mapping to hold components for later access */ protected void getPropertiesComponents(List comps, Hashtable compMap) { super.getPropertiesComponents(comps, compMap); startTextFld = new JTextField(startText, 5); endTextFld = new JTextField(endText, 5); comps.add(GuiUtils.rLabel("Start Label:")); comps.add(GuiUtils.left(startTextFld)); comps.add(GuiUtils.rLabel("End Label:")); comps.add(GuiUtils.left(endTextFld)); maxDistanceFld = null; tvm = null; if (viewDescriptor != null) { VMManager vmManager = control.getControlContext().getIdv().getVMManager(); List vms = vmManager.getViewManagers(TransectViewManager.class); tvm = (TransectViewManager) VMManager.findViewManagerInList(viewDescriptor, vms); if ((tvm != null) && (maxDataDistance != null)) { maxDistanceFld = new JTextField(maxDataDistance.getValue() + " [" + maxDataDistance.getUnit() + "]", 15); maxDistanceFld.setToolTipText("Maximum distance shown. e.g.: value[unit]"); comps.add(GuiUtils.rLabel("Max distance:")); comps.add(GuiUtils.left(maxDistanceFld)); } } }
/** * Add components to properties dialog * * @param comps List of components * @param tabIdx Which tab in properties dialog */ protected void getPropertiesComponents(List comps, int tabIdx) { super.getPropertiesComponents(comps, tabIdx); if (tabIdx != 0) { return; } comps.add(GuiUtils.rLabel("Histogram: ")); comps.add( GuiUtils.left( GuiUtils.hbox( Misc.newList(new JLabel("Number of Bins: "), binFld = new JTextField("" + bins, 6)), 4))); // new JLabel(" Stacked: "), // stackedCbx = new JCheckBox("",stacked)),4))); }
/** * Set the fields from the ProjectionClass * * @param projClass projection class to use */ private void setFieldsWithClassParams(ProjectionClass projClass) { // set the projection in the JComboBox String want = projClass.toString(); for (int i = 0; i < projClassCB.getItemCount(); i++) { ProjectionClass pc = (ProjectionClass) projClassCB.getItemAt(i); if (pc.toString().equals(want)) { projClassCB.setSelectedItem((Object) pc); break; } } // set the parameter fields paramPanel.removeAll(); paramPanel.setVisible(0 < projClass.paramList.size()); List widgets = new ArrayList(); for (int i = 0; i < projClass.paramList.size(); i++) { ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i); // construct the label String name = pp.name; String text = ""; // Create a decent looking label for (int cIdx = 0; cIdx < name.length(); cIdx++) { char c = name.charAt(cIdx); if (cIdx == 0) { c = Character.toUpperCase(c); } else { if (Character.isUpperCase(c)) { text += " "; c = Character.toLowerCase(c); } } text += c; } widgets.add(GuiUtils.rLabel(text + ": ")); // text input field JTextField tf = new JTextField(); pp.setTextField(tf); tf.setColumns(12); widgets.add(tf); } GuiUtils.tmpInsets = new Insets(4, 4, 4, 4); JPanel widgetPanel = GuiUtils.doLayout(widgets, 2, GuiUtils.WT_N, GuiUtils.WT_N); paramPanel.add("North", widgetPanel); paramPanel.add("Center", GuiUtils.filler()); }
/** * Utility method to add components to dialog list * * @param comps list to add to * @param name name * @param cbx enable checkbox * @param comp the component */ private void addEditComponents( List comps, String name, final JCheckBox cbx, final JComponent comp) { cbx.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { GuiUtils.enableTree(comp, cbx.isSelected()); } }); GuiUtils.enableTree(comp, cbx.isSelected()); comps.add(GuiUtils.top(GuiUtils.inset(cbx, 5))); comps.add(GuiUtils.top(GuiUtils.inset(GuiUtils.rLabel(name), new Insets(8, 0, 0, 0)))); JComponent right = GuiUtils.inset(comp, new Insets(3, 5, 0, 0)); // comps.add(GuiUtils.leftCenter(GuiUtils.top(GuiUtils.inset(cbx, // new Insets(2, 0, 0, 0))), GuiUtils.topLeft(right))); comps.add(GuiUtils.topLeft(right)); }
/** * Make the control widgets * * @param controlWidgets list of control widgets * @throws RemoteException Java RMI error * @throws VisADException VisAD Error */ public void getControlWidgets(List controlWidgets) throws VisADException, RemoteException { super.getControlWidgets(controlWidgets); JComponent barbSizeBox = GuiUtils.wrap( GuiUtils.createValueBox( this, CMD_BARBSIZE, (int) flowScaleValue, Misc.createIntervalList(1, 10, 1), true)); // make possible another component(s) to put on same line w barbSizeBox JComponent extra = doMakeExtraComponent(); JComponent rightPanel = GuiUtils.leftCenter( ((extra != null) ? (JComponent) GuiUtils.hflow(Misc.newList(barbSizeBox, extra)) : (JComponent) barbSizeBox), GuiUtils.filler()); controlWidgets.add(new WrapperWidget(this, GuiUtils.rLabel("Windbarb size: "), rightPanel)); }
private void doRename(Element node) { if (imageDefaults == null) { imageDefaults = getImageDefaults(); } if (!node.hasAttribute(ATTR_NAME)) return; JLabel label = new JLabel("New name: "); JTextField nameFld = new JTextField("", 20); JComponent contents = GuiUtils.doLayout( new Component[] { GuiUtils.rLabel("New name: "), nameFld, }, 2, GuiUtils.WT_N, GuiUtils.WT_N); contents = GuiUtils.center(contents); contents = GuiUtils.inset(contents, 10); if (!GuiUtils.showOkCancelDialog( null, "Rename \"" + node.getAttribute("name") + "\"", contents, null)) return; String newName = nameFld.getText().trim(); String tagName = node.getTagName(); Element root = imageDefaultsRoot; if (tagName.equals("default")) { root = (Element) node.getParentNode(); } Element exists = XmlUtil.findElement(root, tagName, ATTR_NAME, newName); if (!(exists == null)) { if (!GuiUtils.askYesNo( "Name Already Exists", "Do you want to replace " + node.getAttribute("name") + " with" + "\"" + newName + "\"?")) return; } node.removeAttribute(ATTR_NAME); node.setAttribute(ATTR_NAME, newName); makeXmlTree(); try { imageDefaults.writeWritable(); } catch (Exception e) { logger.error("write error!", e); } imageDefaults.setWritableDocument(imageDefaultsDocument, imageDefaultsRoot); }
/** Create the UI for this editor */ void makeUI() { JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(new LineBorder(Color.blue)); getContentPane().add(mainPanel, BorderLayout.CENTER); // the map and associated toolbar npEditControl = new NPController(); mapEditPanel = npEditControl.getNavigatedPanel(); // here's where the map will be drawn mapEditPanel.setPreferredSize(new Dimension(250, 250)); mapEditPanel.setSelectRegionMode(true); JToolBar navToolbar = mapEditPanel.getNavToolBar(); navToolbar.setFloatable(false); JToolBar moveToolbar = mapEditPanel.getMoveToolBar(); moveToolbar.setFloatable(false); // toolbar.remove("setReference"); JPanel toolbar = new JPanel(); List localMaps = maps; if (localMaps == null) { localMaps = getDefaultMaps(); } JMenu mapMenu = new JMenu("Maps"); JMenuBar menuHolder = new JMenuBar(); menuHolder.setBorder(null); menuHolder.add(mapMenu); toolbar.add(menuHolder); for (int mapIdx = 0; mapIdx < localMaps.size(); mapIdx++) { final MapData mapData = (MapData) localMaps.get(mapIdx); final JCheckBoxMenuItem cbx = new JCheckBoxMenuItem(mapData.getDescription(), mapData.getVisible()); if (mapData.getVisible()) { toggleMap(mapData, true); } mapMenu.add(cbx); cbx.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent event) { toggleMap(mapData, cbx.isSelected()); } }); } GuiUtils.limitMenuSize(mapMenu, "Maps ", 20); toolbar.add(navToolbar); toolbar.add(moveToolbar); JPanel mapSide = new JPanel(); mapSide.setLayout(new BorderLayout()); TitledBorder mapBorder = new TitledBorder( standardBorder, "Edit Projection", TitledBorder.ABOVE_TOP, TitledBorder.CENTER); mapSide.setBorder(mapBorder); mapSide.add(toolbar, BorderLayout.NORTH); mapSide.add(mapEditPanel, BorderLayout.CENTER); mainPanel.add(mapSide, BorderLayout.WEST); // the projection parameters // the Projection name JLabel nameLabel = GuiUtils.rLabel("Name: "); nameTF = new JTextField(20); // the list of Projection classes is kept in a comboBox typeLabel = GuiUtils.rLabel("Type: "); projClassCB = new JComboBox(); // standard list of projection classes List classNames = getDefaultProjections(); for (int i = 0; i < classNames.size(); i++) { String className = (String) classNames.get(i); try { projClassCB.addItem(new ProjectionClass(className)); } catch (ClassNotFoundException ee) { System.err.println("ProjectionManager failed on " + className + " " + ee); } catch (IntrospectionException ee) { System.err.println("ProjectionManager failed on " + className + " " + ee); } } GuiUtils.tmpInsets = new Insets(4, 4, 4, 4); JPanel topPanel = GuiUtils.doLayout( new Component[] {nameLabel, nameTF, typeLabel, projClassCB}, 2, GuiUtils.WT_N, GuiUtils.WT_N); // the Projection parameter area paramPanel = new JPanel(); paramPanel.setLayout(new BorderLayout()); paramPanel.setBorder( new TitledBorder( standardBorder, "Projection Parameters", TitledBorder.ABOVE_TOP, TitledBorder.CENTER)); // the bottom button panel JPanel buttPanel = new JPanel(); JButton acceptButton = new JButton("Save"); JButton previewButton = new JButton("Preview"); JButton cancelButton = new JButton("Cancel"); buttPanel.add(acceptButton, null); buttPanel.add(previewButton, null); buttPanel.add(cancelButton, null); JPanel mainBox = GuiUtils.topCenterBottom(topPanel, paramPanel, buttPanel); mainPanel.add(mainBox, BorderLayout.CENTER); pack(); // enable event listeners when we're done constructing the UI projClassCB.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ProjectionClass selectClass = (ProjectionClass) projClassCB.getSelectedItem(); setProjection(selectClass.makeDefaultProjection()); } }); acceptButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { accept(); } }); previewButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { ProjectionClass projClass = findProjectionClass(editProjection); if (null != projClass) { setProjFromDialog(projClass, editProjection); setProjection(editProjection); } } }); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { NewProjectionDialog.this.setVisible(false); } }); }
private void showSaveDialog() { if (saveWindow == null) { saveWindow = GuiUtils.createFrame("Save Image Parameter Set"); } if (statusComp == null) { statusLabel = new JLabel(); statusComp = GuiUtils.inset(statusLabel, 2); statusComp.setBackground(new Color(255, 255, 204)); statusLabel.setOpaque(true); statusLabel.setBackground(new Color(255, 255, 204)); } JPanel statusPanel = GuiUtils.inset( GuiUtils.top( GuiUtils.vbox( new JLabel(" "), GuiUtils.hbox(GuiUtils.rLabel("Status: "), statusComp), new JLabel(" "))), 6); JPanel sPanel = GuiUtils.topCenter(statusPanel, GuiUtils.filler()); List newComps = new ArrayList(); final JTextField newName = new JTextField(20); newName.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { setStatus("Click New Folder or New ParameterSet button"); newCompName = newName.getText().trim(); } }); newComps.add(newName); newComps.add(GuiUtils.filler()); newFolderBtn = new JButton("New Folder"); newFolderBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { newFolder = newName.getText().trim(); if (newFolder.length() == 0) { newComponentError("folder"); return; } Element exists = XmlUtil.findElement(imageDefaultsRoot, "folder", ATTR_NAME, newFolder); if (!(exists == null)) { if (!GuiUtils.askYesNo( "Verify Replace Folder", "Do you want to replace the folder " + "\"" + newFolder + "\"?" + "\nNOTE: All parameter sets it contains will be deleted.")) return; imageDefaultsRoot.removeChild(exists); } newName.setText(""); Node newEle = makeNewFolder(); makeXmlTree(); xmlTree.selectElement((Element) newEle); lastCat = newEle; lastClicked = null; newSetBtn.setEnabled(true); setStatus("Please enter a name for the new parameter set"); } }); newComps.add(newFolderBtn); newComps.add(GuiUtils.filler()); newName.setEnabled(true); newFolderBtn.setEnabled(true); newSetBtn = new JButton("New Parameter Set"); newSetBtn.setActionCommand(CMD_NEWPARASET); newSetBtn.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { newCompName = newName.getText().trim(); if (newCompName.length() == 0) { newComponentError("parameter set"); return; } newName.setText(""); Element newEle = saveParameterSet(); if (newEle == null) return; xmlTree.selectElement(newEle); lastClicked = newEle; } }); newComps.add(newSetBtn); newSetBtn.setEnabled(false); JPanel newPanel = GuiUtils.top(GuiUtils.left(GuiUtils.hbox(newComps))); JPanel topPanel = GuiUtils.topCenter(sPanel, newPanel); treePanel = new JPanel(); treePanel.setLayout(new BorderLayout()); makeXmlTree(); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { String cmd = event.getActionCommand(); if (cmd.equals(GuiUtils.CMD_CANCEL)) { if (lastClicked != null) { removeNode(lastClicked); lastClicked = null; } saveWindow.setVisible(false); saveWindow = null; } else { saveWindow.setVisible(false); saveWindow = null; } } }; JPanel bottom = GuiUtils.inset(GuiUtils.makeApplyCancelButtons(listener), 5); contents = GuiUtils.topCenterBottom(topPanel, treePanel, bottom); saveWindow.getContentPane().add(contents); saveWindow.pack(); saveWindow.setLocation(200, 200); saveWindow.setVisible(true); GuiUtils.toFront(saveWindow); setStatus("Please select a folder from tree, or create a new folder"); }
/** * ctor * * @param pointDataSource the associated data source */ public GridParameters(PointDataSource pointDataSource) { super("Grid Parameters"); this.pointDataSource = pointDataSource; gridXFld = new JTextField("" + pointDataSource.gridX, 4); gridXFld.setToolTipText("X spacing in spacing units"); gridYFld = new JTextField("" + pointDataSource.gridY, 4); gridYFld.setToolTipText("Y spacing in spacing units"); gridUnitCmbx = new JComboBox(); gridUnitCmbx.setToolTipText("Set grid spacing option"); tfos = TwoFacedObject.createList(SPACING_IDS, SPACING_NAMES); GuiUtils.setListData(gridUnitCmbx, tfos); gridUnitCmbx.setSelectedItem(TwoFacedObject.findId(pointDataSource.gridUnit, tfos)); gridUnitCmbx.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { TwoFacedObject tfo = (TwoFacedObject) ((JComboBox) ae.getSource()).getSelectedItem(); if (tfo != null) { useCompute = tfo.getId().equals(SPACING_IDS[0]); enableAutoComps(!useCompute); } } }); gainComp = new ValueSliderComponent( pointDataSource, 0, 1, "gridGain", "Gain", 10, false, "Factor by which scaleLength is reduced for the second pass"); searchComp = new ValueSliderComponent( pointDataSource, 0, 20, "gridSearchRadius", "Search Radius", 1, false, "Search radius in grid units for weighting"); numGridPassesFld = new JTextField("" + pointDataSource.numGridPasses, 4); numGridPassesFld.setToolTipText("Set the number of passes for the Barnes analysis"); comps.add(GuiUtils.rLabel("Spacing:")); comps.add(GuiUtils.left(gridUnitCmbx)); comps.add(GuiUtils.rLabel("Grid Size:")); sizeComp = GuiUtils.left(GuiUtils.hbox(new JLabel("X: "), gridXFld, new JLabel(" Y: "), gridYFld)); comps.add(sizeComp); comps.add(GuiUtils.rLabel("Passes:")); comps.add(GuiUtils.left(numGridPassesFld)); comps.add(GuiUtils.rLabel("Search Radius:")); comps.add(GuiUtils.left(searchComp.getContents(false))); comps.add(GuiUtils.rLabel("Gain:")); comps.add(GuiUtils.left(gainComp.getContents(false))); enableAutoComps(!useCompute); useDefaultCbx.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { checkEnable(); } }); }