Source Code : A hack to make a JTextField really 2 columns wide
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
A hack to make a JTextField really 2 columns wide

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class WidthHack {
public static void main(String[] args) {
JTextField tf = new JTextField("mm");
tf.setPreferredSize(tf.getPreferredSize());
tf.setText("");
JPanel pHacked = new JPanel();
pHacked.setBorder(new javax.swing.border.TitledBorder("hacked 2 columns"));
pHacked.add(tf);
JPanel pStock = new JPanel();
pStock.setBorder(new javax.swing.border.TitledBorder("stock 2 columns"));
pStock.add(new JTextField(2));
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new java.awt.GridLayout(0, 1));
frame.getContentPane().add(pHacked);
frame.getContentPane().add(pStock);
frame.setSize(150, 150);
frame.setVisible(true);
tf.requestFocus();
}
}
Thank with us