1 |
/* JPopupMenu.java |
/* JPopupMenu.java -- |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
95 |
/** name for the UI delegate for this menuItem. */ |
/** name for the UI delegate for this menuItem. */ |
96 |
private static final String uiClassID = "PopupMenuUI"; |
private static final String uiClassID = "PopupMenuUI"; |
97 |
|
|
|
/** Fire a PropertyChangeEvent when the "borderPainted" property changes. */ |
|
|
public static final String LABEL_CHANGED_PROPERTY = "label"; |
|
|
|
|
98 |
/* indicates if popup's menu border should be painted*/ |
/* indicates if popup's menu border should be painted*/ |
99 |
private boolean borderPainted = true; |
private boolean borderPainted = true; |
100 |
|
|
139 |
/* Field indicating if popup menu is visible or not */ |
/* Field indicating if popup menu is visible or not */ |
140 |
private boolean visible = false; |
private boolean visible = false; |
141 |
|
|
|
/* Bound Property indicating visibility of the popup menu*/ |
|
|
public static final String VISIBLE_CHANGED_PROPERTY = "visible"; |
|
|
|
|
142 |
/** |
/** |
143 |
* Creates a new JPopupMenu object. |
* Creates a new JPopupMenu object. |
144 |
*/ |
*/ |
285 |
} |
} |
286 |
|
|
287 |
/** |
/** |
|
* Paints popup menu's border if borderPainted is true |
|
|
* |
|
|
* @param graphics graphics context used to paint this popup's menu border. |
|
|
*/ |
|
|
protected void borderPainted(Graphics graphics) |
|
|
{ |
|
|
if (borderPainted) |
|
|
getBorder().paintBorder(this, graphics, 0, 0, getSize(null).width, |
|
|
getSize(null).height); |
|
|
} |
|
|
|
|
|
/** |
|
288 |
* Returns flag indicating if newly created JPopupMenu will use |
* Returns flag indicating if newly created JPopupMenu will use |
289 |
* heavyweight or lightweight container to display its menu items |
* heavyweight or lightweight container to display its menu items |
290 |
* |
* |
431 |
/** |
/** |
432 |
* Sets label for this popup menu. This method fires PropertyChangeEvent |
* Sets label for this popup menu. This method fires PropertyChangeEvent |
433 |
* when the label property is changed. Please note that most |
* when the label property is changed. Please note that most |
434 |
* of the Look & Feel will ignore this property. |
* of the Look & Feel will ignore this property. |
435 |
* |
* |
436 |
* @param label label for this popup menu |
* @param label label for this popup menu |
437 |
*/ |
*/ |
441 |
{ |
{ |
442 |
String oldLabel = this.label; |
String oldLabel = this.label; |
443 |
this.label = label; |
this.label = label; |
444 |
firePropertyChange(LABEL_CHANGED_PROPERTY, oldLabel, label); |
firePropertyChange("label", oldLabel, label); |
445 |
} |
} |
446 |
} |
} |
447 |
|
|
553 |
*/ |
*/ |
554 |
public void setVisible(boolean visible) |
public void setVisible(boolean visible) |
555 |
{ |
{ |
556 |
|
if (visible == isVisible()) |
557 |
|
return; |
558 |
|
|
559 |
boolean old = isVisible(); |
boolean old = isVisible(); |
560 |
this.visible = visible; |
this.visible = visible; |
561 |
if (old != isVisible()) |
if (old != isVisible()) |
562 |
{ |
{ |
563 |
firePropertyChange(VISIBLE_CHANGED_PROPERTY, old, (boolean) isVisible()); |
firePropertyChange("visible", old, isVisible()); |
564 |
if (visible) |
if (visible) |
565 |
{ |
{ |
566 |
firePopupMenuWillBecomeVisible(); |
firePopupMenuWillBecomeVisible(); |