Has anyone done other than the default left-justified columns? I'd like to center the airports, and right-justify and add dollar signs to the cost column. Cannot find a clear reference in the java.sun documentation... Regards,
Paul Anilprem
Enthuware Software Support
Ranch Hand
Joined: Sep 23, 2000
Posts: 2547
posted
0
You'll need a component that implelments TableCellRendere, somthing like: class MyCellRenderer extends JLabel implements TableCellRenderer. Read the Java Tutorial on JTable in Swing section. Customizing table cells is straight forward but customizing Headers is little bit more involved. HTH, Paul.
Ok, I used a class extending JLabel and implementing cell renderer. It works BUT, if I do not implement it, there is no change of background color when the row of the JTable is selected. It remains a simple JLabel all the time. So, in my renderer class, I would like to write: if (isSelected == true){this.setBackground =Color.white;} else {this.setBackground = Color.???} "this" is the JLabel. But how to get the appropriate color to highlight?On my computer, the higlight color of the default renderer is a "Lavande" color, that is blue grey purple. Does the color remain the same on all the platform, PLAF, setting? Or should I get a system property, a color model??? I can not find my answer in the API. Thanks for your help Olivier
Paul Anilprem
Enthuware Software Support
Ranch Hand
Joined: Sep 23, 2000
Posts: 2547
posted
0
Just get the color using theTable.getSelectionForeground/Background() HTH, Paul. ------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus