1)后备箱中有一个标题边框,但我认为它是在 1.4 中添加的。您可以通过覆盖 Container 的paintBorder 方法来绘制类似的内容(请注意,您需要足够的组件填充才能使边框正确显示。这是来自 SVN 版本的代码,只需很少的更改即可工作(只需将 c 更改为此):
Font f=c.getStyle().getFont();
int titleW=f.stringWidth(borderTitle);
int topPad=c.getStyle().getPadding(Component.TOP);
int topY=y+(topPad-thickness)/2;
if (c.isRTL()) {
g.fillRect(x+width-TITLE_MARGIN, topY, TITLE_MARGIN , thickness); //top (segment before the title)
g.fillRect(x, topY, width-(TITLE_MARGIN +titleW+TITLE_SPACE*2), thickness); //top (segment after the title)
g.drawString(borderTitle, x+width-(TITLE_MARGIN +titleW+TITLE_SPACE), y+(topPad-f.getHeight())/2);
} else {
g.fillRect(x, topY, TITLE_MARGIN , thickness); //top (segment before the title)
g.fillRect(x+TITLE_MARGIN +titleW+TITLE_SPACE*2, topY, width-(TITLE_MARGIN +titleW+TITLE_SPACE*2), thickness); //top (segment after the title)
g.drawString(borderTitle, x+TITLE_MARGIN+TITLE_SPACE, y+(topPad-f.getHeight())/2);
}
g.fillRect(x, y+height-thickness, width, thickness); //bottom
g.fillRect(x, topY, thickness, height); //left
g.fillRect(x+width-thickness, topY, thickness, height); //right
2)派生表并覆盖方法:
protected Component createCell(Object value, int row, int column, boolean editable)
调用 super.createCell() 并将返回值的 UIID 适当地设置为“OddRow”、“EvenRow”。将资源编辑器或主题中的样式设置为您喜欢的任何内容。
3)我不知道这样的问题。如果在当前的 SVN 上发生这种情况,您应该在项目问题跟踪器中提交问题。