자바 간단 한 메뉴 만 들 기

6239 단어
 1 package test;
 2 
 3 import java.awt.Container;
 4 import java.awt.GridLayout;
 5 import java.awt.event.WindowAdapter;
 6 import java.awt.event.WindowEvent;
 7 import java.io.File;
 8 import java.util.Vector;
 9 
10 import javax.swing.BorderFactory;
11 import javax.swing.ComboBoxEditor;
12 import javax.swing.ImageIcon;
13 import javax.swing.JCheckBox;
14 import javax.swing.JComboBox;
15 import javax.swing.JFrame;
16 import javax.swing.JLabel;
17 import javax.swing.JMenu;
18 import javax.swing.JMenuBar;
19 import javax.swing.JPanel;
20 import javax.swing.JRadioButton;
21 import javax.swing.JScrollPane;
22 import javax.swing.JTextArea;
23 public class test {
24     public static void main(String[] args) {
25         JFrame f=new JFrame("Welcome!");
26         JTextArea text=new JTextArea();
27         text.setEditable(true);
28         f.getContentPane().add(new JScrollPane(text));
29         JMenu menuFile=new JMenu("  ");
30         menuFile.setIcon(new ImageIcon("d:"+File.separator+"Note.png"));
31         JMenuBar menuBar=new JMenuBar();
32         menuBar.add(menuFile);
33         f.addWindowListener(new WindowAdapter(){
34             public void windowClosing(WindowEvent arg0){
35                 System.exit(1);
36             }
37         });
38         f.setJMenuBar(menuBar);
39         f.setVisible(true);
40         f.setSize(300,100);
41         f.setLocation(300,200);
42         
43     }
44 
45 
46 }

좋은 웹페이지 즐겨찾기