开始学gui
This commit is contained in:
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"java.project.sourcePaths": ["src"],
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
}
|
||||
@@ -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).
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user