From your comments it sounds like CubeGui is a swing frame that you only open once, and you want to get a reference to that frame to call the moveThat method. The best way would be to pass a reference to your solver class:
public class Solver {
private CubeGui gui;
public Solver(CubeGui gui) {
this.gui = gui;
}
void solveIt(){
gui.moveThat();
}
}
If that is really difficult in practice, you could consider making CubeGui a singleton (as much as that is rightly discouraged, sometimes it makes sense, as in this case where you don't have more than one frame showing). To do this, you make the constructor of CubeGui private, and then add a method to CubeGui like this:
private static CubeGui singleInstance;
public static CubeGui getInstance() {
if (singleInstance == null) {
singleInstance = new CubeGui();
}
return singleInstance;
}
Then in your solver you can do:
CubeGui.getInstance().moveThat();
I'll probably get a downvote for suggesting a Singleton. I might even deserve it, but it sounds like the question needs to know what that looks like. To counter balance that, see here.
So if at all possible, pass the object in as a parameter, either to the constructor, or to the method.