当前位置: 首页>>代码示例>>Java>>正文


Java JButton.setOpaque方法代码示例

本文整理汇总了Java中javax.swing.JButton.setOpaque方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setOpaque方法的具体用法?Java JButton.setOpaque怎么用?Java JButton.setOpaque使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.setOpaque方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDecreaseButton

import javax.swing.JButton; //导入方法依赖的package包/类
protected JButton createDecreaseButton(int orientation) {
	JButton btn = new XDMButton();
	btn.setHorizontalAlignment(JButton.CENTER);
	btn.setPreferredSize(new Dimension(15, 15));
	btn.setContentAreaFilled(false);
	btn.setBorderPainted(false);
	btn.setOpaque(false);
	if (orientation == SwingConstants.NORTH) {
		btn.setIcon(XDMIconMap.getIcon("UP_ARROW"));
	}
	if (orientation == SwingConstants.SOUTH) {
		btn.setIcon(XDMIconMap.getIcon("DOWN_ARROW"));
	}
	if (orientation == SwingConstants.EAST) {
		btn.setIcon(XDMIconMap.getIcon("LEFT_ARROW"));
	}
	if (orientation == SwingConstants.WEST) {
		btn.setIcon(XDMIconMap.getIcon("RIGHT_ARROW"));
	}
	return btn;
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:22,代码来源:XDMScrollBarUI.java

示例2: createButtons

import javax.swing.JButton; //导入方法依赖的package包/类
void createButtons() {
    for (int i = 0; i < chars.length; i++) {
        JButton button = new JButton(new CharAction(chars[i]));
        button.setMaximumSize(new Dimension(50, 22));
        //button.setMinimumSize(new Dimension(22, 22));
        button.setPreferredSize(new Dimension(30, 22));
        button.setRequestFocusEnabled(false);
        button.setFocusable(false);
        button.setBorderPainted(false);
        button.setOpaque(false);
        button.setMargin(new Insets(0,0,0,0));
        button.setFont(new Font("serif", 0, 14));
        if (i == chars.length-1) {
            button.setText("nbsp");
            button.setFont(new Font("Dialog",0,10));
            button.setMargin(new Insets(0,0,0,0));
        }
        this.add(button, null);
    }
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:21,代码来源:CharTablePanel.java

示例3: getToolbarPresenter

import javax.swing.JButton; //导入方法依赖的package包/类
public static Component getToolbarPresenter(Action action) {
    JButton button = new JButton(action);
    button.setBorderPainted(false);
    button.setOpaque(false);
    button.setText(null);
    button.putClientProperty("hideActionText", Boolean.TRUE); // NOI18N
    Object icon = action.getValue(Action.SMALL_ICON);
    if (icon == null) {
        icon = ImageUtilities.loadImageIcon("org/netbeans/modules/dlight/terminal/action/local_term.png", false);// NOI18N
    }
    if (!(icon instanceof Icon)) {
        throw new IllegalStateException("No icon provided for " + action); // NOI18N
    }
    button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) icon));
    return button;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TerminalSupportImpl.java

示例4: init

import javax.swing.JButton; //导入方法依赖的package包/类
void init(){
	panel=new JPanel();
	panel.setLayout(new MigLayout("insets 0 5 0 0","[grow,fill]rel[right]", "[]0[]"));
	panel.setOpaque(true);
	panel.setBackground(color_normal);
	addressLabel=new JLabel("");
	panel.add(addressLabel,"");
	addressLabel.setOpaque(false);
	
	button_remove=new JButton("x");
	//panel.add(button_remove,"align right");
	button_remove.setOpaque(false);
	button_remove.setContentAreaFilled(false);
	button_remove.setBorderPainted(false);
	button_remove.setMargin(new Insets(0, 10, 0, 10));
	button_remove.addActionListener(new ActionListener() {
		
		@Override
		public void actionPerformed(ActionEvent e) {
			System.out.println(e);
		}
	});

}
 
开发者ID:jonasxiao,项目名称:FinalSpeed,代码行数:25,代码来源:AddressCellRenderer.java

示例5: addActions

