bluejamesbond 0 Newbie Poster

Hello,

I am trying to get an image and place a rectangle on top of it as an overlay.
So, the image has a different hue as well. Something like this:

http://img215.imageshack.us/img215/8482/picpmf.png

For the overlay: I am currently using this override method on JLabel. It doesnt look that good

public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		super.paintBorder(g);
		
		Graphics2D g2d = (Graphics2D) g;	
		oldHints = g2d.getRenderingHints();
	//	g2d.setComposite(BlendComposite.Overlay.derive(0.75f));  THIS BLENDING TECHNIQUE IS SO SLOW!!!!
		g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f));  //THIS DOESNT LOOK GOOD...HOW CAN I FIX IT?
	    g2d.setPaint(new GradientPaint(0,this.getHeight()/2,start,this.getWidth()+10,this.getHeight()/2,end, false));
	    if(!BORDER)
	    	g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
	    else
	    	g2d.fillRect(4, 4, this.getWidth()-8, this.getHeight()-8);
	 //   g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OUT, 0.5f));
	    if(text){	
	    	g2d.setComposite(AlphaComposite.Src);
	    	g2d.setRenderingHints(hints);
	    	g2d.drawString(getName(), tx, ty);
	    	g2d.setRenderingHints(oldHints);
	    	tx-=1;
	    }
        
        varyColors();
        
	}

Also, how can I make a visualizer like the one shown in the first link or this link
http://img215.imageshack.us/img215/8482/picpmf.png


Thank you.

I am just a beginner and this is not my HW...

Sincerely,

bluejamesbond

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.