MCPcopy Index your code
hub / github.com/processing/processing / Welcome

Method Welcome

app/src/processing/app/ui/Welcome.java:51–132  ·  view source on GitHub ↗
(Base base, boolean sketchbook)

Source from the content-addressed store, hash-verified

49
50
51 public Welcome(Base base, boolean sketchbook) throws IOException {
52 this.base = base;
53
54 // TODO this should live inside theme or somewhere modifiable
55 Font dialogFont = Toolkit.getSansFont(14, Font.PLAIN);
56
57 JComponent panel = Box.createHorizontalBox();
58 panel.setBackground(new Color(245, 245, 245));
59 Toolkit.setBorder(panel, 15, 20, 15, 20);
60
61 //panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
62 //panel.add(Box.createHorizontalStrut(20));
63 JCheckBox checkbox = new JCheckBox("Show this message on startup");
64 checkbox.setFont(dialogFont);
65 // handles the Help menu invocation, and also the pref not existing
66 checkbox.setSelected("true".equals(Preferences.get("welcome.show")));
67 checkbox.addItemListener(new ItemListener() {
68 @Override
69 public void itemStateChanged(ItemEvent e) {
70 if (e.getStateChange() == ItemEvent.SELECTED) {
71 Preferences.setBoolean("welcome.show", true);
72 } else if (e.getStateChange() == ItemEvent.DESELECTED) {
73 Preferences.setBoolean("welcome.show", false);
74 }
75 }
76 });
77 panel.add(checkbox);
78
79 panel.add(Box.createHorizontalGlue());
80
81 JButton button = new JButton("Get Started");
82 button.setFont(Toolkit.getSansFont(14, Font.PLAIN));
83 button.addActionListener(new ActionListener() {
84 public void actionPerformed(ActionEvent e) {
85 view.handleClose();
86 }
87 });
88 panel.add(button);
89 //panel.add(Box.createHorizontalGlue());
90
91 view = new WebFrame(getIndexFile(sketchbook), 425, panel) {
92 /*
93 @Override
94 public void handleSubmit(StringDict dict) {
95 String sketchbookAction = dict.get("sketchbook", null);
96 if ("create_new".equals(sketchbookAction)) {
97 File folder = new File(Preferences.getSketchbookPath()).getParentFile();
98 PApplet.selectFolder(Language.text("preferences.sketchbook_location.popup"),
99 "sketchbookCallback", folder,
100 this, this);
101 }
102
103// // If un-checked, the key won't be in the dict, so null will be passed
104// boolean keepShowing = "on".equals(dict.get("show_each_time", null));
105// Preferences.setBoolean("welcome.show", keepShowing);
106// Preferences.save();
107 handleClose();
108 }

Callers

nothing calls this directly

Calls 8

getSansFontMethod · 0.95
setBorderMethod · 0.95
getMethod · 0.95
getIndexFileMethod · 0.95
setVisibleMethod · 0.65
setSelectedMethod · 0.45
equalsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected