Skip to content

Commit ed2943f

Browse files
committed
Move the AWTWebview back into Core.
Also some misc. fixes :)
1 parent c802428 commit ed2943f

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

examples/src/main/java/dev/webview/webview_java/example/swing/AWTWebview.java renamed to core/src/main/java/dev/webview/webview_java/AWTWebview.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
package dev.webview.webview_java.example.swing;
1+
package dev.webview.webview_java;
22

33
import java.awt.Canvas;
4+
import java.awt.Color;
45
import java.awt.Dimension;
56
import java.awt.Graphics;
67
import java.io.Closeable;
78
import java.util.function.Consumer;
89

9-
import co.casterlabs.commons.platform.OSDistribution;
10-
import co.casterlabs.commons.platform.Platform;
11-
import dev.webview.webview_java.Webview;
1210
import lombok.Getter;
1311
import lombok.Setter;
1412

@@ -41,6 +39,7 @@ public AWTWebview() {
4139
*/
4240
public AWTWebview(boolean debug) {
4341
this.debug = debug;
42+
this.setBackground(Color.BLACK);
4443
}
4544

4645
@Override
@@ -59,7 +58,6 @@ public void paint(Graphics g) {
5958
this.initialized = true;
6059

6160
// We need to create the webview off of the swing thread.
62-
6361
Thread t = new Thread(() -> {
6462
this.webview = new Webview(this.debug, this);
6563

@@ -81,17 +79,7 @@ private void updateSize() {
8179
int width = this.lastSize.width;
8280
int height = this.lastSize.height;
8381

84-
// There is a random margin on Windows that isn't visible, so we must
85-
// compensate.
86-
// TODO figure out why this is caused.
87-
if (Platform.osDistribution == OSDistribution.WINDOWS_NT) {
88-
width -= 16;
89-
height -= 39;
90-
}
91-
9282
this.webview.setFixedSize(width, height);
93-
//this.webview.setMinSize(width, height);
94-
//this.webview.setMaxSize(width, height);
9583
}
9684

9785
@Override

examples/src/main/java/dev/webview/webview_java/example/swing/SwingExample.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
import javax.swing.JFrame;
88

9+
import dev.webview.webview_java.AWTWebview;
10+
911
/**
1012
* do not support resize!
1113
* */

0 commit comments

Comments
 (0)