-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenubar.java
More file actions
51 lines (46 loc) · 1.12 KB
/
menubar.java
File metadata and controls
51 lines (46 loc) · 1.12 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package mayank;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
public class menubar extends JFrame{
private JMenuBar menubar;
private JMenu help;
JMenuItem about;
menubar(){
super("the title");
setLayout(new FlowLayout());
menubar=new JMenuBar();
add(menubar);
help=new JMenu("Help");
menubar.add(help);
about=new JMenuItem("About");
help.add(about);
setJMenuBar(menubar);
about.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
HelpWindow ob1=new HelpWindow(menubar.this);
ob1.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
ob1.setSize(300,100);
ob1.setVisible(true);
}
}
);
}
public class HelpWindow extends JDialog{
JLabel label;
public HelpWindow(JFrame frame){
super(frame, "Help window",true);
setLayout(new FlowLayout());
label=new JLabel("I am tired thi is help menu");
add(label);
}
}
public static void main(String[] args) {
menubar ob=new menubar();
ob.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ob.setVisible(true);
ob.setSize(300,200);
}
}