sun.awt.gtk
Class GLabelPeer

java.lang.Object
  extended by sun.awt.gtk.GLabelPeer
All Implemented Interfaces:
ClipboardOwner, ComponentPeer, LabelPeer, sun.awt.UpdateClient

public class GLabelPeer
extends Object
implements LabelPeer

The peer for label. We don't use GtkLabel widgets from this peer as they don't support the alignment of text. Instead we simply override the paint method and draw the label in Java.


Constructor Summary
GLabelPeer(GToolkit toolkit, Label target)
          Creates a new GLabelPeer.
 
Method Summary
protected  boolean canHavePixmapBackground()
          Decides whether it is possible for this component to have a pixmap background (i.e.
 int checkImage(java.awt.Image img, int w, int h, java.awt.image.ImageObserver o)
           
protected  void create()
          Creates this component peer.
 java.awt.Image createImage(java.awt.image.ImageProducer producer)
           
 java.awt.Image createImage(int width, int height)
           
 void dispose()
           
 java.awt.image.ColorModel getColorModel()
           
 FontMetrics getFontMetrics(Font font)
           
 Graphics getGraphics()
           
 java.awt.Point getLocationOnScreen()
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 Toolkit getToolkit()
           
 void handleEvent(AWTEvent event)
           
 boolean isFocusTraversable()
           
 void lostOwnership(Clipboard clipboard, Transferable contents)
          Notifies this object that it is no longer the owner of the contents of the clipboard.
 void paint(Graphics g)
           
 boolean prepareImage(java.awt.Image img, int w, int h, java.awt.image.ImageObserver o)
           
 void print(Graphics g)
           
 void repaint(long tm, int x, int y, int width, int height)
           
 void requestFocus()
           
 void setAlignment(int alignment)
           
 void setBackground(java.awt.Color c)
           
 void setBounds(int x, int y, int width, int height)
           
 void setCursor(java.awt.Cursor cursor)
           
 void setEnabled(boolean b)
           
 void setFont(Font f)
           
 void setForeground(java.awt.Color c)
           
 void setText(String text)
           
 void setVisible(boolean b)
           
protected  byte[] stringToNulMultiByte(String string)
           
 void update(Graphics g)
           
 void updateClient(Object arg)
          Called by the ScreenUpdater to update the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sun.awt.peer.ComponentPeer
checkImage, clearBackground, createImage, createImage, createVolatileImage, dispose, getColorModel, getFontMetrics, getGraphics, getLocationOnScreen, getToolkit, handleEvent, isFocusTraversable, prepareImage, print, repaint, requestFocus, setBounds, setCursor, setEnabled, setFocusable, setVisible
 

Constructor Detail

GLabelPeer

public GLabelPeer(GToolkit toolkit,
                  Label target)
Creates a new GLabelPeer.

Method Detail

create

protected void create()
Creates this component peer. This requires setting the data field to point to a struct GComponentData.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Specified by:
getPreferredSize in interface ComponentPeer

getMinimumSize

public java.awt.Dimension getMinimumSize()
Specified by:
getMinimumSize in interface ComponentPeer

paint

public void paint(Graphics g)
Specified by:
paint in interface ComponentPeer

update

public void update(Graphics g)

setBackground

public void setBackground(java.awt.Color c)
Specified by:
setBackground in interface ComponentPeer

setForeground

public void setForeground(java.awt.Color c)
Specified by:
setForeground in interface ComponentPeer

setFont

public void setFont(Font f)
Specified by:
setFont in interface ComponentPeer

setText

public void setText(String text)
Specified by:
setText in interface LabelPeer

setAlignment

public void setAlignment(int alignment)
Specified by:
setAlignment in interface LabelPeer

canHavePixmapBackground

protected boolean canHavePixmapBackground()
Decides whether it is possible for this component to have a pixmap background (i.e. a non solid color). We allow all components except Window, Frame, Dialog, Panel and Canvas to have pixmaps as the user can, and typically does, override the paint for these components. Thus update can be called which will clear the background with a solid color for these components. However, we would still like to have support for Gtk themes where a button, for example, may hava a pixmap background.


dispose

public void dispose()
Specified by:
dispose in interface ComponentPeer

setVisible

public void setVisible(boolean b)
Specified by:
setVisible in interface ComponentPeer

setEnabled

public void setEnabled(boolean b)
Specified by:
setEnabled in interface ComponentPeer

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
Specified by:
repaint in interface ComponentPeer

print

public void print(Graphics g)
Specified by:
print in interface ComponentPeer

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Specified by:
setBounds in interface ComponentPeer

handleEvent

public void handleEvent(AWTEvent event)
Specified by:
handleEvent in interface ComponentPeer

updateClient

public void updateClient(Object arg)
Called by the ScreenUpdater to update the component.

Specified by:
updateClient in interface sun.awt.UpdateClient

getLocationOnScreen

public java.awt.Point getLocationOnScreen()
Specified by:
getLocationOnScreen in interface ComponentPeer

getColorModel

public java.awt.image.ColorModel getColorModel()
Specified by:
getColorModel in interface ComponentPeer

getToolkit

public Toolkit getToolkit()
Specified by:
getToolkit in interface ComponentPeer

getGraphics

public Graphics getGraphics()
Specified by:
getGraphics in interface ComponentPeer

getFontMetrics

public FontMetrics getFontMetrics(Font font)
Specified by:
getFontMetrics in interface ComponentPeer

setCursor

public void setCursor(java.awt.Cursor cursor)
Specified by:
setCursor in interface ComponentPeer

requestFocus

public void requestFocus()

isFocusTraversable

public boolean isFocusTraversable()
Specified by:
isFocusTraversable in interface ComponentPeer

createImage

public java.awt.Image createImage(java.awt.image.ImageProducer producer)
Specified by:
createImage in interface ComponentPeer

createImage

public java.awt.Image createImage(int width,
                                  int height)
Specified by:
createImage in interface ComponentPeer

prepareImage

public boolean prepareImage(java.awt.Image img,
                            int w,
                            int h,
                            java.awt.image.ImageObserver o)
Specified by:
prepareImage in interface ComponentPeer

checkImage

public int checkImage(java.awt.Image img,
                      int w,
                      int h,
                      java.awt.image.ImageObserver o)
Specified by:
checkImage in interface ComponentPeer

lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Description copied from interface: ClipboardOwner
Notifies this object that it is no longer the owner of the contents of the clipboard.

Specified by:
lostOwnership in interface ClipboardOwner
Parameters:
clipboard - the clipboard that is no longer owned
contents - the contents which this owner had placed on the clipboard

stringToNulMultiByte

protected byte[] stringToNulMultiByte(String string)