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

Method requestContentHeight

app/src/processing/app/ui/WebFrame.java:181–203  ·  view source on GitHub ↗
(final int width, final URL url)

Source from the content-addressed store, hash-verified

179 // getContentHeight() to fail because it returns zero. Instead we make
180 // things 10x more complicated so that images will work.
181 void requestContentHeight(final int width, final URL url) {
182 new Thread(new Runnable() {
183 public void run() {
184 final JEditorPane dummy = new JEditorPane();
185 dummy.addPropertyChangeListener("page", new PropertyChangeListener() {
186 @Override
187 public void propertyChange(PropertyChangeEvent evt) {
188 int high = dummy.getPreferredSize().height;
189 editorPane.setPreferredSize(new Dimension(width, high));
190 pack();
191 setLocationRelativeTo(null);
192 ready = true;
193 }
194 });
195 try {
196 dummy.setPage(url);
197 } catch (IOException e) {
198 e.printStackTrace();
199 }
200 dummy.setSize(width, Short.MAX_VALUE);
201 }
202 }).start();
203 }
204}

Callers 1

WebFrameMethod · 0.95

Calls 1

startMethod · 0.45

Tested by

no test coverage detected