-
JPanel in JFrame
please help:- i have this java applet to imbed in html;
Inheritance from Java base class JPanel;
• A circle must be drawn at the point where you click;
• The circle must be a random colour and size. The size of the circle is bounded between 10 and60 pixels in diameter;
• The radius and the coordinates of the circle must be displayed at the top of the panel, centered;
• Use the MouseListener event to detect mouse where the mouse is initially clicked.
• Include a new button to move the mouse randomly across the screen to simulate a tennis match;
• If the same button is pressed again, the motion must be stopped;
• Extra marks will be given if the size of the circle can be adjusted.
*It should run on an internet browser as an applet (e.g firefox)~o)
-
Re: JPanel in JFrame
You don't really expect some stranger on an internet forum to do your homework, do you? Show us what you've got so far and ask a specific question and you may get help.
Recommended reading: How To Ask Questions The Smart Way
db
-
Re: JPanel in JFrame
What I've done so far:_
import javax.swing.JApplet;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class GUIApplet extends JApplet
{
public void init()
{
FrameGUI gui = new FrameGUI();
this.add(gui);
this.setSize(500, 500);
this.setVisible(true);
}
public void paint(Graphics g)
{
super.paint(g);
}
}