/** * Show a tooltip message using a balloon tooltip * * @param component component which the tooltip belongs to * @param message tooltip message */ public static void createBalloonTooltip(JComponent component, String message) { BalloonTip tooltip = createBalloonTip( component, new JLabel(message), TOOLTIP_FILL_COLOUR, BalloonTip.Orientation.LEFT_ABOVE, BalloonTip.AttachLocation.NORTH); ToolTipUtils.balloonToToolTip(tooltip, 500, 3000); }
@Override public void mouseMoved(MouseEvent evt) { JTableHeader header = (JTableHeader) evt.getSource(); JTable table = header.getTable(); TableColumnModel colModel = table.getColumnModel(); int vColIndex = colModel.getColumnIndexAtX(evt.getX()); TableColumn col = null; if (vColIndex >= 0) { col = colModel.getColumn(table.convertColumnIndexToModel(vColIndex)); } if (table.convertColumnIndexToModel(vColIndex) != curCol) { if (col != null) { MageFrame.getInstance().getBalloonTip().setAttachedComponent(header); JLabel content = new JLabel(tips.get(table.convertColumnIndexToModel(vColIndex))); content.setFont(GUISizeHelper.tooltipFont); MageFrame.getInstance().getBalloonTip().setContents(content); ToolTipUtils.balloonToToolTip(MageFrame.getInstance().getBalloonTip(), 600, 10000); } else { MageFrame.getInstance().getBalloonTip().setTextContents(""); } curCol = table.convertColumnIndexToModel(vColIndex); } }