Original Post
Hi there, anyone know why calling methods from "paintComponent" and passing the graphics context as argument doesn't work? Like this:
public void paintComponent(Graphics g){
Graphics2D g2 = (Graphics2D)g;
someObject.paintYourself(g2);
}
The drawing code in "someObject.paintYourself" doesn't work. But it works if I put the code directly into paintComponent. Is the use of g2 only allowed inside the "paintComponent" method? But how can Java tell, that I'm in some other method and just passed g2 as argument?