Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTable: Making Table-Cell display text vertical

930622Apr 14 2012 — edited Apr 25 2012
Hi Forum.

I need som help by making a CellRenderer that Rotates the Text making it vertical instead of horisontal.

Have been trying defferent approaches with only limited success.

At first I tried formatting into HTML, eg.
private String getHtmlFormattedString(String value) {
  f (value == null) {
    return null;
  }

  StringBuffer buf = new StringBuffer("<html>");
  char[] chars = value.toCharArray();

  for (int i = 0; i < chars.length; i++) {
    char c = chars;
buf.append(c).append("<br/>");
}

buf.append("</html>");
return buf.toString();

}
This works fairly well - but the Orientation of the single Char is wrong, and it does not work well when the value is a Time.
Here 09:12 is translated into:
0
9
:
1
2

Edited by: 927619 on 2012-04-14 00:16                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2012
Added on Apr 14 2012
7 comments
1,188 views