请问,然后让JdbRadiaButton初始为一个选种?我selected属性设为true时,可以选中,但会报错,为什么?

解决方案 »

  1.   

        ButtonGroup buttonGroup1 = new ButtonGroup();
        JdbRadioButton dbRadioButton0 = new JdbRadioButton();
        JdbRadioButton dbRadioButton1 = new JdbRadioButton();
        dbRadioButton0.setEnabled(false);
        dbRadioButton0.setSelected(false);
        dbRadioButton0.setText("使用");
        dbRadioButton0.setButtonGroup(buttonGroup1);
        dbRadioButton0.setColumnName("Status");
        dbRadioButton0.setDataSet(queryDataSetResource);
        dbRadioButton0.setSelectedDataValue("1");
        dbRadioButton1.setEnabled(false);
        dbRadioButton1.setText("未使用");
        dbRadioButton1.setButtonGroup(buttonGroup1);
        buttonGroup1.add(dbRadioButton1);
        buttonGroup1.add(dbRadioButton0);
        dbRadioButton1.setColumnName("Status");
        dbRadioButton1.setDataSet(queryDataSetResource);
        dbRadioButton1.setSelectedDataValue("0");
    代码就是这样子的,有什么地方错了?为什么把dbRadioButton0.setSelected(false);改为dbRadioButton0.setSelected(true);就出错?
      

  2.   

    貌似你的设置重复,上面已经设置了buttongroup,下面有添加了一次
    还有,报的什么错?不把错误发出来,很难知道是什么问题!