Results 1 to 12 of 12
Thread: Equivalent of PHP isset in JAVA
- 03-24-2011, 01: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, 01: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, 01: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, 01: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, 02:01 PM #5
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Thanks, some rep for you
- 03-24-2011, 02: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, 02:25 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 03-24-2011, 03:01 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
- 03-24-2011, 03: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, 03:38 PM #10
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
- 03-24-2011, 03:40 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
I'm still curious what the actual excpetion was...but maybe that's just me.
- 03-24-2011, 03:41 PM #12
Similar Threads
-
Java equivalent of PHP's variable-variables?
By XmisterIS in forum New To JavaReplies: 7Last Post: 09-01-2010, 12:05 PM -
Java equivalent of Linux 'find' function
By porchrat in forum New To JavaReplies: 5Last Post: 08-25-2010, 12:31 PM -
[SOLVED] Java equivalent to X11 Work Procedure
By LongHitter in forum New To JavaReplies: 0Last Post: 01-12-2009, 12:36 PM -
Filter a file in java (unix cut command equivalent)
By marcosabel in forum New To JavaReplies: 0Last Post: 02-11-2008, 08:26 PM -
Php explode function, equivalent java
By fernando in forum Advanced JavaReplies: 1Last Post: 07-31-2007, 06:44 AM
Bookmarks