Java 类java.awt.event.ContainerEvent 实例源码
项目:AgentWorkbench
文件:BasicGraphGui.java
/**
* 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;
}
}
});
}
项目:iBioSim
文件:CloseTabPaneUI.java
@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!
}
}
项目:iBioSim
文件:CloseTabPaneUI.java
@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);
}
}
}
项目:javify
文件:Container.java
/**
* 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;
}
}
项目:javify
文件:BasicToolBarUI.java
/**
* 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);
}
项目:intellij-ce-playground
文件:EditorsSplitters.java
@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);
}
项目:beautyeye
文件:BEToolBarUI.java
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);
}
项目:jvm-stm
文件:Container.java
/**
* 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;
}
}
项目:jvm-stm
文件:BasicToolBarUI.java
/**
* 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);
}
项目:Desktop
文件:DefaultTabsRemovedHandler.java
@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( );
}
}
}
}
项目:seaglass
文件:SeaGlassDesktopPaneUI.java
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();
}
}
}
项目:tn5250j
文件:Wizard.java
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);
}
}
}
项目:tn5250j
文件:Wizard.java
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);
}
}
}
项目:passage
文件:MapBean.java
/**
* 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);
}
项目:passage
文件:MapBean.java
/**
* 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;
}
项目:concurrent
文件:BEToolBarUI.java
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);
}
项目:cn1
文件:Container.java
protected void processContainerEvent(ContainerEvent e) {
// toolkit.lockAWT();
// try {
for (Iterator<?> i = containerListeners.getUserIterator(); i.hasNext();) {
ContainerListener listener = (ContainerListener) i.next();
switch (e.getID()) {
case ContainerEvent.COMPONENT_ADDED:
listener.componentAdded(e);
break;
case ContainerEvent.COMPONENT_REMOVED:
listener.componentRemoved(e);
break;
}
}
// } finally {
// toolkit.unlockAWT();
// }
}
项目:JamVM-PH
文件:Container.java
/**
* 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;
}
}
项目:JamVM-PH
文件:BasicToolBarUI.java
/**
* 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);
}
项目:incubator-netbeans
文件:UndoRedoSupport.java
@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;
}
}
}
项目:incubator-netbeans
文件:HyperlinkSupport.java
@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;
}
}
}
项目:incubator-netbeans
文件:AbstractMenuFactory.java
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);
}
项目:incubator-netbeans
文件:PlainAquaToolbarUI.java
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);
}
}
项目:SuperMarketManageSystem
文件:JinHuoTuiHuo.java
public void componentRemoved(ContainerEvent e) {
// �������
clearEmptyRow();
// �������
int rows = table.getRowCount();
int count = 0;
double money = 0.0;
// ����Ʒ������
TbKucun column = null;
if (rows > 0)
column = (TbKucun) table.getValueAt(rows - 1, 0);
if (rows > 0 && (column == null || column.getId().isEmpty()))
rows--;
// �����Ʒ�����ͽ��
for (int i = 0; i < rows; i++) {
String column7 = (String) table.getValueAt(i, 7);
String column6 = (String) table.getValueAt(i, 6);
int c7 = (column7 == null || column7.isEmpty()) ? 0 : Integer
.parseInt(column7);
Double c6 = (column6 == null || column6.isEmpty()) ? 0 : Double
.valueOf(column6);
count += c7;
money += c6 * c7;
}
pzs.setText(rows + "");
hpzs.setText(count + "");
hjje.setText(money + "");
// /////////////////////////////////////////////////////////////////
}
项目:SuperMarketManageSystem
文件:JinHuoDan.java
public void componentRemoved(ContainerEvent e) {
// �������
clearEmptyRow();
// �������
int rows = table.getRowCount();
int count = 0;
double money = 0.0;
// ����Ʒ������
TbSpinfo column = null;
if (rows > 0)
column = (TbSpinfo) table.getValueAt(rows - 1, 0);
if (rows > 0 && (column == null || column.getId().isEmpty()))
rows--;
// �����Ʒ�����ͽ��
for (int i = 0; i < rows; i++) {
String column7 = (String) table.getValueAt(i, 7);
String column6 = (String) table.getValueAt(i, 6);
int c7 = (column7 == null || column7.isEmpty()) ? 0 : Integer
.parseInt(column7);
float c6 = (column6 == null || column6.isEmpty()) ? 0 : Float
.parseFloat(column6);
count += c7;
money += c6 * c7;
}
pzs.setText(rows + "");
hpzs.setText(count + "");
hjje.setText(money + "");
// /////////////////////////////////////////////////////////////////
}
项目:SuperMarketManageSystem
文件:XiaoShouTuiHuo.java
public void componentRemoved(ContainerEvent e) {
// �������
clearEmptyRow();
// �������
int rows = table.getRowCount();
int count = 0;
double money = 0.0;
// ����Ʒ������
TbSpinfo column = null;
if (rows > 0)
column = (TbSpinfo) table.getValueAt(rows - 1, 0);
if (rows > 0 && (column == null || column.getId().isEmpty()))
rows--;
// �����Ʒ�����ͽ��
for (int i = 0; i < rows; i++) {
String column7 = (String) table.getValueAt(i, 7);
String column6 = (String) table.getValueAt(i, 6);
int c7 = (column7 == null || column7.isEmpty()) ? 0 : Integer
.parseInt(column7);
Double c6 = (column6 == null || column6.isEmpty()) ? 0 : Double
.valueOf(column6);
count += c7;
money += c6 * c7;
}
pzs.setText(rows + "");
hpzs.setText(count + "");
hjje.setText(money + "");
// /////////////////////////////////////////////////////////////////
}
项目:SuperMarketManageSystem
文件:XiaoShouDan.java
public void componentRemoved(ContainerEvent e) {
// �������
clearEmptyRow();
// �������
int rows = table.getRowCount();
int count = 0;
double money = 0.0;
// ����Ʒ������
TbSpinfo column = null;
if (rows > 0)
column = (TbSpinfo) table.getValueAt(rows - 1, 0);
if (rows > 0 && (column == null || column.getId().isEmpty()))
rows--;
// �����Ʒ�����ͽ��
for (int i = 0; i < rows; i++) {
String column7 = (String) table.getValueAt(i, 7);
String column6 = (String) table.getValueAt(i, 6);
int c7 = (column7 == null || column7.isEmpty()) ? 0 : Integer
.valueOf(column7);
Double c6 = (column6 == null || column6.isEmpty()) ? 0 : Double
.valueOf(column6);
count += c7;
money += c6 * c7;
}
pzs.setText(rows + "");
hpzs.setText(count + "");
hjje.setText(money + "");
// /////////////////////////////////////////////////////////////////
}
项目:OpenJSharp
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:jdk8u-jdk
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:openjdk-jdk10
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:openjdk9
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:Java8CN
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:orbit-image-analysis
文件:JButtonBar.java
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);
}
}
项目:jGAF
文件:JWindowsMenu.java
/**
* Records the addition of a window to the desktop.
*
* @see java.awt.event.ContainerListener#componentAdded(java.awt.event.ContainerEvent)
*/
public void componentAdded(ContainerEvent e) {
if ((this.windowPositioner != null) && (e.getChild() instanceof JInternalFrame)) {
JInternalFrame frame = (JInternalFrame) e.getChild();
Point position = this.windowPositioner.getPosition(frame, getAllVisibleFrames());
frame.setLocation(position);
}
updateWindowsList();
}
项目:geoxygene
文件:MainFrameToolBar.java
@Override
public final void componentAdded(final ContainerEvent e) {
ProjectFrame projectFrame = this.getMainFrame().getProjectFrameFromGui(
e.getChild());
if (projectFrame != null && projectFrame instanceof ProjectFrame) {
this.addComponent(projectFrame.getLayerViewPanel());
}
}
项目:jdk8u_jdk
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:lookaside_java-1.8.0-openjdk
文件:SynthScrollPaneUI.java
public void componentAdded(ContainerEvent e) {
if (e.getChild() instanceof JTextComponent) {
e.getChild().addFocusListener(this);
viewportViewHasFocus = e.getChild().isFocusOwner();
scrollpane.repaint();
}
}
项目:j2se_for_android
文件:Container.java
public synchronized void remove(final Component comp) {
if(components == null){
return;
}
final int index = components.indexOf(comp);
if (index >= 0) {
components.remove(index);
comp.parent = null;
final ViewGroup layoutView = (ViewGroup)getContainerViewAdAPI();
final View subView = comp.getPeerAdAPI();
if(layoutView != null && subView != null){
ActivityManager.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
layoutView.removeView(subView);
}
});
}
{
final ContainerEvent event = new ContainerEvent(this, ContainerEvent.COMPONENT_REMOVED, comp);
final ContainerListener[] listener = list.getListeners(ContainerListener.class);
for (int i = 0; i < listener.length; i++) {
listener[i].componentRemoved(event);
}
}
}
if (layout != null) {
layout.removeLayoutComponent(comp);
}
}
项目:javify
文件:JComponent.java
/**
* Receives notification when a child component is added to the
* JComponent and fires a PropertyChangeEvent on listeners registered
* with the AccessibleJComponent with a property name of
* {@link AccessibleContext#ACCESSIBLE_CHILD_PROPERTY}.
*
* @param event the container event
*/
public void componentAdded(ContainerEvent event)
{
Component c = event.getChild();
if (c != null && c instanceof Accessible)
{
AccessibleContext childCtx = c.getAccessibleContext();
AccessibleJComponent.this.firePropertyChange
(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null, childCtx);
}
}
项目:javify
文件:JComponent.java
/**
* Receives notification when a child component is removed from the
* JComponent and fires a PropertyChangeEvent on listeners registered
* with the AccessibleJComponent with a property name of
* {@link AccessibleContext#ACCESSIBLE_CHILD_PROPERTY}.
*
* @param event the container event
*/
public void componentRemoved(ContainerEvent event)
{
Component c = event.getChild();
if (c != null && c instanceof Accessible)
{
AccessibleContext childCtx = c.getAccessibleContext();
AccessibleJComponent.this.firePropertyChange
(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, childCtx, null);
}
}