public class CohortGui extends JFrame {
public CohortGui () {
super("Simulation");
setSize(1400,850);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Thread runner;
// GUI menu
JMenu fileMenu = new JMenu("File");
JMenu simulationMenu = new JMenu("Simulation");
JMenu optionMenu = new JMenu("Option");
JMenu aboutMenu = new JMenu("About");
JMenuBar menuBar = new JMenuBar();
menuBar.add(fileMenu);
menuBar.add(simulationMenu);
menuBar.add(optionMenu);
menuBar.add(aboutMenu);
setJMenuBar(menuBar);
// Create DrawCanvas
DrawCanvas drawArea = new DrawCanvas();
//Create simulationPanel
SimulationPanel sp = new SimulationPanel();
sp.setBackground(Color.white);
sp.add(drawArea);
add(sp);
..........
class DrawCanvas extends PCanvas {
public DrawCanvas(){
PLayer layer = new PLayer();
PCamera camera = new PCamera();
layer.addCamera(camera);
//Create Lines
LineOne one = new LineOne();
LineTwo two = new LineTwo();
LineThree three = new LineThree();
PLine test = new PLine();
test.setBounds(100,200,200,400);
PImage ngo = new PImage("C:/Users/Renee/Desktop/toolbarButtonGraphics/INET_Earth_Clear.png");
ngo.setBounds(390, 75, getAlignmentX(), getAlignmentY());
layer.addChild(ngo);
PImage ngo2 = new PImage("C:/Users/Renee/Desktop/toolbarButtonGraphics/INET_Earth_Clear.png");
ngo2.setBounds(110,300,getAlignmentX(), getAlignmentY());
layer.addChild(ngo2);
PImage ngo3 = new PImage("C:/Users/Renee/Desktop/toolbarButtonGraphics/INET_Earth_Clear.png");
ngo3.setBounds(730,300, getAlignmentX(), getAlignmentY());
layer.addChild(ngo3);
layer.setPaint(Color.BLACK);
layer.addChild(one);
layer.addChild(two);
layer.addChild(three);
layer.addChild(test);
}
}
class SimulationPanel extends JPanel {
public SimulationPanel () {
setLayout(null);
JLabel testLabel= new JLabel("Test Label");
add(testLabel);
}
}