KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > awt > Container

java.awt
Class Container

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
BasicSplitPaneDivider, CellRendererPane, DefaultTreeCellEditor.EditorContainer, JComponent, Panel, ScrollPane, Window
See Also:
Top Examples, Source Code, add(java.awt.Component, int), getComponent(int), LayoutManager

public Component add(Component comp)
See Also:
JComponent.revalidate(), validate(), addImpl(java.awt.Component, java.lang.Object, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component add(Component comp,
                     int index)
See Also:
JComponent.revalidate(), validate(), remove(int), addImpl(java.awt.Component, java.lang.Object, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void add(Component comp,
                Object constraints)
See Also:
LayoutManager, JComponent.revalidate(), validate(), addImpl(java.awt.Component, java.lang.Object, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void add(Component comp,
                Object constraints,
                int index)
See Also:
LayoutManager, remove(int), JComponent.revalidate(), validate(), addImpl(java.awt.Component, java.lang.Object, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component add(String name,
                     Component comp)
See Also:
add(Component, Object), addImpl(java.awt.Component, java.lang.Object, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addContainerListener(ContainerListener l)
See Also:
getContainerListeners(), removeContainerListener(java.awt.event.ContainerListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void addImpl(Component comp,
                       Object constraints,
                       int index)
See Also:
LayoutManager2, LayoutManager, add(Component, java.lang.Object), add(Component, int), add(Component), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addNotify()
See Also:
removeNotify(), Component.isDisplayable()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addPropertyChangeListener(PropertyChangeListener listener)
See Also:
addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener), Component.removePropertyChangeListener(java.beans.PropertyChangeListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
See Also:
Component.removePropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(java.beans.PropertyChangeListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void applyComponentOrientation(ComponentOrientation o)
See Also:
Component.getComponentOrientation(), Component.setComponentOrientation(java.awt.ComponentOrientation), NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean areFocusTraversalKeysSet(int id)
See Also:
IllegalArgumentException, Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Container()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public int countComponents()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void deliverEvent(Event e)
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void doLayout()
See Also:
validate(), setLayout(java.awt.LayoutManager), LayoutManager.layoutContainer(java.awt.Container), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component findComponentAt(int x,
                                 int y)
See Also:
getComponentAt(int, int), Component.contains(int, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component findComponentAt(Point p)
See Also:
getComponentAt(int, int), Component.contains(int, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public float getAlignmentX()
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public float getAlignmentY()
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component getComponent(int n)
See Also:
ArrayIndexOutOfBoundsException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component getComponentAt(int x,
                                int y)
See Also:
Component.contains(int, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component getComponentAt(Point p)
See Also:
Component.contains(int, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getComponentCount()
See Also:
getComponent(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Component[] getComponents()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final int getComponentZOrder(Component comp)
See Also:
setComponentZOrder(java.awt.Component, int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1263]Swing and AWT z-order
By Anonymous on 2005/01/20 13:10:34  Rate
Because the z-order is defined in the Container class, so it works with both Swing and AWT components.

public ContainerListener[] getContainerListeners()
See Also:
removeContainerListener(java.awt.event.ContainerListener), addContainerListener(java.awt.event.ContainerListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Set<AWTKeyStroke> getFocusTraversalKeys(int id)
See Also:
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, setFocusTraversalKeys(int, java.util.Set), IllegalArgumentException, Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[430]Set UI focus traversal keys
By josue_lopez { at } hotmail { dot } com on 2003/10/01 15:57:01  Rate
Container content = this.getContentPane  (  ) ; 
  
  
     Set set = content.getFocusTraversalKeys  ( KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS ) ; 
     set = new HashSet ( set ) ; 
  
  
     KeyStroke enter = KeyStroke.getKeyStroke  ( "ENTER" ) ; 
     set.add  ( enter ) ; 
  
  
     KeyStroke down = KeyStroke.getKeyStroke  ( "DOWN" ) ; 
     set.add  ( down ) ; 
  
  
     KeyStroke tab = KeyStroke.getKeyStroke  ( "TAB" ) ; 
     set.add  ( tab ) ; 
  
  
     content.setFocusTraversalKeys  ( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set ) ; 
  
  
     set = content.getFocusTraversalKeys  ( KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS ) ; 
     set = new HashSet ( set ) ; 
  
  
     KeyStroke up = KeyStroke.getKeyStroke  ( "UP" ) ; 
     set.add  ( up ) ; 
  
  
     content.setFocusTraversalKeys  ( KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, set ) ;


public FocusTraversalPolicy getFocusTraversalPolicy()
See Also:
isFocusCycleRoot(java.awt.Container), setFocusCycleRoot(boolean), setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Insets getInsets()
See Also:
LayoutManager
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public LayoutManager getLayout()
See Also:
setLayout(java.awt.LayoutManager), doLayout()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public <T extends EventListener> T[] getListeners(Class<T> listenerType)
See Also:
getContainerListeners(), ClassCastException, Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Dimension getMaximumSize()
See Also:
getPreferredSize(), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Dimension getMinimumSize()
See Also:
LayoutManager.minimumLayoutSize(Container), getLayout(), getPreferredSize(), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Point getMousePosition(boolean allowChildren)
                       throws HeadlessException
See Also:
Component.getMousePosition()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Dimension getPreferredSize()
See Also:
LayoutManager.preferredLayoutSize(Container), getLayout(), getMinimumSize(), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Insets insets()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void invalidate()
See Also:
LayoutManager, layout(), validate(), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isAncestorOf(Component c)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isFocusCycleRoot()
See Also:
ContainerOrderFocusTraversalPolicy, getFocusTraversalPolicy(), setFocusTraversalPolicy(java.awt.FocusTraversalPolicy), setFocusCycleRoot(boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isFocusCycleRoot(Container container)
See Also:
isFocusCycleRoot(), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final boolean isFocusTraversalPolicyProvider()
See Also:
setFocusTraversalPolicyProvider(boolean), setFocusCycleRoot(boolean), getFocusTraversalPolicy(), setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isFocusTraversalPolicySet()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void layout()
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void list(PrintStream out,
                 int indent)
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void list(PrintWriter out,
                 int indent)
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Component locate(int x,
                                   int y)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Dimension minimumSize()
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void paint(Graphics g)
See Also:
Component.update(Graphics)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void paintComponents(Graphics g)
See Also:
Component.paintAll(java.awt.Graphics), Component.paint(java.awt.Graphics)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected String paramString()
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Dimension preferredSize()
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void print(Graphics g)
See Also:
Component.update(Graphics)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void printComponents(Graphics g)
See Also:
Component.printAll(java.awt.Graphics), Component.print(java.awt.Graphics)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void processContainerEvent(ContainerEvent e)
See Also:
Component.enableEvents(long)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void processEvent(AWTEvent e)
See Also:
Component.processMouseWheelEvent(java.awt.event.MouseWheelEvent), Component.processHierarchyEvent(java.awt.event.HierarchyEvent), Component.processInputMethodEvent(java.awt.event.InputMethodEvent), Component.processMouseMotionEvent(java.awt.event.MouseEvent), Component.processMouseEvent(java.awt.event.MouseEvent), Component.processKeyEvent(java.awt.event.KeyEvent), Component.processFocusEvent(java.awt.event.FocusEvent), Component.processComponentEvent(java.awt.event.ComponentEvent)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void remove(int index)
See Also:
add(java.awt.Component)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void remove(Component comp)
See Also:
remove(int), add(java.awt.Component)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeAll()
See Also:
remove(int), add(java.awt.Component)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeContainerListener(ContainerListener l)
See Also:
getContainerListeners(), addContainerListener(java.awt.event.ContainerListener)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void removeNotify()
See Also:
addNotify(), Component.isDisplayable()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final void setComponentZOrder(Component comp,
                                     int index)
See Also:
getComponentZOrder(java.awt.Component), IllegalArgumentException, NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1262]The z-order only matters when the components overlap
By Anonymous on 2005/01/20 13:09:51  Rate
The z-order only matters when the components overlap.

public void setFocusCycleRoot(boolean focusCycleRoot)
See Also:
setFocusTraversalPolicyProvider(boolean), ContainerOrderFocusTraversalPolicy, getFocusTraversalPolicy(), setFocusTraversalPolicy(java.awt.FocusTraversalPolicy), isFocusCycleRoot()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFocusTraversalKeys(int id,
                                  Set<? extends AWTKeyStroke> keystrokes)
See Also:
KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, getFocusTraversalKeys(int), IllegalArgumentException, Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFocusTraversalPolicy(FocusTraversalPolicy policy)
See Also:
isFocusCycleRoot(java.awt.Container), setFocusCycleRoot(boolean), getFocusTraversalPolicy()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public final void setFocusTraversalPolicyProvider(boolean provider)
See Also:
isFocusTraversalPolicyProvider(), getFocusTraversalPolicy(), setFocusTraversalPolicy(java.awt.FocusTraversalPolicy)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setFont(Font f)
See Also:
Component.getFont()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setLayout(LayoutManager mgr)
See Also:
getLayout(), doLayout()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void transferFocusBackward()
See Also:
Component.requestFocus()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void transferFocusDownCycle()
See Also:
setFocusCycleRoot(boolean), isFocusCycleRoot(java.awt.Container), Component.requestFocus()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void update(Graphics g)
See Also:
Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void validate()
See Also:
add(java.awt.Component), Component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1849]need to remove and add JTabbedPane with JTable information to JFrame at runtime
By plnmca98 { at } rediffmail { dot } com on 2006/11/25 00:15:55  Rate
private void createTabPanes ( JTabbedPane tabPane, Object obj )   {  
          
         System.out.println ( "Start createTabPanes" ) ; 
         Object [  ]  objArr= ( Object [  ]  ) obj; 
         String proName=null; 
         projTables = new JTable [ objArr.length ] ;    
         projScrolls = new JScrollPane [ objArr.length ] ; 
         for ( int i = 0 ; i < objArr.length ; i++ )  {  
             System.out.println ( "inside for " + i ) ; 
             proName = response.getProjectDetailsArray ( i ) .getProjectName (  ) ; 
             table_proj = new JTable (  ) ; 
             scroll_proj = new JScrollPane (  ) ; 
             table_proj.setModel ( new DefaultTableModel (  (  ( Object [  ]  [  ]  ) objArr [ i ]  ) , task_headers )  ) ; 
             scroll_proj.setViewportView ( table_proj ) ; 
             tabPane.addTab ( proName, scroll_proj ) ; 
             table_proj.getTableHeader (  ) .setReorderingAllowed ( false )  ; 
             table_proj.getColumnModel (  ) .getColumn ( 0 ) .setMinWidth ( 300 ) ; 
             TableColumn col = table_proj.getColumnModel (  ) .getColumn ( 1 ) ; 
             col.setCellEditor ( new HourCellEditor (  )  ) ; 
             col = table_proj.getColumnModel (  ) .getColumn ( 2 ) ; 
             col.setCellEditor ( new HourCellEditor (  )  ) ; 
             col = table_proj.getColumnModel (  ) .getColumn ( 3 ) ; 
             col.setCellEditor ( new HourCellEditor (  )  ) ; 
             col = table_proj.getColumnModel (  ) .getColumn ( 4 ) ; 
             col.setCellEditor ( new HourCellEditor (  )  ) ; 
             col = table_proj.getColumnModel (  ) .getColumn ( 5 ) ; 
             col.setCellEditor ( new HourCellEditor (  )  ) ; 
             col = table_proj.getColumnModel (  ) .getColumn ( 6 ) ; 
             col.setCellEditor ( new HourCellEditor (  )  ) ; 
             projTables [ i ]  = table_proj; 
             projScrolls [ i ] = scroll_proj; 
          }  
         System.out.println ( "End createTabPanes" ) ; 
      }  
    
  
  
 private void getTimeSheetObj ( String weekDate )  {  
        //Object [  ]  [  ]  rowObj=null; 
          
         try  {  
             System.out.println ( "Inside the gettimesheet method try block" ) ; 
             if ( projTables!=null )  {  
                     for ( int i=projTables.length-1; i > =0; i-- )  {  
                         JTable jt = projTables [ i ] ; 
                         jTabbedPane_Main.remove ( jt ) ; 
                         System.out.println ( "Removing Table:"+i ) ; 
                      }  
                     jPanel_Tabbedpane.remove ( jTabbedPane_Main ) ; 
                     jTabbedPane_Main = new JTabbedPane (  ) ; 
                                        
                     jTabbedPane_Main.revalidate (  ) ; 
                     jPanel_Tabbedpane.revalidate (  ) ; 
                      
                     this.getContentPane (  ) .validate (  ) ; 
                     this.getContentPane (  ) .repaint (  ) ; 
                     jTabbedPane_Main.addChangeListener ( new ChangeListener (  )  {  
                         public void stateChanged ( ChangeEvent ce )  {  
                             getTabbedPaneListenerValues (  ) ; 
                          }  
                      }  ) ;  
              // this.setState ( JFrame.ICONIFIED ) ; 
              // this.setExtendedState ( JFrame.MAXIMIZED_BOTH ) ; 
                                        
              }  
             res = GetTimesheetResponseDocument.Factory.parse ( new File ( "C:\\Narayana.xml" )  ) ; 
             response = res.getGetTimesheetResponse (  ) ; 
             proDets=response.getProjectDetailsArray (  ) ; 
             numOfPro = proDets.length; 
             String taskDayValues [  ]  = new String [ 8 ] ; 
             System.out.println ( numOfPro ) ; 
             proArr=new Object [ numOfPro ] ; 
             Object [  ]  [  ]  taskValues=null; 
             for ( int p = 0;p < numOfPro;p++ )  {  
                 System.out.println ( "Inside1" ) ; 
                 taskDet = proDets [ p ] .getTaskDetailsArray (  ) ; 
                 taskValues = new Object [ taskDet.length ]  [ 8 ] ; 
                 for ( int t=0;t < taskDet.length;t++ )  {  
                     System.out.println ( "Inside2" ) ; 
                     taskValues [ t ]  [ 0 ]  =  ( taskDet [ t ] .getTaskName (  )  ) ; 
                     taskValues [ t ]  [ 1 ]  =  ( taskDet [ t ] .getDay1HH (  ) +":"+taskDet [ t ] .getDay1MM (  )  ) .toString (  ) ; 
                     taskValues [ t ]  [ 2 ]  =  ( taskDet [ t ] .getDay2HH (  ) +":"+taskDet [ t ] .getDay2MM (  )  ) .toString (  ) ; 
                     taskValues [ t ]  [ 3 ]  =  ( taskDet [ t ] .getDay3HH (  ) +":"+taskDet [ t ] .getDay3MM (  )  ) .toString (  ) ; 
                     taskValues [ t ]  [ 4 ]  =  ( taskDet [ t ] .getDay4HH (  ) +":"+taskDet [ t ] .getDay4MM (  )  ) .toString (  ) ; 
                     taskValues [ t ]  [ 5 ]  =  ( taskDet [ t ] .getDay5HH (  ) +":"+taskDet [ t ] .getDay5MM (  )  ) .toString (  ) ; 
                     taskValues [ t ]  [ 6 ]  =  ( taskDet [ t ] .getDay6HH (  ) +":"+taskDet [ t ] .getDay6MM (  )  ) .toString (  ) ; 
                     taskValues [ t ]  [ 7 ]  =  ( taskDet [ t ] .getDay7HH (  ) +":"+taskDet [ t ] .getDay7MM (  )  ) .toString (  ) ; 
                     System.out.println ( "After taskvalues" ) ; 
                  }  
             proArr [ p ] =taskValues; 
              }  
             createTabPanes ( jTabbedPane_Main, proArr ) ; 
             System.out.println ( "outside" ) ;  
             jPanel_Tabbedpane.add ( jTabbedPane_Main ) ; 
             jTabbedPane_Main.getAccessibleContext (  ) .setAccessibleName ( "Proj" ) ; 
             getContentPane (  ) .add ( jPanel_Tabbedpane ) ; 
             pack (  ) ; 
                         
          } catch ( XmlException xe )   {  
             System.out.println ( "Inside the XmlException block" ) ; 
             System.out.println ( ""+xe.getMessage (  )  ) ; 
          }  catch ( IOException ioe )   {  
             System.out.println ( "Inside the IOException block" ) ; 
             System.out.println ( ""+ioe.getMessage (  )  ) ; 
          }   
       /* JOptionPane.showMessageDialog ( null, 
                             "Values Displayed in the below tables", 
                             "Alert!",JOptionPane.ERROR_MESSAGE ) ; */
 
     System.out.println ( "Initial JFrame Bounds:"+this.getBounds (  )  ) ; 
      } 


protected void validateTree()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags