test swing
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
# Ignore Gradle build output directory
|
||||
build
|
||||
app/build
|
||||
app/bin
|
||||
ui
|
||||
|
||||
.idea
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
/*
|
||||
* This source file was generated by the Gradle 'init' task
|
||||
*/
|
||||
package cn.naipu.MiraiTris;
|
||||
|
||||
public class App {
|
||||
public String getGreeting() {
|
||||
return "Hello World!";
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new App().getGreeting());
|
||||
new JFrame().setVisible(true);
|
||||
System.out.println("Hello World!");
|
||||
}
|
||||
}
|
||||
|
||||
22
app/src/main/java/cn/naipu/MiraiTris/JFrame.java
Normal file
22
app/src/main/java/cn/naipu/MiraiTris/JFrame.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package cn.naipu.MiraiTris;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class JFrame extends javax.swing.JFrame {
|
||||
public JFrame() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
setTitle("MiraiTris");
|
||||
//setResizable(true);
|
||||
setSize(400,200);
|
||||
JLabel jl = new JLabel("这是使用JFrame类创建的窗口");
|
||||
getContentPane().add(jl);
|
||||
setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
package cn.naipu.MiraiTris;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
//import org.junit.Test;
|
||||
//import static org.junit.Assert.*;
|
||||
|
||||
public class AppTest {
|
||||
@Test public void appHasAGreeting() {
|
||||
App classUnderTest = new App();
|
||||
assertNotNull("app should have a greeting", classUnderTest.getGreeting());
|
||||
}
|
||||
}
|
||||
//public class AppTest {
|
||||
// @Test public void appHasAGreeting() {
|
||||
// App classUnderTest = new App();
|
||||
// assertNotNull("app should have a greeting", classUnderTest.getGreeting());
|
||||
// }
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user