Skip to content

Commit 1af0dd6

Browse files
committed
Cleanup fenced code blocks
1 parent 18ade4f commit 1af0dd6

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

docs/FAQ/FAQ_Can_I_use_SWT_outside_Eclipse_for_my_own_project.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ FAQ Can I use SWT outside Eclipse for my own project?
55

66
This can be interpreted as either a legal question or a technical question. You can find an official answer to the legal question on the SWT FAQ hosted on the SWT development team home page at eclipse.org. The answer to the technical question is an unqualified yes! However, because SWT has a native component, the technical details are a bit more involved than they are for simple Java libraries.
77

8-
Each platform you want your project to run on will need its own native libraries. Luckily, this is easier than it used to be because the download section of eclipse.org now includes SWT drops. Download the appropriate SWT drop for the platform you are interested in running on, and set up the VM's classpath and library path accordingly. Here is a command line that was used to launch the BrowserSnippet stand-alone program:
8+
Each platform you want your project to run on will need its own native libraries. Luckily, this is easier than it used to be because the download section of eclipse.org now includes SWT drops. Download the appropriate SWT drop for the platform you are interested in running on, and set up the VM's classpath and library path accordingly. Here is a command line that was used to launch the `BrowserSnippet` stand-alone program:
99

10-
java -cp swt.jar;. -Djava.library.path=. BrowserSnippet
10+
```sh
11+
java -cp swt.jar;. -Djava.library.path=. BrowserSnippet
12+
```
1113

1214
This command line assumes that java is on your execution path and that both swt.jar and the SWT dynamic link library are located in the current working directory.
1315

docs/FAQ/FAQ_How_do_I_display_a_Web_page_in_SWT.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@ As a quick example, here is a stand-alone SWT snippet that opens a browser shell
99

1010
A title listener is added to the browser in order to update the shell title with the name of the Web page being displayed:
1111

12-
Display display = new Display();
13-
final Shell shell = new Shell(display, SWT.SHELL_TRIM);
14-
shell.setLayout(new FillLayout());
15-
Browser browser = new Browser(shell, SWT.NONE);
16-
browser.addTitleListener(new TitleListener() {
17-
public void changed(TitleEvent event) {
18-
shell.setText(event.title);
19-
}
20-
});
21-
browser.setBounds(0,0,600,400);
22-
shell.pack();
23-
shell.open();
24-
browser.setUrl("https://eclipse.org");
25-
while (!shell.isDisposed())
26-
if (!display.readAndDispatch())
27-
display.sleep();
28-
12+
```java
13+
Display display = new Display();
14+
final Shell shell = new Shell(display, SWT.SHELL_TRIM);
15+
shell.setLayout(new FillLayout());
16+
Browser browser = new Browser(shell, SWT.NONE);
17+
browser.addTitleListener(new TitleListener() {
18+
public void changed(TitleEvent event) {
19+
shell.setText(event.title);
20+
}
21+
});
22+
browser.setBounds(0,0,600,400);
23+
shell.pack();
24+
shell.open();
25+
browser.setUrl("https://eclipse.org");
26+
while (!shell.isDisposed())
27+
if (!display.readAndDispatch())
28+
display.sleep();
29+
```
2930

3031
Figure 7.1 shows the resulting browser inside a simple shell. The browser widget is not yet available on all platforms as not all platforms that SWT supports have an appropriate native control that can be exploited. For Eclipse 3.0, the browser will at least be available on Windows, Linux, QNX, and MacOS. For platforms that do not have a browser widget available, the Browser constructor will throw an SWT error, allowing you to catch the condition and fall back to an alternative, such as a user-specified external browser.
3132

0 commit comments

Comments
 (0)