< prev index next >
src/java.desktop/share/classes/javax/swing/PopupFactory.java
Print this page
@@ -39,17 +39,17 @@
import java.util.List;
import java.util.Map;
import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP;
/**
- * <code>PopupFactory</code>, as the name implies, is used to obtain
- * instances of <code>Popup</code>s. <code>Popup</code>s are used to
- * display a <code>Component</code> above all other <code>Component</code>s
+ * {@code PopupFactory}, as the name implies, is used to obtain
+ * instances of {@code Popup}s. {@code Popup}s are used to
+ * display a {@code Component} above all other {@code Component}s
* in a particular containment hierarchy. The general contract is that
- * once you have obtained a <code>Popup</code> from a
- * <code>PopupFactory</code>, you must invoke <code>hide</code> on the
- * <code>Popup</code>. The typical usage is:
+ * once you have obtained a {@code Popup} from a
+ * {@code PopupFactory}, you must invoke {@code hide} on the
+ * {@code Popup}. The typical usage is:
* <pre>
* PopupFactory factory = PopupFactory.getSharedInstance();
* Popup popup = factory.getPopup(owner, contents, x, y);
* popup.show();
* ...
@@ -70,13 +70,13 @@
return factory.getPopup(owner, contents, ownerX, ownerY, HEAVY_WEIGHT_POPUP);
}
});
}
/**
- * The shared instanceof <code>PopupFactory</code> is per
- * <code>AppContext</code>. This is the key used in the
- * <code>AppContext</code> to locate the <code>PopupFactory</code>.
+ * The shared instanceof {@code PopupFactory} is per
+ * {@code AppContext}. This is the key used in the
+ * {@code AppContext} to locate the {@code PopupFactory}.
*/
private static final Object SharedInstanceKey =
new StringBuffer("PopupFactory.SharedInstanceKey");
/**
@@ -104,29 +104,29 @@
*/
private int popupType = LIGHT_WEIGHT_POPUP;
/**
- * Sets the <code>PopupFactory</code> that will be used to obtain
- * <code>Popup</code>s.
- * This will throw an <code>IllegalArgumentException</code> if
- * <code>factory</code> is null.
+ * Sets the {@code PopupFactory} that will be used to obtain
+ * {@code Popup}s.
+ * This will throw an {@code IllegalArgumentException} if
+ * {@code factory} is null.
*
* @param factory Shared PopupFactory
- * @exception IllegalArgumentException if <code>factory</code> is null
+ * @exception IllegalArgumentException if {@code factory} is null
* @see #getPopup
*/
public static void setSharedInstance(PopupFactory factory) {
if (factory == null) {
throw new IllegalArgumentException("PopupFactory can not be null");
}
SwingUtilities.appContextPut(SharedInstanceKey, factory);
}
/**
- * Returns the shared <code>PopupFactory</code> which can be used
- * to obtain <code>Popup</code>s.
+ * Returns the shared {@code PopupFactory} which can be used
+ * to obtain {@code Popup}s.
*
* @return Shared PopupFactory
*/
public static PopupFactory getSharedInstance() {
PopupFactory factory = (PopupFactory)SwingUtilities.appContextGet(
@@ -139,11 +139,11 @@
return factory;
}
/**
- * Provides a hint as to the type of <code>Popup</code> that should
+ * Provides a hint as to the type of {@code Popup} that should
* be created.
*/
void setPopupType(int type) {
popupType = type;
}
@@ -154,20 +154,20 @@
int getPopupType() {
return popupType;
}
/**
- * Creates a <code>Popup</code> for the Component <code>owner</code>
- * containing the Component <code>contents</code>. <code>owner</code>
- * is used to determine which <code>Window</code> the new
- * <code>Popup</code> will parent the <code>Component</code> the
- * <code>Popup</code> creates to. A null <code>owner</code> implies there
- * is no valid parent. <code>x</code> and
- * <code>y</code> specify the preferred initial location to place
- * the <code>Popup</code> at. Based on screen size, or other paramaters,
- * the <code>Popup</code> may not display at <code>x</code> and
- * <code>y</code>.
+ * Creates a {@code Popup} for the Component {@code owner}
+ * containing the Component {@code contents}. {@code owner}
+ * is used to determine which {@code Window} the new
+ * {@code Popup} will parent the {@code Component} the
+ * {@code Popup} creates to. A null {@code owner} implies there
+ * is no valid parent. {@code x} and
+ * {@code y} specify the preferred initial location to place
+ * the {@code Popup} at. Based on screen size, or other paramaters,
+ * the {@code Popup} may not display at {@code x} and
+ * {@code y}.
*
* @param owner Component mouse coordinates are relative to, may be null
* @param contents Contents of the Popup
* @param x Initial x screen coordinate
* @param y Initial y screen coordinate
@@ -224,12 +224,12 @@
return popupType;
}
/**
- * Obtains the appropriate <code>Popup</code> based on
- * <code>popupType</code>.
+ * Obtains the appropriate {@code Popup} based on
+ * {@code popupType}.
*/
private Popup getPopup(Component owner, Component contents,
int ownerX, int ownerY, int popupType) {
if (GraphicsEnvironment.isHeadless()) {
return getHeadlessPopup(owner, contents, ownerX, ownerY);
@@ -289,12 +289,12 @@
return HeavyWeightPopup.getHeavyWeightPopup(owner, contents, ownerX,
ownerY);
}
/**
- * Returns true if the Component <code>i</code> inside a heavy weight
- * <code>Popup</code>.
+ * Returns true if the Component {@code i} inside a heavy weight
+ * {@code Popup}.
*/
private boolean invokerInHeavyWeightPopup(Component i) {
if (i != null) {
Container parent;
for(parent = i.getParent() ; parent != null ; parent =
@@ -316,11 +316,11 @@
new StringBuffer("PopupFactory.heavyWeightPopupCache");
private volatile boolean isCacheEnabled = true;
/**
- * Returns either a new or recycled <code>Popup</code> containing
+ * Returns either a new or recycled {@code Popup} containing
* the specified children.
*/
static Popup getHeavyWeightPopup(Component owner, Component contents,
int ownerX, int ownerY) {
Window window = (owner != null) ? SwingUtilities.
@@ -371,14 +371,14 @@
return popup;
}
/**
- * Returns a previously disposed heavy weight <code>Popup</code>
- * associated with <code>window</code>. This will return null if
- * there is no <code>HeavyWeightPopup</code> associated with
- * <code>window</code>.
+ * Returns a previously disposed heavy weight {@code Popup}
+ * associated with {@code window}. This will return null if
+ * there is no {@code HeavyWeightPopup} associated with
+ * {@code window}.
*/
private static HeavyWeightPopup getRecycledHeavyWeightPopup(Window w) {
synchronized (HeavyWeightPopup.class) {
List<HeavyWeightPopup> cache;
Map<Window, List<HeavyWeightPopup>> heavyPopupCache = getHeavyWeightPopupCache();
@@ -397,12 +397,12 @@
}
}
/**
* Returns the cache to use for heavy weight popups. Maps from
- * <code>Window</code> to a <code>List</code> of
- * <code>HeavyWeightPopup</code>s.
+ * {@code Window} to a {@code List} of
+ * {@code HeavyWeightPopup}s.
*/
@SuppressWarnings("unchecked")
private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {
synchronized (HeavyWeightPopup.class) {
Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(
@@ -416,11 +416,11 @@
return cache;
}
}
/**
- * Recycles the passed in <code>HeavyWeightPopup</code>.
+ * Recycles the passed in {@code HeavyWeightPopup}.
*/
private static void recycleHeavyWeightPopup(HeavyWeightPopup popup) {
synchronized (HeavyWeightPopup.class) {
List<HeavyWeightPopup> cache;
Window window = SwingUtilities.getWindowAncestor(
@@ -490,12 +490,12 @@
this._dispose();
}
}
/**
- * As we recycle the <code>Window</code>, we don't want to dispose it,
- * thus this method does nothing, instead use <code>_dipose</code>
+ * As we recycle the {@code Window}, we don't want to dispose it,
+ * thus this method does nothing, instead use {@code _dipose}
* which will handle the disposing.
*/
void dispose() {
}
@@ -506,11 +506,11 @@
/**
* ContainerPopup consolidates the common code used in the light/medium
- * weight implementations of <code>Popup</code>.
+ * weight implementations of {@code Popup}.
*/
private static class ContainerPopup extends Popup {
/** Component we are to be added to. */
Component owner;
/** Desired x location. */
@@ -675,13 +675,13 @@
private static class LightWeightPopup extends ContainerPopup {
private static final Object lightWeightPopupCacheKey =
new StringBuffer("PopupFactory.lightPopupCache");
/**
- * Returns a light weight <code>Popup</code> implementation. If
- * the <code>Popup</code> needs more space that in available in
- * <code>owner</code>, this will return null.
+ * Returns a light weight {@code Popup} implementation. If
+ * the {@code Popup} needs more space that in available in
+ * {@code owner}, this will return null.
*/
static Popup getLightWeightPopup(Component owner, Component contents,
int ownerX, int ownerY) {
LightWeightPopup popup = getRecycledLightWeightPopup();
@@ -710,11 +710,11 @@
}
return cache;
}
/**
- * Recycles the LightWeightPopup <code>popup</code>.
+ * Recycles the LightWeightPopup {@code popup}.
*/
private static void recycleLightWeightPopup(LightWeightPopup popup) {
synchronized (LightWeightPopup.class) {
List<LightWeightPopup> lightPopupCache = getLightWeightPopupCache();
if (lightPopupCache.size() < MAX_CACHE_SIZE) {
@@ -722,11 +722,11 @@
}
}
}
/**
- * Returns a previously used <code>LightWeightPopup</code>, or null
+ * Returns a previously used {@code LightWeightPopup}, or null
* if none of the popups have been recycled.
*/
private static LightWeightPopup getRecycledLightWeightPopup() {
synchronized (LightWeightPopup.class) {
List<LightWeightPopup> lightPopupCache = getLightWeightPopupCache();
@@ -803,11 +803,11 @@
//
// Local methods
//
/**
- * Resets the <code>Popup</code> to an initial state.
+ * Resets the {@code Popup} to an initial state.
*/
void reset(Component owner, Component contents, int ownerX,
int ownerY) {
super.reset(owner, contents, ownerX, ownerY);
@@ -832,13 +832,13 @@
/** Child of the panel. The contents are added to this. */
private JRootPane rootPane;
/**
- * Returns a medium weight <code>Popup</code> implementation. If
- * the <code>Popup</code> needs more space that in available in
- * <code>owner</code>, this will return null.
+ * Returns a medium weight {@code Popup} implementation. If
+ * the {@code Popup} needs more space that in available in
+ * {@code owner}, this will return null.
*/
static Popup getMediumWeightPopup(Component owner, Component contents,
int ownerX, int ownerY) {
MediumWeightPopup popup = getRecycledMediumWeightPopup();
@@ -868,11 +868,11 @@
}
return cache;
}
/**
- * Recycles the MediumWeightPopup <code>popup</code>.
+ * Recycles the MediumWeightPopup {@code popup}.
*/
private static void recycleMediumWeightPopup(MediumWeightPopup popup) {
synchronized (MediumWeightPopup.class) {
List<MediumWeightPopup> mediumPopupCache = getMediumWeightPopupCache();
if (mediumPopupCache.size() < MAX_CACHE_SIZE) {
@@ -880,11 +880,11 @@
}
}
}
/**
- * Returns a previously used <code>MediumWeightPopup</code>, or null
+ * Returns a previously used {@code MediumWeightPopup}, or null
* if none of the popups have been recycled.
*/
private static MediumWeightPopup getRecycledMediumWeightPopup() {
synchronized (MediumWeightPopup.class) {
List<MediumWeightPopup> mediumPopupCache = getMediumWeightPopupCache();
@@ -958,11 +958,11 @@
component.add(rootPane, BorderLayout.CENTER);
return component;
}
/**
- * Resets the <code>Popup</code> to an initial state.
+ * Resets the {@code Popup} to an initial state.
*/
void reset(Component owner, Component contents, int ownerX,
int ownerY) {
super.reset(owner, contents, ownerX, ownerY);
< prev index next >