Name: ssR10000 Date: 09/27/2000
Methods:
LabelView.setUnderline(boolean)
LabelView.setStrikeThrough(boolean)
LabelView.setSuperscript(boolean)
LabelView.setSubscript(boolean)
is not set corresponding properties.
Example (for LabelView.setUnderline(boolean)):
-------------------- Test.java ----------------------
import javax.swing.text.*;
public class Test{
public static void main(String argv[]) {
StubElement element = new StubElement("StubElement");
StubLabelView c = new StubLabelView(element);
c.setUnderline(true);
boolean b1 = c.isUnderline();
c.setUnderline(false);
boolean b2 = c.isUnderline();
System.out.println(b1+" "+b2);
System.exit(0);
}
}
class StubLabelView extends LabelView {
public StubLabelView(Element e) {
super(e);
}
public void setStrikeThrough(boolean s) {
super.setStrikeThrough(s);
}
public void setSuperscript(boolean s) {
super.setSuperscript(s);
}
public void setUnderline(boolean u) {
super.setUnderline(u);
}
public void setSubscript(boolean s) {
super.setSubscript(s);
}
}
class StubElement implements Element {
Document document = new DefaultStyledDocument();
String context;
public SimpleAttributeSet attr;
public StubElement(String context) {
this.context = context;
attr = new SimpleAttributeSet();
document = new DefaultStyledDocument();
try {
document.insertString(0, context, new SimpleAttributeSet());
} catch (BadLocationException e) {}
}
public Document getDocument() {
return document;
}
public Element getParentElement() {
return null;
}
public String getName() {
return "StubElement";
}
public AttributeSet getAttributes() {
return attr;
}
public int getStartOffset() {
return 0;
}
public int getEndOffset() {
return document.getLength();
}
public int getElementIndex(int offset) {
return 0;
}
public int getElementCount() {
return 1;
}
public Element getElement(int index) {
return this;
}
public boolean isLeaf() {
return true;
}
public int getLineLimit() {
return getEndOffset() - getStartOffset();
}
}
-----------------------------------------------------
Output:
<ssw@spear(pts/9).282> java Test
false false
======================================================================
- duplicates
-
JDK-4381802 Some LabelView.(is)setXXXX methods works incorrectly
-
- Closed
-