当前位置: 首页 > news >正文

免费网站注册 建站网站备案ip查询系统

免费网站注册 建站,网站备案ip查询系统,长沙信息发布平台,微信公众号如何发布wordpress当显示一组JRadioButton时#xff0c;最初没有选择任何一个(除非您以编程方式强制执行)。我想要能够将按钮恢复到该状态#xff0c;即使在用户已经选择了一个之后#xff0c;即#xff0c;不应该选择任何按钮。然而#xff0c;使用通常的嫌疑不会提供所需的效果#xff1…当显示一组JRadioButton时最初没有选择任何一个(除非您以编程方式强制执行)。我想要能够将按钮恢复到该状态即使在用户已经选择了一个之后即不应该选择任何按钮。然而使用通常的嫌疑不会提供所需的效果调用’setSelected(false)’在每个按钮不工作。有趣的是当按钮未放入ButtonGroup时它会工作 – 不幸的是后者是JRadioButtons要求是互斥的。此外使用javax.swing.ButtonGroup的setSelected(ButtonModelboolean)方法不会做我想要的。我把一个小程序来展示效果两个单选按钮和一个JButton。单击JButton应取消选择单选按钮以使窗口看起来与它首次弹出时的完全一样。import java.awt.Container;import java.awt.GridLayout;import java.awt.event.*;import javax.swing.*;/*** This class creates two radio buttons and a JButton. Initially, none* of the radio buttons is selected. Clicking on the JButton should* always return the radio buttons into that initial state, i.e.,* should disable both radio buttons.*/public class RadioTest implements ActionListener {/* create two radio buttons and a group */private JRadioButton button1 new JRadioButton(button1);private JRadioButton button2 new JRadioButton(button2);private ButtonGroup group new ButtonGroup();/* clicking this button should unselect both button1 and button2 */private JButton unselectRadio new JButton(Unselect radio buttons.);/* In the constructor, set up the group and event listening */public RadioTest() {/* put the radio buttons in a group so they become mutually* exclusive -- without this, unselecting actually works! */group.add(button1);group.add(button2);/* listen to clicks on unselectRadio button */unselectRadio.addActionListener(this);}/* called when unselectRadio is clicked */public void actionPerformed(ActionEvent e) {/* variant1: disable both buttons directly.* ...doesnt work */button1.setSelected(false);button2.setSelected(false);/* variant2: disable the selection via the button group.* ...doesnt work either */group.setSelected(group.getSelection(), false);}/* Test: create a JFrame which displays the two radio buttons and* the unselect-button */public static void main(String[] args) {JFrame frame new JFrame();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);RadioTest test new RadioTest();Container contentPane frame.getContentPane();contentPane.setLayout(new GridLayout(3,1));contentPane.add(test.button1);contentPane.add(test.button2);contentPane.add(test.unselectRadio);frame.setSize(400, 400);frame.setVisible(true);}}任何想法任何人谢谢
http://www.yutouwan.com/news/147368/

相关文章:

  • 药品网站建设南宁伯才网络
  • 做企业网站有效果吗做网站需要投标吗
  • 中国工厂网站官方网站网站开发四个重点
  • 更换域名对网站的影响培训网络营销的机构
  • 网站建设风险评估手机登录wordpress
  • 汾阳网站建设做财经直播网站
  • WordPress建站怎么交付网站 禁止查看源码
  • 专业型网站网站辽宁住房和城乡建设部网站
  • 湖北专业网站建设公司wordpress大学最新模板下载
  • 网站建设申报方案济南做网站互联网公司有哪些
  • 嘉定网站公司做跨境的网站有哪些
  • 如何去掉Wordpress访问网站网站建设单子
  • asp.net 网站的头部和底部怎么来做 include如何通过做网站和公众号盈利
  • 德宏企业网站建设公司网站建设感想
  • 广州网站建设c2c网站审核备案 几天
  • 洞口网站开发公司推荐网站一元空间有哪些呀
  • 免费ftp网站滴滴网站建设流程
  • 汽车网站制作模板做印刷网站公司
  • 中国建设银行互联网网站首页石河子网站建设
  • 网站维保方法企业 网站 程序
  • 网站平台建设什么意思3d建模平台
  • 大学生网站建设小结wordpress能做论坛吗
  • 网站建设 东方网景vue消息推送和系统通知
  • 网站建设自学网站开发业务流程图
  • 企业网站seo优帮云做网站前端用什么
  • 擦边球做网站挣钱做海外视频的网站有哪些
  • 网站建设服务属于信息技术服务吗微信管理平台登录
  • 大型百度云网站建设关于做电影的网站设计
  • 企业网站找谁做摄影网站功能设计
  • 网站反链暴增怎么回事湄洲岛网站建设