Just quick query, with what I have been reading.
How do I link between the circle class I have and the RunCircle class which creates a circle.
Code for Circle Class:
Code:import java.awt.*; import java.applet.*; public class Circle extends Applet { public void paint(Graphics g) { Circle myCircle = new Circle g.setColor(Color.black); g.drawOval(85,45,75,75); } }
Code for RunCircle (Correct)
Code:import java.awt.*; public class RunCircle { public static void main(String[] args) { Frame frame = new Frame(); Circle myCircle = new Circle(100,50,50); // is this line that is linked to the circle class?? frame.setSize(300.300); frame.setBackground(Color.yellow); frame.add(myCircle); frame.setVisible(true); } }
I’m doing some self-study reading a book and this properly isn’t the best way of going about it mixing frames and applets but that’s what I am doing.
Thanks


Reply With Quote


Bookmarks