Solved

JFrames

Posted on 2002-04-12
7
318 Views
Last Modified: 2013-11-23
is it possible to add a JFrame to a Jframe?
0
Comment
Question by:Codster
  • 4
  • 3
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6937941
I don't believe so.
Have a look at JInternalFrame it may do what you're after.
0
 

Author Comment

by:Codster
ID: 6937952
What i really want to do is print the contents of a Jpanel using something similar to

public void printPage(JFrame jf, String title)
{
     Properties pProp = new Properties();
     PrintJob pJob = Toolkit.getDefaultToolkit().getPrintJob(jf,title,pProp);

......
}

where jf is a JPanel ????
any suggestions ????
0
 
LVL 92

Accepted Solution

by:
objects earned 10 total points
ID: 6937960
What's that got to do with frames in frames :-)

Have a look at Sun's Java tutorial on printing it should so you what to do.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Codster
ID: 6938069
i was going to try and change my JPanel to a JFrame and then print that instead of the panel but it wasnt really ever going to work out.

the printing method works fine, it brings up the printing dialog box and prints a sheet but theres nothing there to print!!!!

Thanks for all your help
your great!

the whole project is due in on monday afternoon anyway so im only trying to get more marks by putting in the printing function!

Thanks again
0
 
LVL 92

Expert Comment

by:objects
ID: 6938103
> i was going to try and change my JPanel to a JFrame

Don't think this will make any difference

> but theres nothing there to print!!!!

Do you call the JPanel's print() method?


Sorry I can't be more help, I've got a few deliverables to complete for some clients.
0
 

Author Comment

by:Codster
ID: 6938116
Thank you for the suggestion
ill have a look
actually just a small other question since your busy - can you load the contents of a JPanel into a Graphics object and maybe print the graphics object?


(I'll be using java for 6 months soon so this is why i know nothing!!!!!!)

Thank you
0
 
LVL 92

Expert Comment

by:objects
ID: 6938124
> can you load the contents of a JPanel into a Graphics object ...

That's what the print() method is for.

http://www.objects.com.au
Brainbench MVP for Java 1
http://www.brainbench.com
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

746 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

13 Experts available now in Live!

Get 1:1 Help Now