java.awt.Cursor#getDefaultCursor ( )源码实例Demo

下面列出了java.awt.Cursor#getDefaultCursor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pumpernickel   文件: BoxContainerPanelUI.java
public Cursor getCursor() {
	switch (position) {
	case SwingConstants.NORTH:
		return Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
	case SwingConstants.SOUTH:
		return Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
	case SwingConstants.EAST:
		return Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
	case SwingConstants.WEST:
		return Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
	case SwingConstants.NORTH_EAST:
		return Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
	case SwingConstants.SOUTH_EAST:
		return Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
	case SwingConstants.NORTH_WEST:
		return Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
	case SwingConstants.SOUTH_WEST:
		return Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
	}
	return Cursor.getDefaultCursor();
}
 
源代码2 项目: seaglass   文件: SeaGlassTextFieldUI.java
/**
 * {@inheritDoc}
 */
@Override
public void mouseMoved(MouseEvent e) {
    currentMouseX = e.getX();
    currentMouseY = e.getY();
    
    Cursor cursorToUse = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);
    if (isOverCancelButton() || isOverFindButton()) {
       cursorToUse = Cursor.getDefaultCursor();  
    }
    JComponent c = (JComponent) e.getSource();
    if (!cursorToUse.equals(c.getCursor())) {
        c.setCursor(cursorToUse);
    }
    super.mouseMoved(e);
}
 
源代码3 项目: netbeans   文件: FlashingIcon.java
@Override
public Cursor getCursor() {

    if( isIconVisible ) {
        return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
    }
    return Cursor.getDefaultCursor();
}
 
源代码4 项目: netbeans   文件: TimelinePanel.java
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 项目: gcs   文件: OutlineHeader.java
@Override
public void mouseMoved(MouseEvent event) {
    Cursor cursor = Cursor.getDefaultCursor();
    int    x      = event.getX();
    if (mOwner.overColumnDivider(x) != null) {
        if (mOwner.allowColumnResize()) {
            cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
        }
    } else if (mOwner.overColumn(x) != null) {
        cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
    }
    setCursor(cursor);
}
 
源代码6 项目: gcs   文件: Outline.java
@Override
public void mouseMoved(MouseEvent event) {
    if (isEnabled()) {
        Row rollRow = null;
        try {
            boolean local = event.getSource() == this;
            int     x     = event.getX();
            int     y     = event.getY();
            Row     rowHit;
            Column  column;

            Cursor cursor = Cursor.getDefaultCursor();

            if (overColumnDivider(x) != null) {
                if (allowColumnResize()) {
                    cursor = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
                }
            } else if (local) {
                column = overColumn(x);
                if (column != null) {
                    rowHit = overRow(y);
                    if (rowHit != null) {
                        if (overDisclosureControl(x, y, column, rowHit)) {
                            rollRow = rowHit;
                        } else {
                            Cell cell = column.getRowCell(rowHit);
                            cursor = cell.getCursor(event, getCellBounds(rowHit, column), rowHit, column);
                        }
                    }
                }
            }
            setCursor(cursor);
        } finally {
            repaintChangedRollRow(rollRow);
        }
    }
}
 
源代码7 项目: visualvm   文件: TimelinePanel.java
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);
    }
}
 
源代码8 项目: visualvm   文件: FlashingIcon.java
@Override
public Cursor getCursor() {

    if( isIconVisible ) {
        return Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
    }
    return Cursor.getDefaultCursor();
}
 
源代码9 项目: pumpernickel   文件: BoxContainerPanelUI.java
@Override
public void mouseMoved(MouseEvent e) {
	Cursor cursor = getCursor(e);
	if (cursor == null) {
		cursor = Cursor.getDefaultCursor();
	}
	bcp.setCursor(cursor);
	bcp.putClientProperty(KEY_TARGET_HANDLE_OPACITY, 1f);
}
 
