public GrafPack() { super("2D Drawing Package"); // call base class constructor Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); // get screen dimensions setBounds(0,0,size.width,size.height); // use all screen
mainMenu = new JMenuBar(); // main menu bar
fileMenu = new JMenu("File"); // main menu options createMenu = new JMenu("Create"); transformMenu = new JMenu("Transform"); colourMenu = new JMenu("Colour");
exit = new JMenuItem("Exit"); // menu items createSquare = new JMenuItem("Create Square"); createCircle = new JMenuItem("Create Circle"); move = new JMenuItem("Move"); fillRed = new JMenuItem("Fill Red"); fillGreen = new JMenuItem("Fill Green"); fillBlue = new JMenuItem("Fill Blue");
// process comamnds. The command will be set by the action performed in response to menu selections while (!command.equals("Exit")) { processCommand(); // act upon selected command }
// On leaving loop, closedown System.exit(0); }
public void mouseClicked(MouseEvent eve) { nextPoint = eve.getPoint(); // collect point command =" "; // reset command that was last called. } ; public void mouseEntered(MouseEvent e) { } ; public void mouseExited(MouseEvent e) { } ; public void mousePressed(MouseEvent e) { } ; public void mouseReleased(MouseEvent e) { } ;
public void actionPerformed(ActionEvent e) { aShape=null; // cancel any incomplete shapes nextPoint=null; // and any waiting points command = e.getActionCommand(); // collect String used to define menu item's text }
public void processCommand() { if (command.equals("Create Square")) { aShape = new Square(getPoint(),getPoint()); // create the square by 2 mouse clicks repaint(); // redraw screen } }
public Point getPoint() {
Point aPoint = null; // Point to be returned while (nextPoint==null); // wait for mouse click to change nextPoint { aPoint = nextPoint; // store the Point found nextPoint=null; // reset nextPoint return aPoint; } }
public void paint(Graphics g) { // to redraw screen super.paint(g); // repaint parent if (aShape != null) aShape.draw(g); // draw the shape if it exists }
}
the problem is it returns this error. any clues what i have to do. any help much appreciated. cheers luke
shapeSquare should be declared abstract shapeCircle should be decalred abstract