Alignment date parts in JTable column formatted in propotional font

前端 未结 3 1351
我寻月下人不归
我寻月下人不归 2020-12-22 02:29

I need to make the date parts (dd, MMMM, yyyy) to be vertically aligned. I asked a question at Fixed length of month and day in date format? to insert padding letters, but I

3条回答
  •  悲&欢浪女
    2020-12-22 03:01

    As suggested by @mKorbel, a suitable TableCellRenderer is the right choice, but you may have to override paintComponent() and render the text using the graphics context's FontMetrics as shown here.

    If numeric months are acceptable, most proportionally-spaced fonts give digit glyphs the same constant advance.

提交回复
热议问题