Results 1 to 12 of 12
Thread: Equivalent of PHP isset in JAVA
- 03-24-2011, 12:40 PM #1
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Equivalent of PHP isset in JAVA
I have a GUI that takes a string in a text field. There some conversions (parse string to double) that happen the moment someone clicks the button. If nothing is in there exception exception, something I want to stop.
So I want something to check if the variable that receives this String has anything in it. Does stringVarible != null suffice?
- 03-24-2011, 12:46 PM #2
It's a very difficult to understand that you want.
Do you want to check some parameters on not null, when you click on a button?
I don't advise you compare to Java and PHP. There are very difference language.Skype: petrarsentev
http://TrackStudio.com
- 03-24-2011, 12:48 PM #3
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
I want to make sure that something has been entered in a TextField when the button is pressed.
- 03-24-2011, 12:59 PM #4
It's easy. You can make yourself listener for JButton. It would take a refer on JTextField object. In class a listener you will check a value from JTextField and if it's not null you will do something.
Skype: petrarsentev
http://TrackStudio.com
- 03-24-2011, 01:01 PM #5
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Thanks, some rep for you
- 03-24-2011, 01:04 PM #6
it's good. if it's clear. I think you can show some short example. It will be a very useful for newbie, if they will have same question.
Skype: petrarsentev
http://TrackStudio.com
- 03-24-2011, 01:25 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
- 03-24-2011, 02:01 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
- 03-24-2011, 02:15 PM #9
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
JosAH you are quite right. I have just realised that !=null will not work. "" is the way to go with something like equalsIgnoreCase or something along those lines. At least that is what worked for me
- 03-24-2011, 02:38 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,375
- Blog Entries
- 7
- Rep Power
- 17
- 03-24-2011, 02:40 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
I'm still curious what the actual excpetion was...but maybe that's just me.
- 03-24-2011, 02:41 PM #12
Similar Threads
-
Java equivalent of PHP's variable-variables?
By XmisterIS in forum New To JavaReplies: 7Last Post: 09-01-2010, 11:05 AM -
Java equivalent of Linux 'find' function
By porchrat in forum New To JavaReplies: 5Last Post: 08-25-2010, 11:31 AM -
[SOLVED] Java equivalent to X11 Work Procedure
By LongHitter in forum New To JavaReplies: 0Last Post: 01-12-2009, 11:36 AM -
Filter a file in java (unix cut command equivalent)
By marcosabel in forum New To JavaReplies: 0Last Post: 02-11-2008, 07:26 PM -
Php explode function, equivalent java
By fernando in forum Advanced JavaReplies: 1Last Post: 07-31-2007, 05:44 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks