Setting Background partly transparent

From: Silvio Malitsch (ramon_at_nwn.de)
Date: 02/04/04


Date: Wed, 4 Feb 2004 20:28:36 +0100

Hello,

I have some trouble with designing my GUI for an application.
I need to draw a certain shape (circle, rectangle) on a JPanel which follows
the mouse move on that JPanel.
Well the problem is the background. I should be transparent and only showing
the current shape.
I used the paintComponent() method to draw the shape and a
mouseMotionListener for realising the move- effects.
On runtime, it paints many shapes (one for each mouse move) but it should be
just one.
Clearing the Graphics2D Object with the clear() method makes the component
be painted in the default background color.

Is there a solution for making components partly transparent?
Is there another simple way of realising this?

Thanks.



Relevant Pages

  • Setting Background partly transparent
    ... I need to draw a certain shape on a JPanel which follows ... mouseMotionListener for realising the move- effects. ... Is there a solution for making components partly transparent? ...
    (comp.lang.java.gui)
  • Re: drawImage() Question
    ... If you acquire the whole image before you attempt to draw it you can put 'null' there. ... Here is an example of how to read an image file and draw it on a JPanel. ... public void paint{ ... java ImageIOExample http://www.thealpacastore.com/alpacacam/latest640.jpg ...
    (comp.lang.java.help)
  • Re: User draws selection rectangle over components?
    ... add MouseListener and MouseMotionListener to your JPanel. ... oldDragPoint = dragPoint; ... rect draw 4 lines. ... > user can drag the mouse over all of them and draw a selection rectangle ...
    (comp.lang.java.gui)
  • Re: Newbe, paintComponent problem.
    ... The initial oval, from paintComponent, isn't draw ... private JPanel jPanelbottom = null; ... public void actionPerformed{ ...
    (comp.lang.java.programmer)
  • Re: New Gheyme Round 3
    ... >> 26 Going for a satisfyingly huge dump VS ... >> 56 That feeling of realising that you've done enough and from here you ... > DRAW - WTF are either of these still doing in the comp? ...
    (uk.sport.football)