源代码10 项目: stendhal   文件: CursorRepository.java
private Cursor loadCursor(StendhalCursor stendhalCursor) {
	String imageName = "data/sprites/cursor/" + stendhalCursor.getImageName();

	// load image file
	URL url = DataLoader.getResource(imageName);
	if (url == null) {
		logger.error("Can't find image: " + imageName, new Throwable());
		cursorMap.put(stendhalCursor, Cursor.getDefaultCursor());
		return Cursor.getDefaultCursor();
	}

	// use ImageIO to read the image in
	Image image;
	try {
		image = ImageIO.read(url);
	} catch (IOException e) {
		logger.error("Can't read image: " + imageName, new Throwable());
		cursorMap.put(stendhalCursor, Cursor.getDefaultCursor());
		return Cursor.getDefaultCursor();
	}

	// create cursor
	Point hotSpot = stendhalCursor.getHotSpot();
	String name = stendhalCursor.toString().toLowerCase(Locale.ENGLISH);
	Cursor res = Toolkit.getDefaultToolkit().createCustomCursor(image, hotSpot, name);
	cursorMap.put(stendhalCursor, res);
	return res;
}
 
源代码11 项目: dsworkbench   文件: ImageManager.java
/**
 * Get the cursor for the provided ID
 */
public static Cursor getCursor(int pID) {
    if (!cursorSupported) {
        return Cursor.getDefaultCursor();
    }
    return CURSORS.get(pID);
}
 
源代码12 项目: netbeans   文件: GlassPane.java
/**
 * 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);
}
 
源代码13 项目: gcs   文件: MultiCell.java
@Override
public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) {
    return Cursor.getDefaultCursor();
}
 
源代码14 项目: gcs   文件: WrappedCell.java
@Override
public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) {
    return Cursor.getDefaultCursor();
}
 
源代码15 项目: gcs   文件: TextCell.java
@Override
public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) {
    return Cursor.getDefaultCursor();
}
 
源代码16 项目: gcs   文件: IconsCell.java
@Override
public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) {
    return Cursor.getDefaultCursor();
}
 
源代码17 项目: gcs   文件: WeaponDescriptionCell.java
@Override
public Cursor getCursor(MouseEvent event, Rectangle bounds, Row row, Column column) {
    return Cursor.getDefaultCursor();
}
 
源代码18 项目: ET_Redux   文件: ConcordiaGraphPanel.java
/**
     * Creates a new instance of ConcordiaGraphPanel
     *
     * @param mySample
     * @param reportUpdater the value of reportUpdater
     */
    public ConcordiaGraphPanel(SampleInterface mySample, ReportUpdaterInterface reportUpdater) {
        super();

        this.sample = mySample;
        this.reportUpdater = reportUpdater;

        setOpaque(true);

        setBackground(Color.white);

        selectedFractions = new Vector<>();
        excludedFractions = new Vector<>();

        this.showConcordiaErrorBars = true;
        this.showEllipseCenters = true;
        this.showEllipseLabels = true;
        this.showExcludedEllipses = true;
        this.showFilteredEllipses = false;
        this.display_r206_238r_Th = false;
        this.display_r206_238r_Pa = false;
        this.display_PbcCorr = false;

        this.yorkLineFit = null;

        concordiaCursor = Cursor.getDefaultCursor();
        this.imageMode = "PAN";

        this.showTitleBox = true;
        // set up title box
        concordiaTitlePanel = new TitleBoxPanel(sample.getSampleName());
        this.savedConcordiaTitlePanelX = concordiaTitlePanel.getX();
        this.savedConcordiaTitlePanelY = concordiaTitlePanel.getY();

        this.heatMapLegendPanel = new HeatMapLegendPanel("legend");

        this.useUncertaintyCrosses = false;

        changingBestDateDivider = false;

        try {
            lambda235 = sample.getPhysicalConstantsModel().getDatumByName(Lambdas.lambda235.getName());
            lambda238 = sample.getPhysicalConstantsModel().getDatumByName(Lambdas.lambda238.getName());
            lambda232 = sample.getPhysicalConstantsModel().getDatumByName(Lambdas.lambda232.getName());
        } catch (BadLabDataException ex) {
            new ETWarningDialog(ex).setVisible(true);
        }

        setViewOptions();

        this.fadedDeselectedFractions = false;

        // default is standard Concordia
        this.concordiaFlavor = "C";

        addMouseListener(this);
        addMouseMotionListener(this);
//        addMouseWheelListener(this);

    }
 
