Java Code Examples for javax.swing.JComponent.setCursor()

The following are Jave code examples for showing how to use setCursor() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 6 votes
@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;
}
 
Example 2
Project: incubator-netbeans   File: UtilitiesProgressCursorTest.java   View Source Code Vote up 5 votes
public void testProgressCursor () {
    JComponent testTc = new ProgressCursorComp();
    Cursor progressCursor = Utilities.createProgressCursor(testTc);
    testTc.setCursor(progressCursor);
    //testTc.open();
    Cursor compCursor = testTc.getCursor();
    if (!progressCursor.equals(compCursor)) {
        fail("Setting of progress cursor don't work: \n" +
             "Comp cursor: " + compCursor + "\n" +
             "Progress cursor: " + progressCursor);
    }
}
 
Example 3
Project: incubator-netbeans   File: TooltipWindow.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved (Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(Bundle.CTL_AnnotationBar_action_showCommit(revision));
        return true;
    }
    return false;
}
 
Example 4
Project: incubator-netbeans   File: VCSHyperlinkSupport.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved(Point p, JComponent component) {
    for (int i = 0; i < start.length; i++) {
        if (bounds != null && bounds[i] != null && bounds[i].contains(p)) {
            component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            return true;
        }
    }
    return false;
}
 
Example 5
Project: incubator-netbeans   File: VCSHyperlinkSupport.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved(Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(NbBundle.getMessage(VCSHyperlinkSupport.class, "LBL_StartChat", author));
        return true;
    }
    return false;
}
 
Example 6
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved (Point p, JComponent component) {
    for (Map.Entry<Component, Rectangle> e : bounds.entrySet()) {
        if (e.getValue().contains(p)) {
            component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            component.setToolTipText(tooltips.get(e.getKey()));
            return true;
        }
    }
    return false;
}
 
Example 7
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved (Point p, JComponent component) {
    for (Map.Entry<Component, Rectangle> e : bounds.entrySet()) {
        if (e.getValue().contains(p)) {
            component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            component.setToolTipText((String) labels.get(e.getKey()).getValue(Action.NAME));
            return true;
        }
    }
    return false;
}
 
Example 8
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved(Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ExpandCommitMessage")); //NOI18N
        return true;
    }
    return false;
}
 
Example 9
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved(Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        if (item.revisionExpanded) {
            component.setToolTipText(NbBundle.getMessage(SummaryCellRenderer.class, "MSG_CollapseRevision")); //NOI18N
        } else {
            component.setToolTipText(NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ExpandRevision")); //NOI18N
        }
        return true;
    }
    return false;
}
 
Example 10
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved(Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ShowActions")); //NOI18N
        return true;
    }
    return false;
}
 
Example 11
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved(Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(NbBundle.getMessage(SummaryCellRenderer.class, "MSG_ShowLessFiles")); //NOI18N
        return true;
    }
    return false;
}
 
Example 12
Project: incubator-netbeans   File: TooltipWindow.java   View Source Code Vote up 5 votes
@Override
public boolean mouseMoved (Point p, JComponent component) {
    if (bounds != null && bounds.contains(p)) {
        component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        component.setToolTipText(Bundle.CTL_AnnotationBar_action_showCommit(revision));
        return true;
    }
    return false;
}
 
Example 13
Project: VASSAL-src   File: FreeRotator.java   View Source Code Vote up 5 votes
public void beginInteractiveRotate() {
  startPosition = getPosition();
  startMap = getMap();
  startMap.pushMouseListener(this);
  startMap.addDrawComponent(this);

  final JComponent view = startMap.getView();
  view.addMouseMotionListener(this);
  view.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));

  startMap.disableKeyListeners();

  pivot = getPosition();
}
 
Example 14
Project: incubator-netbeans   File: ProfilingPoint.java   View Source Code Vote up 4 votes
public void setCursor(Cursor cursor) {
    super.setCursor(cursor);
    
    JComponent table = lastTable != null ? lastTable.get() : null;
    if (table != null) table.setCursor(cursor);
}
 
Example 15
Project: batmapper   File: MapperPickingGraphMousePlugin.java   View Source Code Vote up 4 votes
public void mouseEntered( MouseEvent e ) {
    JComponent c = (JComponent) e.getSource();
    c.setCursor( cursor );
}
 
Example 16
Project: batmapper   File: MapperPickingGraphMousePlugin.java   View Source Code Vote up 4 votes
public void mouseExited( MouseEvent e ) {
    JComponent c = (JComponent) e.getSource();
    c.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
}