Methods Summary |
---|
public javax.swing.JMenuItem | add(javax.swing.JMenuItem menuItem)Appends the specified menu item to the end of this menu.
super.add(menuItem);
return menuItem;
|
public javax.swing.JMenuItem | add(java.lang.String s)Creates a new menu item with the specified text and appends
it to the end of this menu.
return add(new JMenuItem(s));
|
public javax.swing.JMenuItem | add(javax.swing.Action a)Appends a new menu item to the end of the menu which
dispatches the specified Action object.
JMenuItem mi = createActionComponent(a);
mi.setAction(a);
add(mi);
return mi;
|
public void | addMenuKeyListener(javax.swing.event.MenuKeyListener l)Adds a MenuKeyListener to the popup menu.
listenerList.add(MenuKeyListener.class, l);
|
public void | addPopupMenuListener(javax.swing.event.PopupMenuListener l)Adds a PopupMenu listener.
listenerList.add(PopupMenuListener.class,l);
|
public void | addSeparator()Appends a new separator at the end of the menu.
add( new JPopupMenu.Separator() );
|
java.awt.Point | adjustPopupLocationToFitScreen(int xposition, int yposition)Returns an point which has been adjusted to take into account of the
desktop bounds, taskbar and multi-monitor configuration.
This adustment may be cancelled by invoking the application with
-Djavax.swing.adjustPopupLocationToFit=false
Point p = new Point(xposition, yposition);
if(popupPostionFixDisabled == true || GraphicsEnvironment.isHeadless())
return p;
Toolkit toolkit = Toolkit.getDefaultToolkit();
Rectangle screenBounds;
Insets screenInsets;
GraphicsConfiguration gc = null;
// Try to find GraphicsConfiguration, that includes mouse
// pointer position
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gd = ge.getScreenDevices();
for(int i = 0; i < gd.length; i++) {
if(gd[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
GraphicsConfiguration dgc =
gd[i].getDefaultConfiguration();
if(dgc.getBounds().contains(p)) {
gc = dgc;
break;
}
}
}
// If not found and we have invoker, ask invoker about his gc
if(gc == null && getInvoker() != null) {
gc = getInvoker().getGraphicsConfiguration();
}
if(gc != null) {
// If we have GraphicsConfiguration use it to get
// screen bounds and insets
screenInsets = toolkit.getScreenInsets(gc);
screenBounds = gc.getBounds();
} else {
// If we don't have GraphicsConfiguration use primary screen
// and empty insets
screenInsets = new Insets(0, 0, 0, 0);
screenBounds = new Rectangle(toolkit.getScreenSize());
}
int scrWidth = screenBounds.width -
Math.abs(screenInsets.left+screenInsets.right);
int scrHeight = screenBounds.height -
Math.abs(screenInsets.top+screenInsets.bottom);
Dimension size;
size = JPopupMenu.this.getPreferredSize();
// Use long variables to prevent overflow
long pw = (long) p.x + (long) size.width;
long ph = (long) p.y + (long) size.height;
if( pw > screenBounds.x + scrWidth )
p.x = screenBounds.x + scrWidth - size.width;
if( ph > screenBounds.y + scrHeight)
p.y = screenBounds.y + scrHeight - size.height;
/* Change is made to the desired (X,Y) values, when the
PopupMenu is too tall OR too wide for the screen
*/
if( p.x < screenBounds.x )
p.x = screenBounds.x ;
if( p.y < screenBounds.y )
p.y = screenBounds.y;
return p;
|
boolean | alwaysOnTop()Always returns true since popups, by definition, should always
be on top of all other windows.
return true;
|
protected java.beans.PropertyChangeListener | createActionChangeListener(javax.swing.JMenuItem b)Returns a properly configured PropertyChangeListener
which updates the control as changes to the Action occur.
return b.createActionPropertyChangeListener0(b.getAction());
|
protected javax.swing.JMenuItem | createActionComponent(javax.swing.Action a)Factory method which creates the JMenuItem for
Actions added to the JPopupMenu .
JMenuItem mi = new JMenuItem() {
protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
PropertyChangeListener pcl = createActionChangeListener(this);
if (pcl == null) {
pcl = super.createActionPropertyChangeListener(a);
}
return pcl;
}
};
mi.setHorizontalTextPosition(JButton.TRAILING);
mi.setVerticalTextPosition(JButton.CENTER);
return mi;
|
private void | fireMenuKeyPressed(javax.swing.event.MenuKeyEvent event)Notifies all listeners that have registered interest for
notification on this event type.
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==MenuKeyListener.class) {
((MenuKeyListener)listeners[i+1]).menuKeyPressed(event);
}
}
|
private void | fireMenuKeyReleased(javax.swing.event.MenuKeyEvent event)Notifies all listeners that have registered interest for
notification on this event type.
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==MenuKeyListener.class) {
((MenuKeyListener)listeners[i+1]).menuKeyReleased(event);
}
}
|
private void | fireMenuKeyTyped(javax.swing.event.MenuKeyEvent event)Notifies all listeners that have registered interest for
notification on this event type.
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==MenuKeyListener.class) {
((MenuKeyListener)listeners[i+1]).menuKeyTyped(event);
}
}
|
protected void | firePopupMenuCanceled()Notifies PopupMenuListeners that this popup menu is
cancelled.
Object[] listeners = listenerList.getListenerList();
PopupMenuEvent e=null;
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==PopupMenuListener.class) {
if (e == null)
e = new PopupMenuEvent(this);
((PopupMenuListener)listeners[i+1]).popupMenuCanceled(e);
}
}
|
protected void | firePopupMenuWillBecomeInvisible()Notifies PopupMenuListener s that this popup menu will
become invisible.
Object[] listeners = listenerList.getListenerList();
PopupMenuEvent e=null;
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==PopupMenuListener.class) {
if (e == null)
e = new PopupMenuEvent(this);
((PopupMenuListener)listeners[i+1]).popupMenuWillBecomeInvisible(e);
}
}
|
protected void | firePopupMenuWillBecomeVisible()Notifies PopupMenuListener s that this popup menu will
become visible.
Object[] listeners = listenerList.getListenerList();
PopupMenuEvent e=null;
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==PopupMenuListener.class) {
if (e == null)
e = new PopupMenuEvent(this);
((PopupMenuListener)listeners[i+1]).popupMenuWillBecomeVisible(e);
}
}
|
public javax.accessibility.AccessibleContext | getAccessibleContext()Gets the AccessibleContext associated with this JPopupMenu.
For JPopupMenus, the AccessibleContext takes the form of an
AccessibleJPopupMenu.
A new AccessibleJPopupMenu instance is created if necessary.
if (accessibleContext == null) {
accessibleContext = new AccessibleJPopupMenu();
}
return accessibleContext;
|
public java.awt.Component | getComponent()Returns this JPopupMenu component.
return this;
|
public java.awt.Component | getComponentAtIndex(int i)Returns the component at the specified index.
return getComponent(i);
|
public int | getComponentIndex(java.awt.Component c)Returns the index of the specified component.
int ncomponents = this.getComponentCount();
Component[] component = this.getComponents();
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = component[i];
if (comp == c)
return i;
}
return -1;
|
public static boolean | getDefaultLightWeightPopupEnabled()Gets the defaultLightWeightPopupEnabled property,
which by default is true .
Boolean b = (Boolean)
SwingUtilities.appContextGet(defaultLWPopupEnabledKey);
if (b == null) {
SwingUtilities.appContextPut(defaultLWPopupEnabledKey,
Boolean.TRUE);
return true;
}
return b.booleanValue();
|
private static java.awt.Frame | getFrame(java.awt.Component c)
Component w = c;
while(!(w instanceof Frame) && (w!=null)) {
w = w.getParent();
}
return (Frame)w;
|
public java.awt.Component | getInvoker()Returns the component which is the 'invoker' of this
popup menu.
return this.invoker;
|
public java.lang.String | getLabel()Returns the popup menu's label
return label;
|
public java.awt.Insets | getMargin()Returns the margin, in pixels, between the popup menu's border and
its containees.
if(margin == null) {
return new Insets(0,0,0,0);
} else {
return margin;
}
|
public javax.swing.event.MenuKeyListener[] | getMenuKeyListeners()Returns an array of all the MenuKeyListener s added
to this JPopupMenu with addMenuKeyListener().
return (MenuKeyListener[])listenerList.getListeners(
MenuKeyListener.class);
|
private javax.swing.Popup | getPopup()Returns a Popup instance from the
PopupMenuUI that has had show invoked on
it. If the current popup is non-null,
this will invoke dispose of it, and then
show the new one.
This does NOT fire any events, it is up the caller to dispatch
the necessary events.
Popup oldPopup = popup;
if (oldPopup != null) {
oldPopup.hide();
}
PopupFactory popupFactory = PopupFactory.getSharedInstance();
if (isLightWeightPopupEnabled()) {
popupFactory.setPopupType(PopupFactory.LIGHT_WEIGHT_POPUP);
}
else {
popupFactory.setPopupType(PopupFactory.MEDIUM_WEIGHT_POPUP);
}
// adjust the location of the popup
Point p = adjustPopupLocationToFitScreen(desiredLocationX,desiredLocationY);
desiredLocationX = p.x;
desiredLocationY = p.y;
Popup newPopup = getUI().getPopup(this, desiredLocationX,
desiredLocationY);
popupFactory.setPopupType(PopupFactory.LIGHT_WEIGHT_POPUP);
newPopup.show();
return newPopup;
|
public javax.swing.event.PopupMenuListener[] | getPopupMenuListeners()Returns an array of all the PopupMenuListener s added
to this JMenuItem with addPopupMenuListener().
return (PopupMenuListener[])listenerList.getListeners(
PopupMenuListener.class);
|
javax.swing.JPopupMenu | getRootPopupMenu()Returns the popup menu which is at the root of the menu system
for this popup menu.
JPopupMenu mp = this;
while((mp!=null) && (mp.isPopupMenu()!=true) &&
(mp.getInvoker() != null) &&
(mp.getInvoker().getParent() != null) &&
(mp.getInvoker().getParent() instanceof JPopupMenu)
) {
mp = (JPopupMenu) mp.getInvoker().getParent();
}
return mp;
|
public javax.swing.SingleSelectionModel | getSelectionModel()Returns the model object that handles single selections.
return selectionModel;
|
public javax.swing.MenuElement[] | getSubElements()Returns an array of MenuElement s containing the submenu
for this menu component. It will only return items conforming to
the JMenuElement interface.
If popup menu is null returns
an empty array. This method is required to conform to the
MenuElement interface.
MenuElement result[];
Vector tmp = new Vector();
int c = getComponentCount();
int i;
Component m;
for(i=0 ; i < c ; i++) {
m = getComponent(i);
if(m instanceof MenuElement)
tmp.addElement(m);
}
result = new MenuElement[tmp.size()];
for(i=0,c=tmp.size() ; i < c ; i++)
result[i] = (MenuElement) tmp.elementAt(i);
return result;
|
public javax.swing.plaf.PopupMenuUI | getUI()Returns the look and feel (L&F) object that renders this component.
return (PopupMenuUI)ui;
|
public java.lang.String | getUIClassID()Returns the name of the L&F class that renders this component.
return uiClassID;
|
public void | insert(javax.swing.Action a, int index)Inserts a menu item for the specified Action object at
a given position.
JMenuItem mi = createActionComponent(a);
mi.setAction(a);
insert(mi, index);
|
public void | insert(java.awt.Component component, int index)Inserts the specified component into the menu at a given
position.
if (index < 0) {
throw new IllegalArgumentException("index less than zero.");
}
int nitems = getComponentCount();
// PENDING(ges): Why not use an array?
Vector tempItems = new Vector();
/* Remove the item at index, nitems-index times
storing them in a temporary vector in the
order they appear on the menu.
*/
for (int i = index ; i < nitems; i++) {
tempItems.addElement(getComponent(index));
remove(index);
}
add(component);
/* Add the removed items back to the menu, they are
already in the correct order in the temp vector.
*/
for (int i = 0; i < tempItems.size() ; i++) {
add((Component)tempItems.elementAt(i));
}
|
public boolean | isBorderPainted()Checks whether the border should be painted.
return paintBorder;
|
public boolean | isLightWeightPopupEnabled()Gets the lightWeightPopupEnabled property.
return lightWeightPopup;
|
private boolean | isPopupMenu()Returns true if the popup menu is a standalone popup menu
rather than the submenu of a JMenu .
return ((invoker != null) && !(invoker instanceof JMenu));
|
public boolean | isPopupTrigger(java.awt.event.MouseEvent e)Returns true if the MouseEvent is considered a popup trigger
by the JPopupMenu 's currently installed UI.
return getUI().isPopupTrigger(e);
|
boolean | isSubPopupMenu(javax.swing.JPopupMenu popup)Examines the list of menu items to determine whether
popup is a popup menu.
int ncomponents = this.getComponentCount();
Component[] component = this.getComponents();
for (int i = 0 ; i < ncomponents ; i++) {
Component comp = component[i];
if (comp instanceof JMenu) {
JMenu menu = (JMenu)comp;
JPopupMenu subPopup = menu.getPopupMenu();
if (subPopup == popup)
return true;
if (subPopup.isSubPopupMenu(popup))
return true;
}
}
return false;
|
public boolean | isVisible()Returns true if the popup menu is visible (currently
being displayed).
if(popup != null)
return true;
else
return false;
|
public void | menuSelectionChanged(boolean isIncluded)Messaged when the menubar selection changes to activate or
deactivate this menu. This implements the
javax.swing.MenuElement interface.
Overrides MenuElement.menuSelectionChanged .
if (DEBUG) {
System.out.println("In JPopupMenu.menuSelectionChanged " + isIncluded);
}
if(invoker instanceof JMenu) {
JMenu m = (JMenu) invoker;
if(isIncluded)
m.setPopupMenuVisible(true);
else
m.setPopupMenuVisible(false);
}
if (isPopupMenu() && !isIncluded)
setVisible(false);
|
public void | pack()Lays out the container so that it uses the minimum space
needed to display its contents.
if(popup != null) {
Dimension pref = getPreferredSize();
if (pref == null || pref.width != getWidth() ||
pref.height != getHeight()) {
popup = getPopup();
} else {
validate();
}
}
|
protected void | paintBorder(java.awt.Graphics g)Paints the popup menu's border if the borderPainted
property is true .
if (isBorderPainted()) {
super.paintBorder(g);
}
|
protected java.lang.String | paramString()Returns a string representation of this JPopupMenu .
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null .
String labelString = (label != null ?
label : "");
String paintBorderString = (paintBorder ?
"true" : "false");
String marginString = (margin != null ?
margin.toString() : "");
String lightWeightPopupEnabledString = (isLightWeightPopupEnabled() ?
"true" : "false");
return super.paramString() +
",desiredLocationX=" + desiredLocationX +
",desiredLocationY=" + desiredLocationY +
",label=" + labelString +
",lightWeightPopupEnabled=" + lightWeightPopupEnabledString +
",margin=" + marginString +
",paintBorder=" + paintBorderString;
|
protected void | processFocusEvent(java.awt.event.FocusEvent evt)
super.processFocusEvent(evt);
|
protected void | processKeyEvent(java.awt.event.KeyEvent evt)Processes key stroke events such as mnemonics and accelerators.
MenuSelectionManager.defaultManager().processKeyEvent(evt);
if (evt.isConsumed()) {
return;
}
super.processKeyEvent(evt);
|
public void | processKeyEvent(java.awt.event.KeyEvent e, javax.swing.MenuElement[] path, javax.swing.MenuSelectionManager manager)Processes a key event forwarded from the
MenuSelectionManager and changes the menu selection,
if necessary, by using MenuSelectionManager 's API.
Note: you do not have to forward the event to sub-components.
This is done automatically by the MenuSelectionManager .
MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),
e.getWhen(), e.getModifiers(),
e.getKeyCode(), e.getKeyChar(),
path, manager);
processMenuKeyEvent(mke);
if (mke.isConsumed()) {
e.consume();
}
|
private void | processMenuKeyEvent(javax.swing.event.MenuKeyEvent e)Handles a keystroke in a menu.
switch (e.getID()) {
case KeyEvent.KEY_PRESSED:
fireMenuKeyPressed(e); break;
case KeyEvent.KEY_RELEASED:
fireMenuKeyReleased(e); break;
case KeyEvent.KEY_TYPED:
fireMenuKeyTyped(e); break;
default:
break;
}
|
public void | processMouseEvent(java.awt.event.MouseEvent event, javax.swing.MenuElement[] path, javax.swing.MenuSelectionManager manager)This method is required to conform to the
MenuElement interface, but it not implemented.
|
private void | readObject(java.io.ObjectInputStream s)
s.defaultReadObject();
Vector values = (Vector)s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
if(indexCounter < maxCounter && values.elementAt(indexCounter).
equals("invoker")) {
invoker = (Component)values.elementAt(++indexCounter);
indexCounter++;
}
if(indexCounter < maxCounter && values.elementAt(indexCounter).
equals("popup")) {
popup = (Popup)values.elementAt(++indexCounter);
indexCounter++;
}
|
public void | remove(int pos)Removes the component at the specified index from this popup menu.
if (pos < 0) {
throw new IllegalArgumentException("index less than zero.");
}
if (pos > getComponentCount() -1) {
throw new IllegalArgumentException("index greater than the number of items.");
}
super.remove(pos);
|
public void | removeMenuKeyListener(javax.swing.event.MenuKeyListener l)Removes a MenuKeyListener from the popup menu.
listenerList.remove(MenuKeyListener.class, l);
|
public void | removePopupMenuListener(javax.swing.event.PopupMenuListener l)Removes a PopupMenu listener.
listenerList.remove(PopupMenuListener.class,l);
|
public void | setBorderPainted(boolean b)Sets whether the border should be painted.
paintBorder = b;
repaint();
|
public static void | setDefaultLightWeightPopupEnabled(boolean aFlag)Sets the default value of the lightWeightPopupEnabled
property. // show bad params, misc.
SwingUtilities.appContextPut(defaultLWPopupEnabledKey,
Boolean.valueOf(aFlag));
|
public void | setInvoker(java.awt.Component invoker)Sets the invoker of this popup menu -- the component in which
the popup menu menu is to be displayed.
Component oldInvoker = this.invoker;
this.invoker = invoker;
if ((oldInvoker != this.invoker) && (ui != null)) {
ui.uninstallUI(this);
ui.installUI(this);
}
invalidate();
|
public void | setLabel(java.lang.String label)Sets the popup menu's label. Different look and feels may choose
to display or not display this.
String oldValue = this.label;
this.label = label;
firePropertyChange("label", oldValue, label);
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
oldValue, label);
}
invalidate();
repaint();
|
public void | setLightWeightPopupEnabled(boolean aFlag)Sets the value of the lightWeightPopupEnabled property,
which by default is true .
By default, when a look and feel displays a popup,
it can choose to
use a lightweight (all-Java) popup.
Lightweight popup windows are more efficient than heavyweight
(native peer) windows,
but lightweight and heavyweight components do not mix well in a GUI.
If your application mixes lightweight and heavyweight components,
you should disable lightweight popups.
Some look and feels might always use heavyweight popups,
no matter what the value of this property.
// NOTE: this use to set the flag on a shared JPopupMenu, which meant
// this effected ALL JPopupMenus.
lightWeightPopup = aFlag;
|
public void | setLocation(int x, int y)Sets the location of the upper left corner of the
popup menu using x, y coordinates.
int oldX = desiredLocationX;
int oldY = desiredLocationY;
desiredLocationX = x;
desiredLocationY = y;
if(popup != null && (x != oldX || y != oldY)) {
popup = getPopup();
}
|
public void | setPopupSize(java.awt.Dimension d)Sets the size of the Popup window using a Dimension object.
This is equivalent to setPreferredSize(d) .
Dimension oldSize = getPreferredSize();
setPreferredSize(d);
if (popup != null) {
Dimension newSize = getPreferredSize();
if (!oldSize.equals(newSize)) {
popup = getPopup();
}
}
|
public void | setPopupSize(int width, int height)Sets the size of the Popup window to the specified width and
height. This is equivalent to
setPreferredSize(new Dimension(width, height)) .
setPopupSize(new Dimension(width, height));
|
public void | setSelected(java.awt.Component sel)Sets the currently selected component, This will result
in a change to the selection model.
SingleSelectionModel model = getSelectionModel();
int index = getComponentIndex(sel);
model.setSelectedIndex(index);
|
public void | setSelectionModel(javax.swing.SingleSelectionModel model)Sets the model object to handle single selections.
selectionModel = model;
|
public void | setUI(javax.swing.plaf.PopupMenuUI ui)Sets the L&F object that renders this component.
super.setUI(ui);
|
public void | setVisible(boolean b)Sets the visibility of the popup menu.
if (DEBUG) {
System.out.println("JPopupMenu.setVisible " + b);
}
// Is it a no-op?
if (b == isVisible())
return;
// if closing, first close all Submenus
if (b == false) {
// 4234793: This is a workaround because JPopupMenu.firePopupMenuCanceled is
// a protected method and cannot be called from BasicPopupMenuUI directly
// The real solution could be to make
// firePopupMenuCanceled public and call it directly.
Boolean doCanceled = (Boolean)getClientProperty("JPopupMenu.firePopupMenuCanceled");
if (doCanceled != null && doCanceled == Boolean.TRUE) {
putClientProperty("JPopupMenu.firePopupMenuCanceled", Boolean.FALSE);
firePopupMenuCanceled();
}
getSelectionModel().clearSelection();
} else {
// This is a popup menu with MenuElement children,
// set selection path before popping up!
if (isPopupMenu()) {
if (getSubElements().length > 0) {
MenuElement me[] = new MenuElement[2];
me[0]=(MenuElement)this;
me[1]=getSubElements()[0];
MenuSelectionManager.defaultManager().setSelectedPath(me);
} else {
MenuElement me[] = new MenuElement[1];
me[0]=(MenuElement)this;
MenuSelectionManager.defaultManager().setSelectedPath(me);
}
}
}
if(b) {
firePopupMenuWillBecomeVisible();
popup = getPopup();
firePropertyChange("visible", Boolean.FALSE, Boolean.TRUE);
} else if(popup != null) {
firePopupMenuWillBecomeInvisible();
popup.hide();
popup = null;
firePropertyChange("visible", Boolean.TRUE, Boolean.FALSE);
// 4694797: When popup menu is made invisible, selected path
// should be cleared
if (isPopupMenu()) {
MenuSelectionManager.defaultManager().clearSelectedPath();
}
}
|
public void | show(java.awt.Component invoker, int x, int y)Displays the popup menu at the position x,y in the coordinate
space of the component invoker.
if (DEBUG) {
System.out.println("in JPopupMenu.show " );
}
setInvoker(invoker);
Frame newFrame = getFrame(invoker);
if (newFrame != frame) {
// Use the invoker's frame so that events
// are propagated properly
if (newFrame!=null) {
this.frame = newFrame;
if(popup != null) {
setVisible(false);
}
}
}
Point invokerOrigin;
if (invoker != null) {
invokerOrigin = invoker.getLocationOnScreen();
// To avoid integer overflow
long lx, ly;
lx = ((long) invokerOrigin.x) +
((long) x);
ly = ((long) invokerOrigin.y) +
((long) y);
if(lx > Integer.MAX_VALUE) lx = Integer.MAX_VALUE;
if(lx < Integer.MIN_VALUE) lx = Integer.MIN_VALUE;
if(ly > Integer.MAX_VALUE) ly = Integer.MAX_VALUE;
if(ly < Integer.MIN_VALUE) ly = Integer.MIN_VALUE;
setLocation((int) lx, (int) ly);
} else {
setLocation(x, y);
}
setVisible(true);
|
public void | updateUI()Resets the UI property to a value from the current look and feel.
setUI((PopupMenuUI)UIManager.getUI(this));
|
private void | writeObject(java.io.ObjectOutputStream s)
Vector values = new Vector();
s.defaultWriteObject();
// Save the invoker, if its Serializable.
if(invoker != null && invoker instanceof Serializable) {
values.addElement("invoker");
values.addElement(invoker);
}
// Save the popup, if its Serializable.
if(popup != null && popup instanceof Serializable) {
values.addElement("popup");
values.addElement(popup);
}
s.writeObject(values);
if (getUIClassID().equals(uiClassID)) {
byte count = JComponent.getWriteObjCounter(this);
JComponent.setWriteObjCounter(this, --count);
if (count == 0 && ui != null) {
ui.installUI(this);
}
}
|