本文整理匯總了Java中javax.swing.JFormattedTextField.setColumns方法的典型用法代碼示例。如果您正苦於以下問題:Java JFormattedTextField.setColumns方法的具體用法?Java JFormattedTextField.setColumns怎麽用?Java JFormattedTextField.setColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JFormattedTextField
的用法示例。
在下文中一共展示了JFormattedTextField.setColumns方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: IntegerEditor
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
* Construct a <code>JSpinner</code> editor that supports displaying and
* editing the value of a <code>SpinnerIntModel</code> with a
* <code>JFormattedTextField</code>. <code>This</code>
* <code>IntegerEditor</code> becomes both a <code>ChangeListener</code>
* on the spinner and a <code>PropertyChangeListener</code> on the new
* <code>JFormattedTextField</code>.
*
* @param spinner the spinner whose model <code>this</code> editor will
* monitor
* @param format the <code>NumberFormat</code> object that's used to
* display and parse the value of the text field.
* @exception IllegalArgumentException if the spinners model is not an
* instance of <code>SpinnerIntModel</code>
*
* @see #getTextField
* @see SpinnerIntModel
* @see java.text.DecimalFormat
*/
private IntegerEditor(JSpinner spinner, NumberFormat format) {
super(spinner);
if (!(spinner.getModel() instanceof SpinnerIntModel)) {
throw new IllegalArgumentException("model not a SpinnerIntModel");
}
format.setGroupingUsed(false);
format.setMaximumFractionDigits(0);
SpinnerIntModel model = (SpinnerIntModel) spinner.getModel();
NumberFormatter formatter = new IntegerEditorFormatter(model, format);
DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
JFormattedTextField ftf = getTextField();
ftf.setEditable(true);
ftf.setFormatterFactory(factory);
ftf.setHorizontalAlignment(JTextField.RIGHT);
try {
String minString = formatter.valueToString(model.getMinimum());
String maxString = formatter.valueToString(model.getMaximum());
// Trying to approximate the width difference between "m" and "0" by multiplying with 0.7
ftf.setColumns((int) Math.round(0.7 * Math.max(maxString.length(), minString.length())));
} catch (ParseException e) {
// Nothing to do, the component width will simply be the default
}
}
示例2: addLabeledNumericInput
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
* Add a labeled numeric input to a data panel.
* @param dataPanel Data panel.
* @param labelText Text for the label.
* @param row Row for the display.
* @param col Column for the display.
* @return Numeric input field.
*/
public static JFormattedTextField addLabeledNumericInput(JPanel dataPanel, String labelText, int row, int col)
{
JLabel titleLabel = SSSaveEditorUI.addLabel(dataPanel, labelText, row, col);
JFormattedTextField field = new JFormattedTextField(SSSaveEditorUI.formatter);
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(0, 5, 0, 0);
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridx = col + 1;
constraints.gridy = row;
dataPanel.add(field, constraints);
field.setColumns(10);
titleLabel.setLabelFor(field);
return field;
}
示例3: GridEditPanel
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public GridEditPanel(int rasterSize) {
JLabel lblSize = new JLabel("size (px)");
lblSize.setFont(Program.TEXT_FONT.deriveFont(Font.BOLD).deriveFont(10f));
textField = new JFormattedTextField(NumberFormat.getIntegerInstance());
textField.setText("16");
textField.setFont(Program.TEXT_FONT.deriveFont(10f));
textField.setColumns(10);
textField.setValue(rasterSize);
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblSize, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(textField, GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
.addGap(34)));
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
.addComponent(lblSize, GroupLayout.PREFERRED_SIZE, 13, GroupLayout.PREFERRED_SIZE)
.addComponent(textField, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
.addContainerGap(46, Short.MAX_VALUE)));
setLayout(groupLayout);
}
示例4: init
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
static void init(int length, boolean hex, JFormattedTextField text) {
ValueFormatter formatter = new ValueFormatter(length, hex);
text.setColumns(length);
text.setFormatterFactory(new DefaultFormatterFactory(formatter));
text.setHorizontalAlignment(SwingConstants.RIGHT);
text.setMinimumSize(text.getPreferredSize());
text.addFocusListener(formatter);
}
示例5: buildNumberTextField
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
private static JTextField buildNumberTextField()
{
// TODO: Verifying user input
NumberFormatter formatter = new NumberFormatter( new DecimalFormat( "0" ) );
formatter.setValueClass( Integer.class );
formatter.setMinimum( Integer.MIN_VALUE );
formatter.setMaximum( Integer.MAX_VALUE );
formatter.setAllowsInvalid( false );
JFormattedTextField result = new JFormattedTextField();
result.setHorizontalAlignment( SwingConstants.RIGHT );
result.setColumns( 10 );
return result;
}
示例6: PHTextFieldNode
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public PHTextFieldNode( IntegerRange range ) {
super();
_range = new IntegerRange( range );
_listeners = new ArrayList();
EventHandler textFieldEventHandler = new EventHandler();
JLabel phLabel = new JLabel( PHScaleStrings.LABEL_PH );
phLabel.setFont( LABEL_FONT );
_textField = new JFormattedTextField( "XX.XX" );
_textField.setFont( VALUE_FONT );
_textField.setColumns( VALUE_COLUMNS );
_textField.setHorizontalAlignment( JTextField.RIGHT );
_textField.addActionListener( textFieldEventHandler );
_textField.addFocusListener( textFieldEventHandler );
_textField.addKeyListener( textFieldEventHandler );
JPanel valuePanel = new JPanel();
valuePanel.setOpaque( false );
EasyGridBagLayout valuePanelLayout = new EasyGridBagLayout( valuePanel );
valuePanel.setLayout( valuePanelLayout );
valuePanelLayout.addComponent( phLabel, 0, 0 );
valuePanelLayout.addComponent( _textField, 0, 1 );
PSwing valuePanelWrapper = new PSwing( valuePanel );
addChild( valuePanelWrapper );
// initialize
setPH( range.getDefault() );
}
示例7: LaserPowerControl
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param powerRange
* @param label
* @param units
* @param pattern
* @param columns
* @param wavelength
* @param sliderSize
* @param font
*/
public LaserPowerControl( DoubleRange powerRange, String label, String units, String pattern, int columns,
double wavelength, Dimension sliderSize, Font font ) {
super();
_minPower = powerRange.getMin();
_maxPower = powerRange.getMax();
_listener = new EventHandler();
_listenerList = new EventListenerList();
Color color = VisibleColor.wavelengthToColor( wavelength );
_intensitySlider = new IntensitySlider( color, IntensitySlider.HORIZONTAL, sliderSize );
_intensitySlider.addChangeListener( _listener );
_label = new JLabel( label );
_label.setFont( font );
_formattedTextField = new JFormattedTextField();
_formattedTextField.setFont( font );
_formattedTextField.setColumns( columns );
_formattedTextField.setHorizontalAlignment( JTextField.RIGHT );
_formattedTextField.addActionListener( _listener );
_formattedTextField.addFocusListener( _listener );
_formattedTextField.addKeyListener( _listener );
_formatter = new DecimalFormat( pattern );
_units = new JLabel( units );
_units.setFont( font );
// Opacity
_intensitySlider.setOpaque( false );
_units.setOpaque( false );
// Default state
_power = powerRange.getMin() - 1; // force an update
setPower( powerRange.getDefault() );
}
示例8: SimulationSpeedControlPanel
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public SimulationSpeedControlPanel( Font titleFont, Font controlFont, OTClock clock ) {
super();
_clock = clock;
_clock.addConstantDtClockListener( new ConstantDtClockAdapter() {
public void dtChanged( ConstantDtClockEvent event ) {
//XXX handle dt changes that are performed by someone else
};
});
// Title
JLabel titleLabel = new JLabel( OTResources.getString( "label.simulationSpeed" ) );
titleLabel.setFont( titleFont );
// Slider
_slider = new SimulationSpeedSlider( clock.getSlowRange(), clock.getFastRange(), clock.getDt() );
_slider.addChangeListener( new ChangeListener() {
public void stateChanged( ChangeEvent e ) {
setSimulationSpeed( _slider.getValue() );
}
});
PhetPCanvas canvas = new PhetPCanvas();
canvas.setBackground( getBackground() );
canvas.setBorder( null );
canvas.getLayer().addChild( _slider );
int margin = 2;
int xOffset = (int) -_slider.getFullBounds().getX() + margin;
int yOffset = (int) -_slider.getFullBounds().getY() + margin;
_slider.setOffset( xOffset, yOffset );
int w = (int) _slider.getFullBounds().getWidth() + ( 2 * margin );
int h = (int) _slider.getFullBounds().getHeight() + ( 2 * margin );
canvas.setPreferredSize( new Dimension( w, h ) );
// Textfield
_textField = new JFormattedTextField( VALUE_FORMAT );
_textField.setFont( controlFont );
_textField.setValue( new Double( _slider.getValue() ) );
_textField.setHorizontalAlignment( JTextField.RIGHT );
_textField.setColumns( VALUE_COLUMNS );
TextFieldListener textFieldListener = new TextFieldListener();
_textField.addActionListener( textFieldListener );
_textField.addFocusListener( textFieldListener );
// Units
JLabel unitsLabel = new JLabel( OTResources.getString( "units.time" ) );
unitsLabel.setFont( controlFont );
EasyGridBagLayout layout = new EasyGridBagLayout( this );
this.setLayout( layout );
layout.setAnchor( GridBagConstraints.WEST );
layout.setFill( GridBagConstraints.HORIZONTAL );
layout.setInsets( OTConstants.SUB_PANEL_INSETS );
int row = 0;
int column = 0;
layout.addComponent( titleLabel, row, column++ );
layout.addComponent( _textField, row, column++ );
layout.addComponent( unitsLabel, row, column++ );
row++;
column = 0;
layout.addComponent( canvas, row, column, 3, 1 );
setSimulationSpeed( clock.getDt() );
}
示例9: ConcentrationControlNode
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public ConcentrationControlNode( double min, double max ) {
super();
changeListeners = new ArrayList<ChangeListener>();
sliderNode = new ConcentrationSliderNode( min, max );
addChild( sliderNode );
sliderNode.addChangeListener( new SliderListener() );
textField = new JFormattedTextField( TEXTFIELD_FORMAT );
textField.setFont( TEXTFIELD_FONT );
textField.setValue( new Double( sliderNode.getValue() ) );
textField.setHorizontalAlignment( JTextField.RIGHT );
textField.setColumns( TEXTFIELD_COLUMNS );
TextFieldListener textFieldListener = new TextFieldListener();
textField.addActionListener( textFieldListener );
textField.addFocusListener( textFieldListener );
textField.addKeyListener( textFieldListener );
JLabel unitsLabel = new JLabel( AABSStrings.UNITS_MOLES_PER_LITER );
unitsLabel.setFont( UNITS_FONT );
JPanel panel = new JPanel();
panel.setOpaque( false );
panel.add( textField );
panel.add( unitsLabel );
PSwing panelWrapper = new PSwing( panel );
addChild( panelWrapper );
// slider
double xOffset = 0;
double yOffset = 0;
sliderNode.setOffset( xOffset, yOffset );
// text field to the right of slider, vertically centered
xOffset = sliderNode.getFullBoundsReference().getMaxX() + X_SPACING;
yOffset = sliderNode.getFullBoundsReference().getCenterY() - ( panelWrapper.getFullBoundsReference().getHeight() / 2 );
panelWrapper.setOffset( xOffset, yOffset );
}
示例10: createIntegerFieldTrackingValue
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public static JFormattedTextField createIntegerFieldTrackingValue(@NotNull InspectionProfileEntry owner,
@NotNull String property,
int integerFieldColumns) {
JFormattedTextField valueField = new JFormattedTextField();
valueField.setColumns(integerFieldColumns);
setupIntegerFieldTrackingValue(valueField, owner, property);
return valueField;
}
示例11: SoftSphereSolidEOSCalculator
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public SoftSphereSolidEOSCalculator() {
super(new BorderLayout());
double density = 1.1964;
double temperature = 1.0;
double[] quantity = getAllQuantity(FCC, n, temperature, density);
//Create the labels.
densityLabel = new JLabel(densityString);
temperatureLabel = new JLabel(temperatureString);
bALabel = new JLabel(bAString);
ZLabel = new JLabel(ZString);
bULabel = new JLabel(bUString);
//Create the text fields and set them up.
densityField = new JFormattedTextField(densityFormat);
densityField.setValue(new Double(density));
densityField.setColumns(10);
densityField.addPropertyChangeListener("value", this);
temperatureField = new JFormattedTextField(temperatureFormat);
temperatureField.setValue(new Double(temperature));
temperatureField.setColumns(10);
temperatureField.addPropertyChangeListener("value", this);
bAField = new JFormattedTextField(bAFormat);
bAField.setValue(new Double(quantity[0]));
bAField.setColumns(10);
bAField.setEditable(false);
// paymentField.setForeground(Color.red);
ZField = new JFormattedTextField(ZFormat);
ZField.setValue(new Double(quantity[1]));
ZField.setColumns(10);
ZField.setEditable(false);
bUField = new JFormattedTextField(bUFormat);
bUField.setValue(new Double(quantity[2]));
bUField.setColumns(10);
bUField.setEditable(false);
//Tell accessibility tools about label/textfield pairs.
densityLabel.setLabelFor(densityField);
temperatureLabel.setLabelFor(temperatureField);
bALabel.setLabelFor(bAField);
ZLabel.setLabelFor(ZField);
bULabel.setLabelFor(bUField);
//Lay out the labels in a panel.
JPanel labelPane = new JPanel(new GridLayout(0,1));
labelPane.add(densityLabel);
labelPane.add(temperatureLabel);
labelPane.add(bALabel);
labelPane.add(ZLabel);
labelPane.add(bULabel);
//Layout the text fields in a panel.
JPanel fieldPane = new JPanel(new GridLayout(0,1));
fieldPane.add(densityField);
fieldPane.add(temperatureField);
fieldPane.add(bAField);
fieldPane.add(ZField);
fieldPane.add(bUField);
//Put the panels in this panel, labels on left,
//text fields on right.
setBorder(BorderFactory.createEmptyBorder(40, 40, 40, 40));
add(labelPane, BorderLayout.CENTER);
add(fieldPane, BorderLayout.LINE_END);
// LayoutStyle layout = new
}
示例12: SnifferControl
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
public SnifferControl() {
super();
setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
_hostIpTextField = new JTextField(17);
_hostIpTextField.setText(Resources.getLabel("sniffer.host.tooltip"));
final FirstInputListener listener = new FirstInputListener(_hostIpTextField);
_hostIpTextField.addMouseListener(listener);
_hostIpTextField.addKeyListener(listener);
_hostIpTextField.setToolTipText(Resources.getLabel("sniffer.host.tooltip"));
add(_hostIpTextField);
final JLabel protocolLabel = new JLabel(Resources.getLabel("protocol.label"));
protocolLabel.setToolTipText(Resources.getLabel("protocol.desc"));
add(protocolLabel);
for (final Protocol type : Protocol.values()) {
if (type == Protocol.OTHER) {
continue;
}
final JCheckBox check = new JCheckBox(type.name(), type == Protocol.TCP);
_packets.put(type, check);
add(check);
}
final JLabel portLabel = new JLabel(Resources.getLabel("port.label"));
portLabel.setToolTipText(Resources.getLabel("port.desc"));
_allPortCheck = new JCheckBox(Resources.getLabel("all.port.label"));
_allPortCheck.setToolTipText(Resources.getLabel("all.port.desc"));
_allPortCheck.setSelected(false);
add(_allPortCheck);
_portTF = new JFormattedTextField();
_portTF.setText("80,443");
_portTF.setColumns(15);
// _portTF.setMaximumSize(new Dimension(30, _portTF.getPreferredSize().height));
add(portLabel);
add(_portTF);
_portTF.setEnabled(true);
_allPortCheck.addChangeListener(e -> _portTF.setEnabled(!_allPortCheck.isSelected()));
_filterPacketLengthCheck = new JCheckBox(Resources.getLabel("filter.length"));
_filterPacketLengthCheck.setToolTipText(Resources.getLabel("filter.length.desc"));
_filterPacketLengthCheck.setSelected(false);
add(_filterPacketLengthCheck);
_filterLengthTF = new JFormattedTextField(new NumberFormatterFactory());
_filterLengthTF.setText("128");
_filterLengthTF.setColumns(5);
add(_filterLengthTF);
_filterPacketLengthCheck.addChangeListener(e -> _filterLengthTF.setEnabled(_filterPacketLengthCheck.isEnabled() && _filterPacketLengthCheck.isSelected()));
_capturePeriod = new JFormattedTextField(new NumberFormatterFactory());
_capturePeriod.setText("0");
_capturePeriod.setColumns(5);
add(new JLabel(Resources.getLabel("capture.period")));
add(_capturePeriod);
_captureButton = new JButton(GO_IMG);
_captureButton.setToolTipText(Resources.getLabel("capture.packet.start"));
add(_captureButton);
_captureButton.addActionListener(arg0 -> start());
}
示例13: MassValueEntryNode
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
* Constructor.
*/
public MassValueEntryNode( final BalanceGameModel balanceGameModel, PCanvas canvas ) {
this.model = balanceGameModel;
this.canvas = canvas;
// Add the textual prompt.
PText prompt = new PText( BalanceAndTorqueStudyResources.Strings.MASS_EQUALS );
prompt.setFont( TEXT_FONT );
// Create the sub-panel that will contain the edit box for entering
// the numerical value.
JPanel numericalValueEntryPanel = new JPanel();
numericalValueEntryPanel.setBackground( BACKGROUND_COLOR );
numberEntryField = new JFormattedTextField( NumberFormat.getNumberInstance() );
numberEntryField.setColumns( ANSWER_ENTRY_FIELD_COLUMNS );
numberEntryField.setFont( TEXT_FONT );
numberEntryField.setBorder( BorderFactory.createEtchedBorder() );
numberEntryField.requestFocus();
numericalValueEntryPanel.add( numberEntryField );
// Add the units label.
PText unitsLabel = new PText( BalanceAndTorqueStudyResources.Strings.KG );
unitsLabel.setFont( TEXT_FONT );
// Add a handler for the case where the user presses the Enter key.
numberEntryField.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent arg0 ) {
submitProposedAnswer();
}
} );
// Wrap the value entry panel in a PSwing.
PSwing valueEntryPSwing = new PSwing( numericalValueEntryPanel );
// Create the button for checking the answer.
checkAnswerButton = new TextButtonNode( BalanceAndTorqueStudyResources.Strings.CHECK_ANSWER, new PhetFont( 20 ), Color.YELLOW );
// Register to send the user's guess when the button is pushed.
checkAnswerButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
submitProposedAnswer();
}
} );
// Lay out the node.
addChild( new ControlPanelNode( new VBox( 10, new HBox( 5, prompt, valueEntryPSwing, unitsLabel ), checkAnswerButton ), BACKGROUND_COLOR ) );
}
示例14: MassValueEntryNode
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
* Constructor.
*/
public MassValueEntryNode( final BalanceGameModel balanceGameModel, PCanvas canvas ) {
this.model = balanceGameModel;
this.canvas = canvas;
// Add the textual prompt.
PText prompt = new PText( BalanceAndTorqueResources.Strings.MASS_EQUALS );
prompt.setFont( TEXT_FONT );
// Create the sub-panel that will contain the edit box for entering
// the numerical value.
JPanel numericalValueEntryPanel = new JPanel();
numericalValueEntryPanel.setBackground( BACKGROUND_COLOR );
numberEntryField = new JFormattedTextField( NumberFormat.getNumberInstance() );
numberEntryField.setColumns( ANSWER_ENTRY_FIELD_COLUMNS );
numberEntryField.setFont( TEXT_FONT );
numberEntryField.setBorder( BorderFactory.createEtchedBorder() );
numberEntryField.requestFocus();
numericalValueEntryPanel.add( numberEntryField );
// Add the units label.
PText unitsLabel = new PText( BalanceAndTorqueResources.Strings.KG );
unitsLabel.setFont( TEXT_FONT );
// Add a handler for the case where the user presses the Enter key.
numberEntryField.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent arg0 ) {
submitProposedAnswer();
}
} );
// Wrap the value entry panel in a PSwing.
PSwing valueEntryPSwing = new PSwing( numericalValueEntryPanel );
// Create the button for checking the answer.
checkAnswerButton = new TextButtonNode( BalanceAndTorqueResources.Strings.CHECK_ANSWER, new PhetFont( 20 ), Color.YELLOW );
// Register to send the user's guess when the button is pushed.
checkAnswerButton.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
submitProposedAnswer();
}
} );
// Lay out the node.
addChild( new ControlPanelNode( new VBox( 10, new HBox( 5, prompt, valueEntryPSwing, unitsLabel ), checkAnswerButton ), BACKGROUND_COLOR ) );
}
示例15: IntensityControl
import javax.swing.JFormattedTextField; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param size
* @param font
*/
public IntensityControl( Dimension size, Font font ) {
super();
_listenerList = new EventListenerList();
_eventSource = this;
EventHandler listener = new EventHandler();
_slider = new IntensitySlider( Color.RED, IntensitySlider.HORIZONTAL, size );
_slider.addChangeListener( listener );
_formattedTextField = new JFormattedTextField();
_formattedTextField.setFont( font );
_formattedTextField.setColumns( 3 );
_formattedTextField.setHorizontalAlignment( JTextField.RIGHT );
_formattedTextField.addActionListener( listener );
_formattedTextField.addFocusListener( listener );
_formattedTextField.addKeyListener( listener );
_units = new JLabel( "%" );
_units.setFont( font );
// Opacity
setOpaque( false );
_slider.setOpaque( false );
_units.setOpaque( false );
// Layout
EasyGridBagLayout layout = new EasyGridBagLayout( this );
layout.setInsets( new Insets( 0, 0, 0, 3 ) ); // top, left, bottom, right
this.setLayout( layout );
layout.setAnchor( GridBagConstraints.WEST );
int row = 0;
int col = 0;
layout.addComponent( _slider, row, col++ );
layout.addComponent( _formattedTextField, row, col++ );
layout.addComponent( _units, row, col++ );
// Default state
setValue( 0 );
}