Solved

Panel contents and A4 paper

Posted on 2004-09-09
15
1,263 Views
Last Modified: 2012-06-21
I have a large JPanel that has inside it an array of JPanels; a header JPanel is first added and then the elements of this array are added in the code to the large JPanel; When the sum of their size reaches the size of an A4 Paper, I want the header panel to be inserted, and then of course I want to continue inserting the elements of the JPanel array  until consequently the sum of the new elements' size (plus the header) reaches the size of an A4 paper, the header JPanel would be inserted again....etc

Any Ideas??
0
Comment
Question by:mte01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
15 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 12018626
If you can determine the size limit you want, you might just count.
It depends on the layoutmanager and the use you make of it how much space
exists between the panels.

B.t.w.: gonna scroll? How large is your screen?

May be you are on the wrong (presentation) way; think about cardlayouts.

;JOOP!
0
 
LVL 3

Author Comment

by:mte01
ID: 12018682
Yes I am going to scroll to see the whole thing (I am doing a Java implementation of something that was done before using an HTML interface for the client and a COBOL program at the server). The HTML interface is that way, I just have to imitate it.
0
 
LVL 3

Author Comment

by:mte01
ID: 12018724
i.e. the size of A4 paper is 297mm x 210mm (its length is then 297 mm); how much that would be in pixels?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Expert Comment

by:sciuriware
ID: 12018773
You can play an easy game when you just put the HTML in a JEditorPane .....

A pixel is not a measure!!!!! several screens have many pixels per inch, others have a few.
;JOOP!
0
 
LVL 3

Author Comment

by:mte01
ID: 12018945
>> A pixel is not a measure!!!!!

I understand but what I want is just a reference (mm to pixels according to a screen resolution); without putting a ruler on the screen ;)

>> You can play an easy game when you just put the HTML in a JEditorPane .....

Yes but I will not be using the COBOL program as the server ; I will be doing everything in Java (server and client), and the logic would be different (and you don't have to comment on using JSP or ASP instead because this will be the subject of a series of questions that I will be posting soon)
0
 
LVL 92

Expert Comment

by:objects
ID: 12022211
Depends on the dpi you want to use
eg. a screen is typically about 75 dpi, whereas printer operate at about 300 dpi (or greater)
0
 
LVL 3

Author Comment

by:mte01
ID: 12022224
Let's say my printer is 300 dpi....what do I do then??
0
 
LVL 92

Expert Comment

by:objects
ID: 12022340
300dpi == 300 pixels per inch
0
 
LVL 3

Author Comment

by:mte01
ID: 12022391
So... using some calculations the length of the A4 paper is approximately 11.693 inches which makes 3508 pixels (on the paper) while it's 877 pixels on the screen (11.693*75), so what would be the solution then objects?
0
 
LVL 92

Expert Comment

by:objects
ID: 12023933
If you know the size you want it to be, why can't you just calculate how many panels will fit.
You can always scale it when you're printing as well.

What exactly is it you are trying to achieve?

0
 
LVL 3

Author Comment

by:mte01
ID: 12026727
No, the size and the number of the panels that will be on the screen is uncontrollable (it is dynamic - depending on user choices). I just want to print all these panels (i.e the array of panels which is in a single large panel) on A4 paper. I want that every time a new A4 paper is printed to have a header panel be printed at the top (it may interfere a panel which will cut this panel into half: one on the 1st A4 paper and one on the 2nd, and of course before the one on the 2nd the header panel of the A4 paper)
0
 
LVL 92

Expert Comment

by:objects
ID: 12031928
you'd deal with that at printing time, you wouldn't need to add/remove components.
0
 
LVL 3

Author Comment

by:mte01
ID: 12031984
yeh yeh i know.....but my question is still unanswered how do i add a header panel when the height of the panels reach the size of an A4 paper??
0
 
LVL 92

Accepted Solution

by:
objects earned 450 total points
ID: 12032001
You don't need to add it.
In you print code, you want to paint the header to the top of every page.
0
 
LVL 3

Author Comment

by:mte01
ID: 12032025
Okk...I'll try that later....and I'll inform you of my results.....but I still need to know how much the size of a JPanel should be for it to fit on an A4 paper (for another puropse which I think I'll post another question for it after I finish from the header thing)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate example using maven 12 77
jmeter usage 4 34
junit as external jar or library 7 37
Running JavaFX on the Raspberry Pi 27 127
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question