Results 1 to 1 of 1
Thread: CLabel Gradient Background
-
CLabel Gradient Background
Java Code:import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class CLabelGradientBG { Display display = new Display(); Shell shell = new Shell(display); Image image = new Image(display, "java2s.gif"); public CLabelGradientBG() { init(); CLabel labelGradientBg = new CLabel(shell, SWT.SHADOW_IN); labelGradientBg.setText("CLabel with gradient colored background"); labelGradientBg.setImage(image); labelGradientBg.setBounds(10, 10, 300, 100); labelGradientBg.setBackground( new Color[] { display.getSystemColor(SWT.COLOR_GREEN), display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_RED)}, new int[] { 50, 100 }); shell.pack(); shell.open(); //textUser.forceFocus(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); } private void init() { } public static void main(String[] args) { new CLabelGradientBG(); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
How to Run a .exe in background???
By jazz2k8 in forum New To JavaReplies: 9Last Post: 01-21-2011, 11:27 AM -
MemImage is an in-memory icon showing a Color gradient
By Java Tip in forum java.awtReplies: 0Last Post: 06-23-2008, 11:18 PM -
Color gradient
By Java Tip in forum java.awtReplies: 0Last Post: 06-21-2008, 08:50 PM -
Set the background in Java
By barney in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:13 AM -
Why this image background is black ?
By samson in forum Java 2DReplies: 1Last Post: 07-17-2007, 04:24 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks