AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
JInternalFrame typedict
 
A JInternalFrame is the interface to the Java Swing JInternalFrame Component. There are a few subtle differences, but it you already know how to use a JFrame you will not have much to learn. The most important difference is that a JInternalFrame is a lightweight component that can not be displayed on its own; instead it must be put in a container, usually a JDesktopPane, which must be added to a heavyweight window, like a JFrame or JDialog, before the internalframe can be displayed your screen. In practice, the easiest way to add an internalframe to a JDesktopPane is to use the desktop field, which is described below. Most of the other JFrame behavior that you are familiar, including events and event handlers, carries over to a JInternalFrame. Yoix programs normally interact with a JInternalFrame using event handlers and by reading or writing the following fields:
autodispose An int that arranges to dispose the internalframe, exactly as if a non-zero value had been stored in the dispose field, whenever a visible internalframe is hidden while autodispose is non-zero.
autoraise An int that automatically puts the internalframe on top of all other internalframes whenever a non-zero value is stored in the internalframe's visible field.
background The Color that is used to paint the background of the internalframe. It is also the default background color assigned to components in the layout array that do not pick their own. An internalframe that does not set its own background color uses VM.screen.background. Reading returns a snapshot of the current color. Writing immediately sets the internalframe's background, and the background of components contained in the internalframe that do not pick their own, to the new color.
backgroundhints An int that controls how backgroundimage is displayed in the internalframe. The value should be one of SCALE_AREA, SCALE_DEFAULT, SCALE_FAST, SCALE_NONE, SCALE_REPLICATE, SCALE_SMOOTH, or SCALE_TILE, which are all defined in yoix.image. SCALE_NONE places the unscaled image in the upper left corner of the internalframe, while SCALE_TILE (the default) tiles the entire internalframe with the unscaled image. The other values select the algorithm used to scale backgroundimage so it fills the entire internalframe. Reading returns the current hints. Writing immediately repaints the internalframe using the new hints to display the background image.
backgroundimage An Object that should be an Image or String that identifies an image that is automatically displayed as part of the internalframe's background in a way that is controlled by the value assigned to backgroundhints. A NULL value, which is the default, means there is no image. A backgroundimage that is a String should name a local a file or URL that contains a GIF or JPEG image. Reading returns the current image. Writing immediately repaints the internalframe using the new image.
border An Object that should be a Border, Insets, Number, or String that describes the border that is drawn around this internalframe. A NULL value, which is the default, means no border. A border that is an Insets or Number is handled differently than most other Swing components, because it is used, in combination with the insets field, to set the extent of the highlighted border, in units of 72 dots per inch, that is drawn around the internalframe. A border that is a String is a quick way to surround this internalframe with a border that uses the String as its title. Reading returns a snapshot of the current border. Writing immediately sets the internalframe's border to the new value.

The behavior of this field probably will be changed in a future release, so we recommend that an internalframe's border not be used.

closable An int that is 1 (the default) when the internalframe can be closed by user actions and 0 when it can not. Writing immediately changes the closable state to the new value, which should affect the internalframe's decorations.
closed An int that is 1 when the internalframe has been closed, and 0 otherwise. Reading returns the current closed state. Writing immediately sets the internalframe's closed state to the new value.
components A Dictionary maintained by the interpreter's layout machinery that maps tag fields to actual components; every component contained in the internalframe has an entry in the dictionary. In addition, the root field in each component is automatically set to the internalframe, so the components dictionary is easy to find, and that means individual components can find each other by name using the root.components dictionary.
cursor An Object that should be an int, Image, or String that selects the cursor shown when the pointer is over the internalframe. It is also the default cursor assigned to components in the internalframe's layout array that do not pick their own. A cursor that is an int should be one of the cursors defined in the yoix.awt.Cursor dictionary. A cursor that is an Image can describe the cursor using its size and hotspot fields and often draws it using its paint function. A cursor that is a String should be the name of a cursor that is already defined in yoix.awt.Cursor or the name a local a file or URL that contains a GIF or JPEG image that will be used as the cursor.

