com.cyberoxygen.Amiga
Class AmigaFrame

All Implemented Interfaces:
none.
Direct Known Subclasses:
none.

public class AmigaFrame

The AmigaFrame class is a java API to deal with Elate/Amiga Digital Environment windows.
AmigaFrame is built on top of the ewinease and core Elate APIs.

It's main goal is to provide access to Elate's unique window features and also, by allowing the programmer to manipulate the pixel map directly in memory, gain considerable performance increases over the traditional java Frame class.

In the simplest case, an AmigaFrame window can be constructed and displayed on screen with the following code:
 
 

int[] pix = new int[640*480];
int flags = AmigaFrame.BORDER|AmigaFrame.TITLE|AmigaFrame.INNER|AmigaFrame.CLOSE;
AmigaFrame af = new AmigaFrame("Name",640,480,32,pix,flags);
af.show();
At the moment, mouse and keyboard listening is not supported, but it is planned for the future.

Field Summary
 byte[] pix_b
 short[] pix_s
 int[] pix_i
static final String VERSION
static final int FDI_BORDER
static final int FDI_TITLE
static final int FDI_CONTENT
static final int FDI_CLOSE
static final int FDI_MIN
static final int FDI_MAX
static final int FDI_DRAG
static final int FDI_RESIZE
static final int FDI_INNER
static final int FAVO_HIDDEN
static final int FAVO_ALPHA
static final int FAVO_ROOTPIX
static final int FAVO_INTERACTIVE
static final int FAVO_TRIG
static final int FAVO_COMMON
static final int FAVO_OPAQUE
static final int FAVO_RECPATCH
static final int FAVO_PERSIST
static final int FAVO_BLOCKING
static final int FAVO_RECURSIVE

Constructor Summary
AmigaFrame(String title, int width, int height, int pixDepth, byte[] pix_b, int flags)
     Create a new, initially invisible AmigaFrame.
AmigaFrame(String title, int width, int height, int pixDepth, short[] pix_s, int flags)
     Create a new, initially invisible AmigaFrame.
AmigaFrame(String title, int width, int height, int pixDepth, int[] pix_i, int flags)
     Create a new, initially invisible AmigaFrame.


 
Method Summary
boolean contains(int x, int y)
          Checks whether the frame "contains" the specified point.
boolean contains(Point p)
          Checks whether the frame "contains" the specified point.
void dispose()
          Disposes of the Frame. 
Rectangle getBounds()
          Gets the bounds of this component in the form of a Rectangle object.
Point getLocation()
          Gets the location of this component in the form of a point specifying the component's top-left corner. 
Point getLocationOnScreen()
          Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
Dimension getMaximumSize()
          Gets the maximum size of this frame.
Dimension getMinimumSize()
          Gets the minimum size of this frame.
String getName()
          Gets the name of the component.
Dimension getPreferredSize()
          Gets the preferred size of this frame.
Dimension getSize()
          Returns the size of this frame in the form of a Dimension object. 
String getTitle()
          Gets the title of the frame.
boolean isClosed()
          Tells if the frame is closed.
void repaint()
          Updates the frame's pixmap. 
void setBounds(int x, int y, int width, int height)
          Moves and resizes this frame.
void setBounds(Rectangle r)
          Moves and resizes this frame to conform to the new bounding rectangle r. 
void setPixFlags(int flags, int mask)
          Sets the pixelmap's flags.
void setLocation(int x, int y)
          Moves this frame to a new location.
void setLocation(Point p)
          Moves this frame to a new location.
void setName(String name)
          Sets the name of the frame to the specified string.
void setSize(int width, int width)
          Resizes this frame to the given values.
void setSize(Dimension d)
          Resizes this frame so that it has width d.width and height d.height. 
void show()
          Draws the component on the screen.



 
 
 

Field Detail

pix_b

public byte[] pix_b

             A byte array for a 1,4 or 8 bit pixmap, provides direct access to this frame's pixel buffer. Memory is assumed to have been allocated prior to the constructor call.



 

pix_s

public short[] pix_s

        A short array for a 12, 15 or 16 bit pixmap, provides direct access to this frame's pixel buffer. Memory is assumed to have been allocated prior to the constructor call.



 

pix_i

public int[] pix_i

        An integer array for a 24 or 32 bit pixmap, provides direct access to this frame's pixel buffer. Memory is assumed to have been allocated prior to the constructor call.



 

VERSION

public static final String VERSION

        The version number of this distribution of the AmigaFrame class.



 

FDI_BORDER

public static final int FDI_BORDER

     Border gadget flag.



 

