Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Force Scroller on JTExtPane  RSS feed

 
Jimmy Nilsson
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey

I have a JTextPane that loads a DefaultStyledDocument.

Every row in this Styeld Document is ending with a "\n". To the right of this text i am drawing(overrides the paint method).

I have set a scroll that is visible bouth as vertical and horizontal. Now it is only using the vertical scroller to be abled to scrool down and see the text. But i realy need it to be abled to scrool vertical to see the drawings.

Is there any way? maby i can set the size on the Styleddocument? i cant set the size on the JTextPane i think?

//Jimmy
 
Jimmy Nilsson
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey again!

by overridering this in JTextPane

public void setBounds(int x, int y,int width, int height)
{

Dimension size = this.getPreferredSize();
super.setBounds(x
,y
,1000+Math.max(size.width, width)
,height
);

}

i get the horixontal scroller like i whant, but if i try to scroll it just jumps back on place 0 again?

ples help

//JImmy
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!