当前位置: 首页>>代码示例>>Java>>正文


Java CloseHandler类代码示例

本文整理汇总了Java中com.trollworks.toolkit.ui.menu.file.CloseHandler的典型用法代码示例。如果您正苦于以下问题:Java CloseHandler类的具体用法?Java CloseHandler怎么用?Java CloseHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloseHandler类属于com.trollworks.toolkit.ui.menu.file包,在下文中一共展示了CloseHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DockTab

import com.trollworks.toolkit.ui.menu.file.CloseHandler; //导入依赖的package包/类
/**
 * Creates a new {@link DockTab} for the specified {@link Dockable}.
 *
 * @param dockable The {@link Dockable} to work with.
 */
public DockTab(Dockable dockable) {
	super(new PrecisionLayout().setMargins(2, 4, 2, 4).setMiddleVerticalAlignment());
	mDockable = dockable;
	setOpaque(false);
	setBorder(new EmptyBorder(2, 1, 0, 1));
	addContainerListener(this);
	mTitle = new JLabel(getFullTitle(), dockable.getTitleIcon(), SwingConstants.LEFT);
	IconButton closeButton = new IconButton(StdImage.DOCK_CLOSE, CLOSE_TOOLTIP, this::attemptClose);
	add(mTitle, new PrecisionLayoutData().setGrabHorizontalSpace(true).setHeightHint(Math.max(mTitle.getPreferredSize().height, closeButton.getPreferredSize().height)));
	if (dockable instanceof CloseHandler) {
		add(closeButton, new PrecisionLayoutData().setEndHorizontalAlignment());
	}
	if (dockable instanceof Saveable) {
		((Saveable) dockable).addDataModifiedListener(this);
	}
	addMouseListener(this);
	setToolTipText(dockable.getTitleTooltip());
	DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this);
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:25,代码来源:DockTab.java

示例2: attemptClose

import com.trollworks.toolkit.ui.menu.file.CloseHandler; //导入依赖的package包/类
/**
 * Attempt to close a {@link Dockable} within this {@link DockContainer}. This only has an
 * affect if the {@link Dockable} is contained by this {@link DockContainer} and implements the
 * {@link CloseHandler} interface. Note that the {@link CloseHandler} must call this
 * {@link DockContainer}'s {@link #close(Dockable)} method to actually close the tab.
 */
public void attemptClose(Dockable dockable) {
	if (dockable instanceof CloseHandler) {
		if (mDockables.contains(dockable)) {
			CloseHandler closeable = (CloseHandler) dockable;
			if (closeable.mayAttemptClose()) {
				closeable.attemptClose();
			}
		}
	}
}
 
开发者ID:Ayutac,项目名称:toolkit,代码行数:17,代码来源:DockContainer.java


注:本文中的com.trollworks.toolkit.ui.menu.file.CloseHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。