Java Code Examples for javax.swing.JComponent#setCursor()
The following examples show how to use
javax.swing.JComponent#setCursor() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: magarena File: MagicStyle.java License: GNU General Public License v3.0 | 6 votes |
/** * Changes border color, background and mouse cursor for the specified component * to indicate that a mouse click will initiate some kind of action. */ public static void setHightlight(final JComponent component, final boolean value) { if (currentTheme != ThemeFactory.getInstance().getCurrentTheme()) { currentTheme = ThemeFactory.getInstance().getCurrentTheme(); final Color refBG = currentTheme.getColor(Theme.COLOR_TITLE_BACKGROUND); BG1 = new Color(refBG.getRed(), refBG.getGreen(), refBG.getBlue(), 200); BG2 = new Color(refBG.getRed(), refBG.getGreen(), refBG.getBlue(), 220); } if (value) { component.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); component.setBorder(BorderFactory.createLineBorder(getRolloverColor(), 2)); component.setBackground(BG1); } else { component.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); component.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); component.setBackground(BG2); } }
Example 2
Source Project: seaglass File: SeaGlassTextFieldUI.java License: Apache License 2.0 | 6 votes |
/** * {@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); }
Example 3
Source Project: netbeans File: SummaryCellRenderer.java License: Apache License 2.0 | 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 4
Source Project: ghidra File: VisualGraphEventForwardingGraphMousePlugin.java License: Apache License 2.0 | 5 votes |
private void updateCursor(VertexMouseInfo<V, E> info) { if (!isHandlingEvent) { return; } JComponent c = (JComponent) info.getEventSource(); c.setCursor(info.getCursorForClickedComponent()); }
Example 5
Source Project: netbeans File: UtilitiesProgressCursorTest.java License: Apache License 2.0 | 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 6
Source Project: netbeans File: VCSHyperlinkSupport.java License: Apache License 2.0 | 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 7
Source Project: netbeans File: VCSHyperlinkSupport.java License: Apache License 2.0 | 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 8
Source Project: netbeans File: SummaryCellRenderer.java License: Apache License 2.0 | 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 9
Source Project: netbeans File: SummaryCellRenderer.java License: Apache License 2.0 | 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 10
Source Project: netbeans File: SummaryCellRenderer.java License: Apache License 2.0 | 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 11
Source Project: netbeans File: SummaryCellRenderer.java License: Apache License 2.0 | 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 12
Source Project: netbeans File: SummaryCellRenderer.java License: Apache License 2.0 | 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 13
Source Project: netbeans File: TooltipWindow.java License: Apache License 2.0 | 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 14
Source Project: material-ui-swing File: MaterialPopupMenuUI.java License: MIT License | 5 votes |
@Override public void uninstallUI(JComponent c) { c.setFont (null); c.setBackground (null); c.setForeground (null); c.setBorder (null); c.setCursor(null); super.uninstallUI(c); }
Example 15
Source Project: material-ui-swing File: MaterialSliderUI.java License: MIT License | 5 votes |
@Override public void uninstallUI(JComponent c) { c.setFont (null); c.setBackground (null); c.setForeground (null); c.setBorder (null); c.setCursor(null); super.uninstallUI(c); }
Example 16
Source Project: material-ui-swing File: MaterialRadioButtonMenuItemUI.java License: MIT License | 5 votes |
@Override public void installUI (JComponent c) { super.installUI (c); c.setBackground(UIManager.getColor("RadioButtonMenuItem.background")); c.setForeground(UIManager.getColor("RadioButtonMenuItem.foreground")); c.setBorder(UIManager.getBorder("RadioButtonMenuItem.border")); c.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }
Example 17
Source Project: material-ui-swing File: MaterialRadioButtonMenuItemUI.java License: MIT License | 5 votes |
@Override public void uninstallUI(JComponent c) { c.setFont (null); c.setBackground (null); c.setForeground (null); c.setBorder (null); c.setCursor(null); super.uninstallUI(c); }
Example 18
Source Project: material-ui-swing File: MaterialSliderUI.java License: MIT License | 5 votes |
@Override public void installUI (JComponent c) { super.installUI (c); JSlider slider = (JSlider) c; slider.setFont (UIManager.getFont ("Slider.font")); slider.setBackground (UIManager.getColor ("Slider.background")); slider.setForeground (UIManager.getColor ("Slider.foreground")); slider.setBorder (UIManager.getBorder ("Slider.border")); c.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }
Example 19
Source Project: spotbugs File: MainFrameComponentFactory.java License: GNU Lesser General Public License v2.1 | 4 votes |
private void removeLink(JComponent component) { this.sourceLink = null; component.setEnabled(false); component.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); component.setToolTipText(""); }
Example 20
Source Project: netbeans File: ProfilingPoint.java License: Apache License 2.0 | 4 votes |
public void setCursor(Cursor cursor) { super.setCursor(cursor); JComponent table = lastTable != null ? lastTable.get() : null; if (table != null) table.setCursor(cursor); }