Results 1 to 3 of 3
Thread: Java String Lengths [SOLVED]
Enjoy an ad free experience by logging in. Not a member yet? Register.
Java String Lengths [SOLVED]
I have the following bit of code in a GUI application that I'm writing:
if(currentCode.length() > 11) tab_string = "\t"; else tab_string = "\t\t";
In both of those, there is an example where the arrow isn't lined up. However, there are also other examples (where the code is actually LONGER than the one not displaying properly) that have the right arros spacing.
Can anyone tell me a good way to get around this? I can't figure out what's wrong, since it's working in 99% of the examples.
- Join Date
- Aug 2005
It's using a variable-length font, so number of characters doesn't determine the width. I don't know much about what you're doing, but can you somehow use fixed-width fonts or (better) put them into a table or something?
Thanks. I admittedly know very little about Fonts, so I didn't even think of that.
I changed it to Courier New, and it's working now. Thanks a bunch!!