-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjbutton.java
More file actions
36 lines (28 loc) · 784 Bytes
/
jbutton.java
File metadata and controls
36 lines (28 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package mayank;
import java.awt.*;
import javax.swing.*;
import javax.xml.bind.Marshaller.Listener;
import java.awt.event.*;
public class jbutton extends JFrame {
private JButton item1;
public jbutton(){
super("the title");
setLayout(new FlowLayout());
item1=new JButton("item1 button");
item1.setToolTipText("mouse when over it!!");
add(item1);
handler thehandle=new handler();
item1.addActionListener(thehandle);
}
public class handler implements ActionListener{
public void actionPerformed(ActionEvent e) {
JOptionPane.showConfirmDialog(null,String.format("%s", e.getActionCommand()));
}
}
public static void main(String[] args) {
jbutton ob=new jbutton();
ob.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ob.setSize(350,250);
ob.setVisible(true);
}
}