BAEL-5421

This commit is contained in:
opokharel 2022-06-25 12:36:55 -06:00
parent db1bf15694
commit 8991dbe2df
2 changed files with 16 additions and 12 deletions

View File

@ -7,20 +7,24 @@ import javax.swing.*;
public class MySampleGUIAppn extends JFrame{
public MySampleGUIAppn() {
if (!GraphicsEnvironment.isHeadless()) {
setSize(300,300);
setTitle("MySampleGUIAppn");
Button b = new Button("Click Me!");
b.setBounds(30,100,80,30);
add(b);
if (!GraphicsEnvironment.isHeadless()) {
setVisible(true);
}
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
}
else {
System.exit(0);
}
}
public static void main(String[] args) {
MySampleGUIAppn app=new MySampleGUIAppn();

View File

@ -8,7 +8,7 @@ class MySampleGUIAppnUnitTest {
@Test
void testMain() throws IOException {
System.setProperty("java.awt.headless", "true");
System.setProperty("java.awt.headless", "false");
MySampleGUIAppn instance = new MySampleGUIAppn();
String [] args = null;
System.exit(0);