SWT(JFace)体验之Label的几种效果
2009-06-23 17:55
585 查看
演示代码:
接着前面的例子:http://blog.csdn.net/kunshan_shenbin/archive/2009/06/23/4291846.aspx
LabelWrap.java
LabelSeparator.java
接着前面的例子:http://blog.csdn.net/kunshan_shenbin/archive/2009/06/23/4291846.aspx
LabelWrap.java
package swt_jface.demo1; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class LabelWrap { public LabelWrap() { Display display = new Display(); Shell shell = new Shell(display); String text = "Professional Java Interfaces With SWT/JFace, by Jack Li Guojie"; Label labelNoWrap = new Label(shell, SWT.BORDER); labelNoWrap.setText(text); labelNoWrap.setBounds(10, 10, 100, 100); Label labelWrap = new Label(shell, SWT.WRAP | SWT.BORDER); labelWrap.setText(text); labelWrap.setBounds(120, 10, 100, 100); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } public static void main(String[] args) { new LabelWrap(); } }
LabelSeparator.java
package swt_jface.demo1; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class LabelSeparator { Display display = new Display(); Shell shell = new Shell(display); Image image = new Image(display, "C:/eclipse32.gif"); public LabelSeparator() { shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.BORDER); // Label label = new Label(shell, SWT.SEPARATOR); label.setImage(image); label.setText("Label"); label.setBounds(10, 10, 150, 150); CLabel clabel = new CLabel(shell, SWT.SHADOW_IN); clabel.setImage(image); clabel.setText("CLabel"); clabel.setBounds(170, 10, 150, 150); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } public static void main(String[] args) { new LabelSeparator(); } }
相关文章推荐
- SWT(JFace)体验之图片的动态渐变效果
- SWT(JFace)体验之Label增亮显示
- SWT(JFace)体验之图片的动态渐变效果
- SWT(JFace)体验之拖曳效果
- SWT(JFace)体验之TreeViewer
- SWT(JFace)体验之ApplicationWindow
- SWT(JFace)体验之快捷键设定
- SWT(JFace)体验之FormLayout布局
- SWT(JFace)体验之ProgressBar
- SWT(JFace)体验之系统托盘实现
- SWT(JFace)体验之FontRegistry
- SWT(JFace) Menu、Bar...体验代码
- SWT(JFace)体验之Slider,Scale
- SWT(JFace)体验之DRAW2D包
- SWT(JFace)体验之Icon任我变
- SWT(JFace)体验之StyledText类