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


Java AbstractButton.isSelected方法代碼示例

本文整理匯總了Java中javax.swing.AbstractButton.isSelected方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractButton.isSelected方法的具體用法?Java AbstractButton.isSelected怎麽用?Java AbstractButton.isSelected使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.AbstractButton的用法示例。


在下文中一共展示了AbstractButton.isSelected方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removeButtonContentAreaAndBorder

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private static void removeButtonContentAreaAndBorder(AbstractButton button) {
    boolean canRemove = true;
    if (button instanceof JToggleButton) {
        canRemove = !button.isSelected();
    }
    if (canRemove) {
        button.setContentAreaFilled(false);
        button.setBorderPainted(false);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:SearchButton.java

示例2: getDefaultComponent

import javax.swing.AbstractButton; //導入方法依賴的package包/類
public Component getDefaultComponent(Container aContainer) {
    Component c = getFirstComponent(aContainer);
    
    if (c instanceof AbstractButton) {
        ButtonModel bm = ((AbstractButton)c).getModel();
        if (bm instanceof DefaultButtonModel) {
            ButtonGroup bg = ((DefaultButtonModel)bm).getGroup();
            Enumeration<AbstractButton> en = bg == null ? null : bg.getElements();
            while (en != null && en.hasMoreElements()) {
                AbstractButton ab = en.nextElement();
                if (ab.isSelected()) return ab;
            }
        }
    }
    
    return c;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ProfilerPopup.java

示例3: getSelectedButtonText

import javax.swing.AbstractButton; //導入方法依賴的package包/類
String getSelectedButtonText(ButtonGroup buttonGroup) {
	    for (Enumeration buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
	        AbstractButton button = (AbstractButton) buttons.nextElement();

	        if (button.isSelected()) {
	            return button.getText();
	        }
	    }
	    return null;
}
 
開發者ID:srilekhadasari,項目名稱:online-quiz-application-in-java-with-jdbc-using-swing-login-registration-timer,代碼行數:11,代碼來源:Questions.java

示例4: refresh

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private void refresh(final AbstractButton b) {
    b.setBackground(UIUtils.getProfilerResultsBackground());
    boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
    boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
    b.setOpaque(filled);
    b.setContentAreaFilled(filled);
    b.repaint();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:TransparentToolBar.java

示例5: getSelected

import javax.swing.AbstractButton; //導入方法依賴的package包/類
public JRadioButton getSelected() {
    Enumeration<AbstractButton> en = radioGroup.getElements();
    while (en.hasMoreElements()) {
        AbstractButton b = en.nextElement();
        if (b.isSelected()) {
            return (JRadioButton)b;
        }
    }
    throw new IllegalStateException();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:AvailableProvidersPanel.java

示例6: isSelectionEmpty

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
public boolean isSelectionEmpty()
{
	for( AbstractButton button : choices.keySet() )
	{
		if( button.isSelected() )
		{
			return false;
		}
	}
	return true;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:13,代碼來源:RadioButtonChoiceList.java

示例7: itemStateChanged

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
public void itemStateChanged(ItemEvent e)
{
	AbstractButton button = (AbstractButton) e.getSource();
	if( button.isSelected() )
	{
		choiceSelected(button);
	}
	else
	{
		choiceDeselected(button);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:RadioButtonChoiceList.java

示例8: getSelectedButtonText

import javax.swing.AbstractButton; //導入方法依賴的package包/類
/**
 * Determines the label of the current selected button.
 * @param buttonGroup
 * @return The text label of the selected button.
 */
public static String getSelectedButtonText(ButtonGroup buttonGroup) {
    for (Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
        AbstractButton button = buttons.nextElement();

        if (button.isSelected()) {
            return button.getText();
        }
    }

    return null;
}
 
開發者ID:LEB-EPFL,項目名稱:SASS,代碼行數:17,代碼來源:ButtonGroupUtils.java

示例9: getSelectedButton

import javax.swing.AbstractButton; //導入方法依賴的package包/類
private String getSelectedButton(ButtonGroup bGroup) {
    for (Enumeration<AbstractButton> buttons = bGroup.getElements(); buttons.hasMoreElements();) {
        AbstractButton button = buttons.nextElement();
        if (button.isSelected()) {
            return button.getText();
        }
    }
    return "None";
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:10,代碼來源:CognizantITSSettings.java

示例10: isEnabledAndSelected

import javax.swing.AbstractButton; //導入方法依賴的package包/類
@Override
protected boolean isEnabledAndSelected(AbstractButton button)
{
	return button.isEnabled() && button.isSelected();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:6,代碼來源:RadioButtonChoiceList.java

示例11: mousePressed

import javax.swing.AbstractButton; //導入方法依賴的package包/類
public void mousePressed( MouseEvent evt ) {
	dragWindow = false;
	dragMap = false;
	if( evt.isControlDown() ) {
		return;
	} 

	Rectangle r = map.getVisibleRect();
	if (rect == null) return;

	r.x += x;
	r.y += y;
	r.width = this.w;
	r.height = this.h;
	if( r.contains( evt.getPoint() ) ) {
		evt.consume();
		AbstractButton b = map.getMapTools().profileB;
		profileEnabled = b.isSelected();
		if (profileEnabled) b.doClick();

		dragWindow = true;
		lastPoint = evt.getPoint();
		r.x+=rect.x;
		r.y+=rect.y;
		r.width=(int)rect.width;
		r.height=(int)rect.height;
		if (r.contains(evt.getPoint())){
			dragMap=true;
			dragWindow = false;
			drawRect();
		} else if (rect.x+rect.width>this.w){
			r.x-=this.w;
			if (r.contains(evt.getPoint())) {
				rect.x-=this.w;
				dragMap=true;
				dragWindow = false;
				drawRect();
			}
		}
		else 
			drawBox();
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:44,代碼來源:LocationInset.java


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