import javax.swing.JButton; //导入方法依赖的package包/类
private void addActions(JToolBar tb, Action[] actions) {
    tb.removeAll();
    boolean visible = false;
    if (actions != null) {
        for (Action a : actions) {
            if (a != null) {
                JButton btn = tb.add(a);
                btn.setBorder(new javax.swing.border.EmptyBorder(0, 2, 0, 2));
                btn.setBorderPainted(false);
                btn.setContentAreaFilled(false);
                btn.setRolloverEnabled(false);
                btn.setOpaque(false);
                btn.setFocusable(false);
                visible = true;
            } else {
                tb.add(new JSeparator(JSeparator.VERTICAL));
            }
        }
    }
    tb.setVisible(visible);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:WatchAnnotationProvider.java

示例6: 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

示例7: SyncChangesBar

import javax.swing.JButton; //导入方法依赖的package包/类
public SyncChangesBar(FileListPanel fileList, Backend backend)
{
	this.backend = backend;

	label = new JLabel(" "); //$NON-NLS-1$
	label.setFont(label.getFont().deriveFont(Font.BOLD));

	JButton button = new JButton(new SynchroniseChangesAction(backend, fileList));
	button.setOpaque(false);

	setOpaque(true);
	setBackground(Color.RED);
	label.setForeground(Color.WHITE);

	setLayout(new BorderLayout());
	add(label, BorderLayout.CENTER);
	add(button, BorderLayout.EAST);

	refresh();
}
 
开发者ID:equella,项目名称:Equella,代码行数:21,代码来源:SyncChangesBar.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: buildErrorLabel

import javax.swing.JButton; //导入方法依赖的package包/类
private JComponent buildErrorLabel() {
    Component header = getContentHeader();
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque( false );

    int row = 0;
    if( null != header ) {
        panel.add( header,  new GridBagConstraints(0,row++,1,1,1.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
    }

    panel.add( new JLabel(BundleSupport.getLabel("ErrLoadingFeed")),  // NOI18N
            new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    JButton button = new JButton();
    Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "Reload" ) );  // NOI18N
    button.setOpaque( false );
    button.addActionListener( new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            lastReload = 0;
            reload();
        }
    });
    panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
            GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:RSSFeed.java

示例10: createButton

import javax.swing.JButton; //导入方法依赖的package包/类
static JButton createButton(String text, String imageName, String actionCommand) {
	final JButton button = new JButton();
	button.setOpaque(false);
	button.setHorizontalAlignment(SwingConstants.LEADING);
	if (text != null) {
		button.setText(text);
	}
	if (imageName != null) {
		button.setIcon(DcdUiHelper.createIcon(imageName));
	}
	if (actionCommand != null) {
		button.setActionCommand(actionCommand);
	}
	return button;
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:16,代码来源:DcdUiHelper.java

示例11: stylizeButton

import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton(JButton b){
	Border thickBorder = new LineBorder(Color.WHITE, 3);
	b.setFont(new Font("Arial", Font.BOLD, 18));
   	b.setBorder(thickBorder);
	b.setContentAreaFilled(false);
	b.setOpaque(true);
	b.setBackground(Color.BLACK);
	b.setForeground(Color.WHITE);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:10,代码来源:SplashPage.java

示例12: stylizeButton

import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton(JButton b){
	Border thickBorder = new LineBorder(Color.WHITE, 3);
   		b.setBorder(thickBorder);
	b.setContentAreaFilled(false);
	b.setOpaque(true);
	b.setBackground(Color.BLACK);
	b.setForeground(Color.WHITE);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:9,代码来源:TrainC.java

示例13: 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

示例14: addImpl

import javax.swing.JButton; //导入方法依赖的package包/类
@Override
protected void addImpl( Component comp, Object constraints, int index ) {
    super.addImpl( comp, constraints, index ); 
    if( comp instanceof JButton ) {
        JButton btn = (JButton) comp;
        btn.setContentAreaFilled( false );
        btn.setOpaque( false );
        btn.setBorder( BorderFactory.createEmptyBorder(2,2,2,2) );
        btn.setFocusable( false );
        btn.setBorderPainted( false );
        btn.setRolloverEnabled( false );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ControlsToolbar.java

示例15: stylizeButton

import javax.swing.JButton; //导入方法依赖的package包/类
public void stylizeButton(JButton b){
	Border thickBorder = new LineBorder(Color.WHITE, 3);
   	b.setBorder(thickBorder);
	b.setContentAreaFilled(false);
	b.setOpaque(true);
	b.setBackground(Color.BLACK);
	b.setForeground(Color.WHITE);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:9,代码来源:TrackModelGUI.java


注:本文中的javax.swing.JButton.setOpaque方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。