[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.technology.albireo] Re: For Starters...

Sorry I forgot to mention I was doing a standalone SWT application. In fact I don't even know what an RCP application is, but i'll be sure to look it up and find out :)

Thanks for the tips also. Is this forum strictly for the project or are am I allowed to ask questions relating to implementing SWT/Swing bridge for my program as well. Perhaps there is a better group to ask those questions in?

Another thing I wanted to mention is I hope the word gets around more that there is indeed a SWT/Swing bridge. In the SWT book I have, there was no mention of it (it covered version 3.0 I believe). The only reason I was aware of it was when I came across your article browsing the eclipse corner articles. Next I searched on google trying to find more examples or information on the bridge, then I eventually came across the page for this project.

Perhaps when I figure out how to use this bridge more and get my program working with it, I can submit a basic program example that uses the swing version of piccolo inside of SWT. Like I said, the SWT version of piccolo is incomplete with missing features and there's a different way of doing certain things..so I'm sure there are other SWT users who might want to use the swing piccolo as well and get benefit from further work on the SWT/Swing bridge.

By the way, will this project be included in a future version of SWT?

Gordon Hirsch wrote:
It's really helpful to know of your interest and what you are working on, so thanks for that.


Sorry about that. You didn't mention if you are writing an Eclipse RCP application or just a standalone SWT application. Below is a snippet that implements an RCP view with a simple embedded Swing JTable, using the code included with the article. If you're writing a standalone SWT application, you should be able to take just the code from createPartControl() and added it to a shell or some other composite. Once you get it running, you should also be able to replace the JTable with another component of your choice. Make sure you take a look at the javadoc as well. The sample code still has some issues, as you can see from some of the other posts in this newsgroup.

public class JTableView extends ViewPart {

    private EmbeddedSwingComposite embeddedComposite;

    public void createPartControl(Composite parent) {
        embeddedComposite = new EmbeddedSwingComposite(parent, SWT.NONE) {
            protected JComponent createSwingComponent() {
                /* Creating components */
                int nrows = 1000, ncolumns = 10;
                Vector rows = new Vector();
                for (int i = 0; i < nrows; i++) {
                    Vector row = new Vector();
                    for (int j = 0; j < ncolumns; j++) {
                        row.addElement("Item " + i + "-" + j);
                    }
                    rows.addElement(row);
                }
                Vector columns = new Vector();
                for (int i = 0; i < ncolumns; i++) {
                    columns.addElement("Column " + i);
                }
                JTable table = new JTable(rows, columns);
                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                table.createDefaultColumnsFromModel();

                JScrollPane scrollPane = new JScrollPane(table);

                return scrollPane;
            }
        };
        embeddedComposite.populate();
    }

    public void setFocus() {
        embeddedComposite.setFocus();
    }

}