S2S is a stand alone application that allows developer
to convert existing Swing GUI applications into SWT GUI.
The program examines run-time structure of Swing GUI and
generates appropriate java code.
Conversion Mapping
|
|
Swing
|
SWT
|
|
JRadioButton
|
Button SWT.RADIO
|
|
JCheckBoxButton
|
Button SWT.CHECK
|
|
JButton
|
Button SWT.PUSH
|
|
JToggleButton
|
Button SWT.TOGGLE
|
|
JLabel
|
Label
|
|
JSlider
|
Scale
|
|
JTextArea
|
Text SWT.MULTI
|
|
JEditorPane
|
StyledText
|
|
JPasswordField
|
Text
|
|
JTextField
|
Text
|
|
JList
|
List
|
|
JComboBox
|
Combo
|
|
JTree
|
Tree
|
|
JTable
|
Table, TableColumn, TableItem
|
|
JProgressBar
|
ProgressBar
|
|
JDesktopPane
|
CTabFolder
|
|
JInternalFrame
|
CTabItem
|
|
JPanel
|
Composite | Group
|
|
JTabbedPane
|
CTabFolder
|
|
JScrollPane
|
ScrolledComposite
|
|
JMenuBar
|
Menu SWT.BAR
|
|
JToolBar
|
ToolBar
|
|
JToolBar subcomponents
|
ToolItem SWT.RADIO | SWT.CHECK
| SWT.PUSH | SWT.SEPARATOR
|
|
JMenu
|
Menu
|
|
JCheckBoxMenuItem
|
MenuItem SWT.CHECK
|
|
JRadioButton
|
MenuItem SWT.RADIO
|
|
JMenuItem
|
MenuItem
|
|
FlowLayout
|
FillLayout | RowLayout
|
|
GridLayout
|
GridLayout
|
|
GridBagLayout:
|
GridLayout
|
|
CardLayout
|
StackLayout
|
|
BoxLayout
|
FillLayout | RowLayout
|
|
Other Layouts
|
null layout, Bounds property
|
|
BorderLayout
|
FormLayout
|
|
AbsoluteLayout
|
null layout, Bounds property
|
In addition, main properties of Swing components are examined
and property set code is generated for SWT properties such
as Alignment, Text, ToolTipText, Selection, Editable, Enabled,
Icon, Image, DisabledImage, HotImage, Bounds, Minimum, Maximum,
EchoChar and others.
Image (Icon) Handling:
If image path can be identified, it is copied and referenced
direclty. If image path cannot be identified, screen capture
on the image is performed, and the resulting jpeg is saved
to generated folder and then referenced in generated SWT
java code.
Other Components Handling:
If SWING2SWT encounters a component, which it cannot map
to the appropriate SWT component, an SWT Label with appropriate
message is used as a stub for the unhandled component.