Reading returns the current cursor. Writing immediately sets the internalframe's cursor, and the cursor of components contained in the internalframe that do not pick their own, to the new value. An internalframe that does not set its own cursor uses DEFAULT_CURSOR.

desktop The JDesktopPane that is responsible for the internalframe. Reading returns the current desktop, or NULL if the internalframe is not currently managed by a JDesktopPane. Writing removes the internalframe from the current desktop and moves it to the new desktop if the new value is not NULL.
dispose An int that is 1 when the internalframe has been properly disposed and 0 otherwise. Reading returns the current dispose state. Writing a non-zero value immediately disposes the internalframe; writing 0 has no effect, which means you cannot resurrect a disposed internalframe. Failure to dispose of unused internalframes means system resources are lost, and that can eventually affect the performance of your program.
doublebuffered An int that is 1 when the internalframe uses double-buffering to draw itself, 0 when it does not, and starts with a default value that is selected by Java for the internalframe. Reading returns the current double-buffering behavior. Writing immediately sets the internalframe's double-buffering behavior to the new value. Note that double-buffering may be required when transparent components are used.
dragenabled An int that should be set to 1 when this internalframe wants to use the automatic drag handling that Swing provides for some components, and 0 (the default) when it does not. Components that do not provide automatic drag handling always return 0 when their dragenabled field is read, so storing 1 in dragenabled should only be viewed as a request for a service that may not be available. Swing components can always take complete control of their drag and drop handling using their transferhandler field or special drag and drop event handlers.
enabled An int that is 1 when the internalframe, or any of the components contained in the internalframe, can respond to user input, and 0 when they can not. Reading returns the current state. Writing immediately sets the internalframe's state to the new value.
firstfocus An int that should be 1 (the default) if the first time the internalframe is shown the focus should automatically be given to the last component in layout that has non-zero values assigned to its requestfocus and requestfocusenabled fields. Setting firstfocus to 0 is unusual, but can be used when an application needs to disable the initial automatic focus selection step.
focusowner A read-only int that is non-zero when the internalframe has the focus.
font The Font, or font name if it is a String, that is used as the default font assigned to components in the layout array that do not pick their own. Reading returns a snapshot of the current font. Writing immediately changes the internalframe's font, and the font used by all components contained in the internalframe that do not pick their own, to the new font.
foreground The Color that is used as the default foreground color assigned to components in the layout array that do not pick their own. An internalframe that does not set its own foreground color uses VM.screen.foreground. Reading returns a snapshot of the current color. Writing immediately sets the internalframe's foreground, and the foreground of components contained in the internalframe that do not pick their own, to the new color.
fronttoback An int that is 1 when components that appear earlier in the layout array are placed on top of components that appear later, and 0 when the stacking order is reversed. In practice, GridBagLayout and CardLayout are only layout managers where stacking components makes sense. Reading returns the current stacking order. Writing immediately tries to change the stacking order.
glasspane A Swing component, often a JCanvas or JPanel, that completely covers the internalframe when its visible field is non-zero and is hidden otherwise. The component is transparent unless its opaque field is non-zero. Reading returns the current glasspane, which is NULL by default. Writing immediately changes the component the internalframe is using as its glasspane. In the current implementation the root field in glasspane does not point to the internalframe, but that may change in a future release.
graphics A Graphics object that defines properties and built-ins that are used to apply graphics operations to this internalframe. Writing after an internalframe has been created is not allowed and will result in an invalidaccess error.
iconifiable An int that is 1 (the default) when the internalframe can be iconified by user actions and 0 when it can not. Writing immediately changes the iconifiable state to the new value, which should affect the internalframe's decorations.
iconified An int that is 1 when the internalframe has been iconified, and 0 otherwise. Reading returns the current iconified state. Writing immediately sets the internalframe's iconified state to the new value.
layout An Array of objects, often just components, that the layoutmanager arranges in the internalframe. Reading returns the current array. Writing immediately clears internalframe and then arranges the new set of components in the internalframe.
layoutmanager A LayoutManager that takes components from the layout array, arranges them in the internalframe, updates the internalframe's components dictionary, and makes sure the root field in each component is set to the internalframe. Reading returns the current layout manager. Writing, when validate is non-zero, immediately clears the internalframe and then rearranges the components in the layout array using the new layout manager. Yoix internalframes use a BorderLayout as their default layout manager.
location A Point that determines the location of the internalframe's upper left corner in the default Yoix coordinate system, which has its origin at the upper left corner of the screen, positive x to the right, positive y down, and a resolution of 72 dots per inch. Reading returns a snapshot of the current location. Writing immediately moves the internalframe to the new location.
maximizable An int that is 1 (the default) when the internalframe can be maximized by user actions and 0 when it can not. Writing immediately changes the maximizable state to the new value, which should affect the internalframe's decorations.
maximized An int that is 1 when the internalframe has been maximized, and 0 otherwise. Reading returns the current maximized state. Writing immediately sets the internalframe's maximized state to the new value.
menubar A JMenuBar that is attached to the internalframe. Reading returns the current menubar. Writing immediately removes the current menubar, if there is one and it is different than the new one, and attaches the new menubar.
nextcard An Object that CardLayout layout managers use to pick the next component that is displayed in the frame. See the description of CardLayout for more details.
opaque An int that should be 0 or 1 (the default) that is only used as the final default value for components contained in the internalframe that do not explicitly set their opaque field to something other than NULL. Changing an internalframe's opaque field does not affect the background of the internalframe itself, but it can immediately change the appearance of the components contained in the internalframe.
paint([Rectangle rect]) A Function that is called, if it is not NULL, whenever the internalframe needs to be painted. The optional rect argument describes the rectangle that needs repainting in the coordinate system specified by graphics.CTM, which by default has its origin at the internalframe's upper left corner, positive x to the right, positive y down, and a resolution of 72 dots per inch.
parent A window, which usually should be a JFrame, JDialog, JFileDialog, JWindow, or JInternalFrame, that is responsible for the internalframe. Hiding, disposing, iconifying or deiconifying the parent does the same thing to its children, so using a parent is a convenient way to manage a group of windows. Reading returns the current parent. Writing immediately sets the internalframe's parent to the new value.
popup A JPopupMenu that is associated with the internalframe. Reading returns the current popup menu. Writing immediately shows the popup menu at the point in the internalframe's coordinate system specified by the popup menu's location field, assuming of course that the internalframe is showing on the screen. Storing TRUE in the popup menu's visible field, which was added in release 1.2.0, is an easy way to show the popup menu that currently belongs to the internalframe.
repaint([int immediate]) A Builtin that tells the internalframe to completely repaint itself, which means the background is regenerated and then the internalframe's paint function is called. If the optional immediate argument is non-zero the repaint request is handled immediately rather than being queued as an event that is processed later. Obviously repaint should not be called, either directly or indirectly, from the internalframe's paint function, however erasedrawable is safe because it does not trigger a paint call.
requestfocus An int that can be used to request or transfer the keyboard focus. Storing a non-zero value in requestfocus tries to get the focus. Storing 0 tries to transfer the focus. Reading requestfocus does not currently return any useful information.
resizable An int that is 1 (the default) when the internalframe can be resized by user actions, and 0 when its size is fixed.
root A read-only field that for convenience always points to the internalframe itself.
showing A read-only int that is non-zero when the internalframe is showing on the screen. Reading showing or visible produce identical results for a top-level container like an internalframe.
size A Dimension that determines the size of the internalframe in units of 72 dots per inch. Reading returns a snapshot of the current size. Writing immediately changes the internalframe's size to the new value. Setting size to NULL means the layoutmanager determines the size of the internalframe based on the preferred size of the components in the layout array.
tag A String used to identify the internalframe that is either supplied when the internalframe is declared, or automatically generated otherwise. Frames are top-level containers, so the tag field is not particularly useful and may be deleted in future releases.
title A String that is used as the internalframe's title. Reading returns a snapshot of the current title. Writing immediately changes the title to the new value.
tooltiptext A String of characters that is displayed in a tightly sized pop-up window that appears near the cursor whenever the cursor lingers over the internalframe. Setting this value to NULL (the default) disables the tooltip mechanism. Reading returns the current tooltip text. Writing immediately sets the new tooltip text.
transferhandler An Object that should be a TransferHandler or String that determines how the internalframe handles data transfer operations like drag and drop. A value that is a String but not "" means the field named by the String should be used as the source and sink of the data that is transferred by the internalframe. The result is the same as assigning the String to the property field in a TransferHandler and then assigning that TransferHandler to transferhandler. The empty String "" is special and refers to the TransferHandler that Swing uses for automatic drag handling, if there is one.

