Results 1 to 7 of 7
- 02-17-2011, 08:43 PM #1
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
- 02-17-2011, 08:47 PM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
'radio1' is null.
-
It should be obvious that radio1 is null. Now trace back in your program to see why.
- 02-17-2011, 08:55 PM #4
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Thanks!
Was calling it in the constructor before I created it...
< 10th day of Java, nothing is obvious... total newb :)It should be obvious...
-
- 02-17-2011, 09:03 PM #6
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
You weren't asking about this, but consider this alternative code:
And since you're just getting started, get in the habit of doing this:Java Code:private int getRadioValue() { if (radio1.isSelected()) return 1; else return 2; }
Those extra braces will save you some tear-your-hair-out frustration someday, when you add an extra line of code and can't figure out why it breaks everything.Java Code:private int getRadioValue() { if (radio1.isSelected()) [COLOR="Blue"]{[/COLOR] return 1; [COLOR="Blue"]}[/COLOR] else [COLOR="Blue"]{[/COLOR] return 2; [COLOR="Blue"]}[/COLOR] }
-Gary-
- 02-17-2011, 09:08 PM #7
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Similar Threads
-
Whats wrong with my code
By zit1343 in forum New To JavaReplies: 9Last Post: 01-24-2011, 01:06 AM -
whats wrong
By atenv in forum New To JavaReplies: 6Last Post: 06-15-2010, 01:55 PM -
whats is wrong with this app??
By mrajan in forum New To JavaReplies: 4Last Post: 06-09-2010, 10:56 PM -
What is wrong with my tiny code?
By Znote in forum New To JavaReplies: 5Last Post: 11-07-2009, 04:42 PM -
Cannot understand whats wrong
By Lehane_9 in forum New To JavaReplies: 1Last Post: 03-06-2008, 07:57 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks