当前位置: 首页>>代码示例>>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;未经允许,请勿转载。