當前位置: 首頁>>代碼示例>>Java>>正文


Java JButton.setCursor方法代碼示例

本文整理匯總了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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:NotificationImpl.java

示例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>");
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ProjectInfoPanel.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:NotifyExcPanel.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:NotificationImpl.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:BrowserMenu.java

示例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));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:LinkButtonPanel.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:SlownessReporter.java

示例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;
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:42,代碼來源:NegotiationDialog.java

示例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;
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:21,代碼來源:Utility.java

示例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));
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:7,代碼來源:ButtonDecotrator.java

示例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);
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:6,代碼來源:TestCaseComponent.java


注:本文中的javax.swing.JButton.setCursor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。