`
i2534
  • 浏览: 182817 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

查看swing提供的cursors形状

    博客分类:
  • util
阅读更多

为了方便查看swing提供的基本cursors在不同系统上的外观程序,用ve写的,看着比较乱.

 

package com.vrv.lan.swing;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.border.TitledBorder;

public class CursorTest extends JFrame {

	private static final long	serialVersionUID	= 1L;
	private JPanel				jContentPane		= null;
	private JPanel				jPanel				= null;
	private JPanel				jPanel1				= null;
	private JPanel				jPanel2				= null;
	private JPanel				jPanel3				= null;
	private JPanel				jPanel4				= null;
	private JPanel				jPanel5				= null;
	private JPanel				jPanel6				= null;
	private JPanel				jPanel7				= null;
	private JPanel				jPanel8				= null;
	private JPanel				jPanel9				= null;
	private JPanel				jPanel10			= null;
	private JPanel				jPanel11			= null;
	private JPanel				jPanel12			= null;
	private JPanel				jPanel13			= null;

	/**
	 * This method initializes jPanel
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel() {
		if (jPanel == null) {
			jPanel = new JPanel();
			jPanel.setLayout(new GridBagLayout());
			jPanel
					.setBorder(BorderFactory
							.createTitledBorder(null, "HAND_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
		}
		return jPanel;
	}

	/**
	 * This method initializes jPanel1
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel1() {
		if (jPanel1 == null) {
			jPanel1 = new JPanel();
			jPanel1.setLayout(new GridBagLayout());
			jPanel1
					.setBorder(BorderFactory
							.createTitledBorder(null, "CROSSHAIR_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel1.setCursor(Cursor
					.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
		}
		return jPanel1;
	}

	/**
	 * This method initializes jPanel2
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel2() {
		if (jPanel2 == null) {
			jPanel2 = new JPanel();
			jPanel2.setLayout(new GridBagLayout());
			jPanel2
					.setBorder(BorderFactory
							.createTitledBorder(null, "MOVE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
			jPanel2.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
		}
		return jPanel2;
	}

	/**
	 * This method initializes jPanel3
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel3() {
		if (jPanel3 == null) {
			jPanel3 = new JPanel();
			jPanel3.setLayout(new GridBagLayout());
			jPanel3
					.setBorder(BorderFactory
							.createTitledBorder(null, "N_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel3.setCursor(Cursor
					.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
		}
		return jPanel3;
	}

	/**
	 * This method initializes jPanel4
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel4() {
		if (jPanel4 == null) {
			jPanel4 = new JPanel();
			jPanel4.setLayout(new GridBagLayout());
			jPanel4
					.setBorder(BorderFactory
							.createTitledBorder(null, "NE_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel4.setCursor(Cursor
					.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
		}
		return jPanel4;
	}

	/**
	 * This method initializes jPanel5
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel5() {
		if (jPanel5 == null) {
			jPanel5 = new JPanel();
			jPanel5.setLayout(new GridBagLayout());
			jPanel5
					.setBorder(BorderFactory
							.createTitledBorder(null, "NW_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel5.setCursor(Cursor
					.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
		}
		return jPanel5;
	}

	/**
	 * This method initializes jPanel6
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel6() {
		if (jPanel6 == null) {
			jPanel6 = new JPanel();
			jPanel6.setLayout(new GridBagLayout());
			jPanel6
					.setBorder(BorderFactory
							.createTitledBorder(null, "S_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel6.setCursor(Cursor
					.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
		}
		return jPanel6;
	}

	/**
	 * This method initializes jPanel7
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel7() {
		if (jPanel7 == null) {
			jPanel7 = new JPanel();
			jPanel7.setLayout(new GridBagLayout());
			jPanel7
					.setBorder(BorderFactory
							.createTitledBorder(null, "SE_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel7.setCursor(Cursor
					.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
		}
		return jPanel7;
	}

	/**
	 * This method initializes jPanel8
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel8() {
		if (jPanel8 == null) {
			jPanel8 = new JPanel();
			jPanel8.setLayout(new GridBagLayout());
			jPanel8
					.setBorder(BorderFactory
							.createTitledBorder(null, "SW_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel8.setCursor(Cursor
					.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
		}
		return jPanel8;
	}

	/**
	 * This method initializes jPanel9
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel9() {
		if (jPanel9 == null) {
			jPanel9 = new JPanel();
			jPanel9.setLayout(new GridBagLayout());
			jPanel9
					.setBorder(BorderFactory
							.createTitledBorder(null, "TEXT_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel9.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
		}
		return jPanel9;
	}

	/**
	 * This method initializes jPanel10
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel10() {
		if (jPanel10 == null) {
			jPanel10 = new JPanel();
			jPanel10.setLayout(new GridBagLayout());
			jPanel10
					.setBorder(BorderFactory
							.createTitledBorder(null, "W_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel10.setCursor(Cursor
					.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
		}
		return jPanel10;
	}

	/**
	 * This method initializes jPanel11
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel11() {
		if (jPanel11 == null) {
			jPanel11 = new JPanel();
			jPanel11.setLayout(new GridBagLayout());
			jPanel11
					.setBorder(BorderFactory
							.createTitledBorder(null, "WAIT_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel11.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
		}
		return jPanel11;
	}

	/**
	 * This method initializes jPanel12
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel12() {
		if (jPanel12 == null) {
			jPanel12 = new JPanel();
			jPanel12.setLayout(new GridBagLayout());
			jPanel12
					.setBorder(BorderFactory
							.createTitledBorder(null, "DEFAULT_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel12.setCursor(Cursor
					.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
		return jPanel12;
	}

	/**
	 * This method initializes jPanel13
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJPanel13() {
		if (jPanel13 == null) {
			jPanel13 = new JPanel();
			jPanel13.setLayout(new GridBagLayout());
			jPanel13
					.setBorder(BorderFactory
							.createTitledBorder(null, "E_RESIZE_CURSOR", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(
									"Dialog", Font.BOLD, 12), new Color(51, 51,
									51)));
			jPanel13.setCursor(Cursor
					.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
		}
		return jPanel13;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				CursorTest thisClass = new CursorTest();
				thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				thisClass.setVisible(true);
			}
		});
	}

	/**
	 * This is the default constructor
	 */
	public CursorTest() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(647, 357);
		this.setContentPane(getJContentPane());
		this.setTitle("Cursors");
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			GridLayout gridLayout = new GridLayout();
			gridLayout.setRows(4);
			jContentPane = new JPanel();
			jContentPane.setLayout(gridLayout);
			jContentPane.add(getJPanel(), null);
			jContentPane.add(getJPanel1(), null);
			jContentPane.add(getJPanel2(), null);
			jContentPane.add(getJPanel3(), null);
			jContentPane.add(getJPanel4(), null);
			jContentPane.add(getJPanel5(), null);
			jContentPane.add(getJPanel6(), null);
			jContentPane.add(getJPanel7(), null);
			jContentPane.add(getJPanel8(), null);
			jContentPane.add(getJPanel9(), null);
			jContentPane.add(getJPanel10(), null);
			jContentPane.add(getJPanel11(), null);
			jContentPane.add(getJPanel12(), null);
			jContentPane.add(getJPanel13(), null);
		}
		return jContentPane;
	}

} // @jve:decl-index=0:visual-constraint="10,10"
 
分享到:
评论

相关推荐

    Use Of Cursors And Parallel Cursors In SAP ABAP

    除了标准的游标外,SAP ABAP还支持并行游标(Parallel Cursors),这使得在单个数据库表上同时打开多个游标成为可能。并行游标特别适用于需要并发访问相同数据表的不同进程场景。使用并行游标可以帮助提高程序的执行...

    Mac OS Cursors

    【Mac OS Cursors】是一套专为非Mac操作系统设计的鼠标指针主题,旨在为用户提供与Mac OS相似的视觉体验。这套鼠标指针集合包含了多种不同状态的指针样式,如默认、等待、链接、帮助、忙态等,使得在Windows或其他非...

    Windows Cursors 光标文件(左撇子用)

    在提供的压缩包子文件的文件名称列表中,我们看到了几个不同的光标文件: 1. `aero_working_left.ani`:这可能是一个动态的"工作"光标,使用了Windows Aero主题风格,并且针对左撇子进行了调整。".ani"扩展名表示这...

    致美化鼠标:Simplify-Handy-Cursors-12198

    总之,"Simplify Handy Cursors-12198" 提供了一种方式来美化计算机的视觉效果,让日常的鼠标操作更加赏心悦目。无论是对于追求个性化的个人用户,还是对于希望提升产品用户体验的设计师来说,这种鼠标指针的定制都...

    Custom Cursors(替换光标)-4.1.0.zip

    名称:Custom Cursors(替换光标) ---------------------------------------- 版本:4.1.0 作者:cute-cursors.com 分类:网页增强 ---------------------------------------- 概述:用可爱,有趣和新潮的东西替换...

    oracle参数open_cursors与session_cached_cursors详解.pdf

    我们可以通过 SQL 语句查看当前的设定值,并根据实际情况进行调整。 open_cursors 和 session_cached_cursors 参数的设置需要遵循以下原则: 1. 设定合理的 open_cursors 值,以避免 ORA-01000 错误的出现。 2. ...

    C#任意形状在按钮

    总之,通过`GraphicsPath`和`Region`,C#提供了强大的工具来定制控件的形状,从而实现更富创意和交互性的用户界面设计。开发者可以根据具体需求,灵活运用这些技术,为用户提供更加个性化和吸引人的视觉体验。

    改变窗口中的光标形状

    在跨平台的编程环境,如Java Swing或JavaFX,改变光标形状则需要用到`java.awt.Cursor`类。我们可以创建`Cursor`对象并将其设置到组件上,例如`myComponent.setCursor(Cursor.WAIT);`。对于Qt框架,可以使用`QCursor...

    Swing Hacks

    介绍Swing组件的电子书 How This Book Is Organized ... Animated cursors, better threading, flashing the keyboard lights, and a bunch of quick one-liners to let you make the most of your busy day.

    取当前鼠标指针形状.e.rar

    在.NET框架中,C#或VB.NET程序员可以使用System.Windows.Forms.Cursors类来获取或设置鼠标指针形状。例如,`Cursor.Current`属性可以用来获取当前的鼠标指针,而`Cursor.SetCursor`方法则可以设置新的鼠标形状。 在...

    How To Use REF Cursors in JDBC Program

    在数据库编程中,特别是与Oracle数据库交互时,使用REF Cursors可以提供更灵活和动态的数据检索方式。本文将详细介绍如何在Java开发环境中,通过JDBC(Java Database Connectivity)利用REF Cursors执行动态SQL查询...

    ArcGIS Geodatabase Cursors

    总的来说,ArcGIS Geodatabase Cursors是GIS开发人员和分析师不可或缺的工具,它们提供了一种高效、灵活的方式,用于处理和操作地理空间数据,从而实现各种定制化的数据处理任务。在实际工作中,理解并熟练掌握...

    Flash cursors.zip

    总的来说,“蓝色生死恋”Flash Cursors.zip提供了一套富有情感色彩和动态美的鼠标指针,它的出现丰富了用户界面设计的可能性,同时也提醒我们关注到那些看似微小但对用户体验有着深远影响的细节。无论是从设计角度...

    好看的鼠标指针Capitaine Cursors

    Capitaine Cursors 提供了一种不同于默认鼠标的视觉效果,使得日常的电脑操作更加生动有趣。 从压缩包内的文件名称列表,我们可以了解到这套鼠标指针包含的特定动作类型: 1. **Working.ani**:这是指工作或忙时的...

    W8黑色鼠标方案

    这个鼠标指针方案包括了系统中的所有基本指针形状,例如:标准箭头、等待指针、忙指针、文本输入指针、帮助指针、精确选择指针、全选指针、链接指针、禁用指针等。这些指针在不同的操作下会自动切换,为用户提供了...

    multiple-cursors.el, emacs的多个游标.zip

    multiple-cursors.el, emacs的多个游标 multiple-cursors.el Emacs的多个游标这是一些非常疯狂的功能,所以是的,有一些问题。 不要害怕,我从 2011开始就用了很多的成功和 merriment 。安装我强烈推荐通过 package....

    Win7_Glass Cursors透明鼠标指针

    软件大小: 21.1 KB 软件语言: 简体中文 运行环境:Win9x/2000/XP/2003/Vista 软件类别:国产软件 / 免费版 / 键盘鼠标 win7鼠标指针 Win7透明鼠标指针 Glass Cursors

    GANT_Cursors鼠标

    【GANT_Cursors鼠标】是一个集合,包含了多个设计精美的鼠标指针,旨在为用户提供更加个性化和美观的电脑体验。这些鼠标指针是由爱好者精心搜集并整理的,适合那些追求桌面美化的人群。 在压缩包中,我们可以找到...

    Custom Cursors-1.1.1.zip

    名称:Custom Cursors ---------------------------------------- 版本:1.1.1 作者:Custom Cursors 分类:网页增强 ---------------------------------------- 概述:让我们为您的日常浏览带来一些特别的东西。...

    左手鼠标指针(Left Hand Cursors)

    它不仅仅是鼠标指针颜色和形状的变化,而是对传统鼠标使用方式的一种创新和补充。这类鼠标指针的设计理念是通过调整鼠标操作习惯,将压力从右手转移到左手,从而分散手部的压力,减轻肌肉和关节的负担。这样一来,...

Global site tag (gtag.js) - Google Analytics