PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Java|javax|swing|CellRendererPane.java =

page 2 of 3



     * The Container p is the component we're actually drawing on, typically it's 
     * equal to this.getParent(). If shouldValidate is true the component c will be 
     * validated before painted.
     */
    public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate) {

	if (c == null) {
	    if (p != null) {
		Color oldColor = g.getColor();
		g.setColor(p.getBackground());
		g.fillRect(x, y, w, h);
		g.setColor(oldColor);
	    }
	    return;
	}

	if (c.getParent() != this) {
	    this.add(c);
	}

	c.setBounds(x, y, w, h);

	if(shouldValidate) {
	    c.validate();
	}

	boolean wasDoubleBuffered = false;
	if ((c instanceof JComponent) && ((JComponent)c).isDoubleBuffered()) {
	    wasDoubleBuffered = true;
	    ((JComponent)c).setDoubleBuffered(false);
	}

	Graphics cg = g.create(x, y, w, h);
	try {
	    c.paint(cg);
	}
	finally {
	    cg.dispose();
	}

	if (wasDoubleBuffered && (c instanceof JComponent)) {
	    ((JComponent)c).setDoubleBuffered(true);
	}

	c.setBounds(-w, -h, 0, 0);
    }


    /**
     * Calls this.paintComponent(g, c, p, x, y, w, h, false).
     */
    public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h) {
	paintComponent(g, c, p, x, y, w, h, false);
    }


    /**
     * Calls this.paintComponent() with the rectangles x,y,width,height fields.
     */
    public void paintComponent(Graphics g, Component c, Container p, Rectangle r) {
	paintComponent(g, c, p, r.x, r.y, r.width, r.height);
    }


    private void writeObject(ObjectOutputStream s) throws IOException {
	removeAll();
	s.defaultWriteObject();
    }


/////////////////
// Accessibility support
////////////////

    protected AccessibleContext accessibleContext = null;

    /**
     * Gets the AccessibleContext associated with this CellRendererPane. 
     * For CellRendererPanes, the AccessibleContext takes the form of an 
     * AccessibleCellRendererPane. 
     * A new AccessibleCellRendererPane instance is created if necessary.
     *
     * @return an AccessibleCellRendererPane that serves as the 
     *         AccessibleContext of this CellRendererPane
     */
    public AccessibleContext getAccessibleContext() {
	if (accessibleContext == null) {
	    accessibleContext = new AccessibleCellRendererPane();
	}
	return accessibleContext;
    }

    /**
     * This class implements accessibility support for the 
     * <code>CellRendererPane</code> class.
     */
    protected class AccessibleCellRendererPane extends AccessibleAWTContainer {
        // AccessibleContext methods
        //
        /**
         * Get the role of this object.
=2=

1| < PREV = PAGE 2 = NEXT > |3

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.033612 wallclock secs ( 0.01 usr + 0.00 sys = 0.01 CPU)