From 2471ab58b2793835a1241854e2860ec2a2a09252 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Thu, 8 Jul 2021 19:57:58 -0400 Subject: [PATCH] working on theme/webkit debugging --- .../src/processing/app/tools/ThemeEngine.java | 1 + .../src/processing/app/tools/WebFrame.java | 30 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/build/shared/tools/ThemeEngine/src/processing/app/tools/ThemeEngine.java b/build/shared/tools/ThemeEngine/src/processing/app/tools/ThemeEngine.java index 5c27874fe..49322d29d 100644 --- a/build/shared/tools/ThemeEngine/src/processing/app/tools/ThemeEngine.java +++ b/build/shared/tools/ThemeEngine/src/processing/app/tools/ThemeEngine.java @@ -18,6 +18,7 @@ public class ThemeEngine implements Tool { public void init(Base base) { this.base = base; + //WebFrame.init(); } diff --git a/build/shared/tools/ThemeEngine/src/processing/app/tools/WebFrame.java b/build/shared/tools/ThemeEngine/src/processing/app/tools/WebFrame.java index d533caaa2..8b8f2c7be 100644 --- a/build/shared/tools/ThemeEngine/src/processing/app/tools/WebFrame.java +++ b/build/shared/tools/ThemeEngine/src/processing/app/tools/WebFrame.java @@ -62,7 +62,8 @@ public class WebFrame extends JFrame { getContentPane().add(panel); setPreferredSize(new Dimension(1024, 600)); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); pack(); } @@ -92,21 +93,26 @@ public class WebFrame extends JFrame { } }); - // FireBug Lite is another option: https://stackoverflow.com/a/9405733 - WebConsoleListener.setDefaultListener((webView, message, lineNumber, sourceId) -> { - System.out.println("console: " + message + " [" + sourceId + " - " + lineNumber + "]"); - }); - jfxPanel.setScene(new Scene(view)); }); } - public void loadURL(final String url) { + void loadURL(final String url) { Platform.runLater(() -> engine.load(url)); } + void addDebug() { + Platform.runLater(() -> { + // FireBug Lite is another option: https://stackoverflow.com/a/9405733 + WebConsoleListener.setDefaultListener((webView, message, lineNumber, sourceId) -> { + System.out.println("console: " + message + " [" + sourceId + " - " + lineNumber + "]"); + }); + }); + } + + /* public void loadURL(final String url) { Platform.runLater(() -> { @@ -132,11 +138,19 @@ public class WebFrame extends JFrame { */ - static public void main(String[] args) { + static WebFrame init() { WebFrame wf = new WebFrame(); wf.setLocationRelativeTo(null); wf.setVisible(true); // wf.loadURL("http://download.processing.org/contribs"); wf.loadURL("https://learn.fathom.info/palettemaker/"); + return wf; + } + + + static public void main(String[] args) { + WebFrame wf = init(); + wf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + wf.addDebug(); } } \ No newline at end of file