📄 rbutton.java
字号:
/*
* 11/14/2003
*
* RButton.java - A JButton that displays a hand cursor when the mouse is over
* it.
* Copyright (C) 2003 Robert Futrell
* email@address.com
* www.website.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.fife.ui;
import java.awt.Cursor;
import java.io.Serializable;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JButton;
/**
* An extension of <code>javax.swing.JButton</code> that displays a hand cursor
* when the mouse is over it.
*
* @author Robert Futrell
* @version 1.0
*/
public class RButton extends JButton implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3160612546110362907L;
/*****************************************************************************/
/**
* Creates a button with no set text or icon.
*/
public RButton() {
super();
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
/*****************************************************************************/
/**
* Creates a button where properties are taken from the <code>Action</code>
* supplied.
*
* @param a The <code>Action</code> used to specify the new button.
*/
public RButton(Action a) {
super(a);
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
/*****************************************************************************/
/**
* Creates a button with an icon.
*
* @param icon The <code>Icon</code> image to display on the button.
*/
public RButton(Icon icon) {
super(icon);
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
/*****************************************************************************/
/**
* Creates a button with text.
*
* @param text The text of the button.
*/
public RButton(String text) {
super(text);
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
/*****************************************************************************/
/**
* Creates a button with initial text and an icon.
*
* @param text The text of the button.
* @param icon The <code>Icon</code> image to display on the button.
*/
public RButton(String text, Icon icon) {
super(text, icon);
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
/*****************************************************************************/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -