All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.dnd.ImageWindow
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Window
|
+----com.ibm.dnd.ImageWindow
- public class ImageWindow
- extends Window
- implements Runnable
The class represents a window with an image in the center.
This class has method trackMouse() which relocates window to follow mouse movements
For example:
ImageWindow iw = new ImageWindow( parent, image ); // parent - java.awt.Frame; image - image;
iw.trackMouse(windowEvent);
It runs separate thread with the lowest priority that actually moves the window.
-
ImageWindow()
- Constructor.
-
ImageWindow(Frame, ImageGlyph)
- Constructor.
-
ImageWindow(ImageGlyph)
- Constructor.
-
getImage()
- Returns the current image.
-
getPreferredSize()
- Returns the preferred size.
-
isActive()
- Returns the value of active flag.
-
isScalable()
- Returns the scalable flag.
-
paint(Graphics)
- Paints the ImageWindow.
-
repaint(long, int, int, int, int)
- Repaints the ImageWindow
-
run()
- This method implements corresponding method from Runnable interface.
-
setActive(boolean)
- Sets the value of active flag
-
setImage(ImageGlyph)
- Set the current image.
-
setScalable(boolean)
- Set scalable flag.
-
trackMouse(Component, Point)
- This method changes window location to follow the mouse movements.
-
trackMouse(MouseEvent)
- This method changes window location to follow the mouse movements
Shortcut for
trackMouse( e.getComponent(),e.getPoint() )
-
trackMouse(Point)
- This method changes window location to follow the mouse movements
It does not change the window position immediately.
-
update(Graphics)
- Repaints the window
ImageWindow
public ImageWindow()
- Constructor. Creates an ImageWindow with the default non-visible
parent frame, no image and false scalable flag.
ImageWindow
public ImageWindow(ImageGlyph image)
- Constructor. Creates an ImageWindow with the default non-visible
parent frame and false scalable flag.
- Parameters:
- image - ImageGlyph
ImageWindow
public ImageWindow(Frame parent,
ImageGlyph image)
- Constructor. Creates an ImageWindow with the false scalable flag.
- Parameters:
- parent - java.awt.Frame parent frame
- image - ImageGlyph
getImage
public ImageGlyph getImage()
- Returns the current image.
- Returns:
- com.ibm.uicontrols.ImageGlyph the current image
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size.
- Returns:
- java.awt.Dimension
- Overrides:
- getPreferredSize in class Container
isActive
public boolean isActive()
- Returns the value of active flag.
- Returns:
- boolean
- Overrides:
- isActive in class Window
isScalable
public boolean isScalable()
- Returns the scalable flag. If the value of the scalable flag is true, the image is streched accordind to the window size.
- Returns:
- boolean
paint
public void paint(Graphics gr)
- Paints the ImageWindow.
- Parameters:
- gr - java.awt.Graphics
- Overrides:
- paint in class Container
repaint
public void repaint(long tm,
int x,
int y,
int width,
int height)
- Repaints the ImageWindow
- Overrides:
- repaint in class Component
run
public void run()
- This method implements corresponding method from Runnable interface.
It updates the ImageWindow position when it changes. The thread running
this method has the lowest priority.
setActive
public void setActive(boolean value)
- Sets the value of active flag
- Parameters:
- value - boolean
setImage
public void setImage(ImageGlyph img)
- Set the current image.
- Parameters:
- img - new current image to display
setScalable
public void setScalable(boolean flag)
- Set scalable flag. If the value of the scalable flag is true, the image is streched accordind to the window size.
- Parameters:
- flag - boolean
trackMouse
public void trackMouse(Component component,
Point componentPoint)
- This method changes window location to follow the mouse movements.
A shortcut for
trackMouse(screenPoint)
- Parameters:
- component - a component
- componentPoint - point in the comoponent's coordinates
trackMouse
public void trackMouse(MouseEvent e)
- This method changes window location to follow the mouse movements
Shortcut for
trackMouse( e.getComponent(),e.getPoint() )
- Parameters:
- e - java.awt.event.MouseEvent
trackMouse
public synchronized void trackMouse(Point screenPoint)
- This method changes window location to follow the mouse movements
It does not change the window position immediately. It saves the new
window location and notify the updating thread it can change the window
position. The updating thread actually moves the window when it gets control.
This allows not to make unnecessary window move when it moves fast enough or
the system is busy with another task.
- Parameters:
- screenPoint - new window location
update
public void update(Graphics g)
- Repaints the window
- Parameters:
- gr - java.awt.Graphics
- Overrides:
- update in class Container
All Packages Class Hierarchy This Package Previous Next Index