下面列出了怎么用java.awt.event.ContainerEvent的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void componentRemoved ( final ContainerEvent e )
{
// Removing state for the removed pane
final AccordionPane pane = ( AccordionPane ) e.getChild ();
states.remove ( pane.getId () );
// Validating states
validateStates ();
// Inform layout about removal
if ( accordion != null )
{
final AccordionLayout layout = accordion.getLayout ();
if ( layout != null )
{
layout.paneRemoved ( accordion, pane );
}
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof WizardPage) {
WizardPage wp = (WizardPage)e.getChild();
JButton b;
b = wp.getNextButton();
if (b != null) {
b.addActionListener(nextListener);
}
b = wp.getPreviousButton();
if (b != null) {
b.addActionListener(previousListener);
}
b = wp.getFinishButton();
if (b != null) {
b.addActionListener(finishListener);
}
b = wp.getCancelButton();
if (b != null) {
b.addActionListener(cancelListener);
}
b = wp.getHelpButton();
if (b != null) {
b.addActionListener(helpListener);
}
}
}
public void componentRemoved(ContainerEvent e) {
if (e.getChild() instanceof WizardPage) {
WizardPage wp = (WizardPage)e.getChild();
JButton b;
b = wp.getNextButton();
if (b != null) {
b.removeActionListener(nextListener);
}
b = wp.getPreviousButton();
if (b != null) {
b.removeActionListener(previousListener);
}
b = wp.getFinishButton();
if (b != null) {
b.removeActionListener(finishListener);
}
b = wp.getCancelButton();
if (b != null) {
b.removeActionListener(cancelListener);
}
b = wp.getHelpButton();
if (b != null) {
b.removeActionListener(helpListener);
}
}
}
@Override
public void componentAdded(ContainerEvent e) {
JTabbedPane tp = (JTabbedPane) e.getContainer();
Component child = e.getChild();
if (child instanceof UIResource) {
return;
}
int index = tp.indexOfComponent(child);
String title = tp.getTitleAt(index);
boolean isHTML = BasicHTML.isHTMLString(title);
if (isHTML) {
if (htmlViews == null) { // Initialize vector
htmlViews = createHTMLVector();
}
else { // Vector already exists
View v = BasicHTML.createHTMLView(tp, title);
htmlViews.insertElementAt(v, index);
}
}
else { // Not HTML
if (htmlViews != null) { // Add placeholder
htmlViews.insertElementAt(null, index);
} // else nada!
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent evt) {
Component c = evt.getChild();
if (lizziePaneFocusListener != null) {
c.addFocusListener(lizziePaneFocusListener);
}
}
public void componentAdded(ContainerEvent e) {
JMenu menu = (JMenu) e.getContainer();
JComponent item = (JComponent) e.getChild();
//Mark the child as belonging to the parent container context
String containerContext = getContainerContext(menu);
item.putClientProperty (KEY_CONTAINERCONTEXT, containerContext);
}
public void componentAdded(ContainerEvent e) {
Container c = (Container) e.getSource();
boolean isEditorToolbar = "editorToolbar".equals (c.getName());
installButtonUI (e.getChild(), isEditorToolbar);
if (isEditorToolbar) {
//It's an editor toolbar. Aqua's combo box ui paints outside
//of its literal component bounds, and doesn't honor opacity.
//Need to ensure the toolbar is tall enough that its border is
//not hidden.
Dimension min = new Dimension (32, 34);
((JComponent)e.getContainer()).setPreferredSize(min);
}
}
@Override
public void componentAdded(ContainerEvent e) {
Component c = e.getChild();
while(((c = c.getParent()) != null)) {
if(c instanceof TopComponent) {
RequestProcessor.Task t = (RequestProcessor.Task) ((TopComponent)c).getClientProperty(REGISTER_TASK);
if(t != null) {
t.schedule(1000);
}
break;
}
}
}
@Override
public void componentAdded(ContainerEvent e) {
Component c = e.getChild();
while(((c = c.getParent()) != null)) {
if(c instanceof TopComponent) {
RequestProcessor.Task t = (RequestProcessor.Task) ((TopComponent)c).getClientProperty(REGISTER_TASK);
if(t != null) {
t.schedule(1000);
}
break;
}
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentAdded(ContainerEvent e) {
JButtonBar container = (JButtonBar)e.getContainer();
if (e.getChild() instanceof AbstractButton) {
((ButtonBarUI)container.ui).installButtonBarUI(
(AbstractButton)e.getChild());
((AbstractButton)e.getChild()).addPropertyChangeListener(
"UI",
JButtonBar.uiUpdater);
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
public void componentRemoved(ContainerEvent evt) {
Component c = evt.getChild();
if (toolBarFocusListener != null) {
c.removeFocusListener(toolBarFocusListener);
}
// Revert the button border
setBorderToNormal(c);
}
public void componentRemoved(ContainerEvent e) {
if (e.getChild() instanceof JInternalFrame) {
JInternalFrame f = (JInternalFrame) e.getChild();
if (!f.isIcon()) {
// Frame was removed without using setClosed(true)
remove(f.getDesktopIcon());
f.removeComponentListener(this);
revalidate();
repaint();
}
}
}
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
@Override
public void componentAdded ( final ContainerEvent e )
{
final Component child = e.getChild ();
if ( child instanceof JMenu )
{
( ( JMenu ) child ).getModel ().addChangeListener ( WMenuBarInputListener.this );
}
}
@Override
public void componentAdded(final ContainerEvent event) {
for (final IGraphWindowListener listener : m_graphPanelListener) {
// ESCA-JAVA0166: Catch Exception because we are calling a listener function
try {
listener.graphPanelOpened((CGraphPanel) event.getChild());
} catch (final Exception e) {
CUtilityFunctions.logException(e);
}
}
}
@Override
public void componentRemoved(ContainerEvent e) {
removeListenerFromTabbedPanels((JTabbedPane) e.getContainer(), e.getChild());
}
public void componentRemoved(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().removeFocusListener(this);
}
}
@Override
public void componentAdded( ContainerEvent e ) {
e.getChild().addFocusListener( this );
}
@Override
public void componentRemoved(ContainerEvent e) {
registerKeyAction(e.getChild());
}
@Override
public void componentAdded(ContainerEvent e) {
listenTo(e.getComponent());
}
@Override
public void componentRemoved(final ContainerEvent e) {
removeKeyAndContainerListenerRecursively(e.getChild());
}
@Override
public void componentAdded(ContainerEvent e) {
initializeComponents(e.getChild());
}