Java JTextField setupTextField(JPanel panel, JLabel label, JTextField field, long val, String toolTip)

Here you can find the source of setupTextField(JPanel panel, JLabel label, JTextField field, long val, String toolTip)

Description

setup Text Field

License

Apache License

Declaration

static void setupTextField(JPanel panel, JLabel label, JTextField field, long val, String toolTip) 

Method Source Code

//package com.java2s;
/**/*  w  ww  .  j  a va 2  s.c o  m*/
 *   Copyright 2012 Workplace Partners LLC
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

import javax.swing.*;

import java.text.DecimalFormat;

public class Main {
    static DecimalFormat _decimalFormat = new DecimalFormat("###,###,###");

    static void setupTextField(JPanel panel, JLabel label, JTextField field, long val, String toolTip) {
        setupTextField(panel, label, field, _decimalFormat.format(val), toolTip);
    }

    static void setupTextField(JPanel panel, JLabel label, JTextField field, String val, String toolTip) {
        //    label.setLabelFor(field);
        field.setColumns(10);
        field.setText(val);
        field.setToolTipText(toolTip);

        panel.add(label);
        panel.add(field);
    }
}

Related

  1. setEnabled(JTextField textField, boolean b)
  2. setEnabled(JTextField textField, boolean enabled)
  3. setModelValue(JTextField tf, String value)
  4. setText(JTextField jField, Object pObject, Object pDefault)
  5. setupNoCommitCheckbox(final JCheckBox addLogInformationCheckBox, final JTextField commitMessage, final JCheckBox noCommitCheckBox)
  6. setValue(JTextField f, String value)
  7. showFileOpenDialogAndChangePrefs(String prefName, FileNameExtensionFilter fileNameExtensionFilter, JTextField textField, Class forClass, Component parent)
  8. textAreaChangeListener(JTextField a, final ChangeListener list)
  9. toUpperCase(JTextField field)