Back to index

im-sdk  12.3.91
Public Member Functions | Static Public Member Functions | Package Functions | Private Attributes
sun.awt.im.iiimp.FocusLabel Class Reference
Collaboration diagram for sun.awt.im.iiimp.FocusLabel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void setText (String text)
void setIterator (AttributedCharacterIterator labelIterator, AttributedCharacterIterator candidateIterator)
void paint (Graphics g)
void mouseClicked (MouseEvent e)
void mouseEntered (MouseEvent e)
void mouseExited (MouseEvent e)
void mousePressed (MouseEvent e)
void mouseReleased (MouseEvent e)
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)
void setText (String text)
void setIterator (AttributedCharacterIterator labelIterator, AttributedCharacterIterator candidateIterator)
void paint (Graphics g)
void mouseClicked (MouseEvent e)
void mouseEntered (MouseEvent e)
void mouseExited (MouseEvent e)
void mousePressed (MouseEvent e)
void mouseReleased (MouseEvent e)
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)

Static Public Member Functions

static String iteratorToString (CharacterIterator iterator)
static String iteratorToString (CharacterIterator iterator)

Package Functions

 FocusLabel (String s)
 FocusLabel ()
void setFocus (boolean b)
void setTarget (LookupPane target, int index)
 FocusLabel (String s)
 FocusLabel ()
void setFocus (boolean b)
void setTarget (LookupPane target, int index)

Private Attributes

boolean focused = false
boolean pressed = false
LookupPane target
int index
AttributedCharacterIterator labelIterator
AttributedCharacterIterator candidateIterator

Detailed Description

Definition at line 291 of file LookupPane.java.


Constructor & Destructor Documentation

sun.awt.im.iiimp.FocusLabel.FocusLabel ( String  s) [inline, package]

Definition at line 300 of file LookupPane.java.

                         {
       super(s);
       setAlignment(LEFT);
       enableInputMethods(false);
       addMouseListener(this);
       addKeyListener(this);
    }

Definition at line 308 of file LookupPane.java.

                 {
       this(null);
    }
sun.awt.im.iiimp.FocusLabel.FocusLabel ( String  s) [inline, package]

Definition at line 302 of file LookupPane.java.

                         {
       super(s);
       setAlignment(LEFT);
       enableInputMethods(false);
       addMouseListener(this);
       addKeyListener(this);
    }

Definition at line 310 of file LookupPane.java.

                 {
       this(null);
    }

Member Function Documentation

static String sun.awt.im.iiimp.FocusLabel.iteratorToString ( CharacterIterator  iterator) [inline, static]

Definition at line 334 of file LookupPane.java.

                                                                      {
        StringBuffer sb = new StringBuffer();
        for (char c = iterator.first(); c != CharacterIterator.DONE;
             c = iterator.next()) {
            sb.append(c);
        }
        return sb.toString();
    }

Here is the caller graph for this function:

static String sun.awt.im.iiimp.FocusLabel.iteratorToString ( CharacterIterator  iterator) [inline, static]

Definition at line 336 of file LookupPane.java.

                                                                      {
        StringBuffer sb = new StringBuffer();
        for (char c = iterator.first(); c != CharacterIterator.DONE;
             c = iterator.next()) {
            sb.append(c);
        }
        return sb.toString();
    }
void sun.awt.im.iiimp.FocusLabel.keyPressed ( KeyEvent  e) [inline]

