MCPcopy Index your code
hub / github.com/benfry/processing4 / init

Method init

app/src/processing/app/tools/ThemeSelector.java:85–200  ·  view source on GitHub ↗
(Base base)

Source from the content-addressed store, hash-verified

83
84
85 public void init(Base base) {
86 this.base = base;
87
88 try {
89 File themeFolder = Theme.getThemeFolder();
90 File[] setFolders = themeFolder.listFiles(file -> {
91 if (file.isDirectory()) {
92 File orderFile = new File(file, ORDER_FILENAME);
93 return orderFile.exists();
94 }
95 return false;
96 });
97 if (setFolders == null) {
98 Messages.showWarning("Could not load themes",
99 "The themes directory could not be read.\n" +
100 "Please reinstall Processing.");
101 return;
102 }
103
104 File miniFile = new File(themeFolder, "mini.svg");
105 miniSvgXml = Util.loadFile(miniFile);
106
107 sets = new ArrayList<>();
108 for (File folder : setFolders) {
109 sets.add(new ThemeSet(folder));
110 }
111 currentSet = sets.get(0);
112 defaultTheme = getDefaultTheme();
113
114 } catch (IOException e) {
115 e.printStackTrace();
116 }
117
118 Container pane = getContentPane();
119
120 Box axis = Box.createVerticalBox();
121
122 String[] setNames = new String[sets.size()];
123 for (int i = 0; i < sets.size(); i++) {
124 setNames[i] = sets.get(i).name;
125 }
126 setSelector = new JComboBox<>(setNames);
127 setSelector.addItemListener(e -> {
128 currentSet = sets.get(setSelector.getSelectedIndex());
129 updateCurrentIndex();
130 repaint();
131 });
132 addRow(axis, setSelector);
133
134 axis.add(Box.createVerticalStrut(13));
135
136 axis.add(selector = new ColorfulPanel()); // flush with sides
137
138 axis.add(Box.createVerticalStrut(13));
139
140 addRow(axis, howtoLabel = new JLabel());
141 howtoLabel.addMouseListener(new MouseAdapter() {
142 public void mousePressed(MouseEvent e) {

Callers

nothing calls this directly

Calls 15

getThemeFolderMethod · 0.95
showWarningMethod · 0.95
loadFileMethod · 0.95
getDefaultThemeMethod · 0.95
updateCurrentIndexMethod · 0.95
addRowMethod · 0.95
getMenuTitleMethod · 0.95
updateThemeMethod · 0.95
repaintMethod · 0.80
getMethod · 0.65
setVisibleMethod · 0.65

Tested by

no test coverage detected