Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Problem whit load image
Problem whit load image [message #490723] Fri, 09 October 2009 20:28
Antonio is currently offline AntonioFriend
Messages: 39
Registered: July 2009
Member
Hi to all, thaks for yours help
i have this problem, i load a image, i use this snipet:

final Canvas canvas = new Canvas(shell,SWT.BORDER |SWT.NO_BACKGROUND |
SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL| SWT.H_SCROLL);
canvas.setLayoutData(new RowData(670,350));

botton.addSelectionListener (new SelectionAdapter () {

public void widgetSelected (SelectionEvent e)
{
String currentDir="c:\\";
FileDialog fileChooser = new FileDialog(s, SWT.OPEN);
fileChooser.setText("Open image file");
fileChooser.setFilterPath(currentDir);
fileChooser.setFilterExtensions(new String[] { "*.gif; *.jpg;
*.png; *.ico; *.bmp" });
fileChooser.setFilterNames(new String[] {"(gif, jpeg, png, ico,
bmp)" });
String filename = fileChooser.open();
currentDir = fileChooser.getFilterPath();
nomeFile=fileChooser.getFileName();
if (filename != null){
srFile=filename;
try{
final Image image=new Image(d,new FileInputStream(filename));
height = image.getBounds().height;
width = image.getBounds().width;
label15_1.setText(Integer.toString(height));
label15_2.setText(Integer.toString(width));

canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
GC gc = new GC(canvas);
gc.drawImage(image,10,50);
}
});
canvas.redraw();

}
catch(FileNotFoundException e1)
{
e1.printStackTrace();
}
}
}

});

i can see the image but don't scroll, you can help me?
best regads
Antonio
Previous Topic:Mistake by externilization of string from the plugin.xml
Next Topic:How to activate my custom presentation?
Goto Forum:
  


Current Time: Fri Apr 26 02:57:50 GMT 2024

Powered by FUDForum. Page generated in 0.02434 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top