Definition at line 433 of file LookupPane.java.

                                       {
       if (target != null) {
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.keyPressed ( KeyEvent  e) [inline]

Definition at line 435 of file LookupPane.java.

                                       {
       if (target != null) {
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.keyReleased ( KeyEvent  e) [inline]

Definition at line 439 of file LookupPane.java.

                                        {
       if (target != null) {
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.keyReleased ( KeyEvent  e) [inline]

Definition at line 441 of file LookupPane.java.

                                        {
       if (target != null) {
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.keyTyped ( KeyEvent  e) [inline]

Definition at line 445 of file LookupPane.java.

                                     {
       if (target != null) {
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.keyTyped ( KeyEvent  e) [inline]

Definition at line 447 of file LookupPane.java.

                                     {
       if (target != null) {
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mouseClicked ( MouseEvent  e) [inline]

Definition at line 400 of file LookupPane.java.

                                           {
       if (target != null) {
           target.clicked(index);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mouseClicked ( MouseEvent  e) [inline]

Definition at line 402 of file LookupPane.java.

                                           {
       if (target != null) {
           target.clicked(index);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mouseEntered ( MouseEvent  e) [inline]

Definition at line 406 of file LookupPane.java.

                                           {
        if (target != null) {
           setFocus(true);
           repaint();
           target.changeFocus(index);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mouseEntered ( MouseEvent  e) [inline]

Definition at line 408 of file LookupPane.java.

                                           {
        if (target != null) {
           setFocus(true);
           repaint();
           target.changeFocus(index);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mouseExited ( MouseEvent  e) [inline]

Definition at line 414 of file LookupPane.java.

                                          {
       if (target != null) {
           setFocus(false);
           pressed = false;
           repaint();
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mouseExited ( MouseEvent  e) [inline]

Definition at line 416 of file LookupPane.java.

                                          {
       if (target != null) {
           setFocus(false);
           pressed = false;
           repaint();
           target.forwardEvent(e);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.mousePressed ( MouseEvent  e) [inline]

Definition at line 423 of file LookupPane.java.

                                           {
       pressed = true;
       repaint();
    }
void sun.awt.im.iiimp.FocusLabel.mousePressed ( MouseEvent  e) [inline]

Definition at line 425 of file LookupPane.java.

                                           {
       pressed = true;
       repaint();
    }
void sun.awt.im.iiimp.FocusLabel.mouseReleased ( MouseEvent  e) [inline]

Definition at line 428 of file LookupPane.java.

                                            {
       pressed = false;
       repaint();
    }
void sun.awt.im.iiimp.FocusLabel.mouseReleased ( MouseEvent  e) [inline]

Definition at line 430 of file LookupPane.java.

                                            {
       pressed = false;
       repaint();
    }
void sun.awt.im.iiimp.FocusLabel.paint ( Graphics  g) [inline]

Definition at line 343 of file LookupPane.java.

                                  {
       Dimension size = getSize();
       Color bg = getBackground();
       Color fg = getForeground();

       if (candidateIterator == null) {
           super.paint(g);
       } else {
           Graphics2D g2 = (Graphics2D)g;
           g2.setColor(bg);
           g2.fillRect(0, 0, size.width, size.height);
           g2.setColor(fg);

           FontRenderContext frc = g2.getFontRenderContext();
           Font font = g2.getFont();
           Rectangle2D b1 =
              font.getStringBounds(iteratorToString(labelIterator), frc);
           Rectangle2D b2 = font.getStringBounds(" : ", frc);
           Rectangle2D b3 =
              font.getStringBounds(iteratorToString(candidateIterator), frc);

           int startX = (int)
              (size.width - (b1.getWidth() + b2.getWidth() + b3.getWidth()))
              / 2;
           int startY = (int)
              (size.height +
               (b1.getHeight() + b2.getHeight() + b3.getHeight())) / 2;

           g.drawString(labelIterator, startX, startY);
           g.drawString(" : ", startX + (int)b1.getWidth(), startY);
           g.drawString(candidateIterator,
                      startX + (int)(b1.getWidth() + b2.getWidth()),
                      startY);
       }

       if (focused) {
           if (pressed) {
              g.setColor(bg.darker());
           } else {
              g.setColor(bg.brighter());
           }
           g.drawLine(1, 1, size.width - 1, 1);
           g.drawLine(1, 1, 1, size.height - 1);
           if (pressed) {
              g.setColor(bg.brighter());
           } else {
              g.setColor(bg.darker());
           }
           g.drawLine(1, size.height - 1, size.width - 1, size.height - 1);
           g.drawLine(size.width - 1, 1, size.width - 1, size.height - 1);
           requestFocus();
       } else {
           g.setColor(bg);
           g.drawRect(1, 1, size.width - 2, size.height - 2);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.paint ( Graphics  g) [inline]

Definition at line 345 of file LookupPane.java.

                                  {
       Dimension size = getSize();
       Color bg = getBackground();
       Color fg = getForeground();

       if (candidateIterator == null) {
           super.paint(g);
       } else {
           Graphics2D g2 = (Graphics2D)g;
           g2.setColor(bg);
           g2.fillRect(0, 0, size.width, size.height);
           g2.setColor(fg);

           FontRenderContext frc = g2.getFontRenderContext();
           Font font = g2.getFont();
           Rectangle2D b1 =
              font.getStringBounds(iteratorToString(labelIterator), frc);
           Rectangle2D b2 = font.getStringBounds(" : ", frc);
           Rectangle2D b3 =
              font.getStringBounds(iteratorToString(candidateIterator), frc);

           int startX = (int)
              (size.width - (b1.getWidth() + b2.getWidth() + b3.getWidth()))
              / 2;
           int startY = (int)
              (size.height +
               (b1.getHeight() + b2.getHeight() + b3.getHeight())) / 2;

           g.drawString(labelIterator, startX, startY);
           g.drawString(" : ", startX + (int)b1.getWidth(), startY);
           g.drawString(candidateIterator,
                      startX + (int)(b1.getWidth() + b2.getWidth()),
                      startY);
       }

       if (focused) {
           if (pressed) {
              g.setColor(bg.darker());
           } else {
              g.setColor(bg.brighter());
           }
           g.drawLine(1, 1, size.width - 1, 1);
           g.drawLine(1, 1, 1, size.height - 1);
           if (pressed) {
              g.setColor(bg.brighter());
           } else {
              g.setColor(bg.darker());
           }
           g.drawLine(1, size.height - 1, size.width - 1, size.height - 1);
           g.drawLine(size.width - 1, 1, size.width - 1, size.height - 1);
           requestFocus();
       } else {
           g.setColor(bg);
           g.drawRect(1, 1, size.width - 2, size.height - 2);
       }
    }

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.setFocus ( boolean  b) [inline, package]

Definition at line 312 of file LookupPane.java.

                             {
        focused = b;
    }

Here is the caller graph for this function:

void sun.awt.im.iiimp.FocusLabel.setFocus ( boolean  b) [inline, package]

Definition at line 314 of file LookupPane.java.

                             {
        focused = b;
    }
void sun.awt.im.iiimp.FocusLabel.setIterator ( AttributedCharacterIterator  labelIterator,
AttributedCharacterIterator  candidateIterator 
) [inline]

Definition at line 326 of file LookupPane.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void sun.awt.im.iiimp.FocusLabel.setIterator ( AttributedCharacterIterator  labelIterator,
AttributedCharacterIterator  candidateIterator 
) [inline]

Definition at line 328 of file LookupPane.java.

Here is the call graph for this function:

void sun.awt.im.iiimp.FocusLabel.setTarget ( LookupPane  target,
int  index 
) [inline, package]

Definition at line 316 of file LookupPane.java.

                                                 {
       this.target = target;
       this.index = index;
    }

Here is the caller graph for this function:

void sun.awt.im.iiimp.FocusLabel.setTarget ( LookupPane  target,
int  index 
) [inline, package]

Definition at line 318 of file LookupPane.java.

                                                 {
       this.target = target;
       this.index = index;
    }
void sun.awt.im.iiimp.FocusLabel.setText ( String  text) [inline]

Definition at line 321 of file LookupPane.java.

                                     {
       super.setText(text);
       setFocus(false);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void sun.awt.im.iiimp.FocusLabel.setText ( String  text) [inline]

Definition at line 323 of file LookupPane.java.

                                     {
       super.setText(text);
       setFocus(false);
    }

Here is the call graph for this function:


Member Data Documentation

AttributedCharacterIterator sun.awt.im.iiimp.FocusLabel.candidateIterator [private]

Definition at line 298 of file LookupPane.java.

boolean sun.awt.im.iiimp.FocusLabel.focused = false [private]

Definition at line 293 of file LookupPane.java.

Definition at line 296 of file LookupPane.java.

AttributedCharacterIterator sun.awt.im.iiimp.FocusLabel.labelIterator [private]

Definition at line 297 of file LookupPane.java.

boolean sun.awt.im.iiimp.FocusLabel.pressed = false [private]

Definition at line 294 of file LookupPane.java.

Definition at line 295 of file LookupPane.java.


The documentation for this class was generated from the following files: