Results 1 to 7 of 7
  1. #1
    Jakeob is offline Java Apprentice
    Join Date
    Oct 2012
    Location
    On my computer
    Posts
    10
    Rep Power
    0

    Default java.awt.geom, Making Objects Invisible?

    I'm attempting to place a rectangle over a part of a picture, but later I want it to disappear without affecting the things below it. Is this possible? I'm using java.awt.geom to place the rectangle over my other shapes. Here is the code I'm using to place the rectangle:

    Java Code:
    JFrame frame = new JFrame();
    //Basic JFrame initialization here
    ProjectComponent project = new ProjectComponent();
    frame.add(project);
    
    //ProjectComponent class that extends JComponent
    Graphics2D g2 = (Graphics2D) g;
    g2.setColor(Color.BLACK);
    Rectangle2D.Double pixel = new Rectangle2D.Double(xLoc, yLoc, 20, 20);
    g2.draw(pixel);
    g2.fill(pixel);
    Also, what do I put around my code to get it to show up as code. Thanks for any help! :D
    Last edited by Jakeob; 10-11-2012 at 04:32 AM. Reason: To add more detail

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: java.awt.geom, Making Objects Invisible?

    You may wish to supply more detail -- what graphics and GUI library are you using? Swing? AWT? SWT? Android? How are you currently doing your coding and animation? Can you show code? We're notoriously poor at guessing these sorts of things.

  3. #3
    Jakeob is offline Java Apprentice
    Join Date
    Oct 2012
    Location
    On my computer
    Posts
    10
    Rep Power
    0

    Default Re: java.awt.geom, Making Objects Invisible?

    I put java.awt.java in the title, but forgot to post it in the body of my post. I'll edit it in now.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: java.awt.geom, Making Objects Invisible?

    To show code, you'd place [code] [/code] tags around your code. Note that the top tag, [code], is different than the bottom tag, [/code].

    Not sure about others, but I still need to see more and know more about your program.

  5. #5
    Jakeob is offline Java Apprentice
    Join Date
    Oct 2012
    Location
    On my computer
    Posts
    10
    Rep Power
    0

    Default Re: java.awt.geom, Making Objects Invisible?

    Is that enough info?

    What isn't understandable?

  6. #6
    Jakeob is offline Java Apprentice
    Join Date
    Oct 2012
    Location
    On my computer
    Posts
    10
    Rep Power
    0

    Default Re: java.awt.geom, Making Objects Invisible?

    bump :/

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 8
    Last Post: 04-04-2012, 02:45 AM
  2. Making two picture objects into one.
    By Poles_Apart in forum New To Java
    Replies: 5
    Last Post: 01-29-2012, 10:08 PM
  3. Making a pointer to objects
    By Bongeh in forum New To Java
    Replies: 9
    Last Post: 04-01-2010, 05:18 PM
  4. Replies: 1
    Last Post: 08-11-2009, 03:00 PM
  5. Replies: 2
    Last Post: 04-14-2009, 11:01 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
  •