加了点好van♂的东西
This commit is contained in:
+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 @@
|
|||||||
|
Main-Class: com.msksbr.click_2_shutdown.Main
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.msksbr.click_2_shutdown;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Frame frame = new Frame("关机?");
|
||||||
|
frame.setBounds(200, 200, 250, 250);
|
||||||
|
frame.setVisible(true);
|
||||||
|
frame.setLayout(new FlowLayout());
|
||||||
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec("shutdown -s -t 00");
|
||||||
|
Runtime.getRuntime().exec("poweroff");
|
||||||
|
Runtime.getRuntime().exec("shutdown -h now");
|
||||||
|
} catch (IOException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Button button = new Button("OK");
|
||||||
|
frame.add(button);
|
||||||
|
button.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec("shutdown -s -t 00");
|
||||||
|
Runtime.getRuntime().exec("poweroff");
|
||||||
|
Runtime.getRuntime().exec("shutdown -h now");
|
||||||
|
} catch (IOException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Main-Class: com.msksbr.click_2_shutdown.Main
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: Shutdown.Main
|
||||||
Reference in New Issue
Block a user