Hi all,
I have a main GUI class as seen here:
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
/*
* Class is to communicate with various other classes in the program to
* create a roster for user based on their selection on GUI.
*/
public class MainGUI extends JFrame
{
private static final long serialVersionUID = 1L;
//declares window width and height for program
final int WINDOW_WIDTH = 1000;
final int WINDOW_HEIGHT= 1000;
private PlatoonPanel pp;
private SquadPanel sp;
private ManualPanel mp;
private ActionButtons ab;
private static Container pane;
public MainGUI()
{
//sets title
setTitle("Roster Generator Version 0.0.1");
//sets window width and height
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
//sets default close operation
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pane = getContentPane();
//creates new class objects
pp = new PlatoonPanel();
sp = new SquadPanel();
mp = new ManualPanel();
ab = new ActionButtons();
//calls buildGUI() method
buildGUI();
//sets visible to true
setVisible(true);
}
//method that combines all the other panels from other classes and
//combines them into one
public void buildGUI(){
//sets border layout for main panel
pane.setLayout(new BorderLayout());
//adds other panels to this main panel
pane.add(pp.getPlatoonRosterPanel(), BorderLayout.WEST);
pane.add(sp.getSquadRosterPanel(), BorderLayout.CENTER);
pane.add(mp.getManualRosterPanel(), BorderLayout.EAST);
pane.add(ab.getButtonPanel(), BorderLayout.SOUTH);
}
}
And trying to have a driver class here for the main method:
/*
* Driver Class for program
*/
public class MainDriver {
public static void main(String[] args) {
MainGUI mg = new MainGUI();
}
}
How can I communicate between these classes so that I do not receive this error:
Exception in thread "main" java.lang.NoSuchMethodError: main
Thanks for any help!