The Browser Demos demonstrate various features of the SWT Browser widget.
The Pawns Game is a board game that can be played against the computer
or against another player. Rendering is based on HTML and CSS techniques. The
board is a table filled with hyperlinks. Cascading Style Sheets
provide various themes and control the table aesthetic appearance.
The API org.eclipse.swt.browser.Browser.setText(java.lang.String)
draws
the board game from HTML generated in memory.
Player moves are captured by implementing the interface org.eclipse.swt.browser.LocationListener
.
e.g the player clicks on a cell that may generate an hyperlink with a URL similar to
http://www.org.eclipse.swt.examples.browser.demos/xx1yy2. That hyperlink identifies
the position of the cell selected by the player. The move is completed by generating
new HTML content and invoking Browser.setText
to update the board game.
Follow the SWT standalone examples setup instructions to install and run the example from your workspace.
The "Main" class is org.eclipse.swt.examples.browser.demos.BrowserDemoView
.
This example can also be run using the Example Launcher. Select the Browser Demo item from the Workbench Views category and click Run.