Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: JPanel in JFrame

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb 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)


  2. #2
    Member Darryl.Burke's Avatar
    Join Date
    Mar 2010
    Location
    Madgaon, Goa, India
    Posts
    491
    Thanks
    8
    Thanked 47 Times in 45 Posts

    Default 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

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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);
    }
    }

Similar Threads

  1. Funny business with JFrame, JPanel and JLabel
    By JeffC in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 21st, 2010, 12:26 PM
  2. Imitating a JFrame extended program with JPanel; help needed...
    By emigrant in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 15th, 2010, 01:30 PM
  3. How to copy image from one jpanel to another jpanel
    By ramanavarayuri1986 in forum AWT / Java Swing
    Replies: 0
    Last Post: February 15th, 2010, 01:36 AM
  4. need help with ActionListener,JPanel,JFrame
    By amahara in forum AWT / Java Swing
    Replies: 5
    Last Post: February 3rd, 2010, 12:40 PM
  5. Creating and displaying a JPanel inside another JPanel
    By JayDuck in forum AWT / Java Swing
    Replies: 1
    Last Post: April 7th, 2009, 08:02 AM