0

How to align rows to the right side in a JTable?
In this picture, the rows are aligned to left, how can I align the rows to the right side?

enter image description here

or123456
  • 2,091
  • 8
  • 28
  • 50
  • 1
    possible duplicate of http://stackoverflow.com/questions/2408541/align-the-values-of-the-cells-in-jtable – Jan Dragsbaek Nov 23 '11 at 12:38
  • Eventually some code could be helpful. – evotopid Nov 23 '11 at 12:39
  • 1
    please can you show us how did you to set Component's Orientation, please post the code in the http://sscce.org/ form – mKorbel Nov 23 '11 at 12:40
  • should happen automatically ( @JanDragsbaek not a duplicate, the other is about aligning in a _cell_ while this is alignment of the complete table itself, actually looks like a problem with ComponentOrientation running wild somehow) – kleopatra Nov 23 '11 at 13:24

1 Answers1

0

Simplest solution is to put your JTable in JScrollPane, and put this pane on plase of yours JTable and JTableHeader. JScrollPane will made everything for you without any headache.

yourPanel.add( new JScrollPane(yourTable) );
gmatagmis
  • 70
  • 2