Đang chuẩn bị liên kết để tải về tài liệu:
Professional Eclipse 3 for Java Developers 2006 phần 4
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Nó có thể bao gồm các chuỗi trong dấu ngoặc kép tự động và có thể đưa văn bản trong Javadoc và ý kiến khác. Chức năng Gói Java Strings cũng là tốt đẹp. Trong chương trình ví dụ HelloWorld của chúng tôi, chỉ cần đặt con trỏ giữa Xin chào và thế giới và nhấn Enter. Kết quả là sự biểu hiện đúng cú pháp | The SWT Library Style Constant Description SWT.FLAT The button is not drawn in 3D fashion but in a flat fashion. SWT.BORDER The button is enclosed by a frame. Using the setText and setImage methods you can assign text or an image to a button. For pushbuttons and toggle buttons the text or the image appears on the button face. For check boxes and radio buttons the text or image is shown beside the button. Buttons of the ARROW type show neither text nor image. Both methods are mutually exclusive. Use either final Button button new Button composite SWT.PUSH button.setText Press me React to click events button.addSelectionListener new SelectionAdapter public void widgetSelected SelectionEvent e System.out.println Key was pressed or final Button button new Button composite SWT.PUSH Display display composite.getDisplay final Image image new Image display images button1.gif button.setImage image React to click events button.addSelectionListener new SelectionAdapter public void widgetSelected SelectionEvent e System.out.println Key was pressed Dispose image when button is disposed button.addDisposeListener new DisposeListener public void widgetDisposed DisposeEvent e image.dispose In the second case additional logic was needed to dispose of the Image resource when it was no longer required. This was necessary because images allocate resources in the host operating system. A good source for images for buttons toolbars and other purposes is the icon directories in the various Eclipse plug-ins for example eclipse plugins org.eclipse.pde.ui_3.0.0 icons obj16. 157 Chapter 8 Sliders and Scales Both the Slider and Scale classes support entry of a numeric value via a sliding control. Usually the Slider class is used for positioning window contents scroll bar while Scale is used for adjusting numeric parameters such as volume brightness contrast and so on. Figure 8.6 shows an instance of each Slider and Scale enclosed by a Group widget. Figure 8.6 The following style constants .