本文整理汇总了Java中java.awt.event.HierarchyEvent.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java HierarchyEvent.getComponent方法的具体用法?Java HierarchyEvent.getComponent怎么用?Java HierarchyEvent.getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.HierarchyEvent
的用法示例。
在下文中一共展示了HierarchyEvent.getComponent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hierarchyChanged
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
@Override
public void hierarchyChanged(HierarchyEvent e) {
if ((e.getComponent() != txtComp)
|| ((e.getChangeFlags() & DISPLAYABILITY_CHANGED) == 0)
|| !txtComp.isDisplayable()) {
return;
}
watcherLogger.finer("componentShown()"); //NOI18N
if (foregroundColor == null) {
foregroundColor = txtComp.getForeground();
}
if ((doc.getLength() == 0) && !txtComp.isFocusOwner()) {
displayInfo();
}
}
示例2: hierarchyChanged
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
public void hierarchyChanged(HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
JComponent component = (JComponent)event.getComponent();
final Demo demo = (Demo)component.getClientProperty("swingset3.demo");
if (!component.isShowing()) {
demo.stop();
} else {
demoContainer.revalidate();
EventQueue.invokeLater(new Runnable() {
public void run() {
demo.start();
}
});
}
}
}
示例3: hierarchyChanged
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
public void hierarchyChanged(HierarchyEvent event) {
if ((event.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
JComponent component = (JComponent)event.getComponent();
final Demo demo = (Demo)component.getClientProperty("swingset3.demo");
if (!component.isShowing()) {
demo.stop();
} else {
getComponentByConstraint("demo").revalidate();
EventQueue.invokeLater(new Runnable() {
public void run() {
demo.start();
}
});
}
}
}
示例4: hierarchyChanged
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
@Override
public void hierarchyChanged(HierarchyEvent e) {
Component c = e.getComponent();
if(c instanceof AudioPlayerComponent) {
AudioPlayerComponent jc = (AudioPlayerComponent)c;
if(jc.getUI() instanceof BasicAudioPlayerUI) {
((BasicAudioPlayerUI)jc.getUI()).updateComponents( (AudioPlayerComponent)jc );
}
}
}
示例5: installListeners
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
protected void installListeners(final JXHeader header) {
propListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
};
boundsListener = new HierarchyBoundsAdapter() {
@Override
public void ancestorResized(HierarchyEvent e) {
if (header == e.getComponent()) {
View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
// view might get lost on LAF change ...
if (v == null) {
descriptionPane.putClientProperty(BasicHTML.propertyKey,
MultiLineSupport.createView(descriptionPane));
v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
}
if (v != null) {
Container tla = header.getTopLevelAncestor();
if (tla == null) {
tla = header.getParent();
while (tla.getParent() != null) {
tla = tla.getParent();
}
}
int h = Math.max(descriptionPane.getHeight(), tla.getHeight());
int w = Math.min(tla.getWidth(), header.getParent().getWidth());
// 35 = description pane insets, TODO: obtain dynamically
w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x;
v.setSize(w, h);
descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
}
}
}};
header.addPropertyChangeListener(propListener);
header.addHierarchyBoundsListener(boundsListener);
}
示例6: installListeners
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
protected void installListeners(final JXHeader header) {
propListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
};
boundsListener = new HierarchyBoundsAdapter() {
@Override
public void ancestorResized(HierarchyEvent e) {
if (header == e.getComponent()) {
View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
// view might get lost on LAF change ...
if (v == null) {
descriptionPane.putClientProperty(BasicHTML.propertyKey,
descriptionPane.getMultiLineSupport().createView(descriptionPane));
v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
}
if (v != null) {
Container tla = header.getTopLevelAncestor();
if (tla == null) {
tla = header.getParent();
while (tla.getParent() != null) {
tla = tla.getParent();
}
}
int h = Math.max(descriptionPane.getHeight(), tla.getHeight());
int w = Math.min(tla.getWidth(), header.getParent().getWidth());
// 35 = description pane insets, TODO: obtain dynamically
w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x;
v.setSize(w, h);
descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
}
}
}};
header.addPropertyChangeListener(propListener);
header.addHierarchyBoundsListener(boundsListener);
}
示例7: hierarchyChanged
import java.awt.event.HierarchyEvent; //导入方法依赖的package包/类
@Override
public void hierarchyChanged(HierarchyEvent hierarchyEvent) {
Component component = hierarchyEvent.getComponent();
privateRegisterComponentListenerToParentWindowOf(component, component);
}