From fc82a1ec5c002b01b1cee4af2ee1395ae8e9efab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=AE=87=E9=93=89?= <2430677357@qq.com> Date: Thu, 17 Oct 2024 16:26:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=88=B6=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 1 - .idea/modules.xml | 1 + Two/Two.iml | 11 +++++ Two/src/Main.java | 5 ++ Two/src/test1.java | 88 +++++++++++++++++++++++++++++++++ out/production/One/Main.class | Bin 0 -> 516 bytes out/production/One/test1.class | Bin 0 -> 4551 bytes out/production/Two/Main.class | Bin 0 -> 516 bytes out/production/Two/test1.class | Bin 0 -> 4567 bytes 9 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 Two/Two.iml create mode 100644 Two/src/Main.java create mode 100644 Two/src/test1.java create mode 100644 out/production/One/Main.class create mode 100644 out/production/One/test1.class create mode 100644 out/production/Two/Main.class create mode 100644 out/production/Two/test1.class diff --git a/.idea/misc.xml b/.idea/misc.xml index 0548357..1f014b5 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/.idea/modules.xml b/.idea/modules.xml index d2a818d..1421c22 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -4,6 +4,7 @@ + \ No newline at end of file diff --git a/Two/Two.iml b/Two/Two.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Two/Two.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Two/src/Main.java b/Two/src/Main.java new file mode 100644 index 0000000..3e59c38 --- /dev/null +++ b/Two/src/Main.java @@ -0,0 +1,5 @@ +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/Two/src/test1.java b/Two/src/test1.java new file mode 100644 index 0000000..ffe12e8 --- /dev/null +++ b/Two/src/test1.java @@ -0,0 +1,88 @@ +import javafx.application.Application; +import javafx.stage.Stage; +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 fromBaseCombo = new ComboBox<>(); + fromBaseCombo.getItems().addAll(2, 8, 10, 16); // 添加八进制 + fromBaseCombo.setValue(10); // 默认选择十进制 + GridPane.setConstraints(fromBaseCombo, 1, 1); + + // 目标进制选择 + Label toBaseLabel = new Label("目标进制:"); + GridPane.setConstraints(toBaseLabel, 0, 2); + ComboBox toBaseCombo = new ComboBox<>(); + toBaseCombo.getItems().addAll(2, 8, 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); + } +} diff --git a/out/production/One/Main.class b/out/production/One/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..baa3095135d94c33157ebcb8e4f7ff41bf99d277 GIT binary patch literal 516 zcmZuuO;5r=5Pb`U(pm*U@LRzXdaxH04;U{d#zXx`FkCz>uz@Apt|>+1&(eb?9{d6R zDC2A~K@xhH*?IH!y_xOz&*v9_6CAk6W6ePowF1^%Y+%#ImW^$O{F#hoa?X%#9(EY4 z3*8qC#Xv^lW)gNqe9yazkaD1VTy=OXP5lR2$xx0-Be>==YSHbGGDEHT5RCW}_Z5!@ zemjX}G-##jJRT6gvY^f2w)G_LiA!nh9HV$_L_F9i*x2!~i#-PKN+_l4&pKB9hK+p> zbu`G?@EJ-o+uQC)^pZKK{W4BONUQ1zHLBAYrS|V=z=XyWJftNmsm46aU_Tm?B9Cfw z(Q;@YM~`g242X^bMTaV%GNYV3`T%=P+b+d?3NkFw*_#q5FH_}U1w}&4<_ko0hd}pmVB&#A`VJeC7ga3#SALH)D~w9 literal 0 HcmV?d00001 diff --git a/out/production/One/test1.class b/out/production/One/test1.class new file mode 100644 index 0000000000000000000000000000000000000000..cdbcaa51b97f9e9f1022aa4e20edfea4ec59db10 GIT binary patch literal 4551 zcmbVQdw3LA75`24F`L~1LP!F`8yZT0(1n1sO(+BclxTRlfx5J6C!0yKu-RE=Cn-^@ zRr`R}+FFXWQY)gB+SW>aY*JEaeJfV2ulmF{fq(RW|MBy8@62p=%hs=7`9AL4x%ZrN z&-tC-Id?V}{(JU3fVKE%6m2*ZfgMF2j*6iuf;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nnz{(W`TqklFkh#1c zi)9wW{HZw=HJFR(Ji8XlQO{qo4J5`)=5!X`i8_@4>s!#UHeLm5tcJwGd1tj-A*= zj-JN9u$yZt{kn)fT#L}76L>cgsHRUx(aqf`y&7R;U5L?_81~^7a{4{Qq=9F-){?a5 z+DOtymH0SuIgUs8780^6=8hr0E?6I&H-=ROtUl8ktX*@4QXr<&(c+<9OJ6~sReC#} ze$Jp*?OfTw6IA~EzYXuD#0*Nm5AT<<4L%a|=XMyP8M)fDt8Ou} z>({9(C+CsndbnP#kBs65vOcJ@vTvL`Z8lv4uIG3IiFG5%(@J`^VKqBVJ9qlr6N-Vh z$fOFlTVyIlpe-_i0XY-N5-_$9qzvH?qZxyQCQR!KB{V9}sFTn{cv1ve?p6~fi&|C4 e;V*nf8R13z4S(j}FCOH(z~GaVc?b{VQ~v{!P{r{8 literal 0 HcmV?d00001 diff --git a/out/production/Two/Main.class b/out/production/Two/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..baa3095135d94c33157ebcb8e4f7ff41bf99d277 GIT binary patch literal 516 zcmZuuO;5r=5Pb`U(pm*U@LRzXdaxH04;U{d#zXx`FkCz>uz@Apt|>+1&(eb?9{d6R zDC2A~K@xhH*?IH!y_xOz&*v9_6CAk6W6ePowF1^%Y+%#ImW^$O{F#hoa?X%#9(EY4 z3*8qC#Xv^lW)gNqe9yazkaD1VTy=OXP5lR2$xx0-Be>==YSHbGGDEHT5RCW}_Z5!@ zemjX}G-##jJRT6gvY^f2w)G_LiA!nh9HV$_L_F9i*x2!~i#-PKN+_l4&pKB9hK+p> zbu`G?@EJ-o+uQC)^pZKK{W4BONUQ1zHLBAYrS|V=z=XyWJftNmsm46aU_Tm?B9Cfw z(Q;@YM~`g242X^bMTaV%GNYV3`T%=P+b+d?3NkFw*_#q5FH_}U1w}&4<_ko0hd}pmVB&#A`VJeC7ga3#SALH)D~w9 literal 0 HcmV?d00001 diff --git a/out/production/Two/test1.class b/out/production/Two/test1.class new file mode 100644 index 0000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