Package java.awt

Examples of java.awt.TextComponent$TextKitImpl


    /**
     * {@inheritDoc}
     */
    protected void registerListeners(Object com)
    {
        TextComponent txtCom = (TextComponent) com;
        txtCom.addFocusListener(this);
        super.registerListeners(com);
    }
View Full Code Here


    }

    public Object updateUI(Object com, DomNode element)
    {
        String str = element.getAttribute("text");
        TextComponent txtCom = (TextComponent) com;
        txtCom.setText(str);
        return txtCom;
    }
View Full Code Here

        return txtCom;
    }

    public void focusGained(FocusEvent e)
    {
        TextComponent txtCom = (TextComponent) e.getSource();
        _texts.put(txtCom, txtCom.getText());
    }
View Full Code Here

        _texts.put(txtCom, txtCom.getText());
    }

    public void focusLost(FocusEvent e)
    {
        TextComponent txtCom = (TextComponent) e.getSource();
        String origText = (String) _texts.get(txtCom);
        String text = txtCom.getText();
        if (!origText.equals(text))
        {
            postEvent(txtCom, null, text, false);
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void processInput(BridgeComponentPeer peer, BridgeInputContext context, Map inputForm)
    {
        TextComponent com = (TextComponent) peer.getComponent();
        if (com.isEditable() && hasEvent(peer, inputForm))
        {
            String value = (String) inputForm.get(peer.getId());
            com.setText(value);
            createTextEvent(context, peer, com);
        }
    }
View Full Code Here

    public boolean hasEvent(BridgePeer peer, Map form)
    {
        String text = (String) form.get(peer.getId());
        if (text != null)
        {
            TextComponent com = (TextComponent) peer.getComponentObject();
            return !text.equals(com.getText());
        } else
        {
            return false;
        }
    }
View Full Code Here

      final JTextComponent textComponent = (JTextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof TextComponent)
    {
      final TextComponent textComponent = (TextComponent) owner;
      textComponent.select(textComponent.getCaretPosition(), textComponent.getCaretPosition());
    }
    else if (owner instanceof JTable)
    {
      final JTable table = (JTable) owner;
      table.clearSelection();
View Full Code Here

      final JTextComponent textComponent = (JTextComponent) owner;
      textComponent.selectAll();
    }
    else if (owner instanceof TextComponent)
    {
      final TextComponent textComponent = (TextComponent) owner;
      textComponent.selectAll();
    }
    else if (owner instanceof JTable)
    {
      final JTable table = (JTable) owner;
      table.selectAll();
View Full Code Here

public class setSelectionStart implements Testlet
{

  public void test(TestHarness harness)
  {
    TextComponent textComp = new TextField();

    // Check that default value is correct.
    harness.check(textComp.getSelectionStart(), 0);
    harness.check(textComp.getSelectionEnd(), 0);
   
    // Check behaviour when setting text.
    textComp.setText("This is some text.");
    harness.check(textComp.getSelectionStart(), 0);
    harness.check(textComp.getSelectionEnd(), 0);
   
    // Check behaviour when start < 0.
    textComp.setSelectionStart(-6);
    harness.check(textComp.getSelectionStart(), 0);
    harness.check(textComp.getSelectionEnd(), 0);
   
    // Check behaviour when start = end
    textComp.setSelectionStart(0);
    harness.check(textComp.getSelectionStart(), 0);
    harness.check(textComp.getSelectionEnd(), 0);
   
    // Check behaviour when start > end
    textComp.setSelectionStart(13);
    harness.check(textComp.getSelectionStart(), 13);
    harness.check(textComp.getSelectionEnd(), 13);
   
    // Check behaviour when start < end
    textComp.setSelectionStart(9);
    harness.check(textComp.getSelectionStart(), 9);
    harness.check(textComp.getSelectionEnd(), 13);

  }
View Full Code Here

  protected void doActionsInSwingThread() throws QTasteTestFailException{
    String value = mData[2].toString();
                   
    // Support for AWT
    if (component instanceof TextField) {         
      TextComponent t = (TextComponent) component;
      t.setText(value);
      forceToLooseFocus(component);           
    }
   
    // Support for Swing   
    if (component instanceof JTextComponent) {     
      System.out.println("Swing case");
      JTextComponent t = (JTextComponent) component;
      t.setText(value);
      t.getParent().requestFocus();     
    }
   
    if (component instanceof JTextComponent) {
        if ( component instanceof JFormattedTextField ){
        try {
View Full Code Here

TOP

Related Classes of java.awt.TextComponent$TextKitImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.