Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Help about gallery
Help about gallery [message #64553] Tue, 16 June 2009 18:37
gaston  is currently offline gaston Friend
Messages: 8
Registered: July 2009
Junior Member
Hi:
I am using the gallery and the expansion and redraw process are very slow,
could you help me ?
The attached code pick up photos from a folder. Thank you very much
Greetings.
Gaston. Argentina


import java.io.File;
import java.util.Arrays;

import org.eclipse.nebula.widgets.gallery.DefaultGalleryGroupRender er;
import org.eclipse.nebula.widgets.gallery.Gallery;
import org.eclipse.nebula.widgets.gallery.GalleryItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class prueba {
static int indentLevel=-1;
static Gallery list ;
static Shell shell;

public static void main (String [] args) {
Display display = new Display ();
shell = new Shell (display);
FillLayout fillLayout = new FillLayout ();
shell.setLayout (fillLayout);


list = new Gallery (shell, SWT.V_SCROLL | SWT.VIRTUAL );

DefaultGalleryGroupRenderer gr = new
DefaultGalleryGroupRenderer();
gr.setMinMargin(2);
gr.setItemHeight(100);
gr.setItemWidth(112);
gr.setAutoMargin(true);
list.setGroupRenderer(gr);

shell.open ();

listPath(new File("C:\\FotosVeterinaria"));

while (!shell.isDisposed ()) {
if (!display.readAndDispatch ())
display.sleep ();
}
display.dispose ();
}
public static void listPath(File path) {
File files[];
indentLevel++;
files = path.listFiles();

Arrays.sort(files);


Image nuevo;
GalleryItem group = new GalleryItem(list, SWT.VIRTUAL);
GalleryItem item ;
group.setText("Imagenes");
group.setExpanded(true);
Display display = shell.getDisplay();

for (int i = 0, n = files.length; i < n; i++) {
for (int indent = 0; indent < indentLevel; indent++) {
System.out.print(" *** ");
}

if (files[i].toString().contains(".JPG")) {

item = new GalleryItem(group, SWT.NONE);
nuevo = new Image(display,files[i].toString() );
item.setImage(nuevo);
// item.setText(files[i].toString());
// item.setData(files[i].toString());
}
// }
}
indentLevel--;
}

}
Previous Topic:[CDateTime] multiple selection / date range
Next Topic:Help about gallery
Goto Forum:
  


Current Time: Fri Apr 19 01:39:15 GMT 2024

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

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

Back to the top