how do i call a class from main class
Hallo...I am quite new to java programming and recently I came across a problem which I can't solve almost a week.I have a small garphic project called SmileyFace and when I compile it there's is awlays some problem with it. Could anybody help me just to give me a hint or a clue where am I mistaking by writing the code...
Here's the code:
import java.awt.*;
import javax.swing.*;
public class RunSmileyFace
{
public static void main(String[] args)
{
SmileyFace myObjRef = new SmileyFace();
myObjRef.SmileyFace();
}
}
public class SmileyFace extends JFrame
{
public void SmileyFace()
{
setTitle("Smiley Face");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(250,220);
setLocation(300,300);
getContentPane().setBackground(Color.yellow);
setVisible(true);
}
public void paint(Graphics g)
{
super.paint(g); // call the paint method of the superclass, Jframe
g.setColor(Color.red);
g.drawOval(85,75,75,75); // the face
g.setColor(Color.blue);
g.drawOval(100,95,10,10); // the right eye
g.drawOval(135,95,10,10); // the left eye
g.drawArc(102,115,40,25,0,-180); // the mouth
g.drawString("Smiley Face", 90,175);
}
}// end of the code
I will be very grateful if some one can help me out with it, because I have tried so many different ways and the result is zilch....Thanks.