KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > swing > CellRendererPane

javax.swing
Class CellRendererPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.CellRendererPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
See Also:
Top Examples, Source Code, XMLEncoder

protected AccessibleContext accessibleContext
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


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


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


public AccessibleContext getAccessibleContext()
See Also:
Component, Accessible
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


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


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


public void paintComponent(Graphics g,
                           Component c,
                           Container p,
                           int x,
                           int y,
                           int w,
                           int h)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[565]Plotting a JTextArea
By ashish_bioinfo { at } yahoo { dot } com on 2004/10/25 18:22:51  Rate
import java.awt.*;     
 import java.awt.event.*; 
 import javax.swing.*;     
 import java.awt.event.ItemListener; 
 import java.awt.Graphics; 
 import javax.swing.JTextArea; 
  
  
 public class Plottery extends JTextArea  {  
  
  
   String StrA = null; 
   String StrB = null; 
     Plottery ( String x1, String y1 )  
      {  
 //System.out.println ( x1 ) ; 
       this.StrA=new String ( x1 ) ; 
       this.StrB=new String ( y1 ) ; 
 //System.out.println ( StrA ) ; 
      }  
     public void paintComponent ( Graphics graph )  {  
 //Graphics plot=this.getGraphics (  ) ; 
               super.paintComponent ( graph ) ; 
     super.setRows ( 10 ) ; 
     super.setColumns ( 40 ) ; 
     //  setBackground ( Color.white ) ; 
 System.out.println ( StrA ) ; 
 System.out.println ( "constructor" ) ; 
       char x ; 
       char y ; 
  
  
       if  ( StrA != null && StrB != null )  
        {  
         for  ( int a = 0;a  <  StrA.length (  ) ; a++ )   
          {  
           x = StrA.charAt ( a ) ; 
                   for  ( int b = 0; b  <  StrB.length (  ) ; b++ )   
            {  
             y = StrB.charAt ( b ) ; 
                                
             if  ( x == y )   
              {  
               graph.setColor ( Color.black ) ; 
               graph.fillRect (  ( a*5 ) , ( b*5 ) ,5,5 ) ; 
              }   
               else   
              {  
               graph.setColor ( Color.white ) ; 
               graph.fillRect (  ( a*5 ) , ( b*5 ) ,5,5 ) ; 
              }  
            }  
          }    
        }  
      }  
  }  
 


public void paintComponent(Graphics g,
                           Component c,
                           Container p,
                           int x,
                           int y,
                           int w,
                           int h,
                           boolean shouldValidate)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void paintComponent(Graphics g,
                           Component c,
                           Container p,
                           Rectangle r)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


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

Popular Tags