1 |
/* PopupMenuUI.java -- |
/* PopupMenuUI.java -- |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
37 |
|
|
38 |
package javax.swing.plaf; |
package javax.swing.plaf; |
39 |
|
|
40 |
// Imports |
import java.awt.event.MouseEvent; |
41 |
import java.awt.event.*; |
import javax.swing.JPopupMenu; |
42 |
|
import javax.swing.Popup; |
43 |
|
import javax.swing.PopupFactory; |
44 |
|
|
45 |
|
|
46 |
/** |
/** |
47 |
* PopupMenuUI |
* An abstract base class for delegates that implement the pluggable |
48 |
* @author Andrew Selkirk |
* look and feel for a <code>JPopupMenu</code>. |
49 |
* @version 1.0 |
* |
50 |
|
* @see javax.swing.JPopupMenu |
51 |
|
* |
52 |
|
* @author Andrew Selkirk (aselkirk@sympatico.ca) |
53 |
|
* @author Sascha Brawer (brawer@dandelis.ch) |
54 |
*/ |
*/ |
55 |
public abstract class PopupMenuUI extends ComponentUI { |
public abstract class PopupMenuUI |
56 |
|
extends ComponentUI |
57 |
//------------------------------------------------------------- |
{ |
58 |
// Initialization --------------------------------------------- |
/** |
59 |
//------------------------------------------------------------- |
* Constructs a new <code>PopupMenuUI</code>. |
60 |
|
*/ |
61 |
/** |
public PopupMenuUI() |
62 |
* Constructor PopupMenuUI |
{ |
63 |
*/ |
} |
64 |
public PopupMenuUI() { |
|
65 |
// TODO |
|
66 |
} // PopupMenuUI() |
/** |
67 |
|
* Tests whether or not a mouse event triggers a popup menu. |
68 |
|
* |
69 |
//------------------------------------------------------------- |
* <p>The default implementation calls |
70 |
// Methods ---------------------------------------------------- |
* <code>event.isPopupTrigger()</code>, which checks for the gesture |
71 |
//------------------------------------------------------------- |
* that is common for the platform on which the application runs. If |
72 |
|
* a look and feel wants to employ non-standard conventions for |
73 |
/** |
* triggering a popup menu, it can override this method. |
74 |
* isPopupTrigger |
* |
75 |
* @param event TODO |
* @param event the event to check. |
76 |
* @returns boolean |
* |
77 |
*/ |
* @return <code>true</code> if the event triggers a popup menu; |
78 |
public boolean isPopupTrigger(MouseEvent event) { |
* <code>false</code> otherwise. |
79 |
return false; // TODO |
* |
80 |
} // isPopupTrigger() |
* @since 1.3 |
81 |
|
*/ |
82 |
|
public boolean isPopupTrigger(MouseEvent event) |
83 |
} // PopupMenuUI |
{ |
84 |
|
return event.isPopupTrigger(); |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
|
/** |
89 |
|
* Creates a <code>Popup</code> for displaying the popup menu. The |
90 |
|
* default implementation uses the {@link javax.swing.PopupFactory} |
91 |
|
* for retrieving a suitable <code>Popup</code>, but subclasses |
92 |
|
* might want to override this method if a LookAndFeel needs special |
93 |
|
* Popups. |
94 |
|
* |
95 |
|
* @param popup the <code>JPopupMenu</code> for whose display |
96 |
|
* a <code>Popup</code> is needed. |
97 |
|
* |
98 |
|
* @param x the horizontal position where the popup will be |
99 |
|
* displayed. |
100 |
|
* |
101 |
|
* @param y the vertical position where the popup will be |
102 |
|
* displayed. |
103 |
|
* |
104 |
|
* @return a <code>Popup</code> for showing and hiding |
105 |
|
* the menu. |
106 |
|
* |
107 |
|
* @since 1.4 |
108 |
|
*/ |
109 |
|
public Popup getPopup(JPopupMenu popup, int x, int y) |
110 |
|
{ |
111 |
|
return PopupFactory.getSharedInstance().getPopup( |
112 |
|
/* origin/owner of the popup */ popup.getInvoker(), |
113 |
|
/* contents */ popup, |
114 |
|
x, y); |
115 |
|
} |
116 |
|
} |