Re: JTable Cells Alignment
- From: Pete Barrett <petebarrett@xxxxxxxx>
- Date: Thu, 30 Jun 2005 19:08:26 +0100
On 30 Jun 2005 08:37:13 -0700, "Yulia" <y56439392@xxxxxxxxxxxx> wrote:
>
>Hi,
>
>I'd like to change the alignment of JTable cells to TOP-CENTER.
>I tried to use cell renderer that inherits JLabel with overriding the
>following method:
>
>public Component getTableCellRendererComponent(JTable theTable, Object
>value,boolean isSelected,boolean hasFocus,int row,int column)
>{
> setHorizontalAlignment(SwingConstants.TOP);
>}
>But then, not only wasn't the alignment applied but the table became
>empty (it didn't load its contents).
>
>I also tried:
> setHorizontalAlignment(JLabel.TOP);
>
>But the result was just the same :-(
>Could you, please, tell me how to do it?
>
TOP looks more like a vertical alignment constant to me! I don't
understand exactly what you mean by TOP-CENTER, but have you tried:
setHorizontalAlignment(JLabel.CENTER);
setVerticalAlignment(JLabel.TOP);
?
Pete Barrett
.
- References:
- JTable Cells Alignment
- From: Yulia
- JTable Cells Alignment
- Prev by Date: Re: Truncated Label Problem
- Next by Date: How long to get up to speed with SWT?
- Previous by thread: JTable Cells Alignment
- Next by thread: How long to get up to speed with SWT?
- Index(es):