![]() |
![]() |
![]() |
![]() |
Property Notebooks
Notebook pages
Each time a part is added to the Working Model, its Properties Notebook is displayed in the Composer window. At any future time, a part's Properties Notebook can be viewed either by selecting the part's Object Name from the Part List or by clicking the part with the mouse.
Every part in the Composer has a minimum of three pages in its properties notebook. These three pages are
All properties specified in the properties notebook are the initial properties that a part will have. Any properties may be changed in the working model by either event code or by user interaction with the working model. The user may restore all parts to the state specified in the properties pages by choosing the Initialize Class menu item on the Program menu.
The first property page for any part contains the name which will identify the declared object and the part-specific properties for that object. For example, the first page for a Checkbox would contain the Object Name plus the checkbox label and the initial checkbox state.
The first property page may also contain controls which have no effect on the operation of the final program, but will assist the user in using the part while in the Composer. For example, the Flow Layout part has a checkbox to indicate whether the Empty Space should appear. The user should check this checkbox to add additional parts to the Flow Layout, and uncheck it when finished. Further, the user can specify the position of the Empty Panel using the Position choice field.
The second property page is the Visual properties page. This page is identical for every part. It contains the visual properties that are common to all parts. Initially, these properties are set to 'default' which means that they should inherit the properties of the layout in which they are sitting. By changing one of these properties, the user overrides this default setting. If a visual property is changed for a layout, that property cascades through all of the parts within that layout as long as that property is set to 'default' for each of those parts.
- Font This specifies the font to use when displaying the part. When the font name is set to default, the font size and style will be disabled.
- Color This specifies the foreground and background colors to be used when displaying the part.
- Cursor This specifies the mouse cursor to be displayed when the mouse is placed over the part.
- Visible This specifies whether the part is initially visible.
- Enabled This specifies whether the part is initially enabled.
Parts from the Swing library also include
- Tool Tip This is the text that should be displayed when the user holds the mouse over a component without activity for a period of time.
- Double Buffer This specifies whether graphics should be drawn using an off-screen buffer, rather than directly on the screen. It uses more memory, but creates much smoother scrolling. Any part which is doubled buffered will also double buffer its children.
- Auto-scroll This option lets a part do internal scrolling based on mouse and cursor movement. It only has meaning for parts which support it, such as JTextField.
The third properties page is the Listeners page. This page contains a set of checkboxes corresponding to the kinds of events that a part is capable of 'Listening' for. The events which are most often used are presented in bold.
When a listener is selected, a new page will appear in that part's properties notebook. This new page will contain a code area where the user can specify code which should be executed in response to events of that Listener type. Many types of events have several kinds of events defined within them. Each of these events are listed in the choice field at the top of the event page. The code which is displayed in the code area corresponds to the event listed in the choice field.
The user can enter any legal Java statements in the code area. Simplicity watches for any changes made and updates the working model so that the working model always reflects the current state of the code. When the user generates an event in the Working Model, the event code will be executed. If there is an error in the code, a message will be printed to the console.
At the top of every event page is a Code Sourcerer button. The Code Sourcerer will write Java statements for the user based upon the user's choices.
All parts listen for at least five types of events.
- Component Events These events are generated when a part is shown, hidden, resized, or moved.
- Focus Events These events are generated when a part gains or loses the focus.
- Key Events These events are generated when the user presses or releases a key.
- Mouse Events These events are generated when the mouse enters or exits a part, or when a mouse button is pressed or released over a part.
- Mouse Motion Events These events are generated when the mouse is moved or dragged over a part.
All of the Layout parts also listen for a sixth type of event.
Some parts generate additional events which are specific to their functionality. For example, a Button generates an Action Event whenever the user presses the Button.
The properties notebooks for the top-level containers (Main Application, Frame, Window, Dialog, Panel, Object) also have a fourth page titled Class. This page contains code areas for user code. These code areas include
- declaration code This code area should be used to declare any static variables or instance variables that a program may need. Any Java statement which is legal to exist within the outermost scope of a Java class can be put here.
- constructor code This code area should be used for any additional initialization code that a class may need. Any legal Java statements may be placed here. This code will be appended to the class constructor.
- method code This code area should be used to declare any static methods or instance methods that a program may need.
- finalize() code This code area should be used for any de-construction code. It will be executed asynchronously by the Java garbage collector when the class is no longer in use.
A Main Application Composer will also have code areas for the four special methods that a web browser uses to control an Applet.
Each of these code areas can be also be reached using the Code menu in the Composer. They can be tested by being used in event code or by the commands on the Program menu in the Composer.
Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |
![]() |
![]() |
![]() |
![]() |