commit
f576668d70
@ -0,0 +1,29 @@
|
||||
### IntelliJ IDEA ###
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/OneTest.iml" filepath="$PROJECT_DIR$/OneTest.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/one/one.iml" filepath="$PROJECT_DIR$/one/one.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4794a12a-bcab-4c55-9a87-7c9e16649e91" name="更改" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OneTest.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/one/one.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/one/src/Main.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/one/src/test1.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"customColor": "",
|
||||
"associatedIndex": -1
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="2nYacmoqPx19yar92TpDiJtHfl3" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||
<ConfirmationsSetting value="2" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"git-widget-placeholder": "master",
|
||||
"jdk.selected.JAVA_MODULE": "1.8",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="4794a12a-bcab-4c55-9a87-7c9e16649e91" name="更改" comment="" />
|
||||
<created>1729152544998</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1729152544998</updated>
|
||||
<workItem from="1729152546072" duration="47000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,5 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class test1 extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) {
|
||||
primaryStage.setTitle("进制转换器");
|
||||
|
||||
// 创建布局
|
||||
GridPane grid = new GridPane();
|
||||
grid.setPadding(new Insets(10));
|
||||
grid.setVgap(8);
|
||||
grid.setHgap(10);
|
||||
|
||||
// 输入框
|
||||
Label inputLabel = new Label("输入数值:");
|
||||
GridPane.setConstraints(inputLabel, 0, 0);
|
||||
TextField inputField = new TextField();
|
||||
GridPane.setConstraints(inputField, 1, 0);
|
||||
|
||||
// 源进制选择
|
||||
Label fromBaseLabel = new Label("源进制:");
|
||||
GridPane.setConstraints(fromBaseLabel, 0, 1);
|
||||
ComboBox<Integer> fromBaseCombo = new ComboBox<>();
|
||||
fromBaseCombo.getItems().addAll(2, 10, 16);
|
||||
fromBaseCombo.setValue(10); // 默认选择十进制
|
||||
GridPane.setConstraints(fromBaseCombo, 1, 1);
|
||||
|
||||
// 目标进制选择
|
||||
Label toBaseLabel = new Label("目标进制:");
|
||||
GridPane.setConstraints(toBaseLabel, 0, 2);
|
||||
ComboBox<Integer> toBaseCombo = new ComboBox<>();
|
||||
toBaseCombo.getItems().addAll(2, 10, 16);
|
||||
toBaseCombo.setValue(10); // 默认选择十进制
|
||||
GridPane.setConstraints(toBaseCombo, 1, 2);
|
||||
|
||||
// 转换按钮
|
||||
Button convertButton = new Button("转换");
|
||||
GridPane.setConstraints(convertButton, 1, 3);
|
||||
|
||||
// 输出框
|
||||
Label resultLabel = new Label("结果:");
|
||||
GridPane.setConstraints(resultLabel, 0, 4);
|
||||
TextField resultField = new TextField();
|
||||
resultField.setEditable(false);
|
||||
GridPane.setConstraints(resultField, 1, 4);
|
||||
|
||||
// 处理转换逻辑
|
||||
convertButton.setOnAction(e -> {
|
||||
String input = inputField.getText();
|
||||
int fromBase = fromBaseCombo.getValue();
|
||||
int toBase = toBaseCombo.getValue();
|
||||
String result = convertBase(input, fromBase, toBase);
|
||||
resultField.setText(result);
|
||||
});
|
||||
|
||||
// 添加所有控件到布局
|
||||
grid.getChildren().addAll(inputLabel, inputField, fromBaseLabel, fromBaseCombo,
|
||||
toBaseLabel, toBaseCombo, convertButton, resultLabel, resultField);
|
||||
|
||||
// 创建场景并显示
|
||||
Scene scene = new Scene(grid, 400, 200);
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
private String convertBase(String value, int fromBase, int toBase) {
|
||||
try {
|
||||
// 将输入值从源进制转换为十进制
|
||||
int decimalValue = Integer.parseInt(value, fromBase);
|
||||
// 将十进制转换为目标进制
|
||||
return Integer.toString(decimalValue, toBase).toUpperCase();
|
||||
} catch (NumberFormatException e) {
|
||||
return "输入无效";
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
Loading…
Reference in new issue