Solved

Mug Shot Page Layout

Posted on 2007-11-15
6
602 Views
Last Modified: 2013-11-23
I would like to create a simple printable mug shot page and want advice which Swing layout manager(s) I should use.  Here are the various sections of the page:

* HEADER - horizontal line across top of page containing a descriptive
                   sentence.
* FOOTER - Horizontal line across bottom of page containing the
                current date on the left, and the page number on the right.
* BODY - There will be 5 rows and 6 columns of jpg photographs.
               Each photograph will be accompanied with some text
               below the photograph.

I've read to distraction about layout managers.  Would someone give me some beginning advice about which manager or managers I should use.  Any basic get-started advice will be appreciated.
0
Comment
Question by:LarryAndro
  • 2
  • 2
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 170 total points
ID: 20292077

Base panel - BorderLayout
 

    Header - panel added NORTH
 

    Mugshots panel added CENTER

    This panel GridLayout

        Each cell - panel with BorderLayout

        Cell

            Image added CENTER

            Footer added SOUTH

            
 

    Footer panel added SOUTH

Open in new window

0
 
LVL 1

Author Comment

by:LarryAndro
ID: 20292251
I think I understand.  The overall page to be printed is created with BorderLayout, placing the Header North, the Footer South, and the third Mugshots panel holding the images Center.

In the third panel, the Mugshots panel another GridLayout panel is embedded holding the desired number of columns and rows.

Finally, within each cell of the GridLayout a third panel is embedded using BorderLayout.  In this layout the image is placed in the Center and the descriptive phrase or footer of the picture is placed in the South.

Do I have it?
0
 
LVL 92

Assisted Solution

by:objects
objects earned 330 total points
ID: 20293896
be something like:


JPanel main = new JPanel(new BorderLayout());

main.add(BorderLayout.NORTH, heading);

JPanel body = new JPanel(new GridLayout(5,6));

for (int i=0; i<30; i++)

{

	String text = ....;

	ImageIcon image = ...;

	JPanel imagepanel = new JPanel(new BorderLayout());

	imagepanel.add(BorderLayout.SOUTH, new JLabel(text));

	imagepanel.add(BorderLayout.CENTER, new JLabel(image));	

	body.add(imagepanel);

}

main.add(BorderLayout.CENTER, body);

main.add(BorderLayout.SOUTH, footer);

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Assisted Solution

by:objects
objects earned 330 total points
ID: 20293901
missied a bit:

>         imagepanel.add(BorderLayout.CENTER, new JLabel(image));

should be:

        imagepanel.add(BorderLayout.CENTER, new JScrollPane(new JLabel(image)));


If you don't want scroll bars then try the panel shown here

http://www.objects.com.au/java/qa/1959359983.html
0
 
LVL 1

Author Closing Comment

by:LarryAndro
ID: 31409409
Thanks, guys!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20296902
>>Do I have it?

You have it exactly ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Export PDF for printing from InDesign 4 45
bitbucket vs gitbucket 3 58
javap bin 2 30
PHPStorm debugging issues 1 25
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…
Not only does Prezi allow you to create non-linear presentations, it also makes it easy to apply transition animations between your frames. Learn how to apply a fade-in transition to select items and entire frames in this tutorial Select "Edit Path"…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now