JButton

The JButton class provides a rich set of features to of design highly user-friendly buttons.with initial text and an icon.

Program

gg

 

 

 

Program Source

import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.FlowLayout;

class Frame extends JFrame{
    
    Frame()
    {
        setTitle("JButton");
        setLayout(new FlowLayout());
        setButtons();
        setSize(700, 200);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    
    private void setButtons()
    {
        JButton jb1 = new JButton("JButton01");
        JButton jb2 = new JButton("JButton02");
        JButton jb3 = new JButton("JButton03");
        add(jb1);
        add(jb2);
        add(jb3);
    }
}

public class Javaapp {
   
    public static void main(String[] args) {
        
        Frame frame = new Frame();
    }
}

Leave a Comment