Swing components that provide automatic drag handling start out with a transferhandler field that is not NULL, but the automatic drag handling is not enabled until 1 is stored in dragenabled. Swing components that provide their own drag and drop event handlers currently must store NULL in transferhandler before those event handlers will start working.

validate An int that is 1 when changing the layoutmanager field takes effect immediately, and 0 when the change is delayed, often until after the layout, size, or validate fields change. Storing a 1 in validate always runs Java's layout manager, even when nothing has changed.
visible An int that is 1 when the internalframe is visible, and 0 otherwise. Reading returns the current visibility. Writing immediately sets the internalframe's visibility to the new state.
Several permanent fields have not been documented and should not be used in Yoix applications. Event handlers are functions that must be added to an internalframe when it is declared. The handlers that work with internalframes are listed below; the names should be familiar if you have done some Java programming. The actionPerformed and itemStateChanged event handlers are only for menus.
 
 Event Handlers:   actionPerformed, componentHidden, componentMoved, componentResized, componentShown, dragDropEnd, dragEnter, dragExit, dragGestureRecognized, dragMouseMoved, dragOver, drop, dropActionChanged, focusGained, focusLost, invocationRun, itemStateChanged, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
 Example:   The program,
import yoix.*.*;

JFrame frame = {
    String title = "JInternalFrame Test";

    Array layout = {
        new JDesktopPane {
            String tag = "$_desktop";
            Color  background = Color.blue;
        }, CENTER,
    };
};

