Java Code Examples for java.awt.Cursor#HAND_CURSOR
The following examples show how to use
java.awt.Cursor#HAND_CURSOR .
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 File: VersionPane.java From bigtable-sql with Apache License 2.0 | 5 votes |
public void mouseMoved(MouseEvent ev) { JTextPane editor = (JTextPane) ev.getSource(); editor.setEditable(false); Point pt = new Point(ev.getX(), ev.getY()); int pos = editor.viewToModel(pt); if (pos >= 0) { Document eDoc = editor.getDocument(); if (eDoc instanceof DefaultStyledDocument) { DefaultStyledDocument hdoc = (DefaultStyledDocument) eDoc; Element e = hdoc.getCharacterElement(pos); AttributeSet a = e.getAttributes(); AttributeSet tagA = (AttributeSet) a.getAttribute(HTML.Tag.A); String href = null; if (tagA!=null){ href = (String)tagA.getAttribute(HTML.Attribute.HREF); } if (href != null) { editor.setToolTipText(href); if (editor.getCursor().getType() != Cursor.HAND_CURSOR) { editor.setCursor(new Cursor(Cursor.HAND_CURSOR)); } } else { editor.setToolTipText(null); if (editor.getCursor().getType() != Cursor.DEFAULT_CURSOR) { editor.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } } } else { editor.setToolTipText(null); } }
Example 2
Source File: DualSub.java From dualsub with GNU General Public License v3.0 | 5 votes |
/** * Create the GUI. * * @throws IOException */ public DualSub() throws IOException { // Look and feel try { // UIManager.setLookAndFeel(new NimbusLookAndFeel()); UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); JFrame.setDefaultLookAndFeelDecorated(false); JDialog.setDefaultLookAndFeelDecorated(false); // UIManager.setLookAndFeel(UIManager // .getCrossPlatformLookAndFeelClassName()); // JFrame.setDefaultLookAndFeelDecorated(true); // JDialog.setDefaultLookAndFeelDecorated(true); } catch (Exception e) { log.warn(e.getMessage()); } splash = new Splash(ClassLoader.getSystemResource("img/splash.png")); cursor = new Cursor(Cursor.HAND_CURSOR); loadProperties(); // Default language String locale = preferences.get("locale", properties.getProperty("locale")); if (!locale.isEmpty()) { I18N.setLocale(locale); } initialize(); menu = new Menu(this, locale); menu.addMenu(leftFileListener, rightFileListener, folderListener, mergeButtonListener); showFrame(); }