1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.tooltip;
14 import java.awt.Frame;
15 import java.awt.Label;
17 import org.simantics.g2d.element.IElement;
19 * Simple tool-tip showing a label
21 * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
24 public abstract class TextTooltipProvider implements TooltipProvider {
28 public void showTooltip(IElement element, int x, int y) {
29 frame = new Frame(getTooltipText(element));
30 frame.setFocusableWindowState(false);
31 frame.setUndecorated(true);
32 Label label = new Label(getTooltipText(element));
35 frame.setVisible(true);
36 frame.setLocation(x,y-32);
40 public void hideTooltip(IElement element) {
41 frame.setVisible(false);
46 public abstract String getTooltipText(IElement element);