Java JTextField Number placeDoubleTextInField(JTextField inField, int length, double toPlace)

Here you can find the source of placeDoubleTextInField(JTextField inField, int length, double toPlace)

Description

place Double Text In Field

License

Open Source License

Declaration

public static void placeDoubleTextInField(JTextField inField, int length, double toPlace) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;
import javax.swing.JTextField;

public class Main {
    public static void placeDoubleTextInField(JTextField inField, int length, double toPlace) {
        char[] valArray = Double.toString(toPlace).toCharArray();
        inField.setText(new String(Arrays.copyOf(valArray, Math.min(valArray.length, length))));
    }// w  w  w  . j ava2 s  .  c  om
}

Related

  1. format(JTextField txt, double num, String fmt)
  2. getNum(JTextField txt, double defaultNum)
  3. getNumber(JTextField field, Integer defaultInt)
  4. largeEqualThan(javax.swing.JTextField input, double x)
  5. parseIntFromField(JTextField jField, int pDefault)
  6. readDoubleFromField(JTextField inField, double defaultValue)
  7. setNumericAndCharOnly(final javax.swing.JTextField textField)
  8. setTextField(javax.swing.JTextField textField, double value, int precision)
  9. showInDecimalFormat(JTextField pJTextField)