你指定的图标,指的是什么呀
是沙漏等还是自己定义的图标呀
如是系统自己的
可以这样
setCursor( new Cursor( Cursor.WAIT_CURSOR ) );
setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
等,自己看Cusor还有什么类型好了呵呵
是沙漏等还是自己定义的图标呀
如是系统自己的
可以这样
setCursor( new Cursor( Cursor.WAIT_CURSOR ) );
setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
等,自己看Cusor还有什么类型好了呵呵
解决方案 »
- 分享一本java大学实用教程书上的代码
- MySQL插入blob类型出错
- jdk环境变量的问题
- 一般电脑虽多能支持多少个java线程?
- 字符串这样赋值不对吗
- 在jpanel中paint一些东西,把jpanel加到一个jframe中,如何设置显示出来的背景颜色(急)
- 关于日期(Date)的问题!
- 请问String 的interface toString(),在构造函数之前被调用还是在之后被调用?
- 超简单问题
- 请问谁有JAVA的SOCKET SERVER和C++的SOCKET CLIENT连接的实例?
- 为什么我的小程序用appletviewer可以运行,而在浏览器中就不行呢?
- 一个关于JDK运行错误的问题
public Cursor createCustomCursor(Image cursor,
Point hotSpot,
String name)
throws IndexOutOfBoundsException
Creates a new custom cursor object. If the image to display is invalid, the cursor will be hidden (made completely transparent), and the hotspot will be set to (0, 0).
Parameters:
image - the image to display when the cursor is active.
hotSpot - the X and Y of the large cursor's hot spot. The hotSpot values must be less than the Dimension returned by getBestCursorSize().
name - a localized description of the cursor, for Java Accessibility use.
Point hotSpot,
String name)
throws IndexOutOfBoundsExceptionCreates a new custom cursor object. If the image to display is invalid, the cursor will be hidden (made completely transparent), and the hotspot will be set to (0, 0).Parameters:
image - the image to display when the cursor is active.
hotSpot - the X and Y of the large cursor's hot spot. The hotSpot values must be less than the Dimension returned by getBestCursorSize().
name - a localized description of the cursor, for Java Accessibility use.Throws:
IndexOutOfBoundsException - if the hotSpot values are outside the bounds of the cursor.
--------------------------------------然后再用 setCursor(Cursor cursor)
createCustomCursor
用
Toolkit.createCustomCursor(java.awt.Image, java.awt.Point, java.lang.String)
import java.awt.*;
import javax.swing.*;public class YourClass extends JFrame {
Cursor cursor;//定义一个 Cursor
Image img = new ImageIcon("Banana.jpg").getImage();//一个图片 //构造函数
public YourClass () {
cursor = this.getToolkit().createCustomCursor(img, new Point(1,1), "Banana");
this.setCursor(cursor);
}
public static void main(String[] args) {
YourClass c= new YourClass ();
c.setSize(20,40);
c.setVisible(true);
}
}
--------------------------------------------------
Understand???
i see