aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Calling repaint from another class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Calling repaint from another class" Watch "Calling repaint from another class" New topic
Author

Calling repaint from another class

Keris Van Engeland
Greenhorn

Joined: Apr 06, 2013
Posts: 2
Hi, i'm programming the game 'for on a row'. When someone makes for in a row I want to reset the game so you can start over. But I have a problem with calling the repaint method from another class.
Here is some code:





On line 50 in 'Vieropeenrij' I want to call the function 'nieuwSpel'. In this function I've put repaint() but this doesn't work.
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3949
    
  17

At line 34 you create a new Bord instance, and that is the one you call the method on. That is not the Bord which is being displayed, so it is not the one which would be painted/repainted (or display the game's state). You need to get a reference to the Bord which is actually displayed - not create a new one.


Steve
Keris Van Engeland
Greenhorn

Joined: Apr 06, 2013
Posts: 2
And how can i make such a reference?
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3949
    
  17

Keris Van Engeland wrote:And how can i make such a reference?

How do you get references for the spelerNaam1 and spelerNaam2 Strings?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling repaint from another class
 
Similar Threads
A simple calculator help!
painting custom components without extending jcomponent
mouseClicked and mouseDragged
Can't Update Record ?
Can't Update Record ?