The Artima Developer Community
Sponsored Link

Java Answers Forum
how can i do the word processor's page operations in my java word processor

1 reply on 1 page. Most recent reply: Apr 12, 2002 7:37 AM by Hiran

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
saravanan

Posts: 1
Nickname: ksaran
Registered: Apr, 2002

how can i do the word processor's page operations in my java word processor Posted: Apr 11, 2002 11:20 AM
Reply to this message Reply
Advertisement
Hai,
I am developing a word processor using Java. It?s workspace is JTextPane. In order to give the page view and do page operation I have assigned one JTextPane per page.
Generaly in a word processor if the cursor completes a page, a new page will be created and the cursor will be fixed in the starting position of the new page.

I need to do the same thing in my word processor.

That is I need to restrict the JTextPane(page) in such a way that the cursor has to be always inside the JtextPane. It means that the JTextPane (page) should not increase it?s size whenever the cursor goes out of it?s size. Instead a new JTextPane(page) can be created and the cursor can be fixed in starting position of the new JTextPane.

Thing is that a text component can be added with or without the JScrollPane. In the first case both the scroll bar and the cursor will appear if it goes out of the text component?s rage. In the second case neither scroll bar nor cursor will appear. So these two will not help me.

How can I do this in my word processor?

I will be grateful to you if you send some suggestion.

With regards,
K. Saran


Hiran

Posts: 41
Nickname: jclu
Registered: Mar, 2002

Re: how can i do the word processor's page operations in my java word processor Posted: Apr 12, 2002 7:37 AM
Reply to this message Reply
Check out the java documentation, and search http://java.sun.com/docs/books/tutorial/ for JTextPane. I started to develop a java word processor as well, and from what I remember, you will have to work with <code>Document</code>s and/or <code>StyledDocument</code>s. Instead of having multiple JTextPanes, you'll probably only need one JTextPane. Then have a class that either extends or uses (as a member variable) the <code>StyledDocument</code> class. This class will contain the content of each page. Then when the user goes to another page in a file, your program will get the content of that page (from the object that's holding the contents) and display it in your text pane. I hope this makes sense. If not, email me at hw_stuckie@hotmail.com and let me know.
Hiran

PS. I kinda gave up on my java word processor, but I'm still interested in creating one. If you would like to work together on this, email me and let me know. Thanks.

Flat View: This topic has 1 reply on 1 page
Topic: Export XLS and CSV Files Previous Topic   Next Topic Topic: Error with Vbe/Java bridge (Jintegra)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use