swingwt.awt
Class Window

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwt.awt.Window
All Implemented Interfaces:
ImageObserver, MenuContainer
Direct Known Subclasses:
Dialog, Frame, JWindow

public class Window
extends Container


Field Summary
protected  boolean delayPack
           
protected  org.eclipse.swt.widgets.Display display
           
protected static int FRAME_DECORATION_HEIGHT
          Number of pixels to allow for frame decoration during pack()
protected static int FRAME_DECORATION_WIDTH
          Number of pixels to allow for frame decoration during pack()
protected  Image iconImage
           
protected  boolean isClosed
           
protected  boolean isIcon
           
protected  org.eclipse.swt.widgets.Shell peer
           
protected  JMenuBar pMenu
           
protected  MenuBar pMenuBar
           
protected  JRootPane rootPane
           
protected  java.lang.String title
           
protected  java.util.Vector windowListeners
           
 
Fields inherited from class swingwt.awt.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
Fields inherited from class swingwt.awt.Component
accessibleContext, actionCommand, actionListeners, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, pEnabled, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, ppeer, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Window(Frame parent)
           
Window(Window parent)
           
Window(Window parent, GraphicsConfiguration gc)
           
 
Method Summary
 Component add(Component c)
          Overridden to point to getContentPane() rather than throwing an error
 void add(Component c, java.lang.Object layoutModifier)
          Overridden to point to getContentPane() rather than throwing an error
 void addMouseListener(MouseListener l)
          Overridden to add mouse listeners to the content pane instead
 void addWindowListener(WindowListener l)
           
protected  void create()
           
protected  void create(int SWTFrameType)
          Actually does the work of creating the Window peer All the descendants of Window call this with an appropriate SWT type as part of their constructor.
