我想将气球提示添加到Cell
in JTable
,其行为类似于Tooltips
。我的意思是当鼠标进入时Cell
它会在一段时间后出现并消失(与Tooltips
但不是 a相同Tooltip
)。我试过这个,但没有按预期为我工作。
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
final JLabel lable = new JLabel(value.toString());
EdgedBalloonStyle style = new EdgedBalloonStyle(new Color(255, 253, 245),
new Color(64, 64, 64));
BalloonTip tooltipBalloon = new BalloonTip(lable, new JLabel(value.toString()), style, new LeftAbovePositioner(15, 10), null);
ToolTipUtils.balloonToToolTip(tooltipBalloon, 400, 2000);
return lable;
}
这什么也没做。我也试过这个
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
final JLabel lable = new JLabel(value.toString());
EdgedBalloonStyle style = new EdgedBalloonStyle(new Color(255, 253, 245), new Color(64, 64, 64));
TablecellBalloonTip tcb = new TablecellBalloonTip(table, new JLabel(value.toString()),
row, column, style, BalloonTip.Orientation.LEFT_ABOVE,
BalloonTip.AttachLocation.ALIGNED, 30, 10, false);
return lable;
}
这只是Balloon Tip
我想要的工作。有什么建议么?