Example usage for javax.accessibility AccessibleRelation AccessibleRelation

List of usage examples for javax.accessibility AccessibleRelation AccessibleRelation

Introduction

In this page you can find the example usage for javax.accessibility AccessibleRelation AccessibleRelation.

Prototype

public AccessibleRelation(String key, Object[] target) 

Source Link

Document

Creates a new AccessibleRelation using the given locale independent key.

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  www.  j  a v  a 2 s. com*/
    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);
}