FDI_TITLE

public static final int FDI_TITLE

     Title gadget flag.



 

FDI_CONTENT

public static final int FDI_CONTENT

     Content gadget flag.



 

FDI_CLOSE

public static final int FDI_CLOSE

     Close button flag.



 

FDI_MIN

public static final int FDI_MIN

     Minimize button flag.



 

FDI_MAX

public static final int FDI_MAX

     Maximize button flag.



 

FDI_DRAG

public static final int FDI_DRAG

     Dragable flag.



 

FDI_RESIZE

public static final int FDI_RESIZE

     Resizable flag.



 

FDI_INNER

public static final int FDI_INNER

     Inner area size.



 

FAVO_HIDDEN

public static final int FDI_HIDDEN

     AVO hidden flag.



 

FAVO_ALPHA

public static final int FDI_ALPHA

     AVO alpha flag.



 

FAVO_ROOTPIX

public static final int FDI_ROOTPIX

     AVO rootpix flag.



 

FAVO_INTERACTIVE

public static final int FDI_INTERACTIVE

     AVO interactive flag.



 

FAVO_TRIG

public static final int FDI_TRIG

     AVO trig flag.



 

FAVO_COMMON

public static final int FDI_COMMON

     AVO common flag.



 

FAVO_OPAQUE

public static final int FDI_OPAQUE

     AVO opaque flag.



 

FAVO_RECPATCH

public static final int FDI_RECPATCH

     AVO recpatch flag.



 

FAVO_PERSIST

public static final int FDI_PERSIST

     AVO persist flag.



 

FAVO_BLOCKING

public static final int FDI_BLOCKING

     AVO blocking flag.



 

FAVO_RECURSIVE

public static final int FDI_RECURSIVE

     AVO recursive flag.



 
 
 

Constructor Detail

AmigaFrame

public AmigaFrame(String title, int width, int height, int pixDepth, byte[] pix_b, int flags)
 

Create a new, initially invisible AmigaFrame, with the specified title, width, height and pixel depth. This constructor is to be used for 1,4 or 8 bit depths only.
 
Parameters:
    title - the title of the frame.
    width - the width of the frame.
    height - the height of the frame.
    pixDepth - color resolution: 1,4 or 8 bit.
    pix_b - the byte array that holds the pixels for this frame's pixmap. Memory for this array must be allocated before the frame can be used.
    flags - the flags can take any value from the FDI constants defined in the class, or a bitwise OR combination of those constants.
Throws:
        Error - if the pixel depth (pixDepth) is neither 1, 4 or 8 bits.
See Also:
show


 

AmigaFrame

public AmigaFrame(String title, int width, int height, int pixDepth, short[] pix_s, int flags)
 

Create a new, initially invisible AmigaFrame, with the specified title, width, height and pixel depth. This constructor is to be used for 12, 15 or 16 bit depths only.
 
Parameters:
    title - the title of the frame.

    width - the width of the frame.
    height - the height of the frame.
    pixDepth - color resolution: 12,15 or 16 bit.
    pix_s - the short array that holds the pixels for this frame's pixmap. Memory for this array must be allocated before the frame can be used.
    flags - the flags can take any value from the FDI constants defined in the class, or a bitwise OR combination of those constants.
Throws:
        Error - if the pixel depth (pixDepth) is neither 12, 15 or 16 bits.
See Also:
show


 

AmigaFrame

public AmigaFrame(String title, int width, int height, int pixDepth, int[] pix_i, int flags)
 

Create a new, initially invisible AmigaFrame, with the specified title, width, height and pixel depth. This constructor is to be used for 24 or 32 bit depths only.
 
Parameters:
    title - the title of the frame.
    width - the width of the frame.
    height - the height of the frame.
    pixDepth - color resolution: 24 or 32 bit.
    pix_i - the integer array that holds the pixels for this frame's pixmap. Memory for this array must be allocated before the frame can be used.
    flags - the flags can take any value from the FDI constants defined in the class, or a bitwise OR combination of those constants.
Throws:
        Error - if the pixel depth (pixDepth) is neither 24 or 32 bits.
See Also:
show

 
 
 

Method Detail

contains

public boolean contains(int x, int y)
 

Checks whether this frame "contains" the specified point, where x and y are defined to be relative to the coordinate system of this frame.
 
Parameters:
        x - the x coordinate of the point.
        y - the y coordinate of the point.
See Also:

contains(Point p)


 

contains

public boolean contains(Point p)
 

Checks whether this frame "contains" the specified point, where the point's x and y coordinates are defined to be relative to the coordinate system of this frame.
 
