本文整理汇总了Java中java.awt.event.ContainerEvent类的典型用法代码示例。如果您正苦于以下问题:Java ContainerEvent类的具体用法?Java ContainerEvent怎么用?Java ContainerEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContainerEvent类属于java.awt.event包,在下文中一共展示了ContainerEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import java.awt.event.ContainerEvent; //导入依赖的package包/类
/**
* This method initializes this
*/
private void initialize() {
// --- Set appearance -----------------------------
this.setVisible(true);
this.setSize(300, 300);
this.setLayout(new BorderLayout());
this.setDoubleBuffered(true);
// --- Add components -----------------------------
this.add(this.getJPanelToolBars(), BorderLayout.WEST);
this.add(this.getGraphZoomScrollPane(), BorderLayout.CENTER);
this.addContainerListener(new ContainerAdapter() {
boolean doneAdded = false;
@Override
public void componentAdded(ContainerEvent ce) {
if (doneAdded==false) {
validate();
zoomSetInitialScalingAndMovement(getVisualizationViewer());
doneAdded=true;
}
}
});
}
示例2: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
@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!
}
}
示例3: componentRemoved
import java.awt.event.ContainerEvent; //导入依赖的package包/类
@Override
public void componentRemoved(ContainerEvent e) {
JTabbedPane tp = (JTabbedPane) e.getContainer();
Component child = e.getChild();
if (child instanceof UIResource) {
return;
}
// NOTE 4/15/2002 (joutwate):
// This fix is implemented using client properties since there is
// currently no IndexPropertyChangeEvent. Once
// IndexPropertyChangeEvents have been added this code should be
// modified to use it.
Integer indexObj = (Integer) tp.getClientProperty("__index_to_remove__");
if (indexObj != null) {
int index = indexObj.intValue();
if (htmlViews != null && htmlViews.size() >= index) {
htmlViews.removeElementAt(index);
}
}
}
示例4: processContainerEvent
import java.awt.event.ContainerEvent; //导入依赖的package包/类
/**
* Called when a container event occurs if container events are enabled.
* This method calls any registered listeners.
*
* @param e The event that occurred.
*/
protected void processContainerEvent(ContainerEvent e)
{
if (containerListener == null)
return;
switch (e.id)
{
case ContainerEvent.COMPONENT_ADDED:
containerListener.componentAdded(e);
break;
case ContainerEvent.COMPONENT_REMOVED:
containerListener.componentRemoved(e);
break;
}
}
示例5: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
/**
* This method is responsible for setting rollover or non rollover for new
* buttons added to the JToolBar.
*
* @param e The ContainerEvent.
*/
public void componentAdded(ContainerEvent e)
{
if (e.getChild() instanceof JButton)
{
JButton b = (JButton) e.getChild();
if (b.getBorder() != null)
borders.put(b, b.getBorder());
}
if (isRolloverBorders())
setBorderToRollover(e.getChild());
else
setBorderToNonRollover(e.getChild());
cachedBounds = toolBar.getPreferredSize();
cachedOrientation = toolBar.getOrientation();
Component c = e.getChild();
if (toolBarFocusListener != null)
c.addFocusListener(toolBarFocusListener);
}
示例6: focusedComponentChanged
import java.awt.event.ContainerEvent; //导入依赖的package包/类
@Override
protected void focusedComponentChanged(final Component component, final AWTEvent cause) {
EditorWindow newWindow = null;
if (component != null) {
newWindow = findWindowWith(component);
}
else if (cause instanceof ContainerEvent && cause.getID() == ContainerEvent.COMPONENT_REMOVED) {
// do not change current window in case of child removal as in JTable.removeEditor
// otherwise Escape in a toolwindow will not focus editor with JTable content
return;
}
setCurrentWindow(newWindow);
setCurrentWindow(newWindow, false);
}
示例7: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
public void componentAdded(ContainerEvent evt) {
Component c = evt.getChild();
if (toolBarFocusListener != null) {
c.addFocusListener(toolBarFocusListener);
}
if (isRolloverBorders()) {
setBorderToRollover(c);
}
else
{
setBorderToNonRollover(c);
}
//## Bug FIX:Issue 51(https://code.google.com/p/beautyeye/issues/detail?id=51)
//* 由Jack Jiang201210-12日注释掉:它样做将导致各种放入的组
//* 件(如文本框)等都将透明,从而不绘制该 组件的背景,那就错误了哦
//* 其实以下代码原本是为了解决放入到JToggleButton的白色背景问题,现在它
//* 已经在BEToolgleButtonUI里解决了,此处就不需要了,也不应该要!
// //* 只有它一行是由jb2011加的
// if(c instanceof JComponent)
// ((JComponent)c).setOpaque(false);
}
示例8: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
/**
* This method is responsible for setting rollover or non rollover for new
* buttons added to the JToolBar.
*
* @param e The ContainerEvent.
*/
public void componentAdded(ContainerEvent e)
{
if (e.getChild() instanceof JButton)
{
JButton b = (JButton) e.getChild();
if (b.getBorder() != null)
borders.put(b, b.getBorder());
}
if (isRolloverBorders())
setBorderToRollover(e.getChild());
else
setBorderToNonRollover(e.getChild());
cachedBounds = toolBar.getPreferredSize();
cachedOrientation = toolBar.getOrientation();
Component c = e.getChild();
if (toolBarFocusListener != null)
c.addFocusListener(toolBarFocusListener);
}
示例9: componentRemoved
import java.awt.event.ContainerEvent; //导入依赖的package包/类
@Override
public void componentRemoved( ContainerEvent e )
{
if( e.getContainer( ) instanceof JTabbedPane )
{
JTabbedPane tabbedPane = ( JTabbedPane ) e.getContainer( );
if( tabbedPane.getTabCount( ) == 0 )
{
Window ancestor = SwingUtilities.getWindowAncestor( tabbedPane );
if( ancestor != null )
{
ancestor.dispose( );
}
}
}
}
示例10: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JInternalFrame) {
JInternalFrame f = (JInternalFrame) e.getChild();
JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
for (Component comp : getComponents()) {
if (comp == desktopIcon) {
// We have it already
return;
}
}
add(desktopIcon);
f.addComponentListener(this);
if (getComponentCount() == 1) {
adjustSize();
}
}
}
示例11: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
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);
}
}
}
示例12: componentRemoved
import java.awt.event.ContainerEvent; //导入依赖的package包/类
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);
}
}
}
示例13: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
/**
* ContainerListener Interface method. Should not be called directly. Part of
* the ContainerListener interface, and it's here to make the MapBean a good
* Container citizen.
*
* @param e ContainerEvent
*/
public void componentAdded(ContainerEvent e) {
// Blindly cast. addImpl has already checked to be
// sure the child is a Layer.
Layer childLayer = (Layer) e.getChild();
addProjectionListener(childLayer);
// If the new layer is in the queue to have removed() called
// on it take it off the queue, and don't add it to the
// added() queue (it doesn't know that it was removed, yet).
// Otherwise, add it to the queue to have added() called on
// it.
if (!removedLayers.removeElement(childLayer)) {
addedLayers.addElement(childLayer);
}
changeLayers(e);
}
示例14: changeLayers
import java.awt.event.ContainerEvent; //导入依赖的package包/类
/**
* ContainerListener Interface method. Should not be called directly. Part of
* the ContainerListener interface, and it's here to make the MapBean a good
* Container citizen.
*
* @param e ContainerEvent
*/
protected void changeLayers(ContainerEvent e) {
// Container Changes can be disabled to speed adding/removing
// multiple layers
if (!doContainerChange) {
return;
}
Component[] comps = this.getComponents();
int ncomponents = comps.length;
Layer[] newLayers = new Layer[ncomponents];
System.arraycopy(comps, 0, newLayers, 0, ncomponents);
if (logger.isLoggable(Level.FINE)) {
debugmsg("changeLayers() - firing change");
}
firePropertyChange(LayersProperty, currentLayers, newLayers);
// Tell the new layers that they have been added
for (int i = 0; i < addedLayers.size(); i++) {
((Layer) addedLayers.elementAt(i)).added(this);
}
addedLayers.removeAllElements();
currentLayers = newLayers;
}
示例15: componentAdded
import java.awt.event.ContainerEvent; //导入依赖的package包/类
public void componentAdded(ContainerEvent evt) {
Component c = evt.getChild();
if (toolBarFocusListener != null) {
c.addFocusListener(toolBarFocusListener);
}
if (isRolloverBorders()) {
setBorderToRollover(c);
} else {
setBorderToNonRollover(c);
}
//## Bug FIX:Issue 51(https://code.google.com/p/beautyeye/issues/detail?id=51)
//* 由Jack Jiang201210-12日注释掉:它样做将导致各种放入的组
//* 件(如文本框)等都将透明,从而不绘制该 组件的背景,那就错误了哦
//* 其实以下代码原本是为了解决放入到JToggleButton的白色背景问题,现在它
//* 已经在BEToolgleButtonUI里解决了,此处就不需要了,也不应该要!
// //* 只有它一行是由jb2011加的
// if(c instanceof JComponent)
// ((JComponent)c).setOpaque(false);
}