Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1299 - development/laboratory/mgr/main/src/main/net/dpml/mgr/main

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1299 - development/laboratory/mgr/main/src/main/net/dpml/mgr/main
  • Date: Sun, 26 Dec 2004 09:44:35 +0100

Author: mcconnell
Date: Sun Dec 26 09:44:35 2004
New Revision: 1299

Modified:

development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
Log:
add popups

Modified:
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
==============================================================================
---
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
(original)
+++
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
Sun Dec 26 09:44:35 2004
@@ -37,6 +37,7 @@
import javax.swing.JButton;
import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.JPopupMenu;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
@@ -341,12 +342,28 @@
{
Component component = event.getComponent();
component.requestFocus();
+ if( event.getButton() == 3 )
+ {
+ //
+ // present a popup menu
+ //
+
+ JPopupMenu popup = new JPopupMenu();
+ JMenuItem about = new JMenuItem( "About ..." );
+ about.setFont( DEFAULT_FONT );
+ popup.add( about );
+ popup.addSeparator();
+ JMenuItem addItem = new JMenuItem( "Add Desktop Item ..." );
+ addItem.setFont( DEFAULT_FONT );
+ popup.add( addItem );
+ popup.show( component, event.getX(), event.getY() );
+ }
}
}

/**
- * MouseEvent listener that listens for doubleclick events on buttons
- * within the content panel.
+ * MouseEvent listener that listens for doubleclick and right-click
+ * events on buttons within the content panel.
*/
private static class ClickListener extends MouseAdapter
{
@@ -358,6 +375,29 @@
{
System.out.println( "# double-click" );
}
+ else if( event.getButton() == 3 )
+ {
+ //
+ // create a popup context menu
+ //
+
+ component.requestFocus();
+ JPopupMenu popup = new JPopupMenu();
+ popup.setFont( DEFAULT_FONT );
+ JMenuItem properties = new JMenuItem( "Properties" );
+ properties.setFont( DEFAULT_FONT );
+ popup.add( properties );
+ popup.addSeparator();
+ JMenuItem open = new JMenuItem( "Open" );
+ open.setFont( DEFAULT_FONT );
+ popup.add( open );
+ JMenuItem remove = new JMenuItem( "Remove" );
+ remove.setFont( DEFAULT_FONT );
+ remove.setEnabled( false );
+ popup.add( remove );
+
+ popup.show( component, event.getX(), event.getY() );
+ }
}
}




  • svn commit: r1299 - development/laboratory/mgr/main/src/main/net/dpml/mgr/main, mcconnell, 12/26/2004

Archive powered by MHonArc 2.6.24.

Top of Page