Setting cell borders in JTable

前端 未结 1 1169
慢半拍i
慢半拍i 2020-12-22 01:25

I have a JTable, and I only show horizontal lines to separate each table row. In Windows 8, the lines show, but in Mac OS X, they don\'t. I am using a JLa

1条回答
  •  囚心锁ツ
    2020-12-22 01:44

    The TableUI delegate on Mac OS X sets both Table.background and Table.gridColor to Color.white, making the grid effectively invisible. You can change the grid color like this:

    UIManager.put("Table.gridColor", new ColorUIResource(Color.gray));
    EventQueue.invokeLater(new Runnable() {
    
        @Override
        public void run() {
            // construct your GUI
        }
    });
    

    0 讨论(0)
提交回复
热议问题