Hover(Shell parent) { final Display display = parent.getDisplay(); hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL); hoverShell.setBackground(display .getSystemColor(SWT.COLOR_INFO_BACKGROUND)); hoverShell.setForeground(display .getSystemColor(SWT.COLOR_INFO_FOREGROUND)); hoverShell.addPaintListener(pe -> { pe.gc.drawText(text, hm, hm); if (!MAC) { pe.gc.drawPolygon(getPolygon(true)); } }); hoverShell.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { hideHover(); } }); }
Hover(Shell parent) { final Display display = parent.getDisplay(); hoverShell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL); hoverShell.setBackground(display .getSystemColor(SWT.COLOR_INFO_BACKGROUND)); hoverShell.setForeground(display .getSystemColor(SWT.COLOR_INFO_FOREGROUND)); hoverShell.addPaintListener(pe -> { pe.gc.drawText(text, hm, hm); if (!MAC) { pe.gc.drawPolygon(getPolygon(true)); } }); hoverShell.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { hideHover(); } }); }
void setNewShape() { Region oldRegion = region; region = new Region(); region.add(getPolygon(false)); hoverShell.setRegion(region); if (oldRegion != null) { oldRegion.dispose(); } } }
void setNewShape() { Region oldRegion = region; region = new Region(); region.add(getPolygon(false)); hoverShell.setRegion(region); if (oldRegion != null) { oldRegion.dispose(); } } }