How to get or set JTextField columns - Java Swing

Java examples for Swing:JTextField

Description

How to get or set JTextField columns

Demo Code


import java.awt.FlowLayout;
 
import javax.swing.JApplet;
import javax.swing.JTextField;
 
public class Main {
 
        public void init(){
               //from  www.j av  a2 s  .co m
                JTextField field = new JTextField("JTextField Columns Example");
               
                field.setColumns(20);
               
                int columns = field.getColumns();
               
        }
}

Related Tutorials