Monday, February 26, 2018

Java Swing Program: GUI

import javax.swing.*;

public class SwingExample
{
    public static void main(String[] S)
    {
        JFrame f=new JFrame();
        JButton b=new JButton("Profit");
        JTextField tf1=new JTextField();
        JTextField tf2=new JTextField();
        //JTextArea ta1=new JTextArea("Sell Price");
        //ta1.setBounds(20,120,100,40);
        tf1.setBounds(90,120,120,40);
        tf2.setBounds(90,60,120,40);
        b.setBounds(90,200,120,50);
        f.add(b);
        f.add(tf1);
        f.add(tf2);
        //f.add(ta1);
        f.setSize(600,600);
        f.setLayout(null);
        f.setVisible(true);
       
    }
}   
Thanks
Happy programming!

No comments:

Post a Comment

Sacred Thought

26 April 2024  Dear friends, I write the explanation of two verses of Geets for all of you, I hope you all will like it and benefit from it....