// Show the browserReference: http://www.eclipse.org/articles/Article-SWT-browser-widget/browser.html
final Browser browser = new Browser(shell, SWT.NONE);
browser.setSize(500,500);
browser.setLocation(10,60);
browser.setUrl("http://www.stanleygeorge.com");
// Prepare a toolbar to show the 'forward' and 'back' navigation buttons
ToolBar navBar = new ToolBar(shell,SWT.HORIZONTAL);
navBar.setSize(150,50);
navBar.setLocation(10,10);
// The back button
final ToolItem back = new ToolItem(navBar, SWT.PUSH);
back.setText("back");
back.setEnabled(false);
// Add a listener so that it will go to the previous URL in history
back.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
browser.back();
}
});
// The code for the forward button is similar to the above code
// Use browser.forward(); instead of browser.back();
// Enable/disable the buttons automatically
LocationListener locationListener = new LocationListener() {
public void changed(LocationEvent event) {
Browser browser = (Browser)event.widget;
back.setEnabled(browser.isBackEnabled());
forward.setEnabled(browser.isForwardEnabled());
}
public void changing(LocationEvent event) {
}
};
browser.addLocationListener(locationListener);
February 19, 2008
SWT - Browser
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(17)
-
▼
February
(17)
- HTML to Excel with JSP
- Basic JDBC: Executing a simple SELECT statement
- Hibernate 3.0 config file with database URL
- Hibernate 3.0 config file with JNDI datasource
- Hibernate mapping file
- org.hibernate.StaleObjectStateException
- Hibernate Tool - Reverse Engineering
- Generic toString() using reflection
- SWT - Browser
- SWT - Tree, Composite, Group, Tab, Popup Menu
- SWT - Slider, Scale, Progress, Combo, Menu, ToolBa...
- SWT - Label, Text, Button, List, Table
- Struts step-by-step
- JavaScript to select all checkboxes
- Fixed header in a datagrid
- Log4J 1.3 RollingFileAppender
- HowTo - GCJ: A native Java Compiler
-
▼
February
(17)
No comments:
Post a Comment