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


Java JToggleButton.isSelected方法代碼示例

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


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

示例1: actionPerformed

import javax.swing.JToggleButton; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
	for (JToggleButton button : primaryButtons) {
		if (button != e.getSource() && button.isSelected()) {
			button.setSelected(false);
		} else if (button == e.getSource() && !button.isSelected()) {
			button.setSelected(true);
		}

		if (button.isSelected()) {
			button.setFont(button.getFont().deriveFont(Font.BOLD));
		} else {
			button.setFont(button.getFont().deriveFont(Font.PLAIN));
		}
	}

	if (secondaryButton != null) {
		if (secondaryButton != e.getSource() && secondaryButton.isSelected()) {
			secondaryButton.clearMenuSelection();
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:23,代碼來源:ToggleButtonGroup.java

示例2: stateChanged

import javax.swing.JToggleButton; //導入方法依賴的package包/類
@Override
public void stateChanged(ChangeEvent e) {
    Object o = e.getSource();
    if (o instanceof JToggleButton) {
        JToggleButton b = (JToggleButton) o;
        if (b.isSelected()) {
            if (!autoFollowScroll) {
                scrollToBottom();
            }
            autoFollowScroll = true;
        } else {
            autoFollowScroll = false;
        }
    }

}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:17,代碼來源:LogTableManager.java

示例3: countSelectedButtons

import javax.swing.JToggleButton; //導入方法依賴的package包/類
/**
 * Count the selected and enabled buttons.
 *
 * @return
 */
public int countSelectedButtons()
{
    int count = 0;

    for (JToggleButton button : buttons)
    {
        if (button.isSelected() && button.isEnabled())
        {
            count++;
        }
    }

    return count;
}
 
開發者ID:nfriaa,項目名稱:swing-memory-game,代碼行數:20,代碼來源:FrameGame.java

示例4: jToggleButton_openAnalysisToolbarActionPerformed

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void jToggleButton_openAnalysisToolbarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton_openAnalysisToolbarActionPerformed
    boolean visible = jToggleButton_openAnalysisToolbar.isSelected();
    jPanel_mainToolbar.setVisible(visible);
    if (!visible) {
        //See if one of the tools in this bar is active. If so, deactivate it.
        Component[] components = jPanel_mainToolbar.getComponents();
        for (Component c : components) {
            if (c instanceof JToggleButton) {
                JToggleButton button = (JToggleButton) c;
                if (button.isSelected()) {
                    jToggleButton_deactivateAllTools.setSelected(true);
                    break;
                }
            }
        }
    }
}
 
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:18,代碼來源:VehicleCommanderJFrame.java

示例5: actionPerformed

import javax.swing.JToggleButton; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
    ActiveBreakpoints ab = this.ab;
    if (ab == null || !ab.canDeactivateBreakpoints()) {
        return ;
    }
    JToggleButton button = (JToggleButton) e.getSource();
    final boolean active = !button.isSelected();
    ab.setBreakpointsActive(active);
    setTooltip(button, active, true);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:BreakpointsViewButtons.java

示例6: countRemainingButtons

import javax.swing.JToggleButton; //導入方法依賴的package包/類
/**
 * Count the remaining and enabled buttons.
 *
 * @return
 */
public int countRemainingButtons()
{
    int count = 0;

    for (JToggleButton button : buttons)
    {
        if (!button.isSelected() && button.isEnabled())
        {
            count++;
        }
    }

    return count;
}
 
開發者ID:nfriaa,項目名稱:swing-memory-game,代碼行數:20,代碼來源:FrameGame.java

示例7: unSelectAllButtons

import javax.swing.JToggleButton; //導入方法依賴的package包/類
/**
 * Unselect all enabled buttons.
 */
public void unSelectAllButtons()
{
    for (JToggleButton button : buttons)
    {
        if (button.isSelected() && button.isEnabled())
        {
            button.setSelected(false);
        }
    }
}
 
開發者ID:nfriaa,項目名稱:swing-memory-game,代碼行數:14,代碼來源:FrameGame.java

示例8: verify

import javax.swing.JToggleButton; //導入方法依賴的package包/類
/**
 * Verify if good attempt or not and if game success or not.
 */
public void verify()
{
    ArrayList<JToggleButton> selection = new ArrayList<>();

    for (JToggleButton button : buttons)
    {
        if (button.isSelected() && button.isEnabled())
        {
            selection.add(button);
        }
    }

    if (selection.size() == 2)
    {
        log.debug("First selected : " + selection.get(0).getName());
        log.debug("Second selected : " + selection.get(1).getName());

        if (selection.get(0).getName().equals(selection.get(1).getName()))
        {
            selection.get(0).setEnabled(false);
            selection.get(1).setEnabled(false);
            log.debug("Good Attempt !");
            log.debug("Remaining buttons : " + countRemainingButtons());
            if (countRemainingButtons() == 0)
            {
                log.debug("Congratulation, game successfully completed !");
                updatejLabelFooterText(true);
                verifyBestScore();
            }
        } else
        {
            log.debug("Wrong Attempt !");
        }
    }
}
 
開發者ID:nfriaa,項目名稱:swing-memory-game,代碼行數:39,代碼來源:FrameGame.java

示例9: ToggleToggler

import javax.swing.JToggleButton; //導入方法依賴的package包/類
public ToggleToggler(JToggleButton b,JToggleButton no){
	this.b=b;
	this.no=no;
	b.addActionListener(this);
	b.addChangeListener(this);
	wasSelected=b.isSelected();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:8,代碼來源:MapTools.java

示例10: ToggleToggler

import javax.swing.JToggleButton; //導入方法依賴的package包/類
public ToggleToggler(JToggleButton b,JToggleButton no) {
	this.b=b;
	this.no=no;
	b.addActionListener(this);
	b.addChangeListener(this);
	wasSelected=b.isSelected();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:8,代碼來源:XMImage.java


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