增加未选择难度时的处理

liwentao_branch
Teptao 4 months ago
parent b2967d0c81
commit 8e0ea7bd6d

@ -9,10 +9,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="1201acd7-f240-4a23-9c12-26bf9afcb8cb" name="更改" comment="合并更改">
<change afterPath="$PROJECT_DIR$/.idea/artifacts/TestSystem_jar.xml" afterDir="false" />
<list default="true" id="1201acd7-f240-4a23-9c12-26bf9afcb8cb" name="更改" comment="修复除零bug">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/com/mathapp/services/DataPersistence.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/mathapp/services/DataPersistence.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/com/mathapp/problemGenerators/HighSchoolProblemGenerator.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/mathapp/problemGenerators/HighSchoolProblemGenerator.class" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -47,10 +46,10 @@
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="KubernetesApiPersistence"><![CDATA[{}]]></component>
<component name="KubernetesApiProvider"><![CDATA[{
"isMigrated": true
}]]></component>
<component name="KubernetesApiPersistence">{}</component>
<component name="KubernetesApiProvider">{
&quot;isMigrated&quot;: true
}</component>
<component name="ProjectColorInfo">{
&quot;customColor&quot;: &quot;&quot;,
&quot;associatedIndex&quot;: 1
@ -61,25 +60,25 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "liwentao__branch",
"kotlin-language-version-configured": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"onboarding.tips.debug.path": "C:/Users/Teptao/Desktop/软件工程导论/结对项目/TestSystem/src/main/java/org/example/Main.java",
"project.structure.last.edited": "工件",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2",
"vue.rearranger.settings.migration": "true",
"应用程序.MathApp.executor": "Run"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;liwentao__branch&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;onboarding.tips.debug.path&quot;: &quot;C:/Users/Teptao/Desktop/软件工程导论/结对项目/TestSystem/src/main/java/org/example/Main.java&quot;,
&quot;project.structure.last.edited&quot;: &quot;工件&quot;,
&quot;project.structure.proportion&quot;: &quot;0.15&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;,
&quot;应用程序.MathApp.executor&quot;: &quot;Run&quot;
}
}]]></component>
}</component>
<component name="RunManager">
<configuration name="MathApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.mathapp.MathApp" />
@ -99,6 +98,7 @@
<item itemvalue="应用程序.MathApp" />
<item itemvalue="应用程序.MathApp" />
<item itemvalue="应用程序.MathApp" />
<item itemvalue="应用程序.MathApp" />
</list>
</recent_temporary>
</component>
@ -160,7 +160,23 @@
<option name="project" value="LOCAL" />
<updated>1760136867337</updated>
</task>
<option name="localTasksCounter" value="6" />
<task id="LOCAL-00006" summary="修复使用用户名登录时无法修改密码的问题">
<option name="closed" value="true" />
<created>1760182983400</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1760182983400</updated>
</task>
<task id="LOCAL-00007" summary="修复除零bug">
<option name="closed" value="true" />
<created>1760183246928</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1760183246928</updated>
</task>
<option name="localTasksCounter" value="8" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -193,6 +209,8 @@
<MESSAGE value="创建maven项目" />
<MESSAGE value="初步框架" />
<MESSAGE value="合并更改" />
<option name="LAST_COMMIT_MESSAGE" value="合并更改" />
<MESSAGE value="修复使用用户名登录时无法修改密码的问题" />
<MESSAGE value="修复除零bug" />
<option name="LAST_COMMIT_MESSAGE" value="修复除零bug" />
</component>
</project>

@ -86,6 +86,15 @@ public class MainMenuPanel extends JPanel {
}
private void handleStart() {
ButtonModel selectedModel = levelGroup.getSelection();
// 关键检查:判断是否有按钮被选中
if (selectedModel == null) {
JOptionPane.showMessageDialog(this, "请先选择一个难度级别!", "选择错误", JOptionPane.WARNING_MESSAGE);
return; // 发现未选择后,直接退出方法,不执行后续逻辑
}
String level = levelGroup.getSelection().getActionCommand();
int count;
try {

Loading…
Cancel
Save