Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
0 answers
40 views

Why does Document.insertString() auto-scroll with getLength()?

I noticed some interesting behavior with JScrollPane when manipulating the underlying document in a JTextPane. Consider this example: public class Example { public static void main(String[] args) ...
Cardinal System's user avatar
0 votes
1 answer
90 views

Why am I not getting scroll-bars with MigLayout manager?

I'm writing a desktop application. The environment is following: Java SE 10 Eclipse IDE Java Swing MigLayout The source-code, the important parts. textPane = new JTextPane(); textPane....
ucas's user avatar
  • 467
2 votes
1 answer
256 views

Keeping a JScrollPane's (JTextPane) scroll bar in place when moving the Caret?

I have a JTextPane within a JScrollPane, and a JButton that moves the position of the caret from the top of the document to the bottom. My goal is to maintain the scroll bar's current value when ...
VanSloun's user avatar
1 vote
1 answer
276 views

Keeping a JScrollPane's (JTextPane) scroll bar at the bottom when resizing text?

Very weird problem: I have a JTextPane within a JScrollPane, and a JSlider for resizing the text. If I increase the text size, the scroll bar moves up (normal). My goal is to keep the scroll bar at ...
VanSloun's user avatar
2 votes
1 answer
162 views

Static Image behind JTextPane text in JScrollPane

So I have a JScrollPane that I need to scroll (vertically only) through centered word-wrapping text. Behind the text should be a static, non-scrollable partially transparent image. My first approach ...
Retardium's user avatar
0 votes
0 answers
222 views

ScrollPane Text always starts in the bottom

Basically my program has a JTabbedPane and each tab has a JTextPane in a JScrollPane. Somehow but always text starts from the bottom. How can I fix that? I tried to put this, but it didn't work. ...
Terranova's user avatar
0 votes
1 answer
207 views

How do you add both JTextPane and JTextArea to a JScrollPane?

I am trying to make a notepad like application in java. Something like this: I want to have the part on the side with the line numbers (JTextArea) and the text part (JTextPane) and I want to add ...
georgezhang006's user avatar
0 votes
1 answer
246 views

JTextPane has overlapping text when highlighted and scrolled upon

My issue is that whenever my JTextPane is highlighted by the user or the user scrolls, the text within the JTextPane overlaps itself many times and the color frequently changes. I've tried looking ...
Tyler's user avatar
  • 21
0 votes
1 answer
94 views

Dynamically added content doesn't scroll correctly (JTextPane inside JScrollPane)

The following behavior of JScrollPane(JTextPane) seems to be above my paygrade: I have added a textPane inside a scrollPane to my frame. textPane = new JTextPane(); scrollPane = new ...
dotwin's user avatar
  • 1,322
0 votes
1 answer
46 views

JTextPane/JScrollPane display issue

I 'm trying to wrap a JTextPane with a JScrollPane, and I need the background to be transparent. Here's my code: public CharPanel(){ super.setLayout(null); JButton LButton = new JButton("&...
CrimsonK9's user avatar
0 votes
1 answer
131 views

JScrollPane problems, not appearing

I have added a few components to my JTextPane and everything prints out fine but when I want to print out more, my JScrollPane does not show up so that I can scroll down to see the other components. ...
jberengu's user avatar
1 vote
1 answer
171 views

JtextPane with HTML is too wide

I am trying to create a scrollable JTextPane to display HTML. I have it working with the exception of trying to get the size right. It seems no matter what I do, I cannot effect the width of the pane. ...
Wt Riker's user avatar
  • 594
1 vote
3 answers
383 views

Multiple JScrollPane (Java) on different hierarchy layer: horizontal scroll bar issue

I'm struggling with the following issue: I have multiple JScrollPanes at different positions in the layout. Everything works when while using only one JScrollPane. Unfortunately the second one is ...
Code Monkey's user avatar
2 votes
2 answers
253 views

JScrollPane won't scroll down to properly display JTextPane called from ActionListener

I want to refresh my ColorPane defined as follow: public class ColorPane extends JTextPane{ /* FYI, The function below allows me to add text with ANSI Coloring */ public void appendANSI(...
Lucien's user avatar
  • 451
0 votes
1 answer
233 views

How To Have A TabPane For A ScrollPane With A TextPane in Java

I'm creating a notepad program in Java and would like to have different tabs to for each document opened. I'm having trouble getting the tabs to be displayed. This is my test document so far that I ...
Vince's user avatar
  • 2,626

15 30 50 per page