JInternalFrame internalframe = {
    String title = "Internal Frame";
    int    visible = TRUE;

    Dimension size = {
        double width = 4*72.0;
        double height = 3*72.0;
    };

    Point location = {
        double x = 36;
        double y = 36;
    };

    windowActivated(e) {
        printf("windowActivated: e=%O\n", e);
    }

    windowDeactivated(e) {
        printf("windowDeactivated: e=%O\n", e);
    }

    windowClosed(e) {
        printf("windowClosed: e=%O\n", e);
    }

    windowClosing(e) {
        printf("windowClosing: e=%O\n", e);
        return(FALSE);
    }

    windowIconified(e) {
        printf("windowIconified: e=%O\n", e);
    }

    windowDeiconified(e) {
        printf("windowDeiconified: e=%O\n", e);
    }

    windowOpened(e) {
        printf("windowOpened: e=%O\n", e);
    }

    componentShown(e) {
        printf("componentShown: e=%O\n", e);
    }

    paint(r) {
        graphics {      // named block
            gsave();
            setcmykcolor(0, 1, 0, 0);
            moveto(36, 36);
            rlineto(100, 0);
            rlineto(0, 50);
            fill();
            grestore();
        }
    }
};

frame.visible = TRUE;
sleep(2);
internalframe.desktop = frame.components.$_desktop;
shows how the desktop field can be used to add an internalframe to a JDesktopPane.
 
 See Also:   BorderLayout, BoxLayout, CardLayout, CustomLayout, FlowLayout, GridBagLayout, GridLayout, invokeLater, JButton, JCanvas, JCheckBox, JCheckBoxMenuItem, JChoice, JColorChooser, JComboBox, JDesktopPane, JDialog, JFileChooser, JFileDialog, JFrame, JLabel, JLayeredPane, JList, JMenu, JMenuBar, JMenuItem, JPanel, JPasswordField, JPopupMenu, JProgressBar, JRadioButton, JRadioButtonMenuItem, JScrollBar, JScrollPane, JSeparator, JSlider, JSplitPane, JTabbedPane, JTable, JTextArea, JTextCanvas, JTextField, JTextPane, JTextTerm, JToggleButton, JToolBar, JTree, JWindow, LayoutManager, postEvent, toBack, toFront, TransferHandler

 

Yoix is a registered trademark of AT&T Inc.