()
| 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); |
| 75 | case 1 -> window.setWindowPosition(bounds.getLeft(), bounds.getTop()); |
| 76 | case 2 -> window.setWindowPosition(bounds.getLeft() + bounds.getWidth() / 2, bounds.getTop()); |
| 77 | case 3 -> window.setWindowPosition(bounds.getLeft(), bounds.getTop() + bounds.getHeight() / 2); |
| 78 | case 4 -> window.setWindowPosition(bounds.getLeft() + bounds.getWidth() / 2, bounds.getTop() + bounds.getHeight() / 2); |
| 79 | } |
| 80 | |
| 81 | switch (Platform.CURRENT) { |
| 82 | case WINDOWS -> { |
| 83 | window.setIcon(new File("examples/dashboard/resources/windows.ico")); |
| 84 | } |
| 85 | case MACOS -> { |
| 86 | window.setIcon(new File("examples/dashboard/resources/macos.icns")); |
| 87 | } |
| 88 | case X11 -> { |
| 89 | ((WindowX11) window).setClassHint("jwm-dashboard-example"); // allows OS-wide identification of the window (e.g. icon themes, .desktop files) |
| 90 | try { |
| 91 | Bitmap i = Bitmap.makeFromImage(Image.makeDeferredFromEncodedBytes(Files.readAllBytes(Path.of("examples/dashboard/resources/linux/icon_48x48.png")))); |
| 92 | ImageInfo info = i.getImageInfo(); |
| 93 | |
| 94 | ((WindowX11) window).setIconData(info.getWidth(), info.getHeight(), i.readPixels()); |
| 95 | } catch (IOException e) { |
| 96 | e.printStackTrace(); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | window.setVisible(true); |
nothing calls this directly
no test coverage detected