[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.technology.albireo] Re: Advice on getting started?
|
First, thanks for taking the time to help me out.
Actually the snippet creates an anonymous subclass of
EmbeddedSwingComposite. The subclass implements only the
createSwingComponent() method. That's basically how it was intended to
be used.
Oh ok. I wasn't aware you could do it like that with an abstract class.
I thought I had to "extend" my class to 'EmbeddedSwingComposite' since
it was abstract (or make it non abstract). I'm still a student, so sorry
for the newbiness :)
I went off of your snippet you posted (the one with the JTables) and
also your Eclipse article and i'm apparently doing something wrong still.
In the old code, we put the canvas onto a JFrame.
Am I missing a function call?
What do I do with the returned JComponent of createSwingComponent()?
Should I be returning the frame instead of the canvas?
So the code i used was:
.
.
.
SashForm sf = new SashForm(main_shell, SWT.VERTICAL);
sf.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true,true));
Composite swing_composite = new Composite(sf, SWT.EMBEDDED |
SWT.NO_BACKGROUND); // put this composite as the top portion of the sashform
createPartControl(swing_composite);
setFocus();
.
.
.
then my function that I went off of your snippet example:
public void createPartControl(Composite parent) {
embeddedComposite = new EmbeddedSwingComposite(parent, SWT.NONE) {
protected JComponent createSwingComponent() {
/* Creating components */
JFrame frame = new JFrame();
canvas = new NetCanvas(frame);
canvas.setBackground( Color.BLACK );
canvas.setBounds( frame.getBounds() );
canvas.setDoubleBuffered( false );
return canvas;
}//end createSwingComponent
};
embeddedComposite.populate();
}//end
public void setFocus() {
embeddedComposite.setFocus();
}