?
Solved

Export JFrame contents without making the JFrame visible

Posted on 2013-12-20
5
Medium Priority
?
275 Views
Last Modified: 2013-12-22
The attached (working) program creates a JFrame, adds a custom JPanel, draws some basic Graphics2D shapes, and finally exports the contents to a png file.

I need to be able to run the attached program without the JFrame actually showing up on my screen. Eventually, it will be run from the command line, and all I want is the exported file.  I tried to comment out the f.setVisible(true) line, but this causes an error.

Can this be done?
StartHere.java
FB.java
MyJpanel.java
0
Comment
Question by:MarkLoveExEx
[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
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 39733501
All you need to do is ignore the gui and work directly on the BufferedImage and save it as i showed
0
 

Author Comment

by:MarkLoveExEx
ID: 39733731
It seems that the whole approach so far is to use GUI components. I am having trouble stripping out the GUI and still making the png image. Am I not to use JFrame and JPanels? If not, what am I to draw on?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 39733772
If not, what am I to draw on?
The Graphics of the BufferedImage
0
 

Author Closing Comment

by:MarkLoveExEx
ID: 39734188
Ok. I understand now. I got it to work. It actually made my code a lot simpler getting rid of the unneeded GUI components. Thanks for your help. My java skills sure are rusty...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39734396
:)
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

765 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