본문 바로가기

Software/JAVA

자바 간단하게 마우스 포인터 없애기 (JAVA)

반응형

Question
In Some portion of my java applet i want cursor to be invisible and

 disable. How Is it possible in java

 Answer

Best shown by example:


import java.awt.image.*;
import javax.swing.*;
import java.awt.*;

public class Test {
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		Toolkit tk = Toolkit.getDefaultToolkit();
		// Creates a cursor from an invalid image.
		Cursor invisCursor = tk.createCustomCursor(tk.createImage(""),
				new Point(), null);
		frame.setCursor(invisCursor);
		// Disable events by showing the glasspane which by default is
		// transparent.
		frame.getGlassPane().setVisible(true);
		// remove the titlebar and resize of the frame (you may want this)
		frame.setUndecorated(true);
		frame.setSize(100, 100);
		frame.setVisible(true);
	}
}


출처 : http://en.allexperts.com/q/Java-1046/cursor.htm

반응형