Results 1 to 6 of 6
  1. #1
    Nakinsige is offline Member
    Join Date
    Jan 2012
    Posts
    4
    Rep Power
    0

    Default Increase Oval size by 2 every time the program is run. For the coordinates 50,50

    Java Code:
    
    
    
    import java.awt.*;
    import javax.swing.*;
    
    public class BigBlueDrawPanel extends JPanel {
    
    	JFrame frame;
    
    	public static void main(String[] args) {
    		BigBlueDrawPanel g = new BigBlueDrawPanel();
    		g.setUpScreen();
    
    	}
    
    	public void setUpScreen() {
    
    		frame = new JFrame("Graphics uol");
    		frame.setVisible(true);
    		frame.setSize(500, 500);
    		frame.add(this);
    	}
    
    	public void paintComponent(Graphics g) {
    		g.setColor(Color.blue);
    		g.fillOval(225, 225, 50, 50);
    
    	}
    
    }

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

    Default Re: Increase Oval size by 2 every time the program is run. For the coordinates 50,50

    Did you have a question you forgot to ask?

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

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,564
    Rep Power
    23

    Default Re: Increase Oval size by 2 every time the program is run. For the coordinates 50,50

    First thing you need to do to be able to change the values used in your program, is to use variables and not hardcoded ints.

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

    Default Re: Increase Oval size by 2 every time the program is run. For the coordinates 50,50

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

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

    Default Re: Increase Oval size by 2 every time the program is run. For the coordinates 50,50

    Double posted and thread closed: GUI Issue

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

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

    Default Re: Increase Oval size by 2 every time the program is run. For the coordinates 50,50

    Nakinsige has, via a PM, denied the cross posting on JavaRanch. Based on whatever evidence I can access, I have to believe that the JavaRanch poster and Nakinsige copied the posted code from the same source, possibly some homework assignment online or otherwise in soft copy. That might account for the 3 extraneous newlines in the same position in both the identical codes, quoted here for record.

    db
    Quote Originally Posted by Nakinsige View Post
    Java Code:
    
    
    
    import java.awt.*;
    import javax.swing.*;
    
    public class BigBlueDrawPanel extends JPanel {
    
    	JFrame frame;
    
    	public static void main(String[] args) {
    		BigBlueDrawPanel g = new BigBlueDrawPanel();
    		g.setUpScreen();
    
    	}
    
    	public void setUpScreen() {
    
    		frame = new JFrame("Graphics uol");
    		frame.setVisible(true);
    		frame.setSize(500, 500);
    		frame.add(this);
    	}
    
    	public void paintComponent(Graphics g) {
    		g.setColor(Color.blue);
    		g.fillOval(225, 225, 50, 50);
    
    	}
    
    }
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. increase pixel size
    By rosh72851 in forum New To Java
    Replies: 9
    Last Post: 07-31-2012, 07:30 PM
  2. increase array size
    By giorgi in forum New To Java
    Replies: 45
    Last Post: 04-08-2011, 04:56 PM
  3. Window size increase animation
    By eLancaster in forum New To Java
    Replies: 3
    Last Post: 04-07-2011, 06:57 PM
  4. Replies: 3
    Last Post: 09-27-2008, 04:46 AM
  5. gridbaglayout: increase/decrease size of components.
    By newtojava7 in forum New To Java
    Replies: 2
    Last Post: 01-28-2008, 07:22 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
  •