Java Code Examples for java.awt.event.ContainerEvent

The following are top voted examples for showing how to use java.awt.event.ContainerEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AgentWorkbench   File: BasicGraphGui.java   View source code 6 votes vote down vote up
/**
 * 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;
			}
		}
	});
}
 
Example 2
Project: iBioSim   File: CloseTabPaneUI.java   View source code 6 votes vote down vote up
@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!
	}
}
 
Example 3
Project: iBioSim   File: CloseTabPaneUI.java   View source code 6 votes vote down vote up
@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);
		}
	}
}
 
Example 4
Project: javify   File: Container.java   View source code 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 5
Project: javify   File: BasicToolBarUI.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 6
Project: intellij-ce-playground   File: EditorsSplitters.java   View source code 6 votes vote down vote up
@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);
}
 
Example 7
Project: beautyeye   File: BEToolBarUI.java   View source code 6 votes vote down vote up
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);
        }
 
Example 8
Project: jvm-stm   File: Container.java   View source code 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 9
Project: jvm-stm   File: BasicToolBarUI.java   View source code 6 votes vote down vote up
/**
    * 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);
   }
 
Example 10
Project: Desktop   File: DefaultTabsRemovedHandler.java   View source code 6 votes vote down vote up
@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( );
			}
		}
	}
}
 
Example 11
Project: seaglass   File: SeaGlassDesktopPaneUI.java   View source code 6 votes vote down vote up
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();
        }
    }
}
 
Example 12
Project: tn5250j   File: Wizard.java   View source code 6 votes vote down vote up
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);
      }
   }
}
 
Example 13
Project: tn5250j   File: Wizard.java   View source code 6 votes vote down vote up
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);
      }
   }
}
 
Example 14
Project: passage   File: MapBean.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 15
Project: passage   File: MapBean.java   View source code 6 votes vote down vote up
/**
 * 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;

}
 
Example 16
Project: concurrent   File: BEToolBarUI.java   View source code 6 votes vote down vote up
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);
        }
 
Example 17
Project: cn1   File: Container.java   View source code 6 votes vote down vote up
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();
    // }
}
 
Example 18
Project: JamVM-PH   File: Container.java   View source code 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 19
Project: JamVM-PH   File: BasicToolBarUI.java   View source code 6 votes vote down vote up
/**
    * 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);
   }
 
Example 20
Project: incubator-netbeans   File: UndoRedoSupport.java   View source code 5 votes vote down vote up
@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;
        }
    }
}
 
Example 21
Project: incubator-netbeans   File: HyperlinkSupport.java   View source code 5 votes vote down vote up
@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;
        }
    }
}
 
Example 22
Project: incubator-netbeans   File: AbstractMenuFactory.java   View source code 5 votes vote down vote up
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);
}
 
Example 23
Project: incubator-netbeans   File: PlainAquaToolbarUI.java   View source code 5 votes vote down vote up
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);
    }
}
 
Example 24
Project: SuperMarketManageSystem   File: JinHuoTuiHuo.java   View source code 5 votes vote down vote up
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 + "");
	// /////////////////////////////////////////////////////////////////
}
 
Example 25
Project: SuperMarketManageSystem   File: JinHuoDan.java   View source code 5 votes vote down vote up
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 + "");
	// /////////////////////////////////////////////////////////////////
}
 
Example 26
Project: SuperMarketManageSystem   File: XiaoShouTuiHuo.java   View source code 5 votes vote down vote up
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 + "");
	// /////////////////////////////////////////////////////////////////
}
 
Example 27
Project: SuperMarketManageSystem   File: XiaoShouDan.java   View source code 5 votes vote down vote up
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 + "");
	// /////////////////////////////////////////////////////////////////
}
 
Example 28
Project: OpenJSharp   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 29
Project: jdk8u-jdk   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 30
Project: openjdk-jdk10   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 31
Project: openjdk9   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 32
Project: Java8CN   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 33
Project: orbit-image-analysis   File: JButtonBar.java   View source code 5 votes vote down vote up
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);
  }
}
 
Example 34
Project: jGAF   File: JWindowsMenu.java   View source code 5 votes vote down vote up
/**
 * 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();
}
 
Example 35
Project: geoxygene   File: MainFrameToolBar.java   View source code 5 votes vote down vote up
@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());
  }
}
 
Example 36
Project: jdk8u_jdk   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 37
Project: lookaside_java-1.8.0-openjdk   File: SynthScrollPaneUI.java   View source code 5 votes vote down vote up
public void componentAdded(ContainerEvent e) {
    if (e.getChild() instanceof JTextComponent) {
        e.getChild().addFocusListener(this);
        viewportViewHasFocus = e.getChild().isFocusOwner();
        scrollpane.repaint();
    }
}
 
Example 38
Project: j2se_for_android   File: Container.java   View source code 5 votes vote down vote up
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);
	}
}
 
Example 39
Project: javify   File: JComponent.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 40
Project: javify   File: JComponent.java   View source code 5 votes vote down vote up
/**
 * 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);
    }
}