Firstly I'd read an article on MVC.
You'll need a View-Controller (they are combined in Swing). A JTextPane or
something, I'm not sure what's best to be honest but a JTextPane would do
it. Then you need to swap in the right model for your view. All data your
view ever displays should be due to a change in that view-controller's
model. Your model is the raw data that your view displays. So if you had a
model1 that looked like "1 2 3", and model2 that looked like "a b c". Using
the same view, you can swap model1 in first, and your view shows "1 2 3".
Then when an event occurs (say a page down) you might swap in
"a b c" as the model. This would then change the view to show "a b c". What
you should concentrate on, is creating a domain model for your pages. The
Document class is a good starting point for text models.
You should hold pages in domain objects. These domain objects should be put
in an ordered list. The ListModel interface describes an ordered list of
things for example. You need to write code first and foremost to navigate
around your list in response to arbitrary events (page up/page down button
presses for example), selecting a current page each time an event is fired.
This current page then needs to be swapped in as the model for your view.
(Use the setModel method which can be found on most well-known view objects
e.g. JTable, JComboBox, JList etc.). A excellent general description of
swing mechanisms and architecture can be found at:
http://manning.spindoczine.com/sbe/
regards,
Neil
-----Original Message-----
From: Dr. Muhammad Masroor Ali [mailto:[EMAIL PROTECTED]]
Sent: 13 March 2001 14:47
To: [EMAIL PROTECTED]
Subject: Pages in a frame
How do you get multiple pages in a frame? What I mean is you have a page
displayed in a frame or scroll pane. This page consists of multiple
pages, whenever PageDown or Page Up buttons are pressed on keyboard, the
display in frame goes to next or previous page. Page tops (ends) needs
to be marked in the page. Hope I have been able to explain the problem.
(The situation is something like whenever you preview a doc file in Ms
Word or ps file using ghostview). Any help will be appreciated.
--
Dr. Muhammad Masroor Ali
Associate Professor, Department of CSE
BUET, Dhaka-1000, Bangladesh
Consultant, n.:
Someone who'd rather climb a tree and tell a lie than stand
on the ground and tell the truth.
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing