Home » Eclipse Projects » Eclipse Platform » SWT Browser run in Ubuntu with FireFox 3.6(SWT Browser)
SWT Browser run in Ubuntu with FireFox 3.6 [message #648407] |
Wed, 12 January 2011 18:52 |
|
Dear friend
How do I run the browser component on GTK, it gives an error:
swt-mozilla-3346.so, says he does not find ...
Before the vine-pi.jar swt, swt-mozilla.jar, etc, how do I create them?
Thank you for your attention ...
In win32 execute in Linux NOT...
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
public final class BrowserTable {
private static final String PATH = System.getProperty("user.dir")+System.getProperty("file.separator ")+"resources"+System.getProperty("file.separator")+"cal_02.html ";
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display, SWT.DIALOG_TRIM);
final FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
shell.setLayout(fillLayout);
shell.addShellListener(new ShellAdapter() {
public void shellClosed(final ShellEvent e) {
final MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
mb.setText("Sair");
mb.setMessage("Deseja sair?");
e.doit = (mb.open() == SWT.OK);
}
});
createBrowser(shell);
createTable(shell);
shell.setSize(500, 500);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
public static void createTable(final Composite c) {
final Table table = new Table(c, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);
table.setHeaderVisible(true);
table.setLinesVisible(true);
final GridData gridData = new GridData(GridData.FILL | GridData.FILL);
gridData.horizontalSpan = 3;
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
table.setLayoutData(gridData);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
final MessageBox mb = new MessageBox(c.getShell(), SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
mb.setText("Excluir");
mb.setMessage("Deseja excluir?");
e.doit = (mb.open() == SWT.OK);
if(e.doit) table.remove(table.getSelectionIndex());
}
});
for (int i = 0; i < 1; i++) {
new TableColumn(table, SWT.CENTER).setText("Id");
new TableColumn(table, SWT.CENTER).setText("Descricao");
}
for (int i = 0; i < 10; i++) {
final TableItem parent = new TableItem(table, SWT.NONE);
parent.setText(0, "" + (i + 1));
parent.setText(1, "Valor");
}
final TableColumn[] columns = table.getColumns();
for (int i = 0, n = columns.length; i < n; i++) {
columns[i].pack();
}
}
private static void createBrowser(Composite c) {
try {
final Browser browser = new Browser(c, SWT.NONE);
browser.setUrl(PATH);
final GridData gridData = new GridData(GridData.FILL | GridData.FILL);
gridData.horizontalSpan = 3;
gridData.grabExcessVerticalSpace = true;
gridData.grabExcessHorizontalSpace = true;
browser.setLayoutData(gridData);
} catch (final SWTError e) {
System.err.println("Nao consegui inicializar o Browser: " + e.getMessage());
return;
}
}
}
Luís Carlos Moreira da Costa
Eclipse RAP, RCP, GMF, OSGI, Spring-DM and Pentaho Developer
Regional Communities/Brazil
http://wiki.eclipse.org/Regional_Communities/Brazil
Java, write once, run everywhere™
|
|
|
Re: SWT Browser run in Ubuntu with FireFox 3.6 [message #648572 is a reply to message #648407] |
Thu, 13 January 2011 14:47 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi,
You didn't specify which Ubuntu version you're using, but your swt version
is quite old, so you probably need a newer Eclipse/SWT version in order to
run on this machine. The xulrunner versions that are supported by the
various swt releases are listed at
http://www.eclipse.org/swt/faq.php#browserlinux .
My advice is to upgrade your Eclipse/SWT to a recent release like
http://download.eclipse.org/eclipse/downloads/drops/R-3.6.1- 201009090800/index.php .
However if for some reason you are stuck using Eclipse/SWT 3.3.x then you'll
need to download xulrunner 1.8.x (I don't know where to find this now, it's
no longer on mozilla.org) and point Eclipse/SWT at it as decribed by
http://www.eclipse.org/swt/faq.php#specifyxulrunner .
Grant
"LuisCM" <luis@tclsoftware.com.br> wrote in message
news:igksvu$e2f$1@news.eclipse.org...
> Dear friend
>
> How do I run the browser component on GTK, it gives an error:
> swt-mozilla-3346.so, says he does not find ...
>
> Before the vine-pi.jar swt, swt-mozilla.jar, etc, how do I create them?
>
> Thank you for your attention ...
>
> In win32 execute in Linux NOT...
>
>
>
>
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.SWTError;
> import org.eclipse.swt.browser.Browser;
> import org.eclipse.swt.events.SelectionAdapter;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.events.ShellAdapter;
> import org.eclipse.swt.events.ShellEvent;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.MessageBox;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Table;
> import org.eclipse.swt.widgets.TableColumn;
> import org.eclipse.swt.widgets.TableItem;
>
> public final class BrowserTable {
>
> private static final String PATH =
> System.getProperty("user.dir")+System.getProperty("file.separator
> ")+"resources"+System.getProperty("file.separator")+"cal_02.html ";
>
> public static void main(String[] args) {
> final Display display = new Display();
> final Shell shell = new Shell(display, SWT.DIALOG_TRIM);
> final FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
> shell.setLayout(fillLayout);
> shell.addShellListener(new ShellAdapter() {
> public void shellClosed(final ShellEvent e) {
> final MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK |
> SWT.CANCEL);
> mb.setText("Sair");
> mb.setMessage("Deseja sair?");
> e.doit = (mb.open() == SWT.OK);
> }
> });
> createBrowser(shell);
> createTable(shell);
>
> shell.setSize(500, 500);
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) {
> display.sleep();
> }
> }
> display.dispose();
> }
> public static void createTable(final Composite c) {
> final Table table = new Table(c, SWT.BORDER | SWT.FULL_SELECTION |
> SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL);
> table.setHeaderVisible(true);
> table.setLinesVisible(true);
>
> final GridData gridData = new GridData(GridData.FILL | GridData.FILL);
> gridData.horizontalSpan = 3;
> gridData.grabExcessVerticalSpace = true;
> gridData.grabExcessHorizontalSpace = true;
> table.setLayoutData(gridData);
> table.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(final SelectionEvent e) {
> final MessageBox mb = new MessageBox(c.getShell(),
> SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
> mb.setText("Excluir");
> mb.setMessage("Deseja excluir?");
> e.doit = (mb.open() == SWT.OK);
> if(e.doit) table.remove(table.getSelectionIndex());
> }
> });
>
> for (int i = 0; i < 1; i++) {
> new TableColumn(table, SWT.CENTER).setText("Id");
> new TableColumn(table, SWT.CENTER).setText("Descricao");
> }
>
> for (int i = 0; i < 10; i++) {
> final TableItem parent = new TableItem(table, SWT.NONE);
> parent.setText(0, "" + (i + 1));
> parent.setText(1, "Valor");
> }
>
> final TableColumn[] columns = table.getColumns();
> for (int i = 0, n = columns.length; i < n; i++) {
> columns[i].pack();
> } }
>
> private static void createBrowser(Composite c) {
> try {
> final Browser browser = new Browser(c, SWT.NONE);
> browser.setUrl(PATH); final GridData gridData = new GridData(GridData.FILL
> | GridData.FILL);
> gridData.horizontalSpan = 3;
> gridData.grabExcessVerticalSpace = true;
> gridData.grabExcessHorizontalSpace = true;
> browser.setLayoutData(gridData);
> } catch (final SWTError e) {
> System.err.println("Nao consegui inicializar o Browser: " +
> e.getMessage());
> return;
> }
> }
> }
> --
> Lu
|
|
|
Re: SWT Browser run in Ubuntu with FireFox 3.6 [message #649253 is a reply to message #648407] |
Tue, 18 January 2011 12:07 |
|
I do not need any of this, I just downloaded firefox 3.6, mozilla`s site, untarred it and ran properly on ubuntu, debian etc...
Luís Carlos Moreira da Costa
Eclipse RAP, RCP, GMF, OSGI, Spring-DM and Pentaho Developer
Regional Communities/Brazil
http://wiki.eclipse.org/Regional_Communities/Brazil
Java, write once, run everywhere™
|
|
|
Goto Forum:
Current Time: Sat Apr 27 00:03:45 GMT 2024
Powered by FUDForum. Page generated in 0.03141 seconds
|