protected class TranslucentPopupFactory.TranslucentPopup
extends javax.swing.Popup
本类的大部分代码都是原封不动地参考自Popup父类(JDK版本是1.6_u18版的源码),因为Popup父 类中的多数方法都是使用的包内可见性,所以没法直接继承,像这种不允许第3方自行扩展的情 况在Swing标准包里比较少见,不知原作者是出于何种考虑,无疑这样的类实现是相当的欠缺远 见性,但这种情况在LNF里很常见。
限定符和类型 | 类和说明 |
---|---|
protected class |
TranslucentPopupFactory.TranslucentPopup.DefaultFrame
Used if no valid Window ancestor of the supplied owner is found.
|
protected class |
TranslucentPopupFactory.TranslucentPopup.HeavyWeightWindow
Component used to house window.
|
构造器和说明 |
---|
TranslucentPopupFactory.TranslucentPopup()
Creates a
Popup . |
TranslucentPopupFactory.TranslucentPopup(java.awt.Component owner,
java.awt.Component contents,
int x,
int y)
Creates a
Popup for the Component owner
containing the Component contents . |
限定符和类型 | 方法和说明 |
---|---|
protected java.awt.Component |
createComponent(java.awt.Component owner)
Creates the Component to use as the parent of the
Popup . |
protected void |
dispose()
Frees any resources the
Popup may be holding onto. |
protected java.awt.Component |
getComponent()
Returns the
Component returned from
createComponent that will hold the Popup . |
protected java.awt.Window |
getParentWindow(java.awt.Component owner)
Returns the
Window to use as the parent of the
Window created for the Popup . |
void |
hide()
Hides and disposes of the
Popup . |
protected void |
pack()
Causes the
Popup to be sized to fit the preferred size
of the Component it contains. |
protected void |
reset(java.awt.Component owner,
java.awt.Component contents,
int ownerX,
int ownerY)
Resets the
Popup to an initial state. |
void |
show()
Makes the
Popup visible. |
public TranslucentPopupFactory.TranslucentPopup(java.awt.Component owner, java.awt.Component contents, int x, int y)
Popup
for the Component owner
containing the Component contents
. owner
is used to determine which Window
the new
Popup
will parent the Component
the
Popup
creates to.
A null owner
implies there is no valid parent.
x
and
y
specify the preferred initial location to place
the Popup
at. Based on screen size, or other paramaters,
the Popup
may not display at x
and
y
.owner
- Component mouse coordinates are relative to, may be nullcontents
- Contents of the Popupx
- Initial x screen coordinatey
- Initial y screen coordinatepublic TranslucentPopupFactory.TranslucentPopup()
Popup
. This is provided for subclasses.public void show()
Makes the Popup
visible. If the Popup
is
currently visible, this has no effect.
本方法的结构完全copy自父类方法,但添加了component.repaint();的调用.
show
在类中 javax.swing.Popup
public void hide()
Popup
. Once a
Popup
has been disposed you should no longer invoke
methods on it. A dispose
d Popup
may be
reclaimed and later used based on the PopupFactory
. As
such, if you invoke methods on a disposed
Popup
, indeterminate behavior will result.hide
在类中 javax.swing.Popup
protected void dispose()
Popup
may be holding onto.protected void reset(java.awt.Component owner, java.awt.Component contents, int ownerX, int ownerY)
Resets the Popup
to an initial state.
本方法的结构完全copy自父类方法,但进行中包括:窗口透明、用图片实现背景填充等在内的修改.
owner
- the ownercontents
- the contentsownerX
- the owner xownerY
- the owner yprotected void pack()
Popup
to be sized to fit the preferred size
of the Component
it contains.protected java.awt.Window getParentWindow(java.awt.Component owner)
Window
to use as the parent of the
Window
created for the Popup
. This creates
a new DefaultFrame
, if necessary.owner
- the ownerprotected java.awt.Component createComponent(java.awt.Component owner)
Popup
.
The default implementation creates a Window
, subclasses
should override.owner
- the ownerprotected java.awt.Component getComponent()
Component
returned from
createComponent
that will hold the Popup
.