List of usage examples for javax.swing JTextField getText
public String getText()
TextComponent
. From source file:umich.ms.batmass.gui.viewers.chromatogram.actions.XICDialog.java
private Double getValidatedDouble(JTextField field) { String text = field.getText(); return org.apache.commons.validator.routines.DoubleValidator.getInstance().validate(text); }
From source file:us.paulevans.basicxslt.BasicXSLTFrame.java
/** * Returns if aTextField is empty or not * @param aTextField/* ww w .j ava 2 s.c o m*/ * @return */ private static boolean isEmpty(JTextField aTextField) { return StringUtils.isBlank(aTextField.getText()); }
From source file:us.paulevans.basicxslt.BasicXSLTFrame.java
/** * Returns if the path specified in aFileTextField points to a valid * file or not./*from www .j a va 2s . c o m*/ * @param aFileTextField * @return */ private static boolean isValidFile(JTextField aFileTextField) { try { fsManager.resolveFile(aFileTextField.getText()); return true; } catch (Throwable any) { return false; } }
From source file:us.paulevans.basicxslt.BasicXSLTFrame.java
/** * Validates the xml file pointed-to by aTextField. * @param aLabel//from w ww .j a v a 2s .c o m * @param aTextField * @param aSuppressSuccessDialog * @return */ private boolean validateXml(String aLabel, JTextField aTextField, boolean aSuppressSuccessDialog) { boolean isValid; isValid = false; if (isEmpty(aTextField)) { Utils.showDialog(this, stringFactory.getString(LabelStringFactory.MAIN_FRAME_XML_FILE_NOT_SPECIFIED), stringFactory.getString(LabelStringFactory.MAIN_FRAME_ERROR_LBL), JOptionPane.ERROR_MESSAGE); } else if (!isValidFile(aTextField)) { Utils.showDialog(this, stringFactory.getString(LabelStringFactory.MAIN_FRAME_XML_FILE_NOT_EXIST_SPECIFY_VALID_FILE), stringFactory.getString(LabelStringFactory.MAIN_FRAME_ERROR_LBL), JOptionPane.ERROR_MESSAGE); } else { isValid = validateXml(aLabel, aTextField.getText(), checkSaxWarning.isSelected(), checkSaxError.isSelected(), checkSaxFatalError.isSelected(), this, aSuppressSuccessDialog); } return isValid; }
From source file:visolate.Visolate.java
private JPanel getInitialXPanel() { if (myInitialXPanel == null) { myInitialXPanel = new JPanel(); myInitialXPanel.setLayout(new BorderLayout()); myInitialXPanel.add(new JLabel("X"), BorderLayout.WEST); myInitialXPanel.setToolTipText("Left side is at this coordinate (mm or inch)"); myInitialXPanel.setEnabled(gCodeWriter.getIsAbsolute()); final JTextField field = new JTextField(NumberFormat.getInstance().format(gCodeWriter.getXOffset())); myInitialXPanel.add(field, BorderLayout.CENTER); myInitialXPanel.addPropertyChangeListener("enabled", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { field.setEnabled(myInitialXPanel.isEnabled()); }//from ww w .j a v a 2 s . c o m }); field.setEnabled(myInitialXPanel.isEnabled()); field.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { gCodeWriter.setXOffset(NumberFormat.getInstance().parse(field.getText()).doubleValue()); } catch (ParseException e) { } field.setText(NumberFormat.getInstance().format(gCodeWriter.getXOffset())); } }); } return myInitialXPanel; }
From source file:visolate.Visolate.java
private JPanel getInitialYPanel() { if (myInitialYPanel == null) { myInitialYPanel = new JPanel(); myInitialYPanel.setLayout(new BorderLayout()); myInitialYPanel.add(new JLabel("Y"), BorderLayout.WEST); myInitialYPanel.setToolTipText("Upper side is at this coordinates (mm or inch)"); myInitialYPanel.setEnabled(gCodeWriter.getIsAbsolute()); final JTextField field = new JTextField(NumberFormat.getInstance().format(gCodeWriter.getYOffset())); myInitialYPanel.add(field, BorderLayout.CENTER); myInitialYPanel.addPropertyChangeListener("enabled", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { field.setEnabled(myInitialYPanel.isEnabled()); }/* ww w. j a v a 2 s . co m*/ }); field.setEnabled(myInitialYPanel.isEnabled()); field.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { gCodeWriter.setYOffset(NumberFormat.getInstance().parse(field.getText()).doubleValue()); } catch (ParseException e) { } field.setText(NumberFormat.getInstance().format(gCodeWriter.getYOffset())); } }); } return myInitialYPanel; }
From source file:visolate.Visolate.java
private Component getZDownMovementPanel() { if (myZDownMovementPanel == null) { myZDownMovementPanel = new JPanel(); myZDownMovementPanel.setLayout(new BorderLayout()); myZDownMovementPanel.add(new JLabel("travel clearance"), BorderLayout.WEST); myZDownMovementPanel.setToolTipText( "When not cutting, lift the cutter to this above origin, in mm or inch. Decimals in native language (point or comma)."); final JTextField field = new JTextField(NumberFormat.getInstance().format(gCodeWriter.getZClearance())); myZDownMovementPanel.add(field, BorderLayout.CENTER); field.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { gCodeWriter.setZClearance(NumberFormat.getInstance().parse(field.getText()).doubleValue()); } catch (ParseException e) { }//from w ww.j a va 2 s. c o m field.setText(NumberFormat.getInstance().format(gCodeWriter.getZClearance())); } }); } return myZDownMovementPanel; }
From source file:visolate.Visolate.java
private JPanel getMillingSpeedPanel() { if (myMillingSpeedPanel == null) { myMillingSpeedPanel = new JPanel(); myMillingSpeedPanel.setLayout(new BorderLayout()); myMillingSpeedPanel.add(new JLabel("cutting feedrate"), BorderLayout.WEST); myMillingSpeedPanel.setToolTipText("Feedrate during cutting in mm or inch per minute."); final JTextField field = new JTextField( NumberFormat.getInstance().format(gCodeWriter.getMillingFeedrate())); myMillingSpeedPanel.add(field, BorderLayout.CENTER); field.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { gCodeWriter.setMillingFeedrate( NumberFormat.getInstance().parse(field.getText()).doubleValue()); } catch (ParseException e) { }//from ww w . j a v a 2 s .c o m field.setText(NumberFormat.getInstance().format(gCodeWriter.getMillingFeedrate())); } }); } return myMillingSpeedPanel; }
From source file:visolate.Visolate.java
private JPanel getPlungeSpeedPanel() { if (myPlungeSpeedPanel == null) { myPlungeSpeedPanel = new JPanel(); myPlungeSpeedPanel.setLayout(new BorderLayout()); myPlungeSpeedPanel.add(new JLabel("plunge feedrate"), BorderLayout.WEST); myPlungeSpeedPanel/*from www . j av a 2s .c o m*/ .setToolTipText("Feedrate when moving vertically into the workpiece in mm or inch per minute."); final JTextField field = new JTextField( NumberFormat.getInstance().format(gCodeWriter.getPlungeFeedrate())); myPlungeSpeedPanel.add(field, BorderLayout.CENTER); field.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { gCodeWriter .setPlungeFeedrate(NumberFormat.getInstance().parse(field.getText()).doubleValue()); } catch (ParseException e) { } field.setText(NumberFormat.getInstance().format(gCodeWriter.getPlungeFeedrate())); } }); } return myPlungeSpeedPanel; }
From source file:visolate.Visolate.java
private JPanel getZCuttingHeightPanel() { if (myZCuttingHeightPanel == null) { myZCuttingHeightPanel = new JPanel(); myZCuttingHeightPanel.setLayout(new BorderLayout()); myZCuttingHeightPanel.add(new JLabel("cutting height"), BorderLayout.WEST); myZCuttingHeightPanel.setToolTipText( "When cutting, the head should have this z-coordinate, in mm or inch. Likely a negative value, decimals in native language (point or comma)"); myZCuttingHeightPanel.setEnabled(gCodeWriter.getIsAbsolute()); final JTextField field = new JTextField( NumberFormat.getInstance().format(gCodeWriter.getZCuttingHeight())); myZCuttingHeightPanel.add(field, BorderLayout.CENTER); myZCuttingHeightPanel.addPropertyChangeListener("enabled", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { field.setEnabled(myZCuttingHeightPanel.isEnabled()); }//ww w . j av a2 s . c o m }); field.setEnabled(myZCuttingHeightPanel.isEnabled()); field.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { try { gCodeWriter .setZCuttingHeight(NumberFormat.getInstance().parse(field.getText()).doubleValue()); } catch (ParseException e) { } field.setText(NumberFormat.getInstance().format(gCodeWriter.getZCuttingHeight())); } }); } return myZCuttingHeightPanel; }