Parameters:
        p - the point.
See Also:

contains(int x, int y)


 

dispose

public void dispose()
 

Disposes of the frame. The thread started by the frame is destroyed.


 
 

getBounds

public Rectangle getBounds()
 

Gets the bounds of this frame in the form of a Rectangle object. The bounds specify this component's width, height, and location relative to its parent.
 
See Also:

getLocation, setBounds,getSize


 

getLocation

public Point getLocation()
 

Gets the location of this component in the form of a point specifying the component's top-left corner. The location will be relative to the parent's coordinate space (currently it can only be the screen).
 
See Also:

getLocationOnScreen , setLocation


 

getLocationOnScreen

public Point getLocationOnScreen()
 

Gets the location of this component in the form of a point specifying the component's top-left corner in the screen's coordinate space.
 
See Also:

getLocation , setLocation


 

getMaximumSize

public Dimension getMaximumSize()
 

This method returns the maximum size for the frame.
 
See Also:

getMinimumSize , getPreferredSize


 

getMinimumSize

public Dimension getMinimumSize()
 

This method returns the minimum size for the frame.
 
See Also:

getMaximumSize , getPreferredSize


 

getName

public String getName()
 

Gets the name of the frame.
 
See Also:

setName


 

getPreferredSize

public Dimension getPreferredSize()
 

This method returns the preferred size for the frame.
 
See Also:

getMinimumSize , getMaximumSize


 

getSize

public Dimension getSize()
 

This method returns the current size for the frame.
 
See Also:

setSize


 

getTitle

public String getTitle()
 

Gets the title of the frame.


 

repaint

public void repaint()
 

Updates the frame's pixmap.


 

isClosed

public boolean isClosed()
 

Tells if the frame is closed (for instance, has been closed by the user).
Note: this method is likely to become deprecated in a future release.


 

setBounds

public void setBounds(int x, int y, int width, int height)
 

Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height.
 
Parameters:
        x - The new x-coordinate of this frame.

        y - The new y-coordinate of this frame.
        width - The new width of this frame.
        height - The new height of this frame.
See Also:

getBounds , setLocation , setSize


 

setBounds

public void setBounds(Rectangle r)
 

Moves and resizes this component to conform to the new bounding rectangle r. This component's new position is specified by r.x and r.y, and its new size is specified by r.width and r.height.
 
Parameters:
        r - The new bounding rectangle for this frame.
See Also:

getBounds , setLocation , setSize


 

setPixFlags

public native void setPixFlags(int flags, int mask)
 

This method allows individual AVO flags to be set, cleared or toggled.
 
Parameters:

        flags - the flags can take any value from the FAVO constants defined in the class, or a bitwise OR combination of those constants.
        mask - FAVO constants to use as mask.


 

setLocation

public void setLocation(int x, int y)
 

Moves this component to a new location. The top-left corner of the new location is specified by the x and y parameters in the coordinate space of this component's parent.
 
Parameters:
        x - The x-coordinate of the new location's top-left corner in the parent's coordinate space.

        y - The y-coordinate of the new location's top-left corner in the parent's coordinate space.
See Also:

setBounds , getLocation


 

setLocation

public void setLocation(Point p)
 

Moves this component to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space.
 
Parameters:
        p - The point defining the top-left corner of the new location, given in the coordinate space of this component's parent.
See Also:

setBounds , getLocation


 

setName

public void setName(String name)
 

Changes the name of the frame.
 
Parameters:
    name - The frame's new name.
See Also:

getName


 

setSize

public void setSize(int width, int height)
 

Resizes this component so that it has width width and height.
 
Parameters:
    width - The new width of this component in pixels.
    height - The new height of this component in pixels.
See Also:

getSize , setBounds


 

setSize

public void setSize(Dimension d)
 

Resizes this component so that it has width d.width and height d.height.
 
Parameters:
    d - The dimension specifying the new size of this component.
See Also:
                    getSize , setBounds

 

show

public native void show()
 

Draws this frame on the screen, making it visible to the user. Should be called one time after the frame has been constructed.




 
 



Version History

    v0.2 Beta
    ---------
        - AmigaFrame class released under LGPL open source license
        - intent 1.1 compatibility implemented
        - repaint bug fixed
        - new FAVO constants added
 

    v0.1 Beta
    ---------
        - Initial public release.
 
 

Contact info:
Please let me know of any improvements or ideas you may have for this class. Email me at:
rubenmonteiro@oninet.pt

Thanks!
 

AmigaFrame java class is Copyright 2001 by Ruben Monteiro. All rights reserved.