Home Answers Viewqa Swing-AWT how can u reduce the size of textfield?

 
 


raveen
how can u reduce the size of textfield?
1 Answer(s)      a year and 8 months ago
Posted in : Swing AWT

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 Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.