The class used to obtain the accessible role for this object.
Method from javax.swing.JLabel$AccessibleJLabel Detail: |
AccessibleExtendedComponent getAccessibleExtendedComponent() {
return this;
}
Returns the AccessibleExtendedComponent |
public AccessibleIcon[] getAccessibleIcon() {
Icon icon = getIcon();
if (icon instanceof Accessible) {
AccessibleContext ac =
((Accessible)icon).getAccessibleContext();
if (ac != null && ac instanceof AccessibleIcon) {
return new AccessibleIcon[] { (AccessibleIcon)ac };
}
}
return null;
}
Get the AccessibleIcons associated with this object if one
or more exist. Otherwise return null. |
public AccessibleKeyBinding getAccessibleKeyBinding() {
int mnemonic = JLabel.this.getDisplayedMnemonic();
if (mnemonic == 0) {
return null;
}
return new LabelKeyBinding(mnemonic);
}
Returns key bindings associated with this object |
public String getAccessibleName() {
String name = accessibleName;
if (name == null) {
name = (String)getClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY);
}
if (name == null) {
name = JLabel.this.getText();
}
if (name == null) {
name = super.getAccessibleName();
}
return name;
}
Get the accessible name of this object. |
public AccessibleRelationSet getAccessibleRelationSet() {
// Check where the AccessibleContext's relation
// set already contains a LABEL_FOR relation.
AccessibleRelationSet relationSet
= super.getAccessibleRelationSet();
if (!relationSet.contains(AccessibleRelation.LABEL_FOR)) {
Component c = JLabel.this.getLabelFor();
if (c != null) {
AccessibleRelation relation
= new AccessibleRelation(AccessibleRelation.LABEL_FOR);
relation.setTarget(c);
relationSet.add(relation);
}
}
return relationSet;
}
Get the AccessibleRelationSet associated with this object if one
exists. Otherwise return null. |
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LABEL;
}
Get the role of this object. |
public AccessibleText getAccessibleText() {
View view = (View)JLabel.this.getClientProperty("html");
if (view != null) {
return this;
} else {
return null;
}
}
|
public String getAfterIndex(int part,
int index) {
if (index < 0 || index >= getCharCount()) {
return null;
}
switch (part) {
case AccessibleText.CHARACTER:
if (index+1 >= getCharCount()) {
return null;
}
try {
return getText(index+1, 1);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.WORD:
try {
String s = getText(0, getCharCount());
BreakIterator words = BreakIterator.getWordInstance(getLocale());
words.setText(s);
int start = words.following(index);
if (start == BreakIterator.DONE || start >= s.length()) {
return null;
}
int end = words.following(start);
if (end == BreakIterator.DONE || end >= s.length()) {
return null;
}
return s.substring(start, end);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.SENTENCE:
try {
String s = getText(0, getCharCount());
BreakIterator sentence =
BreakIterator.getSentenceInstance(getLocale());
sentence.setText(s);
int start = sentence.following(index);
if (start == BreakIterator.DONE || start > s.length()) {
return null;
}
int end = sentence.following(start);
if (end == BreakIterator.DONE || end > s.length()) {
return null;
}
return s.substring(start, end);
} catch (BadLocationException e) {
return null;
}
default:
return null;
}
}
Returns the String after a given index. |
public String getAtIndex(int part,
int index) {
if (index < 0 || index >= getCharCount()) {
return null;
}
switch (part) {
case AccessibleText.CHARACTER:
try {
return getText(index, 1);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.WORD:
try {
String s = getText(0, getCharCount());
BreakIterator words = BreakIterator.getWordInstance(getLocale());
words.setText(s);
int end = words.following(index);
return s.substring(words.previous(), end);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.SENTENCE:
try {
String s = getText(0, getCharCount());
BreakIterator sentence =
BreakIterator.getSentenceInstance(getLocale());
sentence.setText(s);
int end = sentence.following(index);
return s.substring(sentence.previous(), end);
} catch (BadLocationException e) {
return null;
}
default:
return null;
}
}
Returns the String at a given index. |
public String getBeforeIndex(int part,
int index) {
if (index < 0 || index > getCharCount()-1) {
return null;
}
switch (part) {
case AccessibleText.CHARACTER:
if (index == 0) {
return null;
}
try {
return getText(index-1, 1);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.WORD:
try {
String s = getText(0, getCharCount());
BreakIterator words = BreakIterator.getWordInstance(getLocale());
words.setText(s);
int end = words.following(index);
end = words.previous();
int start = words.previous();
if (start == BreakIterator.DONE) {
return null;
}
return s.substring(start, end);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.SENTENCE:
try {
String s = getText(0, getCharCount());
BreakIterator sentence =
BreakIterator.getSentenceInstance(getLocale());
sentence.setText(s);
int end = sentence.following(index);
end = sentence.previous();
int start = sentence.previous();
if (start == BreakIterator.DONE) {
return null;
}
return s.substring(start, end);
} catch (BadLocationException e) {
return null;
}
default:
return null;
}
}
Returns the String before a given index. |
public int getCaretPosition() {
// There is no caret.
return -1;
}
Return the zero-based offset of the caret.
Note: That to the right of the caret will have the same index
value as the offset (the caret is between two characters). |
public int getCharCount() {
View view = (View) JLabel.this.getClientProperty("html");
if (view != null) {
Document d = view.getDocument();
if (d instanceof StyledDocument) {
StyledDocument doc = (StyledDocument)d;
return doc.getLength();
}
}
return accessibleContext.getAccessibleName().length();
}
Return the number of characters (valid indicies) |
public AttributeSet getCharacterAttribute(int i) {
View view = (View) JLabel.this.getClientProperty("html");
if (view != null) {
Document d = view.getDocument();
if (d instanceof StyledDocument) {
StyledDocument doc = (StyledDocument)d;
Element elem = doc.getCharacterElement(i);
if (elem != null) {
return elem.getAttributes();
}
}
}
return null;
}
Return the AttributeSet for a given character at a given index |
public Rectangle getCharacterBounds(int i) {
View view = (View) JLabel.this.getClientProperty("html");
if (view != null) {
Rectangle r = getTextRectangle();
if (r == null) {
return null;
}
Rectangle2D.Float shape =
new Rectangle2D.Float(r.x, r.y, r.width, r.height);
try {
Shape charShape =
view.modelToView(i, shape, Position.Bias.Forward);
return charShape.getBounds();
} catch (BadLocationException e) {
return null;
}
} else {
return null;
}
}
Determine the bounding box of the character at the given
index into the string. The bounds are returned in local
coordinates. If the index is invalid an empty rectangle is
returned. |
public int getIndexAtPoint(Point p) {
View view = (View) JLabel.this.getClientProperty("html");
if (view != null) {
Rectangle r = getTextRectangle();
if (r == null) {
return -1;
}
Rectangle2D.Float shape =
new Rectangle2D.Float(r.x, r.y, r.width, r.height);
Position.Bias bias[] = new Position.Bias[1];
return view.viewToModel(p.x, p.y, shape, bias);
} else {
return -1;
}
}
Given a point in local coordinates, return the zero-based index
of the character under that Point. If the point is invalid,
this method returns -1. |
public String getSelectedText() {
// Text cannot be selected.
return null;
}
Returns the portion of the text that is selected. |
public int getSelectionEnd() {
// Text cannot be selected.
return -1;
}
Returns the end offset within the selected text.
If there is no selection, but there is
a caret, the start and end offsets will be the same. |
public int getSelectionStart() {
// Text cannot be selected.
return -1;
}
Returns the start offset within the selected text.
If there is no selection, but there is
a caret, the start and end offsets will be the same. |
public String getTitledBorderText() {
return super.getTitledBorderText();
}
Returns the titled border text |
public String getToolTipText() {
return JLabel.this.getToolTipText();
}
Returns the tool tip text |