diff src/treecms/test/SwingTest1.java @ 21:f3150b37f9be

commit
author shoshi
date Mon, 06 Jun 2011 21:49:04 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/treecms/test/SwingTest1.java	Mon Jun 06 21:49:04 2011 +0900
@@ -0,0 +1,37 @@
+package treecms.test;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.*;
+
+public class SwingTest1
+{
+	public static void main(String _args[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
+	{
+		UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+		JFrame f = new JFrame("");
+		JButton btn = new JButton("btn!");
+		Container cnt = f.getContentPane();
+		cnt.setLayout(new BorderLayout());
+		cnt.add(btn,BorderLayout.CENTER);
+		
+		
+		final JPopupMenu menu = new JPopupMenu();
+		JMenuItem item = new JMenuItem("test1");
+		menu.add(item);
+		
+		btn.addActionListener(new ActionListener(){
+			@Override
+			public void actionPerformed(ActionEvent e)
+			{
+				menu.setVisible(true);
+			}
+		});
+		
+		f.setVisible(true);
+		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+	}
+}