MCPcopy Create free account
hub / github.com/HumbleUI/JWM / Example

Class Example

examples/dashboard/java/Example.java:17–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15import java.nio.file.Path;
16
17public class Example implements Consumer<Event> {
18 public static int PADDING = 10;
19 public static int COLS = 4, ROWS = 3;
20 public static final KeyModifier MODIFIER = Platform.CURRENT == Platform.MACOS ? KeyModifier.MAC_COMMAND : KeyModifier.CONTROL;
21 public static Font FONT12 = new Font(FontMgr.getDefault().matchFamilyStyleCharacter(null, FontStyle.NORMAL, null, "↑".codePointAt(0)), 12);
22 public static Font FONT24 = new Font(FontMgr.getDefault().matchFamilyStyle(null, FontStyle.NORMAL), 24);
23 public static Font FONT48 = new Font(FontMgr.getDefault().matchFamilyStyle(null, FontStyle.BOLD), 48);
24
25 public float lastScale = 1f;
26 public PanelTextInput panelTextInput;
27 public PanelScreens panelScreens;
28 public PanelLegend panelLegend;
29 public PanelMouse panelMouse;
30 public PanelAnimation panelAnimation;
31 public PanelMouseCursors panelMouseCursors;
32 public PanelRendering panelRendering;
33 public PanelEvents panelEvents;
34 public PanelTheme panelTheme;
35 public PanelTouch panelTouch;
36 public boolean initialized = false;
37
38 public Window window;
39
40 public boolean paused = false;
41
42 public Options progressBars = new Options("Default", "0%", "50%", "100%", "Indeterminate");
43
44 public Example() {
45 window = App.makeWindow();
46 window.setEventListener(this);
47
48 panelTextInput = new PanelTextInput(window);
49 panelScreens = new PanelScreens(window);
50 panelLegend = new PanelLegend(window);
51 panelMouse = new PanelMouse(window);
52 panelAnimation = new PanelAnimation(window);
53 panelMouseCursors = new PanelMouseCursors(window);
54 panelRendering = new PanelRendering(window);
55 panelEvents = new PanelEvents(window);
56 panelTheme = new PanelTheme(window);
57 panelTouch = new PanelTouch(window);
58
59 var scale = window.getScreen().getScale();
60 int count = App._windows.size() - 1;
61 Screen screen = App.getScreens()[(count / 5) % App.getScreens().length];
62 IRect bounds = screen.getWorkArea();
63
64 window.setTitle("JWM Window #" + count);
65 if (window instanceof WindowMac windowMac) {
66 windowMac.setSubtitle("Window Subtitle");
67 windowMac.setRepresentedFilename("macos/cc/WindowMac.mm");
68 }
69
70 panelScreens.setTitleStyle(panelScreens.titleStyles.get(count));
71
72 window.setWindowSize(bounds.getWidth() / 2, bounds.getHeight() / 2);
73 switch (count % 5) {
74 case 0 -> window.setWindowPosition(bounds.getLeft() + bounds.getWidth() / 4, bounds.getTop() + bounds.getHeight() / 4);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected