MCPcopy Index your code
hub / github.com/arduino/Arduino / buildTouchBar

Method buildTouchBar

app/src/processing/app/EditorToolbar.java:170–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168 }
169
170 private void buildTouchBar() {
171 if (touchBarImages == null) {
172 loadTouchBarImages();
173 }
174
175 touchBar = new JTouchBar();
176 touchBarButtons = new TouchBarButton[BUTTON_COUNT];
177 touchBar.setCustomizationIdentifier("Arduino");
178
179 for (int i = 0; i < BUTTON_COUNT; i++) {
180 final int selection = i;
181
182 // add spacers before NEW and SERIAL buttons
183 if (i == NEW) {
184 touchBar.addItem(new TouchBarItem(TouchBarItem.NSTouchBarItemIdentifierFixedSpaceSmall));
185 } else if (i == SERIAL) {
186 touchBar.addItem(new TouchBarItem(TouchBarItem.NSTouchBarItemIdentifierFlexibleSpace));
187 }
188
189 touchBarButtons[i] = new TouchBarButton();
190 touchBarButtons[i].setImage(touchBarImages[i][ROLLOVER]);
191 touchBarButtons[i].setAction(event -> {
192 // Run event handler later to prevent hanging if a dialog needs to be open
193 EventQueue.invokeLater(new Runnable() {
194 @Override
195 public void run() {
196 handleSelectionPressed(selection);
197 }
198 });
199 });
200
201 TouchBarItem touchBarItem = new TouchBarItem(title[i], touchBarButtons[i], true);
202 touchBarItem.setCustomizationLabel(title[i]);
203
204 touchBar.addItem(touchBarItem);
205 }
206 }
207
208 private void loadButtons() {
209 Image allButtons = Theme.getThemeImage("buttons", this,

Callers 1

windowActivatedMethod · 0.95

Calls 1

loadTouchBarImagesMethod · 0.95

Tested by

no test coverage detected