Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bmp, gif, jpeg

 
Tys Seyffert
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

Is it possible to save a panel as a graphic file like a bmp, gif, jpeg?

I have a calender that has a panel as the base. I want to save the the calender as a graphic.

Thank you

Tys
 
nikos sokaf
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're trying to save an image then you have to work with the image.Use the proper API. (See working with images on java.sun.com).

If you're trying to *print* a form, then i don't thing that there is a way you should do that, because this is an operating system's ability.I mean that in other languages, like C++,VB use some System's libraries (like MCI) to print a form etc. The reason is that the programming languages they can use such libraries, are written in system's code-base.And to be more specific: the operating system are written with these languages(talking for C++).Java is Platform Indepedent so i think what you're looking for can't be done.If there is a way to save a panel as an image without using system's libraries, post it if you'll find it, because i don't know any.Java is a low level to high level language,and probably there is a way, but i think it is very advanced.

I'm not telling you to stop looking, I'm telling you what i think.It is intresting , and if you find anything post it!

Best regards
Nikos sokaf
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This could be buggy, I didn't test anything. Should give you the general idea though. Google's an amazing thing you know.

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by nikos sokaf:
If you're trying to *print* a form, then i don't thing that there is a way you should do that, because this is an operating system's ability...Java is Platform Indepedent so i think what you're looking for can't be done.

I'm not telling you to stop looking, I'm telling you what i think.It is intresting , and if you find anything post it!

Best regards
Nikos sokaf


Um...Not exactly. Printing is a task performed by a Printer Driver. All printers are registered with the OS. It's the VM's job to locate those drivers and pass the information to them. That's why we have a different VM for different platforms.

Printing API/Tutorial
 
nikos sokaf
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg,
I believe at last, you are right!
But i think this could be difficult.I haven't try it.But this is true you posted.


Farewell!
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by nikos sokaf:
Hi Gregg,
I believe at last, you are right!
But i think this could be difficult.I haven't try it.But this is true you posted.


Farewell!


It is difficult. The printing API sucks. But it's not much better in any otehr language. You really have to do a lot of preparations of whatever you are printing before sending it to the printer. Like making sure the margins are right and the print area is right, etc, etc. Someone needs to make a higher level API for this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic