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:
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
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.
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.
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.
Re: java.awt.geom, Making Objects Invisible?
Is that enough info?
What isn't understandable?
Re: java.awt.geom, Making Objects Invisible?
Re: java.awt.geom, Making Objects Invisible?
Again, you might get more takers if you give out more info. Consider creating and posting an SSCCE for instance.