Results 1 to 7 of 7
  1. #1
    cupojavanoob is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default Need some help...

    Hey I am new to computer science and have some questions about some java code.

    what would be the best way to explain what these statements do?

    1.)paper.drawLine(20,80,70,10);
    paper.drawLine(70,10,120,80);
    paper.drawLIne(20,80,120,80);

    2.)private JButton myButton;
    private int xLocation, yLocation;


    3.)public void actionPerformed(ActionEvent event)

  2. #2
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    If your new to computer science the best thing to learn first (if you want help) is that people aren't going to do your homework for you.
    Also we need to have a good description of you want.
    ie
    What type of object is paper? Where is paper defined?
    I'm assuming it's a Graphics object. If so the best way to figure out what the method does is either to look at the source code or look at the java api documentation. You should be able to navigate to the Graphics class and see it's DrawLine method.

    2) Creates private variables which will not be accessible by other classes.

    3) A method signature

    Mr. Beans
    Last edited by Mr.Beans; 04-20-2009 at 04:25 AM.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    First off, why not tell us what you think they may do? Then we'll probably have a better idea of how to help you. Best of luck.

  4. #4
    cupojavanoob is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default

    Great! Thank you. That website is great. I am going over some questions from my book and am lost when it comes to some of the harder questions. Like this one...

    Write a method for a program displays three JButtons named button1, button2 and button3. Write the actionPerformed method so that it adds 1, 2 or 3 to an integer instance variable named myScore depending upon which button is clicked.
    Last edited by cupojavanoob; 04-20-2009 at 01:21 AM.

  5. #5
    cupojavanoob is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default

    Can anyone help me with this one?

    Write a method for a program displays three JButtons named button1, button2 and button3. Write the actionPerformed method so that it adds 1, 2 or 3 to an integer instance variable named myScore depending upon which button is clicked.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Again, please show what you've done and what specifically you have problems with. Best of luck.

  7. #7
    Mr.Beans's Avatar
    Mr.Beans is offline Senior Member
    Join Date
    Apr 2009
    Location
    Virginia Beach, Virginia
    Posts
    149
    Rep Power
    0

    Default

    Do you know how to display a JButton?

    Check out How to Use Buttons etc..

    It's a pretty good tutorial. Try your best and post any questions you have. We will be glad to answer them.
    Mr. Beans

Posting Permissions

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