本文整理汇总了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();
}
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
}
}
}
}
示例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);
}
示例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;
}
示例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);
}
}
}
示例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 !");
}
}
}
示例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();
}
示例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();
}