diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e98035c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = true + +[*.java] +indent_style = space +indent_size = 4 diff --git a/src/lib/repl/Sidebar.svelte b/src/lib/repl/Sidebar.svelte index 620062c..310836b 100644 --- a/src/lib/repl/Sidebar.svelte +++ b/src/lib/repl/Sidebar.svelte @@ -22,7 +22,7 @@
-
+
$isSidebarOpen = true} />
{#if $isSidebarOpen} diff --git a/src/lib/repl/sidebar/Examples.svelte b/src/lib/repl/sidebar/Examples.svelte new file mode 100644 index 0000000..9931f07 --- /dev/null +++ b/src/lib/repl/sidebar/Examples.svelte @@ -0,0 +1,51 @@ + + +{#each examples as fiddle} + +{:else} +
+ +
+{/each} diff --git a/src/lib/repl/sidebar/SidebarOptions.svelte b/src/lib/repl/sidebar/SidebarOptions.svelte index d3efc01..b5a2cf2 100644 --- a/src/lib/repl/sidebar/SidebarOptions.svelte +++ b/src/lib/repl/sidebar/SidebarOptions.svelte @@ -3,6 +3,7 @@ import { createEventDispatcher } from "svelte"; import Favourites from "./Favourites.svelte"; import { browser } from "$app/environment"; + import Examples from "./Examples.svelte"; const dispatch = createEventDispatcher<{ selectOption: number }>(); @@ -41,6 +42,8 @@
{#if selectedOptionIndex === 0} + {:else if selectedOptionIndex === 1} + {/if} {:else}
    diff --git a/static/examples/hello-world-swing/Main.java b/static/examples/hello-world-swing/Main.java new file mode 100644 index 0000000..52f5e90 --- /dev/null +++ b/static/examples/hello-world-swing/Main.java @@ -0,0 +1,20 @@ +import java.awt.Font; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingUtilities; + +class Main implements Runnable { + public static void main(String[] args) { + SwingUtilities.invokeLater(new Main()); + } + + public void run() { + JFrame f = new JFrame("Swing example"); + JLabel l = new JLabel("Hello, world!"); + l.setFont(new Font("Serif", Font.PLAIN, 42)); + f.add(l); + f.pack(); + f.setLocationRelativeTo(null); + f.setVisible(true); + } +} diff --git a/static/examples/hello-world/Main.java b/static/examples/hello-world/Main.java new file mode 100644 index 0000000..53eaf6a --- /dev/null +++ b/static/examples/hello-world/Main.java @@ -0,0 +1,5 @@ +class Main { + public static void main(String[] args) { + System.out.println("Hello, World!"); + } +}