From 08945375910095772dabb27cad6a523194c9de55 Mon Sep 17 00:00:00 2001 From: msksbr Date: Fri, 21 Jun 2024 17:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=AD=A6gui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/GUItest/.vscode/settings.json | 7 +++++++ test/GUItest/README.md | 18 ++++++++++++++++++ test/GUItest/src/frameTest/Main.java | 25 +++++++++++++++++++++++++ test/GUItest/src/mutiFrame/Main.java | 10 ++++++++++ test/GUItest/src/mutiFrame/myFrame.java | 13 +++++++++++++ test/others/myFrame.java | 16 ++++++++++++++++ 6 files changed, 89 insertions(+) create mode 100644 test/GUItest/.vscode/settings.json create mode 100644 test/GUItest/README.md create mode 100644 test/GUItest/src/frameTest/Main.java create mode 100644 test/GUItest/src/mutiFrame/Main.java create mode 100644 test/GUItest/src/mutiFrame/myFrame.java create mode 100644 test/others/myFrame.java diff --git a/test/GUItest/.vscode/settings.json b/test/GUItest/.vscode/settings.json new file mode 100644 index 0000000..e112a70 --- /dev/null +++ b/test/GUItest/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "java.project.sourcePaths": ["src"], + "java.project.outputPath": "bin", + "java.project.referencedLibraries": [ + "lib/**/*.jar" + ] +} diff --git a/test/GUItest/README.md b/test/GUItest/README.md new file mode 100644 index 0000000..7c03a53 --- /dev/null +++ b/test/GUItest/README.md @@ -0,0 +1,18 @@ +## Getting Started + +Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. + +## Folder Structure + +The workspace contains two folders by default, where: + +- `src`: the folder to maintain sources +- `lib`: the folder to maintain dependencies + +Meanwhile, the compiled output files will be generated in the `bin` folder by default. + +> If you want to customize the folder structure, open `.vscode/settings.json` and update the related settings there. + +## Dependency Management + +The `JAVA PROJECTS` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-dependency#manage-dependencies). diff --git a/test/GUItest/src/frameTest/Main.java b/test/GUItest/src/frameTest/Main.java new file mode 100644 index 0000000..62f03ff --- /dev/null +++ b/test/GUItest/src/frameTest/Main.java @@ -0,0 +1,25 @@ +package frameTest; + +import java.awt.*; + +public class Main { + public static void main(String[] args) { + // How to create a frame + // R stands for required + // 1.Create a Frame object R + Frame frame = new Frame("My first java gui frame"); + // 2.set frame's visibility to true R + frame.setVisible(true); + // 3.set frame's width and height R + frame.setSize(680, 400); + // 4.set frame's background color + // 4-1.it need Color class + Color frameColor = new Color(0X39, 0XC5, 0XBB); + frame.setBackground(frameColor); + // 5.set frame's initial position + frame.setLocation(200, 200); + // 6.set frame can't be resized + frame.setResizable(false); + } + +} \ No newline at end of file diff --git a/test/GUItest/src/mutiFrame/Main.java b/test/GUItest/src/mutiFrame/Main.java new file mode 100644 index 0000000..e43f6cd --- /dev/null +++ b/test/GUItest/src/mutiFrame/Main.java @@ -0,0 +1,10 @@ +package mutiFrame; + +public class Main { + //send to your homie to break your friendship lol + public static void main(String[] args) { + for (int i = 0; i < 114514; i++) { + new myFrame(String.valueOf(i)); + } + } +} diff --git a/test/GUItest/src/mutiFrame/myFrame.java b/test/GUItest/src/mutiFrame/myFrame.java new file mode 100644 index 0000000..f45c43a --- /dev/null +++ b/test/GUItest/src/mutiFrame/myFrame.java @@ -0,0 +1,13 @@ +package mutiFrame; + +import java.awt.*; + +public class myFrame extends Frame { + public myFrame(String title) { + super(title); + super.setVisible(true); + super.setBackground(new Color(0X39, 0XC5, 0XBB)); + super.setSize(600, 400); + super.setResizable(false); + } +} diff --git a/test/others/myFrame.java b/test/others/myFrame.java new file mode 100644 index 0000000..b773773 --- /dev/null +++ b/test/others/myFrame.java @@ -0,0 +1,16 @@ +import java.awt.*; + +public class FxxkFrame { + public static void main(String[] args) { + + } + +} + +public class myFrame extends Frame { + public myFrame() { + super(); + super.setVisible(true); + super. + } +} \ No newline at end of file