test swing

This commit is contained in:
naipu
2025-09-24 12:39:53 +08:00
parent d46968bf0e
commit e316ca5870
4 changed files with 33 additions and 16 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
# Ignore Gradle build output directory
build
app/build
app/bin
ui
.idea

View File

@@ -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!");
}
}

View 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);
}
}

View File

@@ -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());
// }
//}