pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: One JPanel takes the place of the firstPanel
Date Wed, 13 Jan 2016 17:02:27 GMT
Am 12.01.2016 um 16:24 schrieb gerryw@hispeed.ch:
> Hi
>
> I am not sure if this problem is due to my beginners level java skills 
> or if there is another issue.
>
> Either way any help you can give would be much appreciated.
>
> I have a JFrame with a box layout and I want to add JPanels to it.
>
> The problem is that if there is more than one JPanel the last one 
> covers the first one and sets it to the second position.

This is not the right place for the question.

I did try your project, and here's what happens: the first file is 
opened in the lower half of the window. When opening the 2nd file, 
seemingly nothing happens. But when resizing the window, one can see it 
at the bottom third.

It worked without this trick by adding

     this.pack();

at the end of processView.

But I'm not sure if this is the best solution, or if it is what you 
wanted. If not, what you should do is to ask help on stackoverflow. But 
create a project without pdfbox, as it isn't the cause of the problem. 
Instead of the rendered image, create an image from scratch with a 
random color. (To "write" into a BufferedImage, use getGraphics). Or 
change your project that it reads an image from disk. (ImageIO.read)

Asking a good question is a skill. Make a decent title that contains the 
words "box layout" (maybe search stackoverflow for this to see whether 
it has already been answered). Put "awt" and "swing" as labels of your 
question. After asking the question, look at the website from time to 
time to respond to comments, i.e. don't wait 24 hours. Newbie questions 
receive special screening, so it's likely that you'll get fast feedback.

Re pdfbox, change this line

         PDDocument pddocument = new PDDocument();
         pddocument = pddocument.load(target);

to

         PDDocument pddocument = PDDocument.load(target);

Good luck!

Tilman


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message