Skip to content

Commit 49f9819

Browse files
committed
get title of welcome window working wagain
1 parent 1fbab10 commit 49f9819

File tree

2 files changed

+15
-34
lines changed

2 files changed

+15
-34
lines changed

app/src/processing/app/ui/WebFrame.java

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,27 @@ public class WebFrame extends JFrame {
4747

4848

4949
public WebFrame(File file, int width) throws IOException {
50-
//setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
51-
52-
// String content = "Could not load " + file.getAbsolutePath();
53-
// if (file != null) {
54-
// String[] lines = PApplet.loadStrings(file);
55-
// content = PApplet.join(lines, "\n");
56-
// }
57-
5850
// Need to use the URL version so that relative paths work for images
5951
// https://github.com/processing/processing/issues/3494
6052
URL fileUrl = file.toURI().toURL(); //.toExternalForm();
61-
// int high = getContentHeight(width, content);
6253
requestContentHeight(width, fileUrl);
6354

64-
// while (contentHeight == 0) {
65-
// try {
66-
// Thread.sleep(2);
67-
// } catch (InterruptedException ie) { }
68-
// }
69-
70-
// int high = getContentHeight(width, content);
71-
// editorPane = new JEditorPane("text/html", content);
7255
editorPane = new JEditorPane();
56+
57+
// Title cannot be set until the page has loaded
58+
editorPane.addPropertyChangeListener("page", new PropertyChangeListener() {
59+
public void propertyChange(PropertyChangeEvent evt) {
60+
Object title = editorPane.getDocument().getProperty("title");
61+
if (title instanceof String) {
62+
setTitle((String) title);
63+
}
64+
}
65+
});
66+
7367
editorPane.setPage(fileUrl);
7468
editorPane.setEditable(false);
7569
// set height to something generic
7670
editorPane.setPreferredSize(new Dimension(width, width));
77-
// editorPane.setPreferredSize(new Dimension(width, high));
78-
// editorPane.setPreferredSize(new Dimension(width, contentHeight));
7971
getContentPane().add(editorPane);
8072

8173
Toolkit.registerWindowCloseKeys(getRootPane(), new ActionListener() {
@@ -88,11 +80,6 @@ public void actionPerformed(ActionEvent e) {
8880
editorKit = (HTMLEditorKit) editorPane.getEditorKit();
8981
editorKit.setAutoFormSubmission(false);
9082

91-
Object title = editorPane.getDocument().getProperty("title");
92-
if (title instanceof String) {
93-
setTitle((String) title);
94-
}
95-
9683
editorPane.addHyperlinkListener(new HyperlinkListener() {
9784
@Override
9885
public void hyperlinkUpdate(HyperlinkEvent e) {
@@ -119,9 +106,6 @@ public void hyperlinkUpdate(HyperlinkEvent e) {
119106
}
120107
}
121108
});
122-
// pack();
123-
// setLocationRelativeTo(null);
124-
//setVisible(true);
125109
}
126110

127111

@@ -146,7 +130,6 @@ public void run() {
146130
e.printStackTrace();
147131
}
148132
}
149-
// System.out.println("setting visible");
150133
WebFrame.super.setVisible(visible);
151134
}
152135
}).start();

todo.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ X try to get images working in welcome screen
1616
X https://github.com/processing/processing/blob/master/build/shared/lib/welcome/sketchbook.html#L60
1717
X https://github.com/processing/processing/issues/3494
1818
X update to launch4j 3.8
19+
X inquire about updated document icon
20+
X fix frame title for web frame (welcome window title disappeared)
1921

2022
fixed earlier
2123
X font fixes for Georgia in the examples
@@ -55,12 +57,7 @@ X https://github.com/processing/processing/pull/3522
5557
X Adding ellipses only when text is long
5658
X https://github.com/processing/processing/pull/3470
5759

58-
_ re-close the google code stuff (goes read-only on 8/25)
59-
_ https://code.google.com/p/processing/adminAdvanced
60-
_ https://github.com/processing/
61-
6260
beta
63-
_ set title of welcome window
6461
_ fix the red for the console/error stuff
6562
_ also the sidebar, the squiggly line beneath code, and the status bar
6663
_ write notes about changes with Toolkit and Util, and packages
@@ -81,7 +78,6 @@ _ https://github.com/processing/processing/issues/2953
8178

8279
gui
8380
_ show hover text with 'debug'
84-
_ inquire about updated document icon
8581
_ don't show breakpoints when debugger is off
8682
_ https://github.com/processing/processing/issues/3093
8783
_ no setting breakpoints when debugger is off
@@ -117,6 +113,8 @@ _ recent menu gets huge with other p5 versions on osx
117113

118114

119115
pde/build
116+
_ move processing.mode.java.pdex.XQErrorTable to processing.ui.ErrorTable
117+
_ need to make the list abstract, also "scroll to line" feature
120118
_ can't install processing-java into /usr/bin with El Capitan
121119
_ https://github.com/processing/processing/issues/3497
122120
_ Foundation library examples should appear under "Core" or "Foundation"

0 commit comments

Comments
 (0)