本文整理匯總了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();
}