I am looking to draw a rectangle with multiple fill3DRect(), status boxes inside, which, represent network status of each host. I would like to create a class instantiated from my:
public class MapDsp extends JPanel implements MouseListener
that would handle all the drawing. I have a two part question, do I have to pass in the Graphics instance from the paintComponent(Graphics g) method , or can I create an instance in the class I want to do all my drawing in. Once I get the graphics instance, and make a draw call how do I get the content so it is Visible on the screen?
I wrote A quick
test class that was instantiated in the paintComponent(Graphics g) of public class MapDsp extends JPanel implements MouseListener and used called
public void test() {
g.setColor(FuncStatTypes.FailedColor);
g.fill3DRect(25,25,500,500, true);
}
But nothing was visible on the screen. Is there a simple call to make the drawing visible?
Thanks.