當前位置: 首頁>>代碼示例>>Java>>正文


Java SwingUtilities.isMiddleMouseButton方法代碼示例

本文整理匯總了Java中javax.swing.SwingUtilities.isMiddleMouseButton方法的典型用法代碼示例。如果您正苦於以下問題:Java SwingUtilities.isMiddleMouseButton方法的具體用法?Java SwingUtilities.isMiddleMouseButton怎麽用?Java SwingUtilities.isMiddleMouseButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.isMiddleMouseButton方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mouseClicked

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
public void mouseClicked(MouseEvent e) {
    if(e.isConsumed()) return;
    boolean activate = false;
    HyperlinkType type = getHyperlinkType(e);
    if ( type != null ) {
        activate = !e.isPopupTrigger() && e.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(e);
    } else if ( Utilities.isWindows() && e.getClickCount() == 1 && SwingUtilities.isMiddleMouseButton(e) ) {
        activate = true;
        type = HyperlinkType.GO_TO_DECLARATION;
    }
    
    if ( activate ) {
        int position = component.viewToModel(e.getPoint());
        
        if (position < 0) {
            return ;
        }
        
        performAction(position, type);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:HyperlinkOperation.java

示例2: mouseClicked

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
    if (tabbedPane.getSelectedIndex() != -1) {
        Rectangle rect = tabbedPane.getUI().getTabBounds(tabbedPane, tabbedPane.getSelectedIndex());
        if (rect.contains(e.getPoint())) {
            if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
                if (checkIndexContains()) {
                    startEditing();
                }
            } else if (SwingUtilities.isMiddleMouseButton(e)) {
                if (onMiddleClickAction != null) {
                    onMiddleClickAction.actionPerformed(null);
                }
            }

        } else {
            renameTabTitle();
        }
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:21,代碼來源:TabTitleEditListener.java

示例3: processEvent

import javax.swing.SwingUtilities; //導入方法依賴的package包/類
private static void processEvent(int eventType, MouseEvent e) {
    if (eventCount >= BUTTON_EVENTS_SEQUENCE.length) {
        throw new RuntimeException("Unexpected event " + e);
    }

    int[] arr = BUTTON_EVENTS_SEQUENCE[eventCount];

    if (arr[0] != eventType) {
        throw new RuntimeException("Unexpected eventType " + eventType + "on step " + eventCount);
    }

    boolean result;

    switch (arr[1]) {
        case 1:
            result = SwingUtilities.isLeftMouseButton(e);

            break;

        case 2:
            result = SwingUtilities.isMiddleMouseButton(e);

            break;

        case 3:
            result = SwingUtilities.isRightMouseButton(e);

            break;

        default:
            throw new RuntimeException("Incorrect arr[1] on step " + eventCount);
    }

    if (!result) {
        throw new RuntimeException("Test failed on step " + eventCount);
    }

    eventCount++;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:40,代碼來源:bug7088744.java


注:本文中的javax.swing.SwingUtilities.isMiddleMouseButton方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。