Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 01-16-2005, 11:59 AM   #1 (permalink)
freesoft_2000
Code Monkey
 
Join Date: Oct 2004
Posts: 51
freesoft_2000 is on a distinguished road
Question Images

Hi everyone,

I have a bit of a problem converting a JTextPane to an image.
I am able to convert the JTextPane to a PNG image but its quality is really bad. Is there a way that i can convert my JTextPane to a high quality image.

The type of image format does not matter

Here is what i have so far

Code:
public void export(JComponent Component) 
{

  File f1 = new File("C:\\Temp.PNG");
  Dimension Size5 = Component.getSize();  
  BufferedImage Image1 = new BufferedImage(Size5.width, Size5.height,  BufferedImage.TYPE_INT_ARGB);	
  Graphics2D g2 = Image1.createGraphics();		
  g2.setRenderingHint (RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
  Component.paint(g2);	

try
{
     ImageIO.write(Image1, "PNG", f1);
}

catch (Exception e)
{
     e.printStackTrace();
}

}
I hope someone can help with this problem

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West
freesoft_2000 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What a new article looks like with images .. sde Lounge 0 10-27-2004 05:37 PM
Possible to prevent images in a page from caching? Epsilon HTML, XML, Javascript, AJAX 2 09-06-2004 02:58 AM
New images reaffirm planet is lord of rings redhead Code Newbie News 0 07-05-2004 01:56 AM
Extracting Images from Email? Admin Lounge 5 06-01-2004 04:56 PM


All times are GMT -8. The time now is 01:30 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting