-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathHelloSwingControl.java
More file actions
57 lines (51 loc) · 2.06 KB
/
Copy pathHelloSwingControl.java
File metadata and controls
57 lines (51 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Minimal Swing control program for the Wayland first-light rig
// (issue #101, section 9 "Falsification Criteria").
//
// The rig launches this before JLS on the same runtime, the same
// toolkit (-Dawt.toolkit.name=WLToolkit), and the same headless sway
// compositor, so every run separates the two possible failure modes
// without human interpretation:
//
// control succeeds, JLS fails -> the defect is in JLS's startup path
// (census/fix issues)
// control fails too -> the blocker is upstream
// (JBR/Wakefield or the compositor)
//
// It is intentionally the smallest thing that exercises the toolkit's
// window-mapping and text-rendering paths: one JFrame, one JLabel.
// The frame title is matched by name in `swaymsg -t get_tree`, so keep
// it in sync with scripts/wayland-rig.sh if it ever changes.
//
// Run standalone (single-file source launch, no build step needed):
//
// java -Dawt.toolkit.name=WLToolkit scripts/HelloSwingControl.java
//
// The process stays up until killed; the rig kills it once its window
// has (or has not) appeared.
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
public final class HelloSwingControl {
/** Window title the rig greps for in the compositor tree. */
private static final String TITLE = "HelloSwingControl";
private HelloSwingControl() {
// static entry point only
} // end of HelloSwingControl constructor
/**
* Maps a minimal frame and parks the main thread; the AWT event
* dispatch thread keeps the JVM alive until the rig kills it.
*
* @param args ignored
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame(TITLE);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new JLabel("first light", SwingConstants.CENTER));
frame.setSize(320, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
} // end of main method
} // end of HelloSwingControl class