本文整理汇总了Java中javax.swing.JButton.setCursor方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setCursor方法的具体用法?Java JButton.setCursor怎么用?Java JButton.setCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setCursor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDetails
import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createDetails(String text, ActionListener action) {
try {
text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
} catch (CharConversionException ex) {
throw new IllegalArgumentException(ex);
}
if (null == action) {
return new JLabel(text);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例2: setLinkedText
import javax.swing.JButton; //导入方法依赖的package包/类
@Messages({
"LBL_Loading=<Loading>",
"LBL_Undefined=<Undefined>"
})
private void setLinkedText(JButton btn, String url, boolean loading) {
if (url == null) {
btn.setAction(null);
if (loading) {
btn.setText(LBL_Loading());
} else {
btn.setText(LBL_Undefined());
}
btn.setCursor(null);
} else {
btn.setAction(new LinkAction(url));
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
btn.setText("<html><a href=\"\">" + url + "</a></html>");
}
}
示例3: getDetailsPanel
import javax.swing.JButton; //导入方法依赖的package包/类
private static JComponent getDetailsPanel(String summary) {
JPanel details = new JPanel(new GridBagLayout());
details.setOpaque(false);
JLabel lblMessage = new JLabel(summary);
JButton reportLink = new JButton("<html><a href=\"_blank\">" + NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionReport")); //NOI18N
reportLink.setFocusable(false);
reportLink.setBorder(BorderFactory.createEmptyBorder());
reportLink.setBorderPainted(false);
reportLink.setFocusPainted(false);
reportLink.setOpaque(false);
reportLink.setContentAreaFilled(false);
reportLink.addActionListener(flash);
reportLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
details.add(reportLink, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
details.add(lblMessage, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
return details;
}
示例4: createDetails
import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createDetails( String text, ActionListener action ) {
if( null == action ) {
return new JLabel(text);
}
try {
text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N
} catch( CharConversionException ex ) {
throw new IllegalArgumentException(ex);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例5: createConfigureButton
import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent createConfigureButton() {
if( null == browserProvider || !browserProvider.hasCustomizer() )
return null;
JButton button = new JButton(NbBundle.getMessage(BrowserMenu.class, "Ctl_ConfigurePhoneGap"));
button.addActionListener( new ActionListener() {
@Override
public void actionPerformed( ActionEvent e ) {
browserProvider.customize();
}
});
button.setBorder( new EmptyBorder(1, 1, 1, 1) );
button.setMargin( new Insets(0, 0, 0, 0) );
button.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
button.setHorizontalAlignment( JLabel.LEFT );
button.setFocusable( false );
button.setBorderPainted( false );
button.setFocusPainted( false );
button.setRolloverEnabled( true );
button.setContentAreaFilled( false );
return button;
}
示例6: setLinkLikeButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Set button border and background to look like a label with link.
*/
private void setLinkLikeButton(JButton button) {
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.setBorder(new EmptyBorder(0, 0, 0, 0));
button.setCursor(Cursor.getPredefinedCursor(
Cursor.HAND_CURSOR));
}
示例7: createDetails
import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createDetails(String text) {
JButton btn = new HtmlButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(this);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
return btn;
}
示例8: getTradeItemButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Gets a trade item button for a given item.
*
* @param item The {@code TradeItem} to make a button for.
* @param saleDir Boolean to indicate the EU price for sale (T) or buy (F)
* @return A new {@code JButton} for the item.
*/
private JButton getTradeItemButton(TradeItem item, boolean saleDir) {
Market market = getMyPlayer().getMarket();
JButton button = new JButton(new RemoveAction(item));
// Checks if the items are goods
if (item.getGoods() != null) {
int buyPriceTotal = market.getBidPrice(item.getGoods().getType(), item.getGoods().getAmount());
int salePriceTotal = market.getSalePrice(item.getGoods().getType(), item.getGoods().getAmount());
// Depending on saleDir, creates a button for goods w/ EU buy or sale price
if (saleDir) {
button.setText(Messages.message(item.getLabel()) + " " +
Messages.message(StringTemplate
.template("negotiationDialog.euSalePrice")
.addAmount("%priceTotal%", salePriceTotal)));
} else {
button.setText(Messages.message(item.getLabel()) + " " +
Messages.message(StringTemplate
.template("negotiationDialog.euBuyPrice")
.addAmount("%priceTotal%", buyPriceTotal)));
}
} else {
// If not goods, follow protocol
button.setText(Messages.message(item.getLabel()));
}
button.setMargin(Utility.EMPTY_MARGIN);
button.setOpaque(false);
button.setForeground(Utility.LINK_COLOR);
button.setBorder(Utility.blankBorder(0, 0, 0, 0));
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
return button;
}
示例9: getLinkButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Return a button suitable for linking to another panel
* (e.g. ColopediaPanel).
*
* @param text a {@code String} value
* @param icon an {@code Icon} value
* @param action a {@code String} value
* @return a {@code JButton} value
*/
public static JButton getLinkButton(String text, Icon icon, String action) {
JButton button = new JButton(text, icon);
button.setMargin(EMPTY_MARGIN);
button.setOpaque(false);
button.setForeground(LINK_COLOR);
button.setAlignmentY(0.8f);
button.setBorder(blankBorder(0, 0, 0, 0));
button.setActionCommand(action);
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
return button;
}
示例10: decorateAsLinkButton
import javax.swing.JButton; //导入方法依赖的package包/类
/** Removes background and border, changes cursor to hand. */
public static void decorateAsLinkButton(JButton button) {
button.setBorderPainted(false);
button.setContentAreaFilled(false);
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
示例11: registerDrag
import javax.swing.JButton; //导入方法依赖的package包/类
private void registerDrag(JButton drag) {
drag.setContentAreaFilled(false);
drag.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
WindowMover.register(this, drag, WindowMover.MOVE_BOTH);
}