Chris Bean

Greenhorn
+ Follow
since May 02, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Bean

At the risk of asking a stupid question, I have written a program which contains various labels, textboxes, checkboxgroups and checkboxes.
The problem is that I would like the font color to be white. By setting component.setForeground(Color.white) (where component is the name of a Panel object), all text becomes white with the exception of checkboxes (whether or not included in a checkboxgroup).
I have tried explicitly setting the foreground color of a checkbox using checkbox.setForeground(Color.white) (where checkbox is the name of a Checkbox object) but this has no effect.
Am I missing something here?
Equally I need to figure out how I can align the label of a checkbox with the checkbox.
Any pointers would be greatly appreciated.
19 years ago
Thanks guys. That was it! I actually knew that but wasn't pushing that line since I got it to work earlier with the equality operator. But it might have been due to the way I was referencing the object.
It can sometimes be very difficult to solve a simple problem when one gets too caught up in the details.
Thanks guys for pointing what you did. I can now start work on regaining my sanity.
Thanks a million.
19 years ago
Joel, thanks for the input. I wish it was that simple.
I have further simplified the method and here it is:
public void getPantryData(String t)
{
System.out.println("printing... " + t);
if(t == "B763")
System.out.println("printing..." + t);
}
The first statement prints: printing... B763 which is correct and proves that B763 is what t represents and yet any comparison in the if statement produces false as the second statement does not print!!!
the method call is: pantry.getPantryData(settings.type);
I just don't get it!
[ May 02, 2003: Message edited by: Chris Bean ]
19 years ago
This ought to be really really simple, but I am watching "2+2=5". I hope someone can sort this out!
I have written a program which calls a method in another class and all 6 parameters are supplied from yet another class. Like this:
System.out.println("running pantry update"+ settings.type + settings.dir);
pantry.getPantryData(settings.type, settings.dir, settings.shaulCb, settings.lhaulCb, settings.skiCb, settings.barsCb);
settings is an object of the Settings class and pantry is an object of the pantry class.
The first 2 parameters are String objects and the last 4 are boolean values.
The println statement confirms that the values to be passed to the receiving method are indeed correct (right value and class type). This is also confirmed in the receiving method.
What absolutely baffles me at the moment is why the above method call does not work properly but if I replace the settings.type and settings.dir with literal values it works perfectly???
System out above produces: running pantry updateB763O/B which is great. This information is even carried to into the called method where the value is compared in an if statement. But the result is always false.
BUT if I change the method call as follows:
pantry.getPantryData("B763", "O/B", settings.shaulCb, settings.lhaulCb, settings.skiCb, settings.barsCb);
effectively replacing those 2 values with literals, it all works perfectly!
There are no compilation or runtime errors (except for the fact that the data is not evaluated against the if statement!
Why would that be?
If settings.type = B763 (this is a String variable), why do I have to write "B763" in the method call???
Any ideas would be appreciated.
19 years ago