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

Class ThemeSelector

app/src/processing/app/tools/ThemeSelector.java:56–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55
56public class ThemeSelector extends JFrame implements Tool {
57 static final String HOWTO_URL =
58 "https://github.com/processing/processing4/wiki/Themes";
59 static final String ORDER_FILENAME = "order.txt";
60
61 String miniSvgXml;
62
63 List<ThemeSet> sets;
64
65 String defaultTheme;
66
67 File sketchbookFile;
68 ThemeSet currentSet;
69 int currentIndex;
70
71 JComboBox<String> setSelector;
72 ColorfulPanel selector;
73
74 JLabel howtoLabel;
75 JLabel reloadTheme;
76
77 Base base;
78
79
80 public String getMenuTitle() {
81 return "Theme Selector";
82 }
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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected