本文整理汇总了Java中java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED属性的典型用法代码示例。如果您正苦于以下问题:Java HierarchyEvent.DISPLAYABILITY_CHANGED属性的具体用法?Java HierarchyEvent.DISPLAYABILITY_CHANGED怎么用?Java HierarchyEvent.DISPLAYABILITY_CHANGED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.HierarchyEvent
的用法示例。
在下文中一共展示了HierarchyEvent.DISPLAYABILITY_CHANGED属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installListeners
@Override
protected void installListeners() {
if (WindowsLookAndFeel.isOnVista()) {
installWindowListener();
hierarchyListener =
new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getChangeFlags()
& HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
if (menuBar.isDisplayable()) {
installWindowListener();
} else {
uninstallWindowListener();
}
}
}
};
menuBar.addHierarchyListener(hierarchyListener);
}
super.installListeners();
}
示例2: finishHierarchyChange
void finishHierarchyChange(Component changed, Container changedParent, int ancestorFlags) {
if (--hierarchyChangingCounter == 0) {
int changeFlags = ancestorFlags;
if (wasShowing != isShowing()) {
changeFlags |= HierarchyEvent.SHOWING_CHANGED;
}
if (wasDisplayable != isDisplayable()) {
changeFlags |= HierarchyEvent.DISPLAYABILITY_CHANGED;
}
if (changeFlags > 0) {
postEvent(new HierarchyEvent(this, HierarchyEvent.HIERARCHY_CHANGED, changed,
changedParent, changeFlags));
}
finishChildrenHierarchyChange(changed, changedParent, ancestorFlags);
}
}
示例3: hierarchyChanged
@Override
public void hierarchyChanged(HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
if (isDisplayable()) {
// for (Tile tile: dimension.getTiles()) {
// threeDeeRenderManager.renderTile(tile);
// }
timer = new Timer(250, this);
timer.start();
} else {
timer.stop();
timer = null;
threeDeeRenderManager.stop();
for (Tile tile : dimension.getTiles()) {
tile.removeListener(this);
}
dimension.removeDimensionListener(this);
}
}
}
示例4: hierarchyChanged
@Override
public void hierarchyChanged(HierarchyEvent e) {
if((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && isDisplayable()) {
createBufferStrategy(2);
requestFocus();
}
}
示例5: addNotify
/**
* Called when the parent of this Component is made visible or when
* the Component is added to an already visible Container and needs
* to be shown. A native peer - if any - is created at this
* time. This method is called automatically by the AWT system and
* should not be called by user level code.
*
* @see #isDisplayable()
* @see #removeNotify()
*/
public void addNotify()
{
// We need to lock the tree here to avoid races and inconsistencies.
synchronized (getTreeLock())
{
if (peer == null)
peer = getToolkit().createComponent(this);
else if (parent != null && parent.isLightweight())
new HeavyweightInLightweightListener(parent);
// Now that all the children has gotten their peers, we should
// have the event mask needed for this component and its
//lightweight subcomponents.
peer.setEventMask(eventMask);
// We used to leave the invalidate() to the peer. However, I put it
// back here for 2 reasons: 1) The RI does call invalidate() from
// addNotify(); 2) The peer shouldn't be bother with validation too
// much.
invalidate();
if (dropTarget != null)
dropTarget.addNotify(peer);
// Fetch the peerFont for later installation in validate().
peerFont = getFont();
// Notify hierarchy listeners.
long flags = HierarchyEvent.DISPLAYABILITY_CHANGED;
if (isHierarchyVisible())
flags |= HierarchyEvent.SHOWING_CHANGED;
fireHierarchyEvent(HierarchyEvent.HIERARCHY_CHANGED, this, parent,
flags);
}
}
示例6: removeNotify
/**
* Called to inform this component is has been removed from its
* container. Its native peer - if any - is destroyed at this time.
* This method is called automatically by the AWT system and should
* not be called by user level code.
*
* @see #isDisplayable()
* @see #addNotify()
*/
public void removeNotify()
{
// We need to lock the tree here to avoid races and inconsistencies.
synchronized (getTreeLock())
{
// We null our peer field before disposing of it, such that if we're
// not the event dispatch thread and the dispatch thread is awoken by
// the dispose call, there will be no race checking the peer's null
// status.
ComponentPeer tmp = peer;
peer = null;
peerFont = null;
if (tmp != null)
{
tmp.hide();
tmp.dispose();
}
// Notify hierarchy listeners.
long flags = HierarchyEvent.DISPLAYABILITY_CHANGED;
if (isHierarchyVisible())
flags |= HierarchyEvent.SHOWING_CHANGED;
fireHierarchyEvent(HierarchyEvent.HIERARCHY_CHANGED, this, parent,
flags);
}
}
示例7: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
JComponent c = (JComponent) e.getSource();
if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0
&& !c.isDisplayable() && autoScroll) {
scroller.stop();
}
}
示例8: addNotify
/**
* Called when the parent of this Component is made visible or when
* the Component is added to an already visible Container and needs
* to be shown. A native peer - if any - is created at this
* time. This method is called automatically by the AWT system and
* should not be called by user level code.
*
* @see #isDisplayable()
* @see #removeNotify()
*/
public void addNotify()
{
// We need to lock the tree here to avoid races and inconsistencies.
synchronized (getTreeLock())
{
if (peer == null)
peer = getToolkit().createComponent(this);
else if (parent != null && parent.isLightweight())
new HeavyweightInLightweightListener(parent);
// Now that all the children has gotten their peers, we should
// have the event mask needed for this component and its
//lightweight subcomponents.
peer.setEventMask(eventMask);
// We used to leave the invalidate() to the peer. However, I put it
// back here for 2 reasons: 1) The RI does call invalidate() from
// addNotify(); 2) The peer shouldn't be bother with validation too
// much.
invalidate();
if (dropTarget != null)
dropTarget.addNotify(peer);
// Fetch the peerFont for later installation in validate().
peerFont = getFont();
// Notify hierarchy listeners.
long flags = HierarchyEvent.DISPLAYABILITY_CHANGED;
if (isHierarchyVisible())
flags |= HierarchyEvent.SHOWING_CHANGED;
fireHierarchyEvent(HierarchyEvent.HIERARCHY_CHANGED, this, parent,
flags);
}
}
示例9: hierarchyChanged
public void hierarchyChanged(HierarchyEvent e) {
if((e.getChangeFlags()&HierarchyEvent.DISPLAYABILITY_CHANGED)>0){
if(this.isDisplayable())
ensureUpdates();
else
stopUpdates();
}
}
示例10: hierarchyChanged
public void hierarchyChanged(HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0) {
synchronized (renderLock) {
if (this.isDisplayable()) {
r = createAndSetRenderer();
} else {
env.removeRenderer(r);
r = null;
}
}
}
}