Back to index

moin  1.9.0~rc2
Public Member Functions | Private Attributes
CH.ifa.draw.util.FloatingTextField Class Reference

A text field overlay that is used to edit a TextFigure. More...

List of all members.

Public Member Functions

 FloatingTextField ()
void createOverlay (Container container)
 Creates the overlay for the given Component.
void createOverlay (Container container, Font font)
 Creates the overlay for the given Container using a specific font.
void addActionListener (ActionListener listener)
 Adds an action listener.
void removeActionListener (ActionListener listener)
 Remove an action listener.
void setBounds (Rectangle r, String text)
 Positions the overlay.
String getText ()
 Gets the text contents of the overlay.
Dimension getPreferredSize (int rows, int cols)
 Gets the preferred size of the overlay.
void endOverlay ()
 Removes the overlay.

Private Attributes

TextArea fEditWidget
Container fContainer

Detailed Description

A text field overlay that is used to edit a TextFigure.

A FloatingTextField requires a two step initialization: In a first step the overlay is created and in a second step it can be positioned.

See also:
TextFigure

Definition at line 19 of file FloatingTextField.java.


Constructor & Destructor Documentation

Definition at line 25 of file FloatingTextField.java.

                               {
        fEditWidget = new TextArea(5, 20);
    }

Member Function Documentation

void CH.ifa.draw.util.FloatingTextField.addActionListener ( ActionListener  listener) [inline]

Adds an action listener.

Definition at line 51 of file FloatingTextField.java.

                                                           {
       throw new RuntimeException("Adding action listener " + listener);
       //fEditWidget.addActionListener(listener);
    }
void CH.ifa.draw.util.FloatingTextField.createOverlay ( Container  container) [inline]

Creates the overlay for the given Component.

Definition at line 32 of file FloatingTextField.java.

                                                   {
        createOverlay(container, null);
    }

Here is the caller graph for this function:

void CH.ifa.draw.util.FloatingTextField.createOverlay ( Container  container,
Font  font 
) [inline]

Creates the overlay for the given Container using a specific font.

Definition at line 40 of file FloatingTextField.java.

                                                              {
        container.add(fEditWidget, 0);
        if (font != null)
            fEditWidget.setFont(font);
        fContainer = container;
       fEditWidget.requestFocus();
    }

Removes the overlay.

Definition at line 92 of file FloatingTextField.java.

                             {
       fContainer.requestFocus();
       if (fEditWidget == null)
           return;
       fEditWidget.setVisible(false);
       fContainer.remove(fEditWidget);

       Rectangle bounds = fEditWidget.getBounds();
       fContainer.repaint(bounds.x, bounds.y, bounds.width, bounds.height);
    }

Here is the caller graph for this function:

Dimension CH.ifa.draw.util.FloatingTextField.getPreferredSize ( int  rows,
int  cols 
) [inline]

Gets the preferred size of the overlay.

Definition at line 85 of file FloatingTextField.java.

                                                          {
        return fEditWidget.getPreferredSize(rows, cols);
    }

Here is the caller graph for this function:

Gets the text contents of the overlay.

Definition at line 78 of file FloatingTextField.java.

                            {
        return fEditWidget.getText();
    }

Here is the caller graph for this function:

void CH.ifa.draw.util.FloatingTextField.removeActionListener ( ActionListener  listener) [inline]

Remove an action listener.

Definition at line 59 of file FloatingTextField.java.

                                                              {
       throw new RuntimeException("Removing action listener " + listener);
       // CC removed fEditWidget.removeActionListener(listener);
    }
void CH.ifa.draw.util.FloatingTextField.setBounds ( Rectangle  r,
String  text 
) [inline]

Positions the overlay.

Definition at line 67 of file FloatingTextField.java.

                                                    {
       fEditWidget.setText(text);
        fEditWidget.setBounds(r.x, r.y, r.width, r.height);
        fEditWidget.setVisible(true);
       fEditWidget.selectAll();
       fEditWidget.requestFocus();
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 23 of file FloatingTextField.java.

Definition at line 21 of file FloatingTextField.java.


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