473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

autoscroll in jtextpane

i have searched and searched to find the answer to this problem, but alas, it eluded me and i had to turn in my project without autoscrolling (which sucks since it is a chat client)

i had to use jtextpane since it uses color but everything i have found says how to autoscroll in jtextarea

for quarter 2 i would like to add autoscolling, so if someone could please help me.

also how do you write the contents of a jtextpane to a file?

i also knew how to do this for jtextarea but lost the ability when i switched to jtextpane (i made up for it in my program by having an invisable jtextarea so i didnt lose the ability of saving log files.)

thanks!
Mar 8 '08 #1
1 2860
sukatoa
539 512MB
i have searched and searched to find the answer to this problem, but alas, it eluded me and i had to turn in my project without autoscrolling (which sucks since it is a chat client)

i had to use jtextpane since it uses color but everything i have found says how to autoscroll in jtextarea

for quarter 2 i would like to add autoscolling, so if someone could please help me.

also how do you write the contents of a jtextpane to a file?

i also knew how to do this for jtextarea but lost the ability when i switched to jtextpane (i made up for it in my program by having an invisable jtextarea so i didnt lose the ability of saving log files.)

thanks!
If you mean that you would like to scroll the textpane in sideward...

Make another class that extends JTextPane.
override the getScrollableTrackViewportWidth()...
get the component's parent...
get the component's user interface. --- getUI();

since you override the getScrollableTrackViewPortWidth()...
It should return true or false only...
make an experiment about the preferredSize(component).width() in the JTextPane and the component's parent...

Return the conditions(component must be less than or equal to parent's component)....

About the text in the textpane, when you save them, you can use array of bytes...

using FileInputStream and FileOutputStream...

No hustle if implemented...

Sukatoa. ;-)
Mar 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: 23s | last post by:
I have 2 rich textboxes within an auto-scrolling panel object. The textboxes aren't wider than the panel, so it never scrolls horizontally. But the combined height of both textboxes is taller than...
5
by: Frank | last post by:
Hello, if autoscroll is true in a form. Is there a way to detect the scrollbars are active? Thanks Frank
0
by: Jeff | last post by:
I am making a custom control that displays images, allows zooming in and out, and can fit the image to the control. The way I am handling all of this is probably not best, but I was looking for a...
0
by: clase | last post by:
Hi everyone, I need your help! :) I need to build a widget that manages (read, write, edit) XML files. My idea is to build this new component on JTextPane; it allows to use RTM and HTML files so...
0
by: Grzegorz Kaczor | last post by:
Hello, I have a little problem that causes a lot of trouble to my application :). I've got a JTextPane (but I can change it to anything that can edit a StyledDocument if it will help) and...
0
by: eweaver | last post by:
Hello, I have a problem with getting an autoscrollbar to end up where I want it. Things to know about the prob: I have an imagebox inside of a Panel for (inheritance of) autoscroll capabilities....
1
by: =?Utf-8?B?R3VzIENodWNo?= | last post by:
I’m working on a GroupBox and need to set the AutoScroll property to true. My problem is I have no AutoScroll property listed in the property box. And even if I go in to the Designer.cs file I...
5
by: HxRLxY | last post by:
I am an email client. I want to be able to send the emails in rich-text format, so the GUI uses a JTextPane as the Text Component in which the user's message is entered. The problem is that when I...
2
hsriat
by: hsriat | last post by:
Can I change the DefaultStyledDocument of a JTextPane dynamically? What I want to implement is like a document selector. Selecting an item from the list changes the text inside the JTextPane to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.