Jose Imenes

Greenhorn
+ Follow
since Nov 06, 2006
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 Jose Imenes

Hang on, I messed up copying the code, let me try that again.....

String header = String.format("%-7s%-20s%8s%12s\n\n"," Brand", "Model","Color", "Quantity");

while(source.hasNext())
{
brand = source.next();
model = source.next();
color = source.next();
quantity = source.next();
}
line = String.format("%-7s%-20s%8s%12s\n", brand, model, color, quantity);

textArea.append(header);
textArea.append(line);
11 years ago
while(inputFile.hasNext())
{
brand= inputFile.next();
model= inputFile.next();
color= inputFile.next();
quantity= inputFile.next();
line = String.format("%-7s%-20s%8s%12s\n", partNum, descrip,
quant, ppi);

//add fields to file
gui.getTextFields(line);
11 years ago
Hello-

I'm using a monospace font, but still it doesn't work...
11 years ago
Hello-

I'm trying to output data from a file to a JTextArea and have encountered an unexpected problem...I want to display data in columns that not only line up with eachother but also line up with the column headers I've pre-inserted into the JTextArea when I build it (e.g. brand, model, price, color). How can I get columns of uniform width? The empty spaces between the text are a different width and are causing all kinds of alignment problems. I've tried to format the text first with String.format(%10s%10s%10s) etc, but this does not seem to work. Please help.
11 years ago
thanks very much.
12 years ago
Hi I'm new to Java and I was wondering how you would detect if a user just hits "enter" at a prompt? I'm trying to give the user the option to terminate the input phase.

Thanks.
12 years ago