User Profile

Collapse

Profile Sidebar

Collapse
Cheez It
Cheez It
Last Activity: May 13 '07, 10:43 AM
Joined: Dec 29 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • All the GUI classes extend Component, so you can use the getWidth() and getHeight() methods to find the current dimensions of a frame or window.
    See more | Go to post

    Leave a comment:


  • Cheez It
    replied to Two beginners mistakes...need some input.
    in Java
    showInputDialog () returns null when you click cancel so just check if strChoice is null before continuing. You also need to call exit() in case 4. The way you have it now because there is no break in case 4 it continues on to the default case and displays the "Wrong!!", "WAAAY OFF!!!" message. You get a NullPointerExce ption when you enter 3 because you set strTryDouble to null then tried to parse a double from it. I'm not sure...
    See more | Go to post

    Leave a comment:


  • Cheez It
    replied to Random integers in Java
    in Java
    java.util.Rando m handles random numbers in Java:

    Code:
    Random rand = new Random()
    int aRandomInt = rand.nextInt(10) // Random int 0 (inclusive) to 10 (exclusive)
    Check out the API for more info....
    See more | Go to post

    Leave a comment:


  • Cheez It
    replied to reverse method in JDK6.0
    in Java
    reverse() reverses the order of the characters in the StringBuffer, so it will do what you're looking for.

    Code:
    StringBuffer str = new StringBuffer("This is a string");
    System.out.println(str);
    str.reverse();
    System.out.println(str);
    This would print:
    Code:
    This is a string
    gnirts a si sihT
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...