Hatton T. - SWT. A Developer's Notebook

Hatton T. - SWT. A Developer's Notebook
Название:
Hatton T. - SWT. A Developer's Notebook
Размер:
3 MB
50
Скачать
SWT: A Developer's Notebook
Год: 2004
Автор: Tim Hatton
Издательство: O'Reilly
ISBN: 0-596-00838-4
Язык: Английский
Формат: CHM
Качество: Распознанный текст без ошибок (OCR)
Количество страниц: 320
Описание: The Eclipse platform continues to gain tremendous popularity as both a Java IDE and a Java platform for application programming. One of the core underpinnings of Eclipse is SWT, the Standard Widget Toolkit. This set of components can be used to develop graphical user interfaces in Java,and offer a native-code alternative to Java's Swing and AWT components. Incorporating the look and feel of whatever platform the code is run on, SWT offers a lightning-fast approach to building GUIs, all of which actually look like they belong on the platform on which they are run.
But you already know what you want to do--so wading through the basics of user interface design, graphical components, and what a button does is simply a waste of time. Enter SWT: A Developer's Notebook. In typical Developer's Notebook style, you'll learn how to take SWT out for a spin, make it work for you, and turn it upside down, all without wasted words or space. Each lab in this notebook details a specific task; you can read from the first page to the last, look up just what you need to know, and even squeeze this book into your laptop bag as a quick reference when you forget how to create a multi-tabbed view.
This book covers:
Downloading and configuring Eclipse and SWT
Menus, toolbars, and buttons
Building tabbed layouts and folders
SWT's unique coolbar control
Adding listeners and responding to events
Building a complete SWT-based application
Примеры страниц
Оглавление
>>> Chapter 1 Getting Started
Downloading the SWT Library
Configuring Eclipse for SWT Development
Supplying the SWT Package to the Java Compiler
Specifying the Location of the Native Library
Using swt.jar in Multiple Projects
>>> Chapter 2 SWT Shells
Creating a Simple Shell
Executing the Example
Working with Shell Styles
Creating a Shell Styles Example
Creating Child Shells
Creating Multiple Child Windows
Opening True Dialogs
Setting the Shell Title Text
Setting the Shell Icon
>>> Chapter 3 SWT Menus
Creating the Menu Bar
Adding Drop-Down Menus
Adding Separator Bars
Creating a Complete Menu System
Adding Cascading Submenus
Making Menus Perform the Intended Action
Working with Other Menu Item Styles
Determining the State of CHECK and RADIO Menu Items
Adding Keyboard Shortcuts
Creating Pop-Up Menus
>>> Chapter 4 SWT Toolbars
Creating the Toolbar
Creating Toolbar Buttons
Creating a Complete Toolbar Example
Making the Buttons Work—Adding Listeners
Adding Separators to Your Toolbar
Adding Check and Radio ToolItems
Determining Whether a Check or Radio Button Is Selected
Using Tool Tips
>>> Chapter 5 SWT Text Fields
Adding Text Fields to a Shell
Adding a Border to a Text Field
Positioning the Text Field
Setting the Tab Order
Setting the Text Size Limit
Interacting with the Text in the Text Widget
Populating Text Fields from a Database
Appending Text to a Text Field’s Contents
Creating Multiline Text Fields
Wrapping Text
Adding Scrollbars
Reacting to Text Events
Performing Field Validation
Creating Display-Only Text Fields
Creating Password Fields
>>> Chapter 6 SWT Buttons
Creating Push-Style Buttons
Responding to Button Clicks
Creating Check Buttons
Determining CHECK Button Status
Adding Listeners to CHECK Buttons
Using Radio-Style Buttons
Causing No Radio Button to be Selected
Creating Toggle Buttons
Determining the State of a Toggle Button
Creating Arrow Buttons
Using Images with Buttons
Setting Tool-Tip Text
Enabling and Disabling Buttons
>>> Chapter 7 SWT Lists
Creating a List
Adding Items to a List
Inserting Items in the Middle of a List
Populating a List from a Database
Removing Items from a List
Determining the Selected Items
Determining the Selected Item with Multiple Selections
Causing an Item to Appear Selected
Changing an Item’s Text Value
Adding Scrollbars to a List
>>> Chapter 8 The SWT Combo
Creating a Combo List
Adding Items to a Combo List
Creating a Working Combo List
Getting the Value of the Selected Item
Programmatically Selecting an Item
Removing Items from a Combo List
Adding Events to Combo Widgets
Allowing Additions to the Combo List
Getting and Setting Text in the Text Portion of the Combo
Setting the Maximum Length for Entries
Deselecting Text
Responding to Item Changes in the Combo
Using the SIMPLE Style
>>> Chapter 9 SWT Layouts
What Are the SWT Layouts?
Attaching a Layout to a Container
Filling the Entire Container with Widgets
Changing Widget Placement in FillLayouts
Lining Up Widgets Using RowLayout
Controlling Wrapping of Widgets with RowLayout
Controlling Sizing of Widgets with RowLayout
Creating Vertical Rows
Creating a GridLayout
Creating Column Headings
Controlling Widget Sizing and Alignment
Forcing Widgets to Span Multiple Cells
The SWT FormLayout
Creating a Simple Password Entry Form
>>> Chapter 10 SWT Composites and Groups
Subclassing the Composite Class
Using the TextPaneComposite Class on a Shell
Using Composite Class Styles
Using the Group Class
Creating Multiple Instances of a Composite Subclass
Using Composites to Achieve Complex Designs
An Alternate Approach
>>> Chapter 11 SWT Tabbed Folders
Creating an Instance of TabFolder
Creating the Individual Tabs
Adding Widgets to the Tabs
Creating a Complete Tabbed Folder Example
Setting a Default Tab
>>> Chapter 12 SWT Tables
Creating a Simple Table
Highlighting Rows upon Selection
Allowing Multiple-Row Selection
Selecting Items Programmatically
Changing the Background Color
Creating a Searchable Table
Setting the Background of a Single Cell
Adding Find-and-Replace Functionality
>>> Chapter 13 SWT Trees
Creating the Tree
Adding Items to the Tree
Adding Items to Other Items
Creating a Full Tree Example
Using Images with TreeItem
Changing the Image When the Item Is Expanded
Using Trees with Other Widgets
Working with Other Tree Styles
Determining the Checked Item(s)
>>> Chapter 14 Other SWT Listeners
Using KeyListener
Using MouseListener
Working with the MouseEvent Class
Responding to Shift-Click Events
Working with the MouseMoveListener
Using the MouseTrackListener
>>> Chapter 15 SWT CoolBars
Creating a CoolBar
Using Events with CoolBars
Adding Widgets Other Than Buttons to the CoolBar
Preventing the User from Rearranging the CoolBar
Using ToolBars with CoolBars
>>> Chapter 16 SWT Slider and ProgressBar
The SWT Slider Class
Using the SWT ProgressBar Class
Creating a Moving Progress Bar
>>> Chapter 17 SWT Standard Dialogs
Using the SWT MessageBox Class
Using the SWT FileDialog Class
Using the SWT FileDialog Class
Using the SWT FileDialog Class
The SWT ColorDialog Class
Using the SWT FontDialog Class
Using the SWT PrintDialog Class
>>> Chapter 18 A Complete SWT Application
Designing the Application
Developing the Application
The End of the SWT Road
Доп. информация: Example code - http://examples.oreilly.com/9780596008383/
Дооформил B62