gpt4 book ai didi

java - JCheckBox 已检查,但它显示 else 语句

转载 作者:行者123 更新时间:2023-11-30 05:51:39 27 4
gpt4 key购买 nike

我为学校项目创建了医院管理系统,我认为我占系统的 35%,在患者登记处,我在这里遇到了很多困难,这里是“我在首页的 JFrame1”

First Page

St 第一页 我有过去的病史并通过其他选项查看症状,因此如果我不选中任何 JCheckBox 控件(包括 None 复选框),但我单击下一个按钮,它将如果您没有任何既往病史,则会弹出该选项,代码如下

if(!jCheckBox1.isSelected() || !jCheckBox2.isSelected() || !jCheckBox3.isSelected() || !jCheckBox4.isSelected() || !jCheckBox5.isSelected() || !jCheckBox6.isSelected() || !jCheckBox7.isSelected() || !jCheckBox8.isSelected() || !jCheckBox9.isSelected() || !jCheckBox10.isSelected() || !jCheckBox11.isSelected() || !jCheckBox12.isSelected()|| !jCheckBox13.isSelected() || !jCheckBox14.isSelected() || !jCheckBox15.isSelected() || !jCheckBox16.isSelected() || !jCheckBox17.isSelected() || 
!jCheckBox18.isSelected() || !jCheckBox19.isSelected() || !jCheckBox20.isSelected() || !jCheckBox21.isSelected() || !jCheckBox104.isSelected() || !jCheckBox102.isSelected() || !jCheckBox100.isSelected() || !jCheckBox98.isSelected() || !jCheckBox111.isSelected() || !jCheckBox94.isSelected() || !jCheckBox95.isSelected() || !jCheckBox99.isSelected() || !jCheckBox109.isSelected() || !jCheckBox112.isSelected() || !jCheckBox110.isSelected() || !jCheckBox97.isSelected() ||
!jCheckBox107.isSelected() || !jCheckBox101.isSelected() || !jCheckBox106.isSelected() || !jCheckBox96.isSelected() || !jCheckBox105.isSelected() || !jCheckBox92.isSelected() || !jCheckBox103.isSelected()|| !jCheckBox93.isSelected() || !jCheckBox105.isSelected() || !jCheckBox115.isSelected() || !jCheckBox114.isSelected() || !jCheckBox113.isSelected() || !jCheckBox121.isSelected() || !jCheckBox120.isSelected() || !jCheckBox119.isSelected() || !jCheckBox118.isSelected() ||
!jCheckBox117.isSelected()|| !jCheckBox116.isSelected() || !jCheckBox127.isSelected()){
//JOptionPane.showMessageDialog(null, "Medical History is empty","Error",JOptionPane.WARNING_MESSAGE);
int yesOrno = JOptionPane.showConfirmDialog(null, "No medical History?", "Proceed",JOptionPane.YES_NO_OPTION);
if(yesOrno == 0){
jCheckBox127.setSelected(true);
PARENTPANEL.removeAll();
PARENTPANEL.add(ALLERGIES);
PARENTPANEL.repaint();
PARENTPANEL.revalidate();

jCheckBox1.setEnabled(false);
jCheckBox1.setSelected(false);

jCheckBox2.setEnabled(false);
jCheckBox2.setSelected(false);

jCheckBox3.setEnabled(false);
jCheckBox3.setSelected(false);

JOptionPane Popup even when I already select one

我已经选中了复选框并单击“下一步”,但总是出现弹出窗口。

最佳答案

if 子句中的 || 更改为 && 可能会节省您的时间。

关于java - JCheckBox 已检查,但它显示 else 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53799361/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com