Bobby Marvikuan wrote:is not this part of the code is responsible for putting Julia?
No, it isn't. What it adds to the GUI is an empty JPanel which you create inside the Julia class. I don't know why you did that -- the obvious approach would be to first create the Julia object, which is already a GUI component with paintComponent overridden, and then to add it to the GUI.
Bobby Marvikuan wrote:is not this part of the code is responsible for putting Julia?
No, it isn't. What it adds to the GUI is an empty JPanel which you create inside the Julia class. I don't know why you did that -- the obvious approach would be to first create the Julia object, which is already a GUI component with paintComponent overridden, and then to add it to the GUI.
thanks and Sorry again
I made it like this and added
but now it draws on the second part of my Grid the same thing as in the first part but it calls the method System.out.printl();
1) Get rid of the entire JPanel inside your Julia class. It's a JPanel itself so you can use it instead of the existing JPanel.
2) Always call super.paintComponent(g) as the first statement when you override paintComponent.
Rob Spoor wrote:1) Get rid of the entire JPanel inside your Julia class. It's a JPanel itself so you can use it instead of the existing JPanel.
2) Always call super.paintComponent(g) as the first statement when you override paintComponent.
I have done part number 2 of your comment bur I cannot get rid of JPanel because if I do so myJulia will not work because it needs parameters of the panel on which it is going to draw. Do you think the problem is in this sentence???=/