源代码19 项目: ET_Redux   文件: AbstractPlot.java
/**
 * Specifies a new abstract Plot
 *
 * @param mySample
 * @param reportUpdater the value of reportUpdater
 */
public AbstractPlot(SampleInterface mySample, ReportUpdaterInterface reportUpdater) {
    super();

    this.sample = mySample;
    this.reportUpdater = reportUpdater;

    selectedFractions = new Vector<>();
    excludedFractions = new Vector<>();

    this.showEllipseCenters = true;
    this.showEllipseLabels = true;
    this.showExcludedEllipses = true;
    this.showFilteredEllipses = false;

    this.yorkLineFit = null;

    concordiaCursor = Cursor.getDefaultCursor();
    this.imageMode = "PAN";

    this.showTitleBox = true;
    // set up title box
    concordiaTitlePanel = new TitleBoxPanel(sample.getSampleName());
    this.savedConcordiaTitlePanelX = concordiaTitlePanel.getX();
    this.savedConcordiaTitlePanelY = concordiaTitlePanel.getY();

    this.heatMapLegendPanel = new HeatMapLegendPanel("legend");

    this.useUncertaintyCrosses = false;

    setViewOptions();

    this.fadedDeselectedFractions = false;

    // default is standard Concordia
    this.concordiaFlavor = "C";
    
    this.showEquiline = true;
    this.showRegressionLine = true;
    this.showRegressionLineUnct = false;
    this.showIsochrons = true;


}
 
源代码20 项目: triplea   文件: HeadedUiContext.java
@Override
protected void internalSetMapDir(final String dir, final GameData data) {
  if (resourceLoader != null) {
    resourceLoader.close();
  }
  resourceLoader = ResourceLoader.getMapResourceLoader(dir);
  mapData = new MapData(dir);
  // DiceImageFactory needs loader and game data
  diceImageFactory = new DiceImageFactory(resourceLoader, data.getDiceSides());
  final double unitScale =
      getPreferencesMapOrSkin(dir).getDouble(UNIT_SCALE_PREF, mapData.getDefaultUnitScale());
  scale = getPreferencesMapOrSkin(dir).getDouble(MAP_SCALE_PREF, 1);
  unitImageFactory = new UnitImageFactory(resourceLoader, unitScale, mapData);
  // TODO: separate scale for resources
  resourceImageFactory.setResourceLoader(resourceLoader);
  territoryEffectImageFactory.setResourceLoader(resourceLoader);
  unitIconImageFactory.setResourceLoader(resourceLoader);
  flagIconImageFactory.setResourceLoader(resourceLoader);
  puImageFactory.setResourceLoader(resourceLoader);
  tileImageFactory.setMapDir(resourceLoader);
  // load map data
  mapImage.loadMaps(resourceLoader);
  mapDir = dir;
  drawTerritoryEffects = mapData.useTerritoryEffectMarkers();
  // load the sounds in a background thread,
  // avoids the pause where sounds dont load right away
  // change the resource loader (this allows us to play sounds the map folder, rather than just
  // default sounds)
  new Thread(() -> ClipPlayer.getInstance(resourceLoader), "TripleA sound loader").start();
  // load a new cursor
  cursor = Cursor.getDefaultCursor();
  final Toolkit toolkit = Toolkit.getDefaultToolkit();
  // URL's use "/" not "\"
  final URL cursorUrl = resourceLoader.getResource("misc/cursor.gif");
  if (cursorUrl != null) {
    try {
      final Image image = ImageIO.read(cursorUrl);
      if (image != null) {
        final Point hotSpot =
            new Point(mapData.getMapCursorHotspotX(), mapData.getMapCursorHotspotY());
        cursor = toolkit.createCustomCursor(image, hotSpot, data.getGameName() + " Cursor");
      }
    } catch (final Exception e) {
      log.log(Level.SEVERE, "Failed to create cursor from: " + cursorUrl, e);
    }
  }
}