Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with modelToView()

 
Philip Yang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all,
I am having problem with modelToView(component,pos) while using JTextPane.
The return value is always a Rectangle with width 0 and height 17 no matter styles and the pos.
Sample code:
JTextPane test = new JTextPane();
test.setText("aaaa\nbbbbbb\ncccccc");
java.awt.Rectangle rec = test.getUI().modelToView(test,test.getDocument().getLength()-1);
Any suggestions?
Thanks
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!