Results 1 to 3 of 3
  1. #1
    noobie_nate is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Paint--- trying to paint an oval

    Hey all,

    I'm very new to Java and I'm trying to draw an oval (or any shape really) on the frame I have created. I have gone online, through the books, and cant figure out how to do it. Please help!!

    import java.awt.Graphics;
    import javax.swing.JFrame;
    //import java.awt.MouseEvent;
    //import java.awt.MouseListener;
    import javax.swing.JButton;
    import java.awt.Component;
    import java.awt.FlowLayout;
    import static java.lang.System.out;


    public class Oval {

    public static void main (String args[]) {

    JFrame ovalFrame = new JFrame();
    String ovalTitle = "Change the shape";

    ovalFrame.setTitle(ovalTitle);
    ovalFrame.setSize(500, 400);
    ovalFrame.setDefaultCloseOperation(JFrame.EXIT_ON_ CLOSE);
    ovalFrame.setVisible(true);
    ovalFrame.setLayout(new FlowLayout());
    //ovalFrame.getContentPane().add(drawOval); Not sure if I need this
    ovalFrame.add(new JButton("Click this to change shape"));
    ovalFrame.add(new JButton("Click this to change color"));

    out.println("Keep going!!");


    }

    }

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: Paint--- trying to paint an oval

    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: Paint--- trying to paint an oval

    Moved from Java Applets.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How to get this paint?
    By Monster in forum New To Java
    Replies: 3
    Last Post: 04-15-2013, 01:01 PM
  2. Paint everything at once?
    By Lionlev in forum AWT / Swing
    Replies: 11
    Last Post: 10-15-2012, 03:01 AM
  3. Paint is invalid type for variable paint.
    By minibronya in forum New To Java
    Replies: 3
    Last Post: 05-25-2012, 05:52 AM
  4. Paint
    By ninjaturtlez in forum AWT / Swing
    Replies: 4
    Last Post: 12-17-2011, 04:15 AM
  5. Paint????
    By seanfmglobal in forum New To Java
    Replies: 3
    Last Post: 02-15-2011, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •