Re: Pixelgrabber and Vectors, changes not happening.
- From: bH <bherbst65@xxxxxxxxxxx>
- Date: Fri, 27 Jul 2007 20:41:18 -0700
On Jul 27, 8:06 pm, Joshua Cranmer <Pidgeo...@xxxxxxxxxxx> wrote:
On Fri, 27 Jul 2007 16:00:42 -0700, bH wrote:
if (mSt == "000000"){
String == comparison only works under certain conditions that are not
true for about 95% of the cases.
The short answer:
Use "000000".equals(mSt) instead of mSt == "000000"
The long answer:
There is a long thread explaining this topic in full detail in the
comp.lang.java.programmer group, entitled "String.equals()" by Chameleon,
started on July 22, 2007.
Hi Joshua,
Thanks for your help.
First I discarded entirely:
private String RestateClrLine (String mSt) {
String res ="";
System.out.println(mSt );
if (mSt == "000000"){
res = "ff0000";
System.out.println("Y");
}
else {
res = mSt;
System.out.println("N");
}
return res;
}
Revision as you have suggested:
mSet = mSet + si;
if ("000000".equals( mSet)) {
mSet = "ff0000";
}
vectorColorData.addElement(mSet);
or this will also work
mSet = mSet + si;
if( mSet.equals("000000")) {
mSet = "ff0000";
}
vectorColorData.addElement(mSet);
Thanks again,
bH
.
- Follow-Ups:
- References:
- Pixelgrabber and Vectors, changes not happening.
- From: bH
- Re: Pixelgrabber and Vectors, changes not happening.
- From: Joshua Cranmer
- Pixelgrabber and Vectors, changes not happening.
- Prev by Date: Is there a better way to do this?
- Next by Date: Re: Isn't Date deprecated? Use Calendar instead.
- Previous by thread: Re: Pixelgrabber and Vectors, changes not happening.
- Next by thread: Re: Pixelgrabber and Vectors, changes not happening.
- Index(es):
Relevant Pages
|