Results 1 to 1 of 1
-
Creating a flat tool bar with images
Java Code:import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; public class Snippet36 { public static void main(String[] args) { Display display = new Display(); Image image = new Image(display, 16, 16); Color color = display.getSystemColor(SWT.COLOR_RED); GC gc = new GC(image); gc.setBackground(color); gc.fillRectangle(image.getBounds()); gc.dispose(); Shell shell = new Shell(display); ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.BORDER); for (int i = 0; i < 12; i++) { ToolItem item = new ToolItem(toolBar, SWT.DROP_DOWN); item.setImage(image); } toolBar.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } image.dispose(); display.dispose(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
Javadoc-tool
By tskumarme in forum New To JavaReplies: 1Last Post: 05-30-2008, 01:31 PM -
ANT (Another Neat Tool) - II
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 05-24-2008, 02:44 PM -
ANT (Another Neat Tool)
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 05-17-2008, 11:42 AM -
SPT Relational Database Web Tool 1.0
By JavaBean in forum Java SoftwareReplies: 0Last Post: 10-16-2007, 06:39 PM -
Swing Tool
By Nick15 in forum AWT / SwingReplies: 2Last Post: 05-05-2007, 05:45 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks