R.V. Veiko
Research Scientist, Research Centre for Medical Genetics (Moscow)
E-mail: db-mail-dbase@yandex.ru
In the late 1990s and early 2000s, Delphi was very popular in Russia. Perhaps, in most government information systems, the client part was implemented on Delphi. After that, the Delphi language lost its popularity, giving way to Oracle Java and Microsoft C#. Delphi is very convenient for implementing the graphical interface of client applications. Built in the Delphi IDE, the Visual Component Library (VCL) made it easy to implement standard GUI objects: windows, buttons, text boxes, check boxes, and so on. Within one of the projects, it was decided to switch from Delphi to Java. In Java, the main packages that provide the creation of graphical interfaces are AWT and Swing, and Swing is based on AWT. In this article, we give a first look at the correspondence between the VCL components and the corresponding Swing components.
Windows. In VCL the TForm class is responsible for the implementation of windows, inheriting which windows (conventional or modal) are implemented. In Java, the JFrame class (for normal windows) and JDialog (for modal windows) are responsible for this.
Controls. The analogue of the buttons in Swing is the JButton class, where the buttons can contain images (similar to TBitBtn from VCL). The check boxes are created using the JCheckBox class, the test fields are created using the JTextField class. Files are selected using the JFileChooser component (in Delphi - TOpenDialog and TSaveDialog). The group analog (TGroupBox) is a TitledBorder component. The scroll bars (TScrollBar in VCL) are implemented using the JScrollBar class. The labels are created through the JLabel class (in Delphi it is a component of TLabel). List (TListBox in VCL) - Jlist in Swing. Multiline editable text is implemented through the JTextArea component (in Delphi it is a component of TListBox). Tabs (TPageControl in VCL) are implemented using the JTabbedPane component. The panel (TPanel) is through the JPanel class. Progress bar (TProgressBar) - JProgressBar. Radio buttons (TRadioButton in VCL) - JRadioButton in Swing. Drop-down lists (TComboBox in Delphi) - JComboBox in Swing. Image (TImage in VCL) - class BufferedImage in AWT. The menu is implemented through the JMenu class, its elements through JMenuItem, and the pop-up menus through the JPopupMenu class.
Non-visual components. The font analog (TFont in VCL) is a JFont component. The analog color (TColor) is the Color class of the AWT library. Lists (TList in Delphi) can be specified as a parameterized ArrayList class.
During the transition from Delphi to Java, for convenience, "wrappers" around Java components were implemented
so that calls and properties were similar to calls and properties in VCL.