⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e952. setting the gap size between cells in a jtable component.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
The horizontal space (column margin) and vertical space (row margin) between cells can be customized. If you increase the column margin, the cell widths automatically increase by the same amount. However, if you increase the row margin, the cell heights do not automatically increase. In order to increase the cell heights, you need to call setRowHeight() explicitly. 
    JTable table = new JTable();
    
    // Add data here
    // Get defaults
    Dimension d = table.getIntercellSpacing();
    // d.width == 1, d.height == 1
    
    // Add 5 spaces to the left and right sides of a cell.
    // Add 2 spaces to the top and bottom sides of a cell.
    int gapWidth = 10;
    int gapHeight = 4;
    table.setIntercellSpacing(new Dimension(gapWidth, gapHeight));
    
    // Increase the row height
    table.setRowHeight(table.getRowHeight()+gapHeight);

 Related Examples 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -