protected void displayNewTxf(String strLabel, String strValue) { strLabel = (strLabel == null) ? "" : strLabel.trim(); strValue = (strValue == null) ? "" : strValue.trim(); JCheckBox chkBox1 = new JCheckBox(Util.getImageIcon("boxGray.gif")); DataField txf1 = new DataField(strLabel); DataField txf2 = new DataField(strValue); JPanel pnlTxf = new JPanel(m_gbl); m_nRow = m_nRow + 1; txf1.setName("label"); txf2.setName("value"); /* 1st line of text field*/ m_gbc.weightx = 0; showComp(m_gbl, m_gbc, 0, m_nRow, 1, chkBox1); m_gbc.weightx = 1; showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf1); // showSpaces( gbl, gbc, 2, 6 ); showComp(m_gbl, m_gbc, GridBagConstraints.RELATIVE, m_nRow, 1, txf2); m_gbc.weightx = 0; txf1.addFocusListener(this); txf2.addFocusListener(this); m_objTxfValue.addToLabel(txf1); m_objTxfValue.addToValue(txf2); }
/** Initializes contained components. */ private void initComponents() { final SimpleDateFormat format = new SimpleDateFormat("mm:ss"); final Calendar c = Calendar.getInstance(); final JLabel counter = new JLabel(); counter.setForeground(Color.red); counter.setFont(counter.getFont().deriveFont((float) (counter.getFont().getSize() + 5))); setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); GridBagConstraints constraints = new GridBagConstraints(); JLabel messageLabel = new JLabel( GuiActivator.getResources().getI18NString("service.gui.security.SECURITY_ALERT")); messageLabel.setForeground(Color.WHITE); constraints.anchor = GridBagConstraints.CENTER; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 0; add(messageLabel, constraints); constraints.anchor = GridBagConstraints.CENTER; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 1; add(counter, constraints); ZrtpControl zrtpControl = null; if (securityControl instanceof ZrtpControl) zrtpControl = (ZrtpControl) securityControl; long initialSeconds = 0; if (zrtpControl != null) initialSeconds = zrtpControl.getTimeoutValue(); c.setTimeInMillis(initialSeconds); counter.setText(format.format(c.getTime())); if (initialSeconds > 0) timer.schedule( new TimerTask() { @Override public void run() { if (c.getTimeInMillis() - 1000 > 0) { c.add(Calendar.SECOND, -1); counter.setText(format.format(c.getTime())); } } }, 1000, 1000); }
private void addView() { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridx = 6; gbc.gridy = 0; add((JComponent) _secondaryView, gbc); }
/** * Adds a radio button group. * * @param label group label (or null) * @param items radio button labels * @param rows number of rows * @param columns number of columns * @param defaultItem button initially selected */ public void addRadioButtonGroup( String label, String[] items, int rows, int columns, String defaultItem) { Panel panel = new Panel(); int n = items.length; panel.setLayout(new GridLayout(rows, columns, 0, 0)); CheckboxGroup cg = new CheckboxGroup(); for (int i = 0; i < n; i++) { Checkbox cb = new Checkbox(items[i], cg, items[i].equals(defaultItem)); cb.addItemListener(this); panel.add(cb); } if (radioButtonGroups == null) radioButtonGroups = new Vector(); radioButtonGroups.addElement(cg); Insets insets = getInsets(5, 10, 0, 0); if (label == null || label.equals("")) { label = "rbg" + radioButtonGroups.size(); insets.top += 5; } else { setInsets(10, insets.left, 0); addMessage(label); insets.top = 2; insets.left += 10; } c.gridx = 0; c.gridy = y; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(insets.top, insets.left, 0, 0); grid.setConstraints(panel, c); add(panel); if (Recorder.record || macro) saveLabel(cg, label); y++; }
/** Description of the Method */ public void init() { // super.init(); size = new Dimension(570, 570); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); Dimension d = messagePanel.getSize(); d.height += 20; messagePanel.setPreferredSize(d); contentPane.add(messagePanel, BorderLayout.SOUTH); contentPane.setOpaque(true); userPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(2, 2, 2, 2); messagePanel.setLayout(borderLayout5); contentPane.setOpaque(true); contentPane.setBackground(Color.white); this.setSize(size); messagePanel.add(labelMessage, BorderLayout.NORTH); // Logg.logg("MhClient: Före XttTree-skapande", 6); this.mhTable = new MhTable(root, false, this.labelMessage); // Logg.logg("MhClient: mhTable-skapande klart", 6); this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER); }
/** * Adds a label that shows the percentage of hours spent on a particular project. * * @param gbl The layout to add the label to. * @param gbc The layout constraints to use. * @param row The row to link against. * @see {@link #addRow(GridBagLayout, GridBagConstraints, String, double)} */ private void addPercentLabel(GridBagLayout gbl, GridBagConstraints gbc, Row row) { gbc.gridx = 3; gbc.ipadx = 5; gbl.setConstraints(row.percentL, gbc); gbc.ipadx = 0; reviewPanel.add(row.percentL); }
private void add(Component c, GridBagConstraints gbc, int x, int y, int w, int h) { gbc.gridx = x; gbc.gridy = y; gbc.gridwidth = w; gbc.gridheight = h; getContentPane().add(c, gbc); }
/** * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as * <tt>CallPeer</tt> display name, call duration, security status. * * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information * such as <tt>CallPeer</tt> display name, call duration, security status */ private Component createStatusBar() { // stateLabel callStatusLabel.setForeground(Color.WHITE); dtmfLabel.setForeground(Color.WHITE); callStatusLabel.setText(callPeer.getState().getLocalizedStateString()); PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; statusPanel.add(securityStatusLabel, constraints); initSecurityStatusLabel(); constraints.gridx++; statusPanel.add(holdStatusLabel, constraints); constraints.gridx++; statusPanel.add(muteStatusLabel, constraints); constraints.gridx++; callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12)); statusPanel.add(callStatusLabel, constraints); constraints.gridx++; constraints.weightx = 1f; statusPanel.add(dtmfLabel, constraints); return statusPanel; }
public DisplayResults() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; text.setForeground(Color.black); add(text, gbc); gbc.gridy = 0; gbc.gridwidth = GridBagConstraints.REMAINDER; add(emptyLabel, gbc); add(Box.createVerticalStrut(0), gbc); add(emptyLabel, gbc); /* gbc.gridy = 1; VTextMsg result = new VTextMsg(sshare, vnmrif, null); result.setPreferredSize(new Dimension(300, 30)); result.setForeground(Color.black); add( result, gbc ); */ setBorder( new CompoundBorder( BorderFactory.createTitledBorder(" Results "), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
private void showSpaces(GridBagLayout gbl, GridBagConstraints gbc, int gridx, int gridy) { JLabel spaces = new JLabel(" "); gbc.gridx = gridx; gbc.gridy = gridy; gbl.setConstraints(spaces, gbc); m_pnlDisplay.add(spaces); }
private void updateDebugPanelState(String result, boolean debug, boolean test) { result = result == null ? "nothing" : result; List<Component> componentList = Arrays.asList(getComponents()); if (!componentList.contains(p_debug)) { choice = new Label(String.format("Your choice is: %s", result)); isDebug = new Label(String.format("Debug mode: %b", debug)); isTest = new Label(String.format("Test mode: %b", test)); GridBagLayout layout = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); layout.setConstraints(choice, constraints); constraints.gridy = 1; layout.setConstraints(isDebug, constraints); constraints.gridy = 2; layout.setConstraints(isTest, constraints); p_debug.setLayout(layout); p_debug.add(choice); p_debug.add(isDebug); p_debug.add(isTest); add(p_debug, BorderLayout.SOUTH); } else { choice.setText(String.format("Your choice is: %s", result)); isDebug.setText(String.format("Debug mode: %b", debug)); isTest.setText(String.format("Test mode: %b", test)); } }
protected void addComp(JPanel panel, Component comp, GridBagConstraints gbc, int x, int y) { gbc.gridx = x; gbc.gridy = y; gbc.fill = GridBagConstraints.HORIZONTAL; panel.add(comp, gbc); }
/** * Adds an editable text field containing the hours spent on a project. * * @param gbl The layout to add the text field to. * @param gbc The layout constraints to use. * @param row The row to link against. * @param hours The number of hours spent on the project. * @see {@link #addRow(GridBagLayout, GridBagConstraints, String, double)} */ private void addMiddleField(GridBagLayout gbl, GridBagConstraints gbc, Row row, double hours) { row.hoursTF.setText(decimalFormat.format(hours)); gbc.gridx = 1; gbc.weightx = 1; gbl.setConstraints(row.hoursTF, gbc); gbc.weightx = 0; reviewPanel.add(row.hoursTF); }
private void addSpacer() { JPanel spacer = new JPanel(); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 1; gbc.gridx = 5; gbc.gridy = 0; add(spacer, gbc); }
/** * Adds a simple 'h' to show that the time period is specified in hours. * * @param gbl The layout to add the label to. * @param gbc The layout constraints to use. * @see {@link #addRow(GridBagLayout, GridBagConstraints, String, double)} */ private void addRightLabel(GridBagLayout gbl, GridBagConstraints gbc) { JLabel hLabel = new JLabel("h", SwingConstants.CENTER); gbc.gridx = 2; gbc.ipadx = 5; gbl.setConstraints(hLabel, gbc); gbc.ipadx = 0; reviewPanel.add(hLabel); }
private void setRow(GridBagConstraints c, GridBagLayout gridbag, Component obj1, Component obj2) { c.gridwidth = GridBagConstraints.RELATIVE; gridbag.setConstraints(obj1, c); add(obj1); c.gridwidth = GridBagConstraints.REMAINDER; // end row gridbag.setConstraints(obj2, c); add(obj2); c.fill = GridBagConstraints.BOTH; }
/** * Adds a group of checkboxs using a grid layout. * * @param rows the number of rows * @param columns the number of columns * @param labels the labels * @param defaultValues the initial states * @param headings the column headings Example: * http://imagej.nih.gov/ij/plugins/multi-column-dialog/index.html */ public void addCheckboxGroup( int rows, int columns, String[] labels, boolean[] defaultValues, String[] headings) { Panel panel = new Panel(); int nRows = headings != null ? rows + 1 : rows; panel.setLayout(new GridLayout(nRows, columns, 6, 0)); int startCBIndex = cbIndex; if (checkbox == null) checkbox = new Vector(12); if (headings != null) { Font font = new Font("SansSerif", Font.BOLD, 12); for (int i = 0; i < columns; i++) { if (i > headings.length - 1 || headings[i] == null) panel.add(new Label("")); else { Label label = new Label(headings[i]); label.setFont(font); panel.add(label); } } } int i1 = 0; int[] index = new int[labels.length]; for (int row = 0; row < rows; row++) { for (int col = 0; col < columns; col++) { int i2 = col * rows + row; if (i2 >= labels.length) break; index[i1] = i2; String label = labels[i1]; if (label == null || label.length() == 0) { Label lbl = new Label(""); panel.add(lbl); i1++; continue; } if (label.indexOf('_') != -1) label = label.replace('_', ' '); Checkbox cb = new Checkbox(label); checkbox.addElement(cb); cb.setState(defaultValues[i1]); cb.addItemListener(this); if (Recorder.record || macro) saveLabel(cb, labels[i1]); if (IJ.isLinux()) { Panel panel2 = new Panel(); panel2.setLayout(new BorderLayout()); panel2.add("West", cb); panel.add(panel2); } else panel.add(cb); i1++; } } c.gridx = 0; c.gridy = y; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; c.insets = getInsets(10, 0, 0, 0); grid.setConstraints(panel, c); add(panel); y++; }
/** * Adds a Panel to the dialog with custom contraint and insets. The defaults are * GridBagConstraints.WEST (left justified) and "new Insets(5, 0, 0, 0)" (5 pixels of padding at * the top). */ public void addPanel(Panel panel, int constraints, Insets insets) { c.gridx = 0; c.gridy = y; c.gridwidth = 2; c.anchor = constraints; c.insets = insets; grid.setConstraints(panel, c); add(panel); y++; }
private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) { lastAddedButton = button; constraints.insets = new Insets(0, 0, V_GAP, 0); constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.NONE; constraints.gridx = gridX; constraints.gridy = 2; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0f; constraints.weighty = 0f; this.add(button, constraints); int yBounds = TOP_BORDER + BOTTOM_BORDER + 2 * V_GAP + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText()) .height; button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT); button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); setButtonBg(button, gridX, isLast); return button.getWidth(); }
/** Get the panel for a given form. * */ public JPanel getPanelFor(ArrayList elements) { JPanel p = new JPanel(new GridBagLayout()); int maxCols = 1; int elementSize = elements.size(); for (int i = 0; i < elementSize; i++) { // count max number of cols // ((XmlUIElement)elements.get(i)).setEditable(true);//by jai int cols = ((XmlUIElement) elements.get(i)).getNumberOfColumns(); if (cols > maxCols) { maxCols = cols; } } GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.gridx = 0; c.gridy = 0; if (elementSize < 5) c.insets = new Insets(8, 8, 8, 14); else if (elementSize < 20) c.insets = new Insets(4, 4, 4, 10); else if ((elementSize > 40 && maxCols == 2) || (elementSize > 80 && maxCols == 4)) c.insets = new Insets(1, 1, 1, 8); else c.insets = new Insets(2, 2, 2, 8); int rowsAdded = 0; for (int i = 0; i < elementSize; i++) { elementsAndPanels.put(elements.get(i), p); rowsAdded += ((XmlUIElement) elements.get(i)).addComponents(p, c, 0, rowsAdded, maxCols); } return p; }
public static void addToGridBag( GridBagLayout grid, Container cont, Component comp, int x, int y, int gw, int gh, double wx, double wy, int fill, int anchor) { // now the constraints GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = x; gbc.gridy = y; gbc.weightx = wx; gbc.weighty = wy; gbc.fill = fill; gbc.gridwidth = gw; gbc.gridheight = gh; gbc.anchor = anchor; cont.add(comp); grid.setConstraints(comp, gbc); }
/** * Adds a popup menu. * * @param label the label * @param items the menu items * @param defaultItem the menu item initially selected */ public void addChoice(String label, String[] items, String defaultItem) { String label2 = label; if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' '); Label theLabel = makeLabel(label2); c.gridx = 0; c.gridy = y; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; if (choice == null) { choice = new Vector(4); defaultChoiceIndexes = new Vector(4); c.insets = getInsets(5, 0, 5, 0); } else c.insets = getInsets(0, 0, 5, 0); grid.setConstraints(theLabel, c); add(theLabel); Choice thisChoice = new Choice(); thisChoice.addKeyListener(this); thisChoice.addItemListener(this); for (int i = 0; i < items.length; i++) thisChoice.addItem(items[i]); if (defaultItem != null) thisChoice.select(defaultItem); else thisChoice.select(0); c.gridx = 1; c.gridy = y; c.anchor = GridBagConstraints.WEST; grid.setConstraints(thisChoice, c); add(thisChoice); choice.addElement(thisChoice); int index = thisChoice.getSelectedIndex(); defaultChoiceIndexes.addElement(new Integer(index)); if (Recorder.record || macro) saveLabel(thisChoice, label); y++; }
protected void buildPanel(String strPath) { strPath = FileUtil.openPath(strPath); ArrayList aListPath = new ArrayList(); BufferedReader reader = WFileUtil.openReadFile(strPath); if (reader == null) return; String strLine; try { while ((strLine = reader.readLine()) != null) { StringTokenizer strTok = new StringTokenizer(strLine, ":"); if (strTok.countTokens() < 4) continue; boolean bChecksum = false; boolean bShow = false; String strDir = strTok.nextToken(); String strChecksum = strTok.nextToken(); if (strChecksum.equalsIgnoreCase("checksum")) bChecksum = true; if (bChecksum && (strDir.equals("file") || strDir.equals("dir"))) { String strValue = strTok.nextToken(); String strShow = strTok.nextToken(); if (strShow.equalsIgnoreCase("yes")) bShow = true; if (bShow) aListPath.add(strValue); } } m_cmbPath = new JComboBox(aListPath.toArray()); JPanel pnlDisplay = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints( 0, 0, 1, 1, 0.2, 0.2, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0); pnlDisplay.add(m_cmbPath, gbc); gbc.gridx = 1; pnlDisplay.add(m_cmbChecksum, gbc); add(pnlDisplay, BorderLayout.NORTH); add(m_txaChecksum, BorderLayout.CENTER); } catch (Exception e) { e.printStackTrace(); } }
public void init(GUI gui) { m_gui = gui; // Create the display // width, height addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } }); setSize(new Dimension(100, 100)); setBackground(Color.white); setFont(new Font("Helvetica", Font.PLAIN, 14)); GridBagLayout gridbag = new GridBagLayout(); setLayout(gridbag); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; recency = new TextField(Truline.userProps.getProperty("RecencyDays", "28"), 5); setRow(c, gridbag, new Label("Recency Days"), recency); maxdays = new TextField(Truline.userProps.getProperty("MaxDays", "120"), 5); setRow(c, gridbag, new Label("Max Days"), maxdays); maxvariant = new TextField(Truline.userProps.getProperty("MaxVariant", "25"), 5); setRow(c, gridbag, new Label("Max Variant"), maxvariant); maiden = new TextField(Truline.userProps.getProperty("UseMaiden", "Y"), 2); setRow(c, gridbag, new Label("Use Maiden"), maiden); betFactorVersion = new TextField(Truline.userProps.getProperty("BetFactorVersion", " "), 7); setRow(c, gridbag, new Label("Bet Factor Version"), betFactorVersion); datadir = new TextField(Truline.userProps.getProperty("DATADIR", "."), 40); setRow(c, gridbag, new Label("Data Directory"), datadir); fontsize = new TextField(Truline.userProps.getProperty("FontSize", "8"), 40); setRow(c, gridbag, new Label("Print Font Size (8,9,10)"), fontsize); printProgram = new TextField(Truline.userProps.getProperty("PrintProgram", "WordPad.exe /p"), 40); setRow(c, gridbag, new Label("Print program"), printProgram); // shell = new TextField(Truline.userProps.getProperty("Shell", "command"), // 40); // setRow(c, gridbag, new Label("Shell program"), shell); Panel panel1 = new Panel(); panel1.setLayout(new BorderLayout()); Button OKButton = new Button(" OK "); OKButton.setActionCommand("ok"); OKButton.addActionListener(this); panel1.add(OKButton, BorderLayout.CENTER); Panel panel2 = new Panel(); panel2.setLayout(new BorderLayout()); Button cancelButton = new Button("Cancel"); cancelButton.setActionCommand("cancel"); cancelButton.addActionListener(this); panel2.add(cancelButton, BorderLayout.CENTER); setRow(c, gridbag, panel2, panel1); pack(); show(); }
private void showComp( GridBagLayout gbl, GridBagConstraints gbc, int gridx, int gridy, int gridwidth, JComponent comp) { gbc.gridx = gridx; gbc.gridy = gridy; gbl.setConstraints(comp, gbc); m_pnlDisplay.add(comp); }
protected GridBagConstraints createConstraints(int x, int y) { GridBagConstraints c = new GridBagConstraints(); c.gridx = x; c.gridy = y; c.gridwidth = 2; c.gridheight = 1; c.ipadx = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; return c; }
private void showInstruction( GridBagLayout gbl, GridBagConstraints gbc, int gridx, int gridy, int gridwidth, JLabel instruction) { gbc.gridwidth = gridwidth; gbc.gridx = gridx; gbc.gridy = gridy; gbl.setConstraints(instruction, gbc); instruction.setForeground(Color.black); m_pnlDisplay.add(instruction); }
private JComponent makeTitlePanel(String title, List<? extends JComponent> list) { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(BorderFactory.createTitledBorder(title)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1d; c.gridy = 0; for (JComponent cmp : list) { p.add(cmp, c); c.gridy++; } return p; }
public InstanceAction(String caption, Icon icon) { super(caption, icon); mainPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(3, 3, 3, 3); gbc.anchor = GridBagConstraints.WEST; mainPanel.add(new JLabel("Name Space:"), gbc); mainPanel.add(nameSpace = new JTextField(30), gbc); gbc.gridy = 1; mainPanel.add(new JLabel("Instance Name:"), gbc); mainPanel.add(instanceName = new JTextField(30), gbc); }
/** * Adds a numeric field. The first word of the label must be unique or command recording will not * work. * * @param label the label * @param defaultValue value to be initially displayed * @param digits number of digits to right of decimal point * @param columns width of field in characters * @param units a string displayed to the right of the field */ public void addNumericField( String label, double defaultValue, int digits, int columns, String units) { String label2 = label; if (label2.indexOf('_') != -1) label2 = label2.replace('_', ' '); Label theLabel = makeLabel(label2); c.gridx = 0; c.gridy = y; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; if (firstNumericField) c.insets = getInsets(5, 0, 3, 0); else c.insets = getInsets(0, 0, 3, 0); grid.setConstraints(theLabel, c); add(theLabel); if (numberField == null) { numberField = new Vector(5); defaultValues = new Vector(5); defaultText = new Vector(5); } if (IJ.isWindows()) columns -= 2; if (columns < 1) columns = 1; String defaultString = IJ.d2s(defaultValue, digits); if (Double.isNaN(defaultValue)) defaultString = ""; TextField tf = new TextField(defaultString, columns); if (IJ.isLinux()) tf.setBackground(Color.white); tf.addActionListener(this); tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); numberField.addElement(tf); defaultValues.addElement(new Double(defaultValue)); defaultText.addElement(tf.getText()); c.gridx = 1; c.gridy = y; c.anchor = GridBagConstraints.WEST; tf.setEditable(true); // if (firstNumericField) tf.selectAll(); firstNumericField = false; if (units == null || units.equals("")) { grid.setConstraints(tf, c); add(tf); } else { Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(tf); panel.add(new Label(" " + units)); grid.setConstraints(panel, c); add(panel); } if (Recorder.record || macro) saveLabel(tf, label); y++; }