MCPcopy
hub / github.com/arduino/Arduino / PresentMode

Class PresentMode

app/src/processing/app/PresentMode.java:34–128  ·  view source on GitHub ↗

Helper class for full-screen presentation mode.

Source from the content-addressed store, hash-verified

32 * Helper class for full-screen presentation mode.
33 */
34public class PresentMode {
35
36 static GraphicsDevice devices[];
37
38 /**
39 * Index of the default display device, probably the one that p5 was
40 * started from.
41 */
42 static int defaultIndex;
43
44 /**
45 * Menu object for preferences window
46 */
47 //JMenu preferencesMenu;
48 static JComboBox selector;
49
50 /**
51 * Index of the currently selected display to be used for present mode.
52 */
53 static GraphicsDevice device;
54
55
56 static {
57 GraphicsEnvironment environment =
58 GraphicsEnvironment.getLocalGraphicsEnvironment();
59 devices = environment.getScreenDevices();
60 GraphicsDevice defaultDevice = environment.getDefaultScreenDevice();
61
62 Vector<String> names = new Vector<>();
63 for (int i = 0; i < devices.length; i++) {
64 String name = String.valueOf(i + 1);
65 if (devices[i] == defaultDevice) {
66 defaultIndex = i;
67 name += " (default)";
68 }
69 names.add(name);
70 }
71
72 selector = new JComboBox(names);
73 selector.addActionListener(new ActionListener() {
74 public void actionPerformed(ActionEvent e) {
75 int index = selector.getSelectedIndex();
76 //device = devices[index];
77 PreferencesData.setInteger("run.present.display", index + 1);
78 }
79 });
80 }
81
82
83 static public JComboBox getSelector() {
84 int deviceIndex = PreferencesData.getInteger("run.present.display") - 1;
85 selector.setSelectedIndex(deviceIndex);
86 return selector;
87 }
88
89
90 /*
91 static public JFrame create() {

Callers

nothing calls this directly

Calls 2

valueOfMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected