本文整理汇总了Java中org.eclipse.swt.widgets.ToolTip类的典型用法代码示例。如果您正苦于以下问题:Java ToolTip类的具体用法?Java ToolTip怎么用?Java ToolTip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ToolTip类属于org.eclipse.swt.widgets包,在下文中一共展示了ToolTip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAndShowBalloonToolTip
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public static ToolTip createAndShowBalloonToolTip(Shell shell, int iconStyle, String message, String title, int pos, boolean autohide) {
int posX = shell.getLocation().x;
int posY = shell.getLocation().y;
if (pos == 1) {
posX += shell.getSize().x;
}
else if (pos == 2) {
posX += shell.getSize().x;
posY += shell.getSize().y;
}
else {
posY += shell.getSize().y;
}
ToolTip tt = createBallonToolTip(shell, iconStyle, message, title, posX, posY);
tt.setAutoHide(autohide);
tt.setVisible(true);
return tt;
}
示例2: StringTypeEditor
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public StringTypeEditor(IStringifier<Object> stringifier, Composite parent, Object value, boolean editable) {
super(Object.class);
this.stringifier = stringifier;
super.setObject(value);
this.text = createText(parent, value, editable);
addTextListeners();
tip = new ToolTip(text.getShell(), SWT.BALLOON | SWT.ICON_ERROR);
// For some reason, applying a color at creation, does not get it to update correctly
// so simply do it next in the queue.
parent.getDisplay().asyncExec(new Runnable() {
public void run() {
updateValidityColor(false); // make sure the color is set right in the case where you ALLOW errors.
}
});
}
示例3: canConnectToSource
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
@Override
public boolean canConnectToSource(INode oldSource, INode newSource,
INode target, EConnectionType lineStyle, String connectorName,
String connectionName) {
if (oldSource != null
&& newSource != null
&& (T_REST_REQUEST.equals(newSource.getComponent().getName()) || T_REST_REQUEST
.equals(oldSource.getComponent().getName()))) {
ToolTip tooltip = new ToolTip(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), SWT.ICON_WARNING);
tooltip.setText(Messages.RESTRequestReconnectionValidation_WarningMsg);
// tooltip.setMessage("It's not allowed to reconnect to or from a tRESTRequest component");
tooltip.setAutoHide(true);
tooltip.setVisible(true);
return false;
}
return true;
}
示例4: showTrayItemTooltipMessage
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public static void showTrayItemTooltipMessage(final TrayItem trayItem, final String title, final String message)
{
final Shell sShell = MailsterSWT.getInstance().getShell();
Display.getDefault().asyncExec(new Thread() {
public void run()
{
final ToolTip tip = new ToolTip(sShell, SWT.BALLOON | SWT.ICON_INFORMATION);
tip.setMessage(message);
tip.setText(title);
if (Display.getDefault().getSystemTray() != null)
trayItem.setToolTip(tip);
else
tip.setLocation(sShell.getLocation());
tip.setVisible(true);
tip.setAutoHide(ConfigurationManager.CONFIG_STORE.getBoolean(ConfigurationManager.AUTO_HIDE_NOTIFICATIONS_KEY));
}
});
}
示例5: createRegionActions
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
private IAction createRegionActions() {
final String regionViewName = PlotUtil.getRegionViewName();
final ToolTip tip = new ToolTip(viewer.getTable().getShell(), SWT.BALLOON);
MenuAction rois = new MenuAction("Add Region");
ActionContributionItem menu = (ActionContributionItem)system.getActionBars().getMenuManager().find(BasePlottingConstants.ADD_REGION);
IAction menuAction = (IAction)menu.getAction();
for (RegionType regionType : regionTypes) {
IAction action = new Action("Press to click and drag a "+regionType.getName()+" on '"+PlotUtil.getRegionViewName()+"'") {
@Override
public void run() {
try {
ScanRegions.createRegion(system, regionType, null);
ViewUtil.showTip(tip, "Click and drag in the '"+regionViewName+"' to create a scan region.");
} catch (Exception e) {
logger.error("Unable to create region!", e);
}
rois.setSelectedAction(this);
}
};
final ImageDescriptor des = findImageDescriptor(menuAction, regionType.getId());
action.setImageDescriptor(des);
rois.add(action);
}
rois.setSelectedAction(rois.getAction(0));
return rois;
}
示例6: createBoundingBox
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
protected void createBoundingBox() throws GeneratorException {
this.value = ScanRegions.createBoxFromPlot();
if (value!=null) {
setValueValid(true);
fireApplyEditorValue();
} else {
try {
ScanRegions.createRegion(PlotUtil.getRegionSystem(), RegionType.BOX, null);
ViewUtil.showTip(new ToolTip(defaultLabel.getShell(), SWT.BALLOON), "Drag a box in the '"+PlotUtil.getRegionSystem().getPlotName()+"' to create a scan region.");
} catch (Exception e) {
logger.error("Unable to create region!", e);
}
}
}
示例7: showTip
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
/**
* Show the top where the mouse is.
* @param tip
* @param message
*/
public static void showTip(ToolTip tip, String message) {
if (tip==null) return;
tip.setMessage(message);
PointerInfo a = MouseInfo.getPointerInfo();
java.awt.Point loc = a.getLocation();
tip.setLocation(loc.x, loc.y+20);
tip.setVisible(true);
}
示例8: createBallonToolTip
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public static ToolTip createBallonToolTip(Shell shell, int iconStyle, String message, String title, int posX, int posY) {
final ToolTip tip = new ToolTip(shell, SWT.BALLOON | iconStyle);
tip.setMessage(message);
tip.setText(title);
if (posX < 0 || posY < 0)
tip.setLocation(shell.getLocation().x+shell.getSize().x, shell.getLocation().y+shell.getSize().y);
else
tip.setLocation(posX, posY);
return tip;
}
示例9: show
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public void show(String title, String message) {
ToolTip tooltip = new ToolTip(shell.getShell(), SWT.BALLOON | SWT.ICON_INFORMATION);
tooltip.setText(title);
tooltip.setMessage(message);
shell.getTrayItem().setToolTip(tooltip);
tooltip.setVisible(true);
tooltip.setAutoHide(true);
}
示例10: run
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
@Override
public void run() {
// 現在時刻
Date now = Calendar.getInstance().getTime();
List<String> notice = new ArrayList<String>();
boolean visibleHome = false;
// 遠征を更新する
if (this.updateDeck(now, notice)) {
PlayerThread.randomExpeditionSoundPlay();
visibleHome |= AppConfig.get().isVisibleOnReturnMission();
}
// 入渠を更新する
if (this.updateNdock(now, notice)) {
PlayerThread.randomDockSoundPlay();
visibleHome |= AppConfig.get().isVisibleOnReturnBathwater();
}
if (visibleHome) {
this.main.getTabFolder().setSelection(0);
}
if (AppConfig.get().isUseBalloon()) {
// バルーンツールチップを表示する
try {
// 遠征・入渠のお知らせ
if (notice.size() > 0) {
ToolTip tip = new ToolTip(this.main.getShell(), SWT.BALLOON
| SWT.ICON_INFORMATION);
tip.setText("遠征・入渠");
tip.setMessage(StringUtils.join(notice, "\r\n"));
this.main.getTrayItem().setToolTip(tip);
tip.setVisible(true);
}
} catch (Exception e) {
LoggerHolder.LOG.warn("お知らせの表示に失敗しました", e);
}
}
}
示例11: postFatal
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
/**
* 艦隊が出撃中で大破した場合に警告を行います
*/
private void postFatal() {
if (this.badlyDamage && GlobalContext.isSortie(this.dock.getId())) {
if (AppConfig.get().isBalloonBybadlyDamage()) {
List<ShipDto> ships = this.dock.getShips();
StringBuilder sb = new StringBuilder();
sb.append(AppConstants.MESSAGE_STOP_SORTIE);
sb.append("\n");
for (ShipDto shipDto : ships) {
if (shipDto.isBadlyDamage()) {
sb.append(shipDto.getName());
sb.append("(" + shipDto.getLv() + ")");
sb.append(" : ");
List<ItemDto> items = shipDto.getItem();
List<String> names = new ArrayList<String>();
for (ItemDto itemDto : items) {
if (itemDto != null) {
names.add(itemDto.getName());
}
}
sb.append(StringUtils.join(names, ","));
sb.append("\n");
}
}
ToolTip tip = new ToolTip(this.getShell(), SWT.BALLOON
| SWT.ICON_ERROR);
tip.setText("大破警告");
tip.setMessage(sb.toString());
this.main.getTrayItem().setToolTip(tip);
tip.setVisible(true);
}
// 大破時にサウンドを再生する
PlayerThread.randomBadlySoundPlay();
}
}
示例12: showToolTipSWTwidget
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
private static void showToolTipSWTwidget(Control control, int style, String title, String message) {
ToolTip tooltip = new ToolTip(control.getShell(), /*SWT.BALLOON | */ style);
tooltip.setAutoHide(true);
tooltip.setLocation(control.toDisplay(control.getSize().x/2, control.getSize().y + 5));
tooltip.setText(title);
tooltip.setMessage(message);
tooltip.setVisible(true);
}
示例13: showToolTipSWTJface
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
private static void showToolTipSWTJface(Control control, int style, String title, String message) {
DefaultToolTip tooltip = new DefaultToolTip(control, org.eclipse.jface.window.ToolTip.NO_RECREATE, true);
tooltip.setHideDelay(TOOLTIP_HIDE_DELAY);
tooltip.setText("[" + title+ "]\n\n" + message);
tooltip.setImage(control.getDisplay().getSystemImage(/*SWT.ICON_INFORMATION*/ style));
tooltip.show(control.toDisplay(control.getSize().x/2, 5));
}
示例14: GridMouseHandler
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public GridMouseHandler(final Grid<T> grid, final GC gc, final Collection<IGridListener<T>> listeners, final ToolTip toolTip) {
this.grid = grid;
this.gridModel = grid.getGridModel();
this.viewport = grid.getViewport();
this.listeners = listeners;
this.toolTip = toolTip;
this.gc = gc;
}
示例15: Grid
import org.eclipse.swt.widgets.ToolTip; //导入依赖的package包/类
public Grid(final Composite parent) {
super(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.DOUBLE_BUFFERED /*| SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE*/);
resourceManager = new ResourceManager(parent.getDisplay());
gc = new GC(this);
computedArea = new Point(-1, -1);
gridModel = new GridModel<T>(this, resourceManager, gc);
modelListener = new GridModelListener();
gridModel.addListener(modelListener);
viewport = new Viewport<T>(this);
gridRenderer = new GridRenderer<T>(this);
disposeListener = new GridDisposeListener();
resizeListener = new ResizeListener();
scrollListener = new ScrollListener();
focusListener = new GridFocusListener();
listeners = new ArrayList<>();
toolTip = new ToolTip(parent.getShell(), SWT.NONE);
toolTip.setAutoHide(true);
keyboardHandler = createKeyboardHandler(gc);
mouseHandler = createMouseHandler(gc, listeners, toolTip);
parent.addDisposeListener(disposeListener);
setKeyboardHandler(keyboardHandler);
setMouseHandler(mouseHandler);
addPaintListener(gridRenderer);
addListener(SWT.Resize, resizeListener);
addFocusListener(focusListener);
getVerticalBar().addSelectionListener(scrollListener);
getHorizontalBar().addSelectionListener(scrollListener);
}