本文整理汇总了Java中org.mihalis.opal.itemSelector.DLItem类的典型用法代码示例。如果您正苦于以下问题:Java DLItem类的具体用法?Java DLItem怎么用?Java DLItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DLItem类属于org.mihalis.opal.itemSelector包,在下文中一共展示了DLItem类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.mihalis.opal.itemSelector.DLItem; //导入依赖的package包/类
public static void main(final String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("Dual List Snippet");
shell.setSize(600, 600);
shell.setLayout(new GridLayout(1, false));
System.out.println("shell = "+shell);
final DualList dl = new DualList(shell, SWT.NONE);
dl.setItems(createItems(shell));
dl.addSelectionChangeListener(new SelectionChangeListener() {
@Override
public void widgetSelected(final SelectionChangeEvent e) {
System.out.println("Selection Change Listener called");
for (final DLItem item : e.getItems()) {
final StringBuilder sb = new StringBuilder();
if (item.getLastAction() == LAST_ACTION.SELECTION) {
sb.append("[SELECTION] ");
} else {
sb.append("[DE-SELECTION] ");
}
sb.append(item.getText());
System.out.println(sb.toString());
}
}
});
dl.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
示例2: createItems
import org.mihalis.opal.itemSelector.DLItem; //导入依赖的package包/类
private static List<DLItem> createItems(final Shell shell) {
final List<DLItem> list = new ArrayList<DLItem>();
String defaultFontName = null;
int defaultHeight = -1;
for (final FontData fontData : shell.getFont().getFontData()) {
if (defaultFontName == null) {
defaultFontName = fontData.getName();
}
if (defaultHeight == -1) {
defaultHeight = fontData.getHeight();
}
}
final Font font = new Font(shell.getDisplay(), defaultFontName, defaultHeight, SWT.BOLD);
list.add(new DLItem("Austria", createImage(shell, "austria")));
list.add(new DLItem("Belgium", createImage(shell, "belgium")));
list.add(new DLItem("Bulgaria", createImage(shell, "bulgaria")));
list.add(new DLItem("Cyprus", createImage(shell, "cyprus")));
list.add(new DLItem("Czech Republic", createImage(shell, "czech")));
list.add(new DLItem("Denmark", createImage(shell, "denmark")));
list.add(new DLItem("Estonia", createImage(shell, "estonia")));
list.add(new DLItem("Finland", createImage(shell, "finland")));
list.add(new DLItem("France", createImage(shell, "france"), font));
list.add(new DLItem("Germany", createImage(shell, "germany")));
list.add(new DLItem("Greece", createImage(shell, "greece")));
list.add(new DLItem("Hungary", createImage(shell, "hungary")));
list.add(new DLItem("Ireland", createImage(shell, "ireland")));
list.add(new DLItem("Italy", createImage(shell, "italy")));
list.add(new DLItem("Latvia", createImage(shell, "latvia")));
list.add(new DLItem("Lithuania", createImage(shell, "lithuania")));
list.add(new DLItem("Luxembourg", createImage(shell, "luxembourg")));
list.add(new DLItem("Malta", createImage(shell, "malta")));
list.add(new DLItem("Netherlands", createImage(shell, "netherlands")));
list.add(new DLItem("Poland", createImage(shell, "poland"), shell.getDisplay().getSystemColor(SWT.COLOR_WHITE), shell.getDisplay().getSystemColor(SWT.COLOR_RED)));
list.add(new DLItem("Portugal", createImage(shell, "portugal")));
list.add(new DLItem("Romania", createImage(shell, "romania")));
list.add(new DLItem("Slovakia", createImage(shell, "slovakia")));
list.add(new DLItem("Slovenia", createImage(shell, "slovenia")));
list.add(new DLItem("Spain", createImage(shell, "spain")));
list.add(new DLItem("Sweden", createImage(shell, "sweden")));
list.add(new DLItem("United Kingdom", createImage(shell, "unitedkingdom")));
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
font.dispose();
}
});
return list;
}