custom-cursor

CSS - Custom cursor that changes depending on hovered element flickers when moving left to right but not right to left

天大地大妈咪最大 提交于 2020-01-25 09:28:09
问题 I am trying to create a custom cursor that changes when hovering over a <div> , but there is a flicker when moving left to right across it, but not when moving right to left. Why this is happening and what I can do to fix it? document.addEventListener('mousemove', (ev) => cursorMove(ev)); function cursorMove(ev) { let circle = document.getElementById('circle'); let posY = ev.clientY; let posX = ev.clientX; circle.style.top = posY + 'px'; circle.style.left = posX + 'px'; } body { margin: 0;

CSS change custom cursor image origin (hotspot) to center

孤者浪人 提交于 2019-12-29 04:27:22
问题 I want to use a custom image for a cursor. This is fine, but from what I can see - the origin (tip of arrow) is by default at the top-left point of my image. How can I set the origin to be the center of my image. Here is a demo snippet to demonstrate the problem div { width: 600px; height: 100px; background: pink; cursor: url(http://placehold.it/50x30), auto } <div>the cat in the hat<br> the cat in the hat<br> the cat in the hat<br> the cat in the hat</div> Notice that when I try to select

assign color to mouse cursor using CSS

限于喜欢 提交于 2019-12-24 17:23:25
问题 How can I assign color to the mouse cursor in a web-page? Can anyone suggest me a way to do it using any of the technologies e.g. HTML, CSS, JavaScript? 回答1: Use an image along with CSS cursor property, I don't see any need of JavaScript heere... Demo div { cursor: url(YOUR_IMAGE_URL), auto; } As commented, I've used auto which is nothing but default cursor just incase your image fails to load, exactly like we declare multiple font families. 回答2: Just to add the possibility to dynamically

Custom Cursor in a Swing JDialog

丶灬走出姿态 提交于 2019-12-22 08:26:31
问题 I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5. I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though. When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have to write all the dialog code myself. How can I get the cursor to appear? Here's the simplest code I could create to demonstrate the problem: import javax.swing.*; import java.awt.*; public class

assign color to mouse cursor using CSS

北城余情 提交于 2019-12-17 11:43:15
问题 How can I assign color to the mouse cursor in a web-page? Can anyone suggest me a way to do it using any of the technologies e.g. HTML, CSS, JavaScript? 回答1: Use an image along with CSS cursor property, I don't see any need of JavaScript heere... Demo div { cursor: url(YOUR_IMAGE_URL), auto; } As commented, I've used auto which is nothing but default cursor just incase your image fails to load, exactly like we declare multiple font families. 回答2: Just to add the possibility to dynamically

Java Swing Custom Cursor is invisible

冷暖自知 提交于 2019-12-13 02:27:02
问题 I made a custom cursor using this tutorial. Problem is, as soon as it changes, i just get nothing. The cursor is invisible. I tried the pencil image given there, a custom image i quickly have drawn in paint, but they all don't work. public Cursor stoneCursor; Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.getImage("pencil.gif"); Point hotspot = new Point(0,0); stoneCursor = toolkit.createCustomCursor(image, hotspot, "Stone"); getContentPane().setCursor(stoneCursor); This

Trying to make a Custom CursorAdapter that converts UnixTime into something readable before putting in a ListView

拥有回忆 提交于 2019-12-11 17:59:31
问题 I'm trying to make a custom CursorAdapter for something that I'm writing. The plan for what I'm doing involves an SQLite databases full of dates and times for an alarm to go off. (Since SQLite doesn't actually have a DATETIME datatype, they're all just converted to Unix Time before being stored as INT.) I found this example of making a custom cursor adapter and tried to adapt it so that it could take in the Unix Time entries and convert them into something human-readable. I've hit a bit of a

How To create A Large Size Custom Cursor In Java?

不问归期 提交于 2019-12-11 02:34:39
问题 I'm developing a Java Swing app for an award winning password protection system, and I need a large custom cursor [ 80 x 80 ], you might ask why so large, there is an online web demo you may look at to learn why it needs to be so large : http://gatecybertech.net That large cursor is used on the login page in the above link. Of course you need to create a test password first before you can try the login process. But anyway, in my Swing app, I hit a limit of 32 x 32 for the largest possible

Custom Cursor in a Swing JDialog

假如想象 提交于 2019-12-05 12:46:09
I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5. I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though. When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have to write all the dialog code myself. How can I get the cursor to appear? Here's the simplest code I could create to demonstrate the problem: import javax.swing.*; import java.awt.*; public class CursorTest { public static void main(String[] args) { JLabel label = new JLabel("Move mouse here for

Get correct cursor in CustomCursor Adapater getView()

醉酒当歌 提交于 2019-12-01 17:58:45
I have a custom cursor adapter where each row consists of a check box, text view and button. The button is initially set as GONE, when the user selects the check box I want the button to display so that the user can click it and delete the corresponding row. My problem is that in my getView() I cannot get the correct cursor so keep getting cursorOutOfBoundsExceptions . I also want to remove the bindView() if I don't need it any more. public class DeleteCampaignCustomCursorAdapater extends CursorAdapter { protected static final String TAG = null; DatabaseHelper myDbHelper; protected