Problem with picture using plugin [message #161284] |
Sat, 11 December 2004 05:09 |
Eclipse User |
|
|
|
Originally posted by: pengfai81.mail.yahoo.com
hello, i'm beginner of java eclipse tools. Currentl i am using in this
tool.I have a problem of inserting pictures using this function as below:
InputStream in = getClass().getResourceAsStream("map.gif");
Label nodeLabel1 = new Label("Node4", new
Image(getViewSite().getShell().getDisplay(), in));
final NodeFigure nodeFigure1 = new NodeFigure(nodeLabel1);
panel.add(nodeFigure1, BorderLayout.CENTER);
This is the function that I found but seem like not working. Do you have
other suggestion in term to insert pictures? Thanks...
|
|
|
|
Re: Problem with picture using plugin [message #161496 is a reply to message #161364] |
Tue, 14 December 2004 04:12 |
Eclipse User |
|
|
|
Originally posted by: pengfai81.mail.yahoo.com
Pratik Shah wrote:
> Are you adding the label to nodeFigure1 somewhere? What is NodeFigure's
> layout?
> "Michael" <pengfai81@mail.yahoo.com> wrote in message
> news:cpdve2$ivf$1@www.eclipse.org...
>> hello, i'm beginner of java eclipse tools. Currentl i am using in this
>> tool.I have a problem of inserting pictures using this function as below:
>>
>> InputStream in = getClass().getResourceAsStream("map.gif");
>> Label nodeLabel1 = new Label("Node4", new
>> Image(getViewSite().getShell().getDisplay(), in));
>> final NodeFigure nodeFigure1 = new NodeFigure(nodeLabel1);
>> panel.add(nodeFigure1, BorderLayout.CENTER);
>>
>> This is the function that I found but seem like not working. Do you have
>> other suggestion in term to insert pictures? Thanks...
>>
Here is the NodeFigure's code ...
public class NodeFigure extends Figure {
public NodeFigure(Label name) {
ToolbarLayout layout = new ToolbarLayout();
layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
layout.setStretchMinorAxis(false);
layout.setSpacing(2);
setLayoutManager(layout);
add(name);
}
}
thanks in advance ...
|
|
|
|
Re: Problem with picture using plugin [message #161534 is a reply to message #161502] |
Wed, 15 December 2004 07:33 |
Eclipse User |
|
|
|
Originally posted by: pengfai81.mail.yahoo.com
Pratik Shah wrote:
> Try setting some text on the label (or maybe a LineBorder) and see if it's
> visible. Maybe the problem is with loading the image.
>>I tried it before ...And the text label is visible. But,the problems occured
when loading the picture. Any suggestion instead of the code i have written
before?
|
|
|
|
Re: Problem with picture using plugin [message #162535 is a reply to message #161698] |
Wed, 22 December 2004 08:18 |
Eclipse User |
|
|
|
Originally posted by: pengfai81.mail.yahoo.com
I am not clear abt why my application window can display the .gif picture
but not to plugin project.Is that different mechanism to implement it?
The node text alone is visible but if i include with image together, the
error "An error has occurred when creating this view" came out when
running the pugin project.
plugin code:
InputStream in = getClass().getResourceAsStream("map.gif");
Label nodeLabel1 = new Label("Node4", new
Image(getViewSite().getShell().getDisplay(), in));
final NodeFigure nodeFigure1 = new NodeFigure(nodeLabel1);
panel.add(nodeFigure1, BorderLayout.CENTER);
I get stucked here.Or i calling the wrong image method..
Thanks...
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02658 seconds