출처 : http://www.jlab.net
Snippets There have been a significant number of small example code fragments posted to the newsgroup which provide insights into some aspect of SWT programming. This section is an attempt to capture these for future reference. Most of these have been written by one of the SWT committers, but in some cases they were created by modifying examples provided by other readers of the newsgroup. For simplicity, no attempt has been made to attribute these to a particular author. If you see something you wrote here, and want that to be noted, please email platform-swt-dev@eclipse.org and a by-line will be added.
You should also remember that examples from the newsgroup are often edited for brevity rather than completeness. They are intended to guide the reader towards the correct solution, rather than be finished products. NOTE: Snippets are tested against the HEAD stream and may reference new API or require bug fixes from there.
Note also that the best way to report an SWT bug is to write your own snippet showing the problem and paste it into the bug report. For a snippet template, see: "What is a snippet?" in the SWT FAQ.
If you are new to SWT and need help compiling and running snippets, click here for instructions.
- "Hello World"
- Browser
- BusyIndicator
- Button
- Canvas
- Caret
- Clipboard
- Combo
- Composite
- Control
- CoolBar
- CTabFolder, CTabItem
- Cursor
- DirectoryDialog
- Display
- create two one shot timers (5000 ms, 2000 ms)
- create one repeating timer (every 500 ms)
- stop a repeating timer when a button is pressed
- get the bounds and client area of a display
- fill a table from a background thread (sync exec)
- post mouse events (UI testing tools only)
- post key events (UI testing tools only)
- Drag and Drop
- FileDialog
- Font
- FormLayout
- GC
- GridLayout
- Image
- Label
- List
- Menu
- Monitor
- OLE and ActiveX
- Printing
- Program
- ProgressBar
- Sash
- SashForm
- Scale
- ScrolledComposite
- Shell
- create a dialog shell
- create a dialog shell (prompt for a value)
- create a splash screen
- prevent a shell from closing (prompt the user)
- prevent escape from closing a dialog
- open a shell minimized (iconified)
- open a shell maximized (full screen)
- create a non-rectangular window
- set icons with different resolutions
- Slider
- Swing/AWT
- TabFolder, TabItem
- Table, TableItem, TableColumn
- color cells and rows in table
- create a table (no columns, no headers)
- create a table (columns, headers, lines)
- create a table with 1,000,000 items (lazy)
- create a table (lazy with a thread)
- detect a selection or check event in a table (SWT.CHECK)
- find a table cell from mouse down (SWT.FULL_SELECTION)
- find a table cell from mouse down (works for any table style)
- insert a table item (at an index)
- insert a table column (at an index)
- place arbitrary controls in a table
- print selected items in a table
- remove selected items
- resize columns as table resizes
- scroll a table (set the top index)
- select an index (select and scroll)
- sort a table by column
- update table item text
- TableCursor
- TableEditor
- Text
- set the selection (i-beam)
- set the selection (start, end)
- verify input (only allow digits)
- select all the text in the control
- detect CR in a text control (default selelection)
- prevent CR from going to the default button
- resize a text control (show about 10 characters)
- add a select all menu item to the control
- prompt for a password (set the echo character)
- TextLayout, TextStyle
- ToolBar, ToolItem
- Tool Tips
- Tracker
- Tray, TrayItem
- Tree
- TreeEditor
- ... and a lots more still to come. Keep checking back.
'Dev... > 웹서비스' 카테고리의 다른 글
[펌] log4j를 웹로직에서 쓰자. (0) | 2005.02.13 |
---|---|
[펌] Velocity Template Engine 시작하기 (0) | 2005.02.13 |
[펌] iBatis SQL Maps 2.0에 대한 소개 (0) | 2005.02.13 |
[펌] 하이버네이트(Hibernate) 입문 (0) | 2005.02.13 |
[펌] Easy Struts 플러긴 사용법입니다 (0) | 2005.02.13 |