Results 1 to 2 of 2
  1. #1
    aaroffl is offline Member
    Join Date
    Mar 2008
    Rep Power

    Default Setting an image's transparency?

    Hi all, not quite sure how to word this question..but here he goes. I'm currently working on a GUI program for a Tetris game i've created. The board for it uses a JPanel, and overrides paintComponents. I was first creating a rectangle2D and filling it with the piece's color to represent each block of my pieces, which is fine but to me seems kind of boring.

    What i now want to do is create a transparant image for the block, the reason i want it transparant is because I want some of the color of the piece to show through the image.

    What i'm doing now is using a .png image file i made in photoshop and using the drawImage method in my panel to paint it. Now that i've done this, it seems to be sufficiently more sluggish.

    Any ideas?
    Thanks in advance.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power


    You can use java.awt.geom.Area or java.awt.Polygon for a non-rectangular Shape.


Similar Threads

  1. Replies: 0
    Last Post: 07-25-2008, 02:26 PM
  2. Setting the DSN
    By tim in forum JDBC
    Replies: 1
    Last Post: 02-14-2008, 09:55 PM
  3. Help with setting up please
    By BlitzA in forum New To Java
    Replies: 6
    Last Post: 12-29-2007, 12:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts