3 Replies - 223 Views - Last Post: 03 May 2013 - 12:03 PM Rate Topic: -----

#1 mistwalker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-May 13

Converting from an Applet to a GUI error

Posted 03 May 2013 - 11:29 AM

So I have the task to make a Applet and a GUI for an assignment. I have completed the Applet and Html, but I keep getting an error 21: cannot find symbol in my GUI.

import javax.swing.*;
import java.awt.*;
public class PineTreeGUI extends JFrame
{
	private int [] xTree = {50, 160, 270};
	private int [] yTree = {200, 20, 200};
	private int [] xBase = {135, 135, 180, 180};
	private int [] yBase = {200, 250, 250, 200};
	public void paintComponent(Graphics canvas)
	{
		canvas.setColor(Color.GREEN);
		canvas.fillPolygon(xTree, yTree, xTree.length);
		canvas.setColor(Color.GRAY);
		canvas.fillPolygon(xBase, yBase, xBase.length);
    }
    public static void main(String[]args)
    {
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(400, 400);
		frame.add(new PineTreeJFrame(), BorderLayout.CENTER);
		frame.setVisible(true);
	}
}


Thanks a in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Converting from an Applet to a GUI error

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10814
  • View blog
  • Posts: 40,310
  • Joined: 27-December 08

Re: Converting from an Applet to a GUI error

Posted 03 May 2013 - 11:53 AM

There is no PineTreeJFrame class. Also, you shouldn't be adding a JFrame to a JFrame.
Was This Post Helpful? 1
  • +
  • -

#3 mistwalker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 03-May 13

Re: Converting from an Applet to a GUI error

Posted 03 May 2013 - 12:02 PM

Thanks a million. Final week is coming up and lack of sleep is getting to me needless to say.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10814
  • View blog
  • Posts: 40,310
  • Joined: 27-December 08

Re: Converting from an Applet to a GUI error

Posted 03 May 2013 - 12:03 PM

Glad to help!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1