本文整理汇总了Java中javax.swing.plaf.TabbedPaneUI.tabForCoordinate方法的典型用法代码示例。如果您正苦于以下问题:Java TabbedPaneUI.tabForCoordinate方法的具体用法?Java TabbedPaneUI.tabForCoordinate怎么用?Java TabbedPaneUI.tabForCoordinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.plaf.TabbedPaneUI
的用法示例。
在下文中一共展示了TabbedPaneUI.tabForCoordinate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showPopup
import javax.swing.plaf.TabbedPaneUI; //导入方法依赖的package包/类
/** Called when the seqeunce of mouse events should lead to actual
* showing of the popup menu. */
@Override
protected void showPopup(java.awt.event.MouseEvent mouseEvent) {
TabbedPaneUI tabUI = mergeTabbedPane.getUI();
int clickTab = tabUI.tabForCoordinate(mergeTabbedPane, mouseEvent.getX(), mouseEvent.getY());
MergePanel panel = getSelectedMergePanel();
if (panel == null) {
return;
}
if (clickTab != -1) {
//Click is on valid tab, not on empty area in tab
showPopupMenu(createPopupMenu(panel), mouseEvent.getPoint(), mergeTabbedPane);
}
}
示例2: closeTabAt
import javax.swing.plaf.TabbedPaneUI; //导入方法依赖的package包/类
private void closeTabAt(int x, int y) {
TabbedPaneUI ui = getUI();
int index = ui.tabForCoordinate(this, x, y);
if (index < 0 || !myManager.canCloseContents()) {
return;
}
final Content content = myManager.getContent(index);
if (content != null && content.isCloseable()) {
myManager.removeContent(content, true);
}
}
示例3: processMouseEvent
import javax.swing.plaf.TabbedPaneUI; //导入方法依赖的package包/类
protected void processMouseEvent(MouseEvent e) {
if (e.isPopupTrigger()) { // Popup doesn't activate clicked tab.
showPopup(e.getX(), e.getY());
return;
}
if (!e.isShiftDown() && (MouseEvent.BUTTON1_MASK & e.getModifiers()) > 0) { // RightClick without Shift modifiers just select tab
if (MouseEvent.MOUSE_RELEASED == e.getID()) {
TabbedPaneUI ui = getUI();
int index = ui.tabForCoordinate(this, e.getX(), e.getY());
if (index != -1) {
setSelectedIndex(index);
}
hideMenu();
}
}
else if (e.isShiftDown() && (MouseEvent.BUTTON1_MASK & e.getModifiers()) > 0) { // Shift+LeftClick closes the tab
if (MouseEvent.MOUSE_RELEASED == e.getID()) {
closeTabAt(e.getX(), e.getY());
hideMenu();
}
}
else if ((MouseEvent.BUTTON2_MASK & e.getModifiers()) > 0) { // MouseWheelClick closes the tab
if (MouseEvent.MOUSE_RELEASED == e.getID()) {
closeTabAt(e.getX(), e.getY());
hideMenu();
}
}
else if ((MouseEvent.BUTTON3_MASK & e.getModifiers()) > 0 && SystemInfo.isWindows) { // Right mouse button doesn't activate tab
}
else {
super.processMouseEvent(e);
}
}
示例4: getContentAt
import javax.swing.plaf.TabbedPaneUI; //导入方法依赖的package包/类
/**
* @return content at the specified location. <code>x</code> and <code>y</code> are in
* tabbed pane coordinate system. The method returns <code>null</code> if there is no contnt at the
* specified location.
*/
private Content getContentAt(int x, int y) {
TabbedPaneUI ui = getUI();
int index = ui.tabForCoordinate(this, x, y);
if (index < 0) {
return null;
}
return myManager.getContent(index);
}
示例5: getInplaceProperty
import javax.swing.plaf.TabbedPaneUI; //导入方法依赖的package包/类
/**
* @return inplace property for editing of the title of the clicked tab
*/
public Property getInplaceProperty(final int x, final int y) {
final JTabbedPane tabbedPane = getTabbedPane();
final TabbedPaneUI ui = tabbedPane.getUI();
LOG.assertTrue(ui != null);
final int index = ui.tabForCoordinate(tabbedPane, x, y);
return index != -1 ? new MyTitleProperty(null, index) : null;
}
示例6: getInplaceEditorBounds
import javax.swing.plaf.TabbedPaneUI; //导入方法依赖的package包/类
public Rectangle getInplaceEditorBounds(final Property property, final int x, final int y) {
final JTabbedPane tabbedPane = getTabbedPane();
final TabbedPaneUI ui = tabbedPane.getUI();
LOG.assertTrue(ui != null);
final int index = ui.tabForCoordinate(tabbedPane, x, y);
LOG.assertTrue(index != -1);
return ui.getTabBounds(tabbedPane, index);
}