MyEclipse swt/swing Designer (top)

Source: Internet
Author: User

1. What is the Swt/swing designer?

The Swt/swing designer is a Java GUI designer that makes it very easy to create Java GUI applications without having to spend a lot of time writing code that displays simple forms. You can use the WYSIWYG visual designer to create complex windows within minutes, while generating Java code. You can also use drag-and-drop operations to easily add controls, add event handlers to controls, change various properties using the control Editor, internationalize your application, and more. The generated code does not require additional custom libraries to compile and run, and SWT can reverse engineer most of the handwritten Java GUI code.

The editor is made up of the following parts:

    • design View --Main visual layout area.
    • structure View -constitutes component tree and property Pane.
      • Component Tree --Displays the hierarchical relationship between all components.
      • property Pane --Displays the properties and events for the selected component.
    • toolbar -provides access to commonly used commands.

This editor also has the following main features:

    • bidirectional code generation --reads and writes most handwritten code in almost any format and reverse engineering process.
    • Internationalization (i18n)/localization --The external component string, creating and managing resource bundles.
    • custom composites & Panels --Create custom reusable components.
    • factories --Create custom factory classes and methods.
    • Visual inheritance --Create a hierarchy of visual components.
    • event handling --the component that adds an event handler.
    • menu Edit --Visually create and Edit menu bars and menu items and pop-up menus.
    • deform --Converts the type of one component to another.

The Swing designer contains the necessary tools for creating Windows, forms, and other UI elements.

Swing designer2. Create a UI element

Use the Swt/swing Designer to create a new UI element class for a part of the project. Select File>new>other, then expand Windowbuilder and select one of the many components to continue the details of the element through the wizard.

Select a UI element to create

After you complete the wizard and create the finished UI element, swing designer opens and allows you to use Design view or source view when designing elements.

2.1 Select Layout Manager

When writing a Java application, you might want to use the layout to look at the window specifically. The location and size of the layout control are in the container. A layout class is a subclass of a layout abstract class. SWT and swing provide several standard layout classes, and you can write custom layout classes. Other UI toolkits are embedded in the implicit Layout Manager for each panel type.

In Java, locations and dimensions are not automatically generated. The application can determine the size and placement of the original container, or adjust the listener. Another option is to specify a layout class to locate and size. If there is no size, then they are zero and cannot be seen.

The layout manager sets the size and location based on a variety of factors, such as:

    • Layout rules for layout manager
    • Property settings for Layout manager
    • Individual components of the Layout Data Association
    • Size of the container

Each layout manager has its own performance advantages and disadvantages. Grid-based layouts and constraint-based layouts are the most useful and powerful standard layouts, but they are also the most complex. When you use Design view, you can change the layout according to your own needs. The tool can adjust the code that is running according to the requirements. Changing the layout you can select a composite layout by adding the Layout manager container's source code, or by using the palette's layout Tools on the design panel.

3. Design view

Design view is a virtual artboard. You can add or remove components, edit layout properties, edit labels directly, and see the evolution of your overall design.

Edit Form Design

You select a component in Design view so that it can be displayed in the Properties view, and you can edit its properties. This also allows you to select a handle for the component. For layout properties of some layout managers and homogeneous controls, selection handles let you change the performance of the layout of the selected control. All properties that are changed in Design view also change accordingly in the Properties view. The row and column headings may be visible in the header area, depending on the layout manager in effect.

Right-click a component to access the same context menu from the component tree. You can select them in the palette to add components and then press the DELETE key to delete them.

3.1 Selecting Components

Use the tool in the palette to select one or more parts. Hold down the SHIFT or CTRL key to select multiple parts.

Select components

Select multiple parts using the Rubber Band marquee tool in the palette. Hold down the ALT key and drag to the auto-start marquee tool.

Select with the Marquee tool3.2 Editing Component text

There are shortcuts to edit buttons (including check and radio buttons), labels, text fields, groups, and table column text properties. You first select the component in Design view, and then press the SPACEBAR to display an edit box in which you can set the component's text properties.

Edit Component Text3.3 Moving Components

When you move components in Design view, the Layout Manager provides a unique drag feedback. In an absolute layout like X, y orientation, the live component is displayed using a ToolTip to move out of its current position. A component that provides a dynamic snap/align point to facilitate coordination with other components or window margins.

Moving components in the x,y-oriented layout

In a rasterized layout, different feedback depends on the end of the cell pointer. If a pointer is positioned on an open cell, the cell is highlighted in green and the pointer is shown as a green checkmark. If the pointer is prevented from being on the boundary of a row or column, the row or column boundary is highlighted in yellow, indicating that a new row or column will be inserted. If the pointer is positioned over a filled cell, the area is highlighted in red, and the pointer is displayed as a red minus sign.

Moving components in a grid-oriented layout3.4 Adjusting Components

When you adjust components in Design view, dimensional feedback provides a dedicated layout manager. In an absolute layout like X, y orientation, the new dimensions of the contour use the tool to show the current size. A component that provides a dynamic snap/align point to facilitate coordination with other components or window margins. Resizing a component also captures the preferred size of the adjustment component's parameters, or the dimensions of other components (vertical or horizontal) in the same parent.

Adjusting components in a x,y-oriented layout

In a grid layout, the component is adjusted so that it spans multiple rows and columns. During an adjustment operation, the component that is occupied in the cell is displayed in green.

Adjusting components in a grid-oriented layout

MyEclipse official Chinese online line, welcome to download Communication!

MyEclipse swt/swing Designer (top)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.