1.降级到jdk1.8

This commit is contained in:
JianGuo 2024-06-14 13:50:16 +08:00
parent f1eb943f08
commit 52a99a220a
4 changed files with 9 additions and 9 deletions

View File

@ -15,7 +15,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.java.version>21</project.java.version> <project.java.version>1.8</project.java.version>
</properties> </properties>
<dependencies> <dependencies>
@ -28,7 +28,6 @@
<groupId>com.formdev</groupId> <groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId> <artifactId>flatlaf</artifactId>
<version>3.4.1</version> <version>3.4.1</version>
<classifier>no-natives</classifier>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -63,8 +63,8 @@ public class MainWindow extends JFrame {
// 将JScrollPane添加到窗口中 // 将JScrollPane添加到窗口中
getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(scrollPane, BorderLayout.CENTER);
JLabel adress = new JLabel(); JLabel address = new JLabel();
adress.setText("地址:"); address.setText("地址:");
JTextField textField = new JTextField(20); // 参数20指定了文本框的列数 JTextField textField = new JTextField(20); // 参数20指定了文本框的列数
JButton sendButton = new JButton("连接"); JButton sendButton = new JButton("连接");
JButton stopButton = new JButton("断开"); JButton stopButton = new JButton("断开");
@ -88,16 +88,17 @@ public class MainWindow extends JFrame {
stopButton.setEnabled(true); stopButton.setEnabled(true);
Client.init(host, Integer.parseInt(port)); Client.init(host, Integer.parseInt(port));
} catch (Exception ex) { } catch (Exception ex) {
setLogText("连接失败..."); sendButton.setEnabled(true);
stopButton.setEnabled(false); stopButton.setEnabled(false);
setStatusLabel("已连接", Color.RED); setStatusLabel("未连接", Color.RED);
JOptionPane.showMessageDialog(this, "连接失败,请检查...", "连接", JOptionPane.ERROR_MESSAGE);
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
}).start(); }).start();
}); });
JPanel northPanel = new JPanel(); JPanel northPanel = new JPanel();
northPanel.add(adress); northPanel.add(address);
northPanel.add(textField); northPanel.add(textField);
northPanel.add(sendButton); northPanel.add(sendButton);
northPanel.add(statusLabel, BorderLayout.WEST); northPanel.add(statusLabel, BorderLayout.WEST);

View File

@ -15,7 +15,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.java.version>21</project.java.version> <project.java.version>1.8</project.java.version>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -15,7 +15,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.java.version>21</project.java.version> <project.java.version>1.8</project.java.version>
</properties> </properties>
<dependencies> <dependencies>