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


Java Cursor類代碼示例

本文整理匯總了Java中java.awt.Cursor的典型用法代碼示例。如果您正苦於以下問題:Java Cursor類的具體用法?Java Cursor怎麽用?Java Cursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: createDetails

import java.awt.Cursor; //導入依賴的package包/類
private JComponent createDetails(String text, ActionListener action) {
    try {
        text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
    } catch (CharConversionException ex) {
        throw new IllegalArgumentException(ex);
    }
    if (null == action) {
        return new JLabel(text);
    }
    JButton btn = new JButton(text);
    btn.setFocusable(false);
    btn.setBorder(BorderFactory.createEmptyBorder());
    btn.setBorderPainted(false);
    btn.setFocusPainted(false);
    btn.setOpaque(false);
    btn.setContentAreaFilled(false);
    btn.addActionListener(action);
    btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
    if (c != null) {
        btn.setForeground(c);
    }
    return btn;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:NotificationImpl.java

示例2: pSetCursor

import java.awt.Cursor; //導入依賴的package包/類
public void pSetCursor(Cursor cursor, boolean ignoreSubComponents) {
    XToolkit.awtLock();
    try {
        long xcursor = XGlobalCursorManager.getCursor(cursor);

        XSetWindowAttributes xwa = new XSetWindowAttributes();
        xwa.set_cursor(xcursor);

        long valuemask = XConstants.CWCursor;

        XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData);
        XlibWrapper.XFlush(XToolkit.getDisplay());
        xwa.dispose();
    } finally {
        XToolkit.awtUnlock();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:XComponentPeer.java

示例3: dispatchResultsRendererEvent

import java.awt.Cursor; //導入依賴的package包/類
private void dispatchResultsRendererEvent(MouseEvent e) {
    int column = profilingPointsTable.columnAtPoint(e.getPoint());

    if (column != 3) {
        //    if (column != 2) { // TODO: revert to 3 once Scope is enabled
        profilingPointsTable.setCursor(Cursor.getDefaultCursor()); // Workaround for forgotten Hand cursor from HTML renderer, TODO: fix it!

        return;
    }

    int row = profilingPointsTable.rowAtPoint(e.getPoint());

    if (row == -1) {
        return;
    }

    ProfilingPoint profilingPoint = getProfilingPointAt(row);
    ProfilingPoint.ResultsRenderer resultsRenderer = profilingPoint.getResultsRenderer();
    Rectangle cellRect = profilingPointsTable.getCellRect(row, column, true);
    resultsRenderer.dispatchMouseEvent(e, cellRect);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:ProfilingPointsWindowUI.java

示例4: closestSide

import java.awt.Cursor; //導入依賴的package包/類
public int closestSide(Point p, XYGraph xyg) {
	int n=0;
	double dist = 5/xScale;
	double dist2 = Math.abs(xyg.getXAt(p) - minX+.03*(maxX-minX));
	if (dist2 < dist) {dist = dist2; n = -1;}
	dist2 = Math.abs(xyg.getXAt(p) - maxX-.03*(maxX-minX));
	if (dist2 < dist) {dist = dist2; n = -2;}
	dist = 5/yScale;
	dist2 = Math.abs(xyg.getYAt(p) - minY+.03*(maxY-minY));
	if (dist2 < dist) {dist = dist2; n = 1;}
	dist2 = Math.abs(xyg.getYAt(p) - maxY-.03*(maxY-minY));
	if (dist2 < dist) {dist = dist2; n = 2;}
	if (side!=0&&n==0)
		if (lassoButton!=null && lassoButton.isSelected())
			xyg.setCursor(Cursors.getCursor(Cursors.LASSO));
		else
			xyg.setCursor(Cursor.getDefaultCursor());
	return n;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:20,代碼來源:PDBDataSetGraph.java

示例5: mouseMoved

import java.awt.Cursor; //導入依賴的package包/類
@Override
public void mouseMoved(MouseEvent e) {
	if(graphics!=null){
		float spacer = LayerUtilities.pixelsToUnits(graphics, 20, false);
		float heightOfABlock = LayerUtilities.pixelsToUnits(graphics, 30, false);		
		int verticalOffsetOffset = -1 * (Math.round((index + 1) * spacer + index * heightOfABlock));
		int startHeight = verticalOffsetOffset ;
		int stopHeight = verticalOffsetOffset + Math.round(heightOfABlock); 

		Point2D pointInUnits = LayerUtilities.pixelsToUnits(graphics, e.getX(), e.getY());
		int startTime = Math.round(guessedStartTimeOfStream);
		int stopTime = Math.round(guessedStartTimeOfStream+streamDuration);
		
		if(pointInUnits.getX() >= startTime && pointInUnits.getX() <= stopTime && pointInUnits.getY() >= startHeight &&  pointInUnits.getY() <= stopHeight){
			((JComponent)(e.getSource())).setCursor(new Cursor(Cursor.HAND_CURSOR));
			e.consume();
		}
	}
}
 
開發者ID:JorenSix,項目名稱:Panako,代碼行數:20,代碼來源:StreamLayer.java

示例6: mousePressed

import java.awt.Cursor; //導入依賴的package包/類
public void mousePressed(MouseEvent e) {

		dragging = false;
		mouseButtonPress = e.getButton();
		// If the cursor is on a point and the left button is press
		// the point is select
		if (e.getButton() == 1) {
			// Select the dominant
			if (selectedPoint != null) {
				selectedPoint.setSelect(true);
				setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
				dragging = true;
			} else {
				filterStartPoint = adjustMousePoint(e.getPoint());
				filterEndPoint = filterStartPoint;
				filtering = true;
			}
		} else if (e.getButton() == 3) {
			filterStartPoint = adjustMousePoint(e.getPoint());
			filterEndPoint = filterStartPoint;
			unFiltering = true;
		}
		repaint();
	}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:25,代碼來源:Convex2DGraph.java

示例7: setWaitCursor

import java.awt.Cursor; //導入依賴的package包/類
/**
 * Switches the wait cursor on the NetBeans glasspane of/on
 * 
 * @param on
 */
public static void setWaitCursor(final boolean on) {
    Runnable r = new Runnable() {
        @Override
        public void run() {
            JFrame mainWindow = (JFrame) WindowManager.getDefault().getMainWindow();
            mainWindow
                .getGlassPane()
                .setCursor(Cursor.getPredefinedCursor(
                    on ?
                    Cursor.WAIT_CURSOR :
                    Cursor.DEFAULT_CURSOR));
            mainWindow.getGlassPane().setVisible(on);
        }
    };
    if(EventQueue.isDispatchThread()) {
        r.run();
    } else {
        EventQueue.invokeLater(r);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:Utils.java

示例8: showHistory

import java.awt.Cursor; //導入依賴的package包/類
@Override
public void showHistory() {
    getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                SQLHistoryPanel panel = new SQLHistoryPanel(getEditorPane());
                Object[] options = new Object[]{
                    DialogDescriptor.CLOSED_OPTION
                };
                final DialogDescriptor desc = new DialogDescriptor(panel, NbBundle.getMessage(SQLCloneableEditor.class, "LBL_SQL_HISTORY_TITLE"), false, options,
                        DialogDescriptor.CLOSED_OPTION, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("sql_history"), null);  // NOI18N
                Dialog dlg = DialogDisplayer.getDefault().createDialog(desc);
                dlg.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SQLCloneableEditor.class, "ACSD_DLG"));
                dlg.setVisible(true);
            } finally {
                getComponent().setCursor(null);
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:SQLCloneableEditor.java

示例9: mouseMoved

import java.awt.Cursor; //導入依賴的package包/類
@Override
public boolean mouseMoved(Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        int i = item.getNextFilesToShowCount();
        String tooltip;
        if (i > 0) {
            tooltip = NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ShowMoreFiles", i); //NOI18N
        } else {
            tooltip = NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ShowAllFiles"); //NOI18N
        }
        component.setToolTipText(tooltip);
        return true;
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:SummaryCellRenderer.java

示例10: setCursor

import java.awt.Cursor; //導入依賴的package包/類
static void setCursor(int c, Object display) {
  Container d = (Container) display;
  switch (c) {
  case JmolConstants.CURSOR_HAND:
    c = Cursor.HAND_CURSOR;
    break;
  case JmolConstants.CURSOR_MOVE:
    c = Cursor.MOVE_CURSOR;
    break;
  case JmolConstants.CURSOR_ZOOM:
    c = Cursor.N_RESIZE_CURSOR;
    break;
  case JmolConstants.CURSOR_CROSSHAIR:
    c = Cursor.CROSSHAIR_CURSOR;
    break;
  case JmolConstants.CURSOR_WAIT:
    c = Cursor.WAIT_CURSOR;
    break;
  default:
    d.setCursor(Cursor.getDefaultCursor());
    return;
  }
  d.setCursor(Cursor.getPredefinedCursor(c));
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:25,代碼來源:Display.java

示例11: start

import java.awt.Cursor; //導入依賴的package包/類
public void start() {
    //Get things going.  Request focus, set size, et cetera
    setSize(200, 200);
    setVisible(true);
    validate();

    final Image image = new MultiResolutionCursor();

    int center = sizes[0] / 2;
    Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
            image, new Point(center, center), "multi-resolution cursor");

    Frame frame = new Frame("Test Frame");
    frame.setSize(300, 300);
    frame.setLocation(300, 50);
    frame.add(new Label("Move cursor here"));
    frame.setCursor(cursor);
    frame.setVisible(true);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:MultiResolutionCursorTest.java

示例12: currentProjectChanged

import java.awt.Cursor; //導入依賴的package包/類
void currentProjectChanged(Project newprj, NoteList nl, TaskList tl, ResourcesList rl) {
//		Util.debug("currentProjectChanged");

        Cursor cur = App.getFrame().getCursor();
        App.getFrame().setCursor(waitCursor);
        if (!changedByHistory)
            History.add(new HistoryItem(CurrentDate.get(), newprj));
        if (editorPanel.isDocumentChanged())
            saveNote();
        /*if ((currentNote != null) && !changedByHistory && !addedToHistory)
                    History.add(new HistoryItem(currentNote));*/
        CurrentProject.save();        
        
        /*addedToHistory = false;
        if (!changedByHistory) {
            if (currentNote != null) {
                History.add(new HistoryItem(currentNote));
                addedToHistory = true;
            }
        }*/
        
        updateIndicators(CurrentDate.get(), tl);
        App.getFrame().setCursor(cur);
    }
 
開發者ID:ser316asu,項目名稱:SER316-Aachen,代碼行數:25,代碼來源:DailyItemsPanel.java

示例13: IsOverriddenPopup

import java.awt.Cursor; //導入依賴的package包/類
/** Creates new form IsOverriddenPopup */
public IsOverriddenPopup(String caption, List<ElementDescription> declarations) {
    this.caption = caption;
    this.declarations = declarations;

    Collections.sort(declarations, new Comparator<ElementDescription>() {
        public int compare(ElementDescription o1, ElementDescription o2) {
            if (o1.isOverridden() == o2.isOverridden()) {
                return o1.getDisplayName().compareTo(o2.getDisplayName());
            }
            
            if (o1.isOverridden()) {
                return 1;
            }
            
            return -1;
        }
    });
    
    initComponents();
    
    jList1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    
    addFocusListener(this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:IsOverriddenPopup.java

示例14: run

import java.awt.Cursor; //導入依賴的package包/類
@Override
public void run() {
    final ActionsTree tree = new ActionsTree();
    tree.getAccessibleContext().setAccessibleDescription( getBundleString("ACSD_ActionsTree") );
    tree.getAccessibleContext().setAccessibleName( getBundleString("ACSN_ActionsTree") );
    palettePanel.removeAll();
    palettePanel.setBorder( BorderFactory.createEtchedBorder() );
    palettePanel.add( tree, BorderLayout.CENTER );
    lblHint.setLabelFor( tree );
    invalidate();
    validate();
    repaint();
    setCursor( Cursor.getDefaultCursor() );
    explorerManager.setRootContext( root );
    tree.expandAll();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:ConfigureToolbarPanel.java

示例15: showDSDP

import java.awt.Cursor; //導入依賴的package包/類
protected void showDSDP() {
	if (whichMap == WORLDWIND) {
		map.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
		map.getTopLevelAncestor().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
		if( dsdp==null ) dsdp=new DSDPDemo(this, new haxby.worldwind.db.dsdp.WWDSDP());
		dsdp.show();

		map.getTopLevelAncestor().setCursor(Cursor.getDefaultCursor());
		map.setCursor(Cursor.getDefaultCursor());
	} else
		super.showDSDP();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:13,代碼來源:WWMapApp.java


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