Example usage for javax.swing JTextField getAccessibleContext

List of usage examples for javax.swing JTextField getAccessibleContext

Introduction

In this page you can find the example usage for javax.swing JTextField getAccessibleContext.

Prototype

@BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() 

Source Link

Document

Gets the AccessibleContext associated with this JTextField.

Usage

From source file:MainClass.java

MainClass() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel p = new JPanel();
    p.setPreferredSize(new Dimension(300, 50));
    JLabel jl = new JLabel("Name:");
    p.add(jl);/*from   ww  w  .jav  a 2 s . c  om*/
    JTextField jtf = new JTextField(20);
    jtf.getAccessibleContext().setAccessibleName("Name-entry");
    p.add(jtf);

    AccessibleRelation ar = new AccessibleRelation("connector", jtf);

    AccessibleContext ac = jl.getAccessibleContext();
    ac.getAccessibleRelationSet().add(ar);

    getContentPane().add(p);

    pack();
    setVisible(true);
}

From source file:com.eviware.soapui.support.components.SimpleForm.java

/**
 * Appends a label and a text field to the form
 *
 * @param label            The value of the label
 * @param name             The name of the text field
 * @param tooltip          The value of the text field tool tip
 * @param textFieldColumns The number of columns to display for the text field. Should be a constant defined in SimpleForm
 * @return The text field/* w  ww .  j  a v a2  s  . co m*/
 * @see com.eviware.soapui.support.components.SimpleForm
 */
public JTextField appendTextField(String label, String name, String tooltip, int textFieldColumns) {
    JTextField textField = new JUndoableTextField();
    textField.setName(name);
    textField.setColumns(textFieldColumns);
    setToolTip(textField, tooltip);
    textField.getAccessibleContext().setAccessibleDescription(tooltip);
    JTextComponentPopupMenu.add(textField);
    append(label, textField);
    return textField;
}