public class Demo1 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("带文字和图片的标签示例"); shell.setLayout(new FillLayout()); CLabel clabel = new CLabel(shell, SWT.LEFT); clabel.setText("这是一个带图标的自定义标签"); clabel.setImage(display.getSystemImage(SWT.ICON_INFORMATION)); shell.pack(); shell.open(); while(!shell.isDisposed()){ if(!display.readAndDispatch()){ display.sleep(); } } display.dispose(); } }
时间: 2024-10-27 10:12:41