Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -16,10 +16,9 @@

import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
Expand Down Expand Up @@ -118,18 +117,12 @@ void createExampleWidgets () {
} else if (lastText != null) {
browser.setText(lastText);
} else {
StringBuilder sb= new StringBuilder(300);

try (InputStream htmlStream = ControlExample.class.getResourceAsStream("browser-content.html");
BufferedReader br = new BufferedReader(new InputStreamReader(htmlStream))) {
int read = 0;
while ((read = br.read()) != -1)
sb.append((char) read);
try (InputStream htmlStream = ControlExample.class.getResourceAsStream("browser-content.html")) {
browser.setText( new String (htmlStream.readAllBytes(), StandardCharsets.UTF_8));
} catch (IOException e) {
log(e.getMessage());
browser.setText("Loading failed, see log for details!");
}
String text= sb.toString();
browser.setText(text);
}
lastText = lastUrl = null;
}
Expand Down Expand Up @@ -229,16 +222,6 @@ void disposeExampleWidgets () {
super.disposeExampleWidgets();
}

public static String getContents(InputStream in) throws IOException {
StringBuilder sb= new StringBuilder(300);
try (BufferedReader br= new BufferedReader(new InputStreamReader(in))) {
int read= 0;
while ((read= br.read()) != -1)
sb.append((char) read);
}
return sb.toString();
}

/**
* Gets the list of custom event names.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>SWT Browser</title>
</head>

<h3>About SWT Browser</h3>
<p>You are looking at HTML content in a <b>Browser</b> widget.
<p>You are looking at HTML content in a <b>Browser</b> widget.</p>
<ul>
<li>For a definition of the Browser widget, see:
<a href="http://www.eclipse.org/swt/faq.php#whatisbrowser">http://www.eclipse.org/swt/faq.php#whatisbrowser</a></li>
Expand All @@ -14,7 +15,7 @@ <h3>About SWT Browser</h3>
<a href="http://www.eclipse.org/swt/faq.php#howusewebkit">http://www.eclipse.org/swt/faq.php#howusewebkit</a></li>
<li>For more examples that use a Browser widget, see BrowserExample, BrowserDemo, and WebBrowser:
<a href="http://www.eclipse.org/swt/examples.php">http://www.eclipse.org/swt/examples.php</a></li>
</ul></p>
</ul>

<h3>About SWT</h3>
<p>For more information on SWT, including the Widget Gallery, Snippets, Examples, FAQ, Tools, Documentation
Expand Down
Loading