Java JTextField Size fixTextFieldsSize(JTextField... jTextFields)

Here you can find the source of fixTextFieldsSize(JTextField... jTextFields)

Description

fix Text Fields Size

License

LGPL

Declaration

public static void fixTextFieldsSize(JTextField... jTextFields) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import javax.swing.*;

import java.awt.*;

public class Main {
    public static void fixTextFieldsSize(JTextField... jTextFields) {
        for (JTextField field : jTextFields) {
            fixTextFieldSize(field);//from   ww  w.j a  v  a 2  s .c  o  m
        }
    }

    public static JTextField fixTextFieldSize(JTextField field) {
        final Dimension size = field.getPreferredSize();
        size.width = field.getMaximumSize().width;
        field.setMaximumSize(size);

        return field;
    }
}

Related

  1. adjustSize(JTextField textField)
  2. fixTextFieldSize(JTextField field)
  3. setMinimumSizeFromCols(JTextField component)