|
10 | 10 | import static com.sun.jna.platform.win32.WinUser.*;
|
11 | 11 |
|
12 | 12 | public class Main {
|
13 |
| - public static final int WM_COMMAND = 0x0111; |
14 |
| - public static final int COLOR_WINDOW = 0x5; |
15 |
| - |
16 |
| - public static final int BUTTON_0_ID = 0; |
17 |
| - public static final int BUTTON_1_ID = 1; |
18 |
| - public static final int BUTTON_2_ID = 2; |
19 |
| - public static final int BUTTON_3_ID = 3; |
20 |
| - public static final int BUTTON_4_ID = 4; |
21 |
| - public static final int BUTTON_5_ID = 5; |
22 |
| - public static final int BUTTON_6_ID = 6; |
23 |
| - public static final int BUTTON_7_ID = 7; |
24 |
| - public static final int BUTTON_8_ID = 8; |
25 |
| - public static final int BUTTON_9_ID = 9; |
26 |
| - public static final int BUTTON_C_ID = 10; |
27 |
| - public static final int BUTTON_DIVIDE_ID = 11; |
28 |
| - public static final int BUTTON_DOT_ID = 12; |
29 |
| - public static final int BUTTON_EQUALS_ID = 13; |
30 |
| - public static final int BUTTON_E_ID = 14; |
31 |
| - public static final int BUTTON_FACTORIAL_ID = 15; |
32 |
| - public static final int BUTTON_INVERSE_ID = 16; |
33 |
| - public static final int BUTTON_MINUS_ID = 17; |
34 |
| - public static final int BUTTON_MULTIPLE_ID = 18; |
35 |
| - public static final int BUTTON_PI_ID = 19; |
36 |
| - public static final int BUTTON_PLUS_ID = 20; |
37 |
| - public static final int BUTTON_SQUARE_ID = 21; |
38 |
| - public static final int BUTTON_SQUARE_ROOT_ID = 22; |
39 |
| - public static final int BUTTON_UNARY_MINUS_ID = 23; |
40 |
| - |
41 |
| - public static final int DEFAULT_CAPACITY = 100; |
42 |
| - |
43 |
| - public static HWND field; |
44 |
| - public static List<String> data; |
45 |
| - |
46 |
| - private static final int[] FACTORIAL = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600}; |
| 13 | + private static final int WM_COMMAND = 0x0111; |
| 14 | + private static final int COLOR_WINDOW = 0x5; |
| 15 | + |
| 16 | + private static final int BUTTON_0_ID = 0; |
| 17 | + private static final int BUTTON_1_ID = 1; |
| 18 | + private static final int BUTTON_2_ID = 2; |
| 19 | + private static final int BUTTON_3_ID = 3; |
| 20 | + private static final int BUTTON_4_ID = 4; |
| 21 | + private static final int BUTTON_5_ID = 5; |
| 22 | + private static final int BUTTON_6_ID = 6; |
| 23 | + private static final int BUTTON_7_ID = 7; |
| 24 | + private static final int BUTTON_8_ID = 8; |
| 25 | + private static final int BUTTON_9_ID = 9; |
| 26 | + private static final int BUTTON_C_ID = 10; |
| 27 | + private static final int BUTTON_DIVIDE_ID = 11; |
| 28 | + private static final int BUTTON_DOT_ID = 12; |
| 29 | + private static final int BUTTON_EQUALS_ID = 13; |
| 30 | + private static final int BUTTON_E_ID = 14; |
| 31 | + private static final int BUTTON_FACTORIAL_ID = 15; |
| 32 | + private static final int BUTTON_INVERSE_ID = 16; |
| 33 | + private static final int BUTTON_MINUS_ID = 17; |
| 34 | + private static final int BUTTON_MULTIPLE_ID = 18; |
| 35 | + private static final int BUTTON_PI_ID = 19; |
| 36 | + private static final int BUTTON_PLUS_ID = 20; |
| 37 | + private static final int BUTTON_SQUARE_ID = 21; |
| 38 | + private static final int BUTTON_SQUARE_ROOT_ID = 22; |
| 39 | + private static final int BUTTON_UNARY_MINUS_ID = 23; |
| 40 | + |
| 41 | + private static final int DEFAULT_CAPACITY = 100; |
| 42 | + |
| 43 | + private static HWND field; |
| 44 | + private static List<String> data; |
| 45 | + |
| 46 | + private static final int[] FACTORIAL = new int[]{1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600}; |
47 | 47 |
|
48 | 48 | public static void main(String[] args) {
|
49 | 49 | var className = "HummelCalculator";
|
@@ -83,7 +83,7 @@ public static void main(String[] args) {
|
83 | 83 | }
|
84 | 84 | }
|
85 | 85 |
|
86 |
| - public static class WndProc implements WindowProc { |
| 86 | + private static class WndProc implements WindowProc { |
87 | 87 | @Override
|
88 | 88 | public LRESULT callback(HWND window, int msg, WPARAM wParam, LPARAM lParam) {
|
89 | 89 | switch (msg) {
|
@@ -172,6 +172,7 @@ private static void calculateWrapper() {
|
172 | 172 | }
|
173 | 173 | }
|
174 | 174 |
|
| 175 | + @SuppressWarnings("NumericCastThatLosesPrecision") |
175 | 176 | private static void calculate(HWND field) {
|
176 | 177 | var buffer = new char[DEFAULT_CAPACITY];
|
177 | 178 | ExUser32.INSTANCE.GetWindowText(field, buffer, DEFAULT_CAPACITY);
|
|
0 commit comments