public static void main(String[] args) throws IOException { List<Emoticon> emoticons = new ArrayList<Emoticon>(); new EmoFormat(emoticons, protocols).load(); Display display = new Display(); shell = new Shell(display); DirectoryDialog dialog = new DirectoryDialog(shell, SWT.NONE); dialog.setText("Select folder with emoticon images"); String path = dialog.open(); if (path == null) return; // String path = "C:\\Desenvolvimento\\Miranda\\bin\\Debug // Unicode\\Customize\\Emoticons\\Originals"; File mepPath = new File(path); if (!mepPath.exists()) return; mepFormat = new MepFormat(mepPath, emoticons, protocols); mep = mepFormat.load(); createMainWindow(shell); shell.setText("Emoticon Pack Editor"); shell.setImage(Images.get("data/Defaults/smile.png")); shell.setSize(500, 600); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
private static void createEmoticonNameLabel(final Composite parent, EmoticonImage icon) { File defImage = new File("data/Defaults/" + icon.emoticon.name + ".png"); if (defImage.exists()) { Label label = new Label(parent, SWT.NONE); label.setLayoutData(gridData(1, 2)); label.setImage(Images.get(defImage)); createBoldLabel(parent, getEmoLabelText(icon), gridData(1, 2)); } else { createBoldLabel(parent, getEmoLabelText(icon), gridData(2, 2)); } }
private static void createToolbar(Composite main) { Button save = new Button(main, SWT.PUSH); save.setImage(Images.get("imgs/disk.png")); save.addListener( SWT.Selection, new Listener() { public void handleEvent(Event event) { try { mepFormat.save(); } catch (IOException e) { e.printStackTrace(); } } }); }
@Test public void testFindImages() throws Exception { assertNotNull(Images.get(fileImage)); assertNotNull(Images.get(packageImage)); assertNotNull(Images.get(imageFolderImage)); }