Results 1 to 12 of 12
Thread: Tabular Expression
- 03-26-2012, 08:57 PM #1
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Tabular Expression
Hi,
In the toString method which returns all instance fields, I am trying to use the tabular expression '\t' between each of the fields. But when I test under main, it has no spaces? Sample code is below:
Thanks
Java Code:public String toString() { return title +"\t"+ genre +"\t"+ year; }
- 03-26-2012, 08:59 PM #2
Re: Tabular Expression
What does your output look like?
- 03-26-2012, 09:00 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 03-26-2012, 09:04 PM #4
- 03-26-2012, 09:07 PM #5
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: Tabular Expression
Sorry its not under main, the output is on a JList. The output returns three fields with no spaces.
So what expression will I use then?
Thanks
- 03-26-2012, 09:09 PM #6
Re: Tabular Expression
So the String returned from toString() is one of the items in your JList?
- 03-26-2012, 09:11 PM #7
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 03-26-2012, 09:18 PM #8
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: Tabular Expression
Well there are two Strings and an int which are returned from the toString().
Iv'e tried the '\u0020' expression and it is a space. The other expression '\u0009' is nothing?
Well Iv'e used JList because I am using a Stack structure to push and pop items in a list.
I'd like to tab the three fields apart?
Thanks
- 03-26-2012, 09:22 PM #9
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: Tabular Expression
Sorry just in case there's confusion, I want a tab space between the fields, not just a space. '\t' returns no tab spaces.
Thanks
- 03-26-2012, 09:26 PM #10
Re: Tabular Expression
JosAH might be right, you may not be able to do what you are looking to do. You may have to manually put in the number of spaces comparable to a "\t"
- 03-26-2012, 09:28 PM #11
Senior Member
- Join Date
- Nov 2011
- Posts
- 116
- Rep Power
- 0
Re: Tabular Expression
Oh right. Thanks guys for your help. Doing things manually isn't so bad :P
- 03-26-2012, 09:32 PM #12
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Re: Tabular Expression
When people rob a bank they get a penalty; when banks rob people they get a bonus.
Similar Threads
-
Looking for pseudocode to convert Prefix Expression & Infix Expression to expression
By dragstang86 in forum New To JavaReplies: 2Last Post: 07-18-2011, 07:11 AM -
Regular Expression Help
By niketanand in forum Advanced JavaReplies: 1Last Post: 06-24-2011, 04:56 PM -
Big-oh expression help!
By borgan in forum New To JavaReplies: 2Last Post: 01-24-2011, 04:20 PM -
JSF expression inside another JSF expression
By barbarabxl in forum JavaServer Faces (JSF)Replies: 2Last Post: 05-21-2010, 03:03 PM -
Regarding Tabular data from .doc file
By praveen83 in forum Advanced JavaReplies: 10Last Post: 03-23-2010, 11:26 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks