本文整理匯總了Java中java.awt.Cursor.getPredefinedCursor方法的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.getPredefinedCursor方法的具體用法?Java Cursor.getPredefinedCursor怎麽用?Java Cursor.getPredefinedCursor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Cursor
的用法示例。
在下文中一共展示了Cursor.getPredefinedCursor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mousePressed
import java.awt.Cursor; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent e)
{
JTableHeader header = (JTableHeader)e.getComponent();
TableColumnModel tcm = header.getColumnModel();
int columnIndex = tcm.getColumnIndexAtX( e.getX() );
Cursor cursor = header.getCursor();
if (columnIndex == tcm.getColumnCount() - 1
&& cursor == Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR))
{
column = tcm.getColumn( columnIndex );
columnWidth = column.getWidth();
pressedX = e.getX();
header.addMouseMotionListener( this );
}
}
示例2: getMouseCursor
import java.awt.Cursor; //導入方法依賴的package包/類
private static synchronized Cursor getMouseCursor(HyperlinkType type) {
switch (type) {
case GO_TO_DECLARATION:
case ALT_HYPERLINK:
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
default:
throw new UnsupportedOperationException();
}
}
示例3: InteractiveCanvasComponent
import java.awt.Cursor; //導入方法依賴的package包/類
public InteractiveCanvasComponent() {
mousePanningButton = MouseEvent.BUTTON1;
mousePanningCursor = Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR);
enableMousePanning();
zoomMode = ZOOM_ALL;
mouseZoomingFactor = 1.05d;
enableMouseZooming();
}
示例4: updateCursor
import java.awt.Cursor; //導入方法依賴的package包/類
private void updateCursor() {
if (draggingRow != null) {
Cursor resizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
chart.setCursor(resizeCursor);
probesPanel.setCursor(resizeCursor);
} else {
Cursor defaultCursor = Cursor.getDefaultCursor();
chart.setCursor(defaultCursor);
probesPanel.setCursor(defaultCursor);
}
}
示例5: getCursor
import java.awt.Cursor; //導入方法依賴的package包/類
@Override
public Cursor getCursor() {
if( isIconVisible ) {
return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
}
return Cursor.getDefaultCursor();
}
示例6: contains
import java.awt.Cursor; //導入方法依賴的package包/類
/**
* If someone adds a mouseListener to the GlassPane or set a new cursor
* we expect that he knows what he is doing and return the super.contains(x, y) otherwise
* we return false to respect the cursors for the underneath components.
*/
@Override
public boolean contains(int x, int y) {
if (getMouseListeners().length == 0 && getMouseMotionListeners().length == 0
&& getMouseWheelListeners().length == 0
&& getCursor() == Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)) {
return false;
}
return super.contains(x, y);
}
示例7: createDragCursor
import java.awt.Cursor; //導入方法依賴的package包/類
public Cursor createDragCursor(Component comp) {
Cursor c = null;
if (!pieces.isEmpty()) {
c = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
}
return c;
}
示例8: MapperPickingGraphMousePlugin
import java.awt.Cursor; //導入方法依賴的package包/類
/**
* create an instance with overides
*
* @param selectionModifiers for primary selection
* @param addToSelectionModifiers for additional selection
*/
public MapperPickingGraphMousePlugin( int selectionModifiers, int addToSelectionModifiers ) {
super( selectionModifiers );
this.addToSelectionModifiers = addToSelectionModifiers;
this.lensPaintable = new LensPaintable();
this.cursor = Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
}
示例9: getCurrentCursor
import java.awt.Cursor; //導入方法依賴的package包/類
public Cursor getCurrentCursor() {
if (!map.baseCursor.equals(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)))
return map.baseCursor;
if (tb[0].isSelected() || tb[3].isSelected()) {
return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
if (panB.isSelected()) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
ClassLoader loader = org.geomapapp.util.Icons.class.getClassLoader();
String path = "org/geomapapp/resources/icons/open_hand.png";
java.net.URL url = loader.getResource(path);
try {
BufferedImage im = ImageIO.read(url);
// Image image = toolkit.getImage("img.gif");
Cursor brokenCursor = toolkit.createCustomCursor( im, new Point(0,0), "open_hand" );
return brokenCursor;
} catch (IOException e1) {
e1.printStackTrace();
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
}
}
if (tb[1].isSelected()) {
return Zoomer.ZOOM_IN;
}
if (tb[2].isSelected()) {
return Zoomer.ZOOM_OUT;
}
return Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
示例10: getCursor
import java.awt.Cursor; //導入方法依賴的package包/類
@Override
public Cursor getCursor() {
return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
}
示例11: updateCursor
import java.awt.Cursor; //導入方法依賴的package包/類
/**
* Updates cursor according to its location. For example, it sets
* the appropriate resizing cursor when the mouse is over the boundary
* of the selection component.
*
* @param cursorLocation current mouse cursor location.
*/
void updateCursor(Point cursorLocation) {
Cursor cursor = Cursor.getDefaultCursor();
if (cursorLocation == null) {
resizingMode = 0;
} else {
int x = cursorLocation.x;
int y = cursorLocation.y;
Image resizeHandle = GridDesigner.RESIZE_HANDLE;
int rw = resizeHandle.getWidth(null);
int rh = resizeHandle.getHeight(null);
for (Component selComp : selection) {
Rectangle rect = fromComponentPane(selectionResizingBounds(selComp));
boolean w = (rect.x-rw<=x) && (x<=rect.x+rect.width+rw);
boolean h = (rect.y-rh<=y) && (y<=rect.y+rect.height+rh);
boolean top = w && (rect.y-rh<=y) && (y<=rect.y+2);
boolean bottom = w && (rect.y+rect.height-2<=y) && (y<=rect.y+rect.height+rh);
boolean left = h && (rect.x-rw<=x) && (x<=rect.x+2);
boolean right = h && (rect.x+rect.width-2<=x) && (x<=rect.x+rect.width+rw);
if (top) {
if (left) {
cursor = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
resizingMode = SwingConstants.NORTH_WEST;
} else if (right) {
cursor = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
resizingMode = SwingConstants.NORTH_EAST;
} else {
cursor = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
resizingMode = SwingConstants.NORTH;
}
} else if (bottom) {
if (left) {
cursor = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
resizingMode = SwingConstants.SOUTH_WEST;
} else if (right) {
cursor = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
resizingMode = SwingConstants.SOUTH_EAST;
} else {
cursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
resizingMode = SwingConstants.SOUTH;
}
} else if (left) {
cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
resizingMode = SwingConstants.WEST;
} else if (right) {
cursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
resizingMode = SwingConstants.EAST;
} else {
cursor = Cursor.getDefaultCursor();
resizingMode = 0;
}
if (resizingMode != 0) {
focusedComponent = selComp;
break;
}
}
}
setCursor(cursor);
}
示例12: isHyperlinkMouseCursor
import java.awt.Cursor; //導入方法依賴的package包/類
private static synchronized boolean isHyperlinkMouseCursor(Cursor c) {
return c == Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
|| c == Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)
|| c == Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR);
}
示例13: getCursor
import java.awt.Cursor; //導入方法依賴的package包/類
@Override
public Cursor getCursor(Canvas canvas) {
return Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
}
示例14: updateCursor
import java.awt.Cursor; //導入方法依賴的package包/類
private void updateCursor() {
super.setCursor(isCollapsed ?
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR) :
Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
}
示例15: waitCursor
import java.awt.Cursor; //導入方法依賴的package包/類
private void waitCursor(boolean enable) {
RootPaneContainer root = ((RootPaneContainer) getTopLevelAncestor());
Cursor cursor = Cursor.getPredefinedCursor(enable ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR);
root.getGlassPane().setCursor(cursor);
root.getGlassPane().setVisible(enable);
}