Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7938301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:46:17+00:00 2026-06-03T22:46:17+00:00

I changed the cursor Icon whenever a certain toggle button is clicked. But the

  • 0

I changed the cursor Icon whenever a certain toggle button is clicked. But the loaded image contains an extra pixel in it at the bottom corner! It’s annoying, like there’s constant dirt on the screen. I created the cursor icon using junior icon editor. When I open the picture using windows photo viewer or photoshop, the pixel doesn’t manifest itself. It only shows when I use it in the application.

The application is a Java application, and this is how I set the cursor.

Image img = getResourceMap().getImageIcon( iconFilename ).getImage();
        Cursor newCursor = Toolkit.getDefaultToolkit().createCustomCursor( img,
            new Point( 5, 5 ), "cursor" );

Does anyone know what could be the possible reasons for this extra shaded pixel? It occurs right below the east-facing arrow, about 2 milimeters below it.

enter image description here

You can see the effect running this code. The image appears as expected in a label, but as a pointer there is a darkened pixel on the lower left.

import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import javax.swing.border.EmptyBorder;

import javax.imageio.ImageIO;
import java.net.URL;

class ShowImage {

    public static void main(String[] args) throws Exception {
        URL url = new URL("https://i.stack.imgur.com/kP1jv.png");
        final BufferedImage img = ImageIO.read(url);
        System.out.println(
            "Image is: " + img.getWidth() + "x" + img.getHeight());
        SwingUtilities.invokeLater( new Runnable() {
            public void run() {
                JLabel l = new JLabel(new ImageIcon(img));
                l.setBorder(new EmptyBorder(5,5,5,5));
                l.setOpaque(true);
                l.setBackground(Color.GREEN.darker());
                Cursor newCursor = Toolkit.getDefaultToolkit().
                    createCustomCursor( img,new Point( 5, 5 ), "c" );
                l.setCursor(newCursor);
                JOptionPane.showMessageDialog(null, l);
            }
        });
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:46:18+00:00Added an answer on June 3, 2026 at 10:46 pm

    At first i thought that we were specifying a bigger image than the system cursor size could handle but than i realized that if we remove the last column(!!) of pixels it worked fine!!
    I don’t know how to explain this!

    BufferedImage originalImg = ImageIO.read(new File("kP1jv.png"));
    System.out.println("originalImage is: " + originalImg.getWidth() + "x"
                      + originalImg.getHeight());
    Dimension d = Toolkit.getDefaultToolkit().getBestCursorSize(
                    originalImg.getWidth(), originalImg.getHeight());
    
    final BufferedImage img = originalImg.getSubimage(0, 0, d.width/*-1*/, d.height-1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I changed image of cursor. I am trying to change size of cursor image
I tried several ways but the cursor can't be changed on <img> elements. I
I have a custom QGraphicsItem, that (among other things) changed the cursor to an
I need to change my mouse cursor to a custom image. If possible I
I want to change the position of the cursor to the first row but
How to change cursor icon to the 'busy icon' usually shown on the desktop?
How would i get my cursor to change to this loading icon when a
In master page Script: $(.RightMenu).click(function(){ $(.FlashMenu).css('background-image','url(icon/PersonalPage/blueFlash30.png)'); $('.RightMenu').css('background-image','url(icon/PersonalPage/Menu.png)'); $(this).css('background-image','url(icon/PersonalPage/MenuActive.png)'); $(this).css('background-repeat','repeat-x'); $(this).find(>:first-child).css('background-image','url(icon/PersonalPage/greenflash30.png)'); $(this).find(>:first-child).css('background-repeat','no-repeat'); }); $(.RightMenu).mouseover(function(){ $('.RightMenu').css('background-image','url(icon/PersonalPage/Menu.png)');
A stored procedure is given that can't be changed. It returns a cursor with
EDIT, Changed the code slightly based on answers below, but still haven't got it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.