how can u reduce the size of textfield?

how can u reduce the size of textfield?

thanks in advance

View Answers

September 29, 2011 at 11:49 AM

import javax.swing.*;

   public class ReduceTextField extends JFrame {
        public static void main(String[] args) {
           JTextField text1 = new JTextField(20);
           JTextField text2 = new JTextField(10);
           JFrame f=new JFrame();
           f.setLayout(null);
           text1.setBounds(10,10,100,20);
           text2.setBounds(120,10,100,10);
           f.add(text1);
           f.add(text2);
           f.setVisible(true);
           f.setSize(300,150);
          }
    }









Related Tutorials/Questions & Answers:
Advertisements