protected  void dispatchEvents()
           
 void dispose()
          Destroys the component and stops all listeners
 Rectangle getBounds()
          Returns the actual bounds of the component (or 0,0,0,0 if it isn't realised yet)
 JButton getDefaultButton()
           
 Image getIconImage()
           
 JMenuBar getJMenuBar()
           
 LayoutManager getLayout()
          Overridden to point to getContentPane() rather than throwing an error
 Point getLocationOnScreen()
          FIXME: Bad algorithm here, but can't find appropriate routine.
 MenuBar getMenuBar()
           
 Dimension getSize()
          Returns the peers actual size.
protected  int getSWTFrameType()
           
 org.eclipse.swt.widgets.Control getSWTPeer()
          Returns the SWT peer
 java.lang.String getTitle()
           
 void hide()
          Makes the component invisible
 boolean isActive()
           
 void pack()
           
protected  void processWindowEvent(int id)
           
protected  void processWindowEvent(WindowEvent e)
           
 void registerWindowEvents()
           
 void remove(Component c)
          Overridden to point to getContentPane() rather than throwing an error
 void removeMouseListener(MouseListener l)
          Overridden to remove mouse listeners from the content pane instead
 void removeWindowListener(WindowListener l)
           
protected  void repaintFix()
          Under GTK2 and MacOSX, SWT has some trouble issuing repaints, the only way around it seems to be to tell SWT to relayout the top-level container again after creation and child components have been added.
 void setBounds(int x, int y, int width, int height)
          Sets the physical bounds of the component - used by layout managers
 void setBounds(Rectangle r)
          Sets the physical bounds of the component
 void setCachedProperties()
          If the component has just been added to a container, but properties were set in the meantime, this routine gets called by JSWTComposite to set the cached properties.
 void setDefaultButton(JButton button)
           
 void setIconImage(Image icon)
           
 void setJMenuBar(JMenuBar menu)
           
 void setLayout(LayoutManager l)
          Overridden to point to getContentPane() rather than throwing an error
 void setLayout(LayoutManager2 l)
          Overridden to point to getContentPane() rather than throwing an error
 void setLocation(int x, int y)
          Sets the component's location in it's container
 void setLocation(Point p)
          Sets the component's location in it's container
 void setLocationRelativeTo(Component c)
           
 void setMenuBar(MenuBar menu)
           
 void setSize(Dimension d)
          Sets the peer's actual size
 void setSize(int width, int height)
          Sets the peer's actual size
 void setSwingWTParent(Composite parent)
           
 void setTitle(java.lang.String s)
           
 void setVisible(boolean b)
          Change the visibility of the component
 void show()
          Makes the component visible
 void toBack()
          Sends the window to the back
 void toFront()
          Sends the window to the front
 
Methods inherited from class swingwt.awt.Container
add, add, add, addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getInsets, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, remove, removeAll, removeComponentFromCache, removeContainerListener, revalidate, setLayoutImpl, setSwingWTParent, validate
 
Methods inherited from class swingwt.awt.Component
add, addActionListener, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, addNotify, calculatePreferredSize, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getAccessibleContext, getActionCommand, getAlignmentX, getAlignmentY, getBackground, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getListeners, getLocation, getName, getPeer, getPeerSize, getSize, getToolkit, getToolTipText, getTreeLock, getWidth, getX, getY, grabFocus, hasFocus, hasSetFont, imageUpdate, inside, isEnabled, isFocusable, isMinimumSizeSet, isShowing, isVisible, paint, paintComponent, processActionEvent, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerActionEvents, registerComponentEvents, registerEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeActionListener, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, requestFocus, setActionCommand, setAlignmentX, setAlignmentY, setBackground, setComponentOrientation, setComponentRemoved, setCursor, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setMaximumSize, setMinimumSize, setName, setPreferredSize, setToolTipText, setWidth, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peer

protected org.eclipse.swt.widgets.Shell peer

display

protected org.eclipse.swt.widgets.Display display

windowListeners

protected java.util.Vector windowListeners

isClosed

protected boolean isClosed

isIcon

protected boolean isIcon

rootPane

protected JRootPane rootPane

title

protected java.lang.String title

iconImage

protected Image iconImage

pMenu

protected JMenuBar pMenu

pMenuBar

protected MenuBar pMenuBar

delayPack

protected boolean delayPack

FRAME_DECORATION_HEIGHT

protected static final int FRAME_DECORATION_HEIGHT
Number of pixels to allow for frame decoration during pack()

See Also:
Constant Field Values

FRAME_DECORATION_WIDTH

protected static final int FRAME_DECORATION_WIDTH
Number of pixels to allow for frame decoration during pack()

See Also:
Constant Field Values
Constructor Detail

Window

public Window(Frame parent)

Window

public Window(Window parent)

Window

public Window(Window parent,
              GraphicsConfiguration gc)
Method Detail

getSWTFrameType

protected int getSWTFrameType()

create

protected void create()

create

protected void create(int SWTFrameType)
Actually does the work of creating the Window peer All the descendants of Window call this with an appropriate SWT type as part of their constructor. A bit cheaty, but we use the Swing JRootPane stuff here as well so it only needs doing once and subclasses can use it if they want it.


setCachedProperties

public void setCachedProperties()
Description copied from class: Component
If the component has just been added to a container, but properties were set in the meantime, this routine gets called by JSWTComposite to set the cached properties.

Overrides:
setCachedProperties in class Component

setLocation

public void setLocation(Point p)
Description copied from class: Component
Sets the component's location in it's container

Overrides:
setLocation in class Component

getLocationOnScreen

public Point getLocationOnScreen()
FIXME: Bad algorithm here, but can't find appropriate routine. Display.map() looks interesting, but it is undocumented.

Overrides:
getLocationOnScreen in class Component

add

public Component add(Component c)
Overridden to point to getContentPane() rather than throwing an error

Overrides:
add in class Container

add

public void add(Component c,
                java.lang.Object layoutModifier)
Overridden to point to getContentPane() rather than throwing an error

Overrides:
add in class Container

remove

public void remove(Component c)
Overridden to point to getContentPane() rather than throwing an error

Overrides:
remove in class Container

getLayout

public LayoutManager getLayout()
Overridden to point to getContentPane() rather than throwing an error

Overrides:
getLayout in class Container

addMouseListener

public void addMouseListener(MouseListener l)
Overridden to add mouse listeners to the content pane instead

Overrides:
addMouseListener in class Component

removeMouseListener

public void removeMouseListener(MouseListener l)
Overridden to remove mouse listeners from the content pane instead

Overrides:
removeMouseListener in class Component

setLayout

public void setLayout(LayoutManager l)
Overridden to point to getContentPane() rather than throwing an error

Overrides:
setLayout in class Container

setLayout

public void setLayout(LayoutManager2 l)
Overridden to point to getContentPane() rather than throwing an error


pack

public void pack()

setLocation

public void setLocation(int x,
                        int y)
Description copied from class: Component
Sets the component's location in it's container

Overrides:
setLocation in class Component

setLocationRelativeTo

public void setLocationRelativeTo(Component c)

getSize

public Dimension getSize()
Description copied from class: Component
Returns the peers actual size. Or, if the peer is embedded inside a ScrollPane component, the larger of the preferredSize/peers actual size. This works rather nicely for handling layouts inside a scrollbar as we can simply offset a large composite according to the scrollbar positions inside JScrollPane. One note - if the component is JTree, JTable, JTextArea or JEditorPane, then we return the size as usual since these components handle their own scrolling and we don't want the JScrollPane behaving weirdly.

Overrides:
getSize in class Component

getBounds

public Rectangle getBounds()
Description copied from class: Component
Returns the actual bounds of the component (or 0,0,0,0 if it isn't realised yet)

Overrides:
getBounds in class Component

setSize

public void setSize(int width,
                    int height)
Description copied from class: Component
Sets the peer's actual size

Overrides:
setSize in class Component

setSize

public void setSize(Dimension d)
Description copied from class: Component
Sets the peer's actual size

Overrides:
setSize in class Component

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Description copied from class: Component
Sets the physical bounds of the component - used by layout managers

Overrides:
setBounds in class Component

setBounds

public void setBounds(Rectangle r)
Description copied from class: Component
Sets the physical bounds of the component

Overrides:
setBounds in class Component

isActive

public boolean isActive()

show

public void show()
Description copied from class: Component
Makes the component visible

Overrides:
show in class Component

hide

public void hide()
Description copied from class: Component
Makes the component invisible

Overrides:
hide in class Component

addWindowListener

public void addWindowListener(WindowListener l)

removeWindowListener

public void removeWindowListener(WindowListener l)

setVisible

public void setVisible(boolean b)
Description copied from class: Component
Change the visibility of the component

Overrides:
setVisible in class Component

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String s)

getIconImage

public Image getIconImage()

setIconImage

public void setIconImage(Image icon)

dispose

public void dispose()
Description copied from class: Component
Destroys the component and stops all listeners

Overrides:
dispose in class Container

setJMenuBar

public void setJMenuBar(JMenuBar menu)

getJMenuBar

public JMenuBar getJMenuBar()

setMenuBar

public void setMenuBar(MenuBar menu)

getMenuBar

public MenuBar getMenuBar()

setDefaultButton

public void setDefaultButton(JButton button)

getDefaultButton

public JButton getDefaultButton()

registerWindowEvents

public void registerWindowEvents()

processWindowEvent

protected void processWindowEvent(int id)

processWindowEvent

protected void processWindowEvent(WindowEvent e)

dispatchEvents

protected void dispatchEvents()

toFront

public void toFront()
Sends the window to the front


toBack

public void toBack()
Sends the window to the back


repaintFix

protected void repaintFix()
Under GTK2 and MacOSX, SWT has some trouble issuing repaints, the only way around it seems to be to tell SWT to relayout the top-level container again after creation and child components have been added.


getSWTPeer

public org.eclipse.swt.widgets.Control getSWTPeer()
Description copied from class: Component
Returns the SWT peer

Overrides:
getSWTPeer in class Component

setSwingWTParent

public void setSwingWTParent(Composite parent)
                      throws java.lang.Exception
Throws:
java.lang.Exception