<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Java Programming Forum - Learn Java Programming - Blogs - Java AWT</title>
		<link>http://www.java-forums.org/blogs/java-awt/</link>
		<description>Java Programming Forum - Learning Java easily</description>
		<language>en</language>
		<lastBuildDate>Fri, 24 May 2013 14:06:05 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.java-forums.org/images/misc/rss.jpg</url>
			<title>Java Programming Forum - Learn Java Programming - Blogs - Java AWT</title>
			<link>http://www.java-forums.org/blogs/java-awt/</link>
		</image>
		<item>
			<title>Printing Support in Swing Components</title>
			<link>http://www.java-forums.org/blogs/java-awt/1079-printing-support-swing-components.html</link>
			<pubDate>Wed, 07 Mar 2012 16:53:15 GMT</pubDate>
			<description>Contents out of view or which are invisible because of scrolling in a scrollable window would not be present in a printout. At printer, they will be...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Contents out of view or which are invisible because of scrolling in a scrollable window would not be present in a printout. At printer, they will be placing a dumb effect. This specified problem is usually present with larger components printing like a swing table or text components.<br />
<br />
Multiple lines of text are present in many components that are entirely not visible at the screen. Contents shall be printed in a way that is consistent along with the screen display.<br />
<br />
For sorting out such problems, swing tables are text components are aware of printing. For Java 2D printing, these given methods would be used.<br />
<ul><li style="">javax.swing.text.JTextComponent.print();</li><li style="">javax.swing.JTable.print();</li></ul><br />
<br />
Implementations of the contents that are required to be printed are supported by the above methods. Printable interface is implemented by an application and PrinterJob object creation is not needed.<br />
When you call these methods, print dialog gets displayed. According to the selection of user, component data will be printed.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1079-printing-support-swing-components.html</guid>
		</item>
		<item>
			<title>Print Service Discovery</title>
			<link>http://www.java-forums.org/blogs/java-awt/1078-print-service-discovery.html</link>
			<pubDate>Wed, 07 Mar 2012 16:51:47 GMT</pubDate>
			<description>Abstract class PrintServiceLookup static methods are invoked by the application so that to locate the print services that possess certain abilities...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Abstract class PrintServiceLookup static methods are invoked by the application so that to locate the print services that possess certain abilities to makes the print requests of an application satisfied. E.g, to print out 2 copies of double sided document first thing that shall be searched  by the application is the printers that hold the ability of double sided capability.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">DocFlavor doc_flavor = DocFlavor.INPUT_STREAM.PDF;
PrintRequestAttributeSet attr_set =
    new HashPrintRequestAttributeSet();
attr_set.add(new Copies(2));
attr_set.add(Sides.DUPLEX);
PrintService&#91;&#93; service =
    PrintServiceLookup.lookupPrintServices(doc_flavor,
                                           attr_set);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1078-print-service-discovery.html</guid>
		</item>
		<item>
			<title>Attribute Definitions</title>
			<link>http://www.java-forums.org/blogs/java-awt/1077-attribute-definitions.html</link>
			<pubDate>Wed, 07 Mar 2012 16:50:35 GMT</pubDate>
			<description><![CDATA[The javax.print.attribute.standard & javax.print.attribute packages details those attributes of prints that show the print service’s capabilities,...]]></description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">The javax.print.attribute.standard &amp; javax.print.attribute packages details those attributes of prints that show the print service’s capabilities, requirement of print job or the progress of print job.<br />
<br />
E.g, for using A4 paper format to print 3 copies, you shall construct following attributes set implementing<br />
the PrintRequestAttributeSet interface:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">PrintRequestAttributeSet attr_set =
    new HashPrintRequestAttributeSet();
attr_set.add(MediaSize.ISO_A4); 
attr_set.add(new Copies(3));</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1077-attribute-definitions.html</guid>
		</item>
		<item>
			<title>Document Type Specification</title>
			<link>http://www.java-forums.org/blogs/java-awt/1076-document-type-specification.html</link>
			<pubDate>Wed, 07 Mar 2012 16:41:22 GMT</pubDate>
			<description>Format of the print data is presented by DocFlavor, like PostScript or JPEG. There are 2 main parts of the DocFlavor: A representation class name or...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Format of the print data is presented by DocFlavor, like PostScript or JPEG. There are 2 main parts of the DocFlavor: A representation class name or a MIME type. MIME shows that what is the format and a document representation class name show the way documents are delivered to output stream/ printer. An attribute set and DocFlavor is used by an application to find printers with certain capabilities that have been specified by attribute set. Such sample code shows the way an array of StreamPrintServiceFactory  object is obtained which may return the StreamPrintService objects, that are capable of converting GIF to PostScript.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
String psMimeType =
    DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType();
StreamPrintServiceFactory&#91;&#93; psfactories =
    StreamPrintServiceFactory.
       lookupStreamPrintServiceFactories(
       flavor, psMimeType);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1076-document-type-specification.html</guid>
		</item>
		<item>
			<title>Working with Print Services and Attributes</title>
			<link>http://www.java-forums.org/blogs/java-awt/1075-working-print-services-attributes.html</link>
			<pubDate>Wed, 07 Mar 2012 16:39:43 GMT</pubDate>
			<description>The Java™ Print Service (JPS) API makes the extension of the current features of Java 2D printing so that to offer these functionalities: 
 
*...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">The Java™ Print Service (JPS) API makes the extension of the current features of Java 2D printing so that to offer these functionalities:<br />
<ul><li style="">Printers which cater to the needs of application by querying the capabilities of printers are discovered.</li><li style="">Attributes are extended by the application included with the JPS API.</li><li style="">With service provider Interface, 3rd parties might put their print services which print varying formats, including PDF, SVG and Postscript.</li></ul><br />
<br />
The Java Print Service API has 4 packages:<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/advanced-java/3190d1331138085-portal-sap-java-1.jpg" border="0" alt="Name:  1.JPG
Views: 98
Size:  17.5 KB" class="thumbnail" style="float:CONFIG" /><br />
<b>Working with Print Services and Attributes</b></div><br />
Interfaces and principle classes are provided by the javax.print package, for Java™ Print Service API.<br />
<br />
It enables server applications and clients to:<br />
<ul><li style="">Discover &amp; select the print services that are based at their abilities.</li><li style="">Specify the print data format.</li><li style="">Submit print jobs to services, which support the document type that needs to be printed.</li></ul></blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1075-working-print-services-attributes.html</guid>
		</item>
		<item>
			<title>Printing a Multiple Page Document</title>
			<link>http://www.java-forums.org/blogs/java-awt/1074-printing-multiple-page-document.html</link>
			<pubDate>Wed, 07 Mar 2012 16:11:54 GMT</pubDate>
			<description><![CDATA[To print number of graphic images, page index is used so that to iterate via pages & print just 1 at every page. E.g, many images are presented in...]]></description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">To print number of graphic images, page index is used so that to iterate via pages &amp; print just 1 at every page. E.g, many images are presented in this array:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">BufferedImage&#91;&#93; images = new BufferedImage&#91;10&#93;;
Then, use the print() method as in the following code fragment:
public int print(Graphics graphics,
           PageFormat pageFormat, int pageIndex)
           throws PrinterException {

    if (pageIndex &lt; images.length) {
        graphics.drawImage(images&#91;pageIndex&#93;,
                           100, 100, null);
        return PAGE_EXISTS;
    } else {
        return NO_SUCH_PAGE:
    }
}</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 If there exists a continuous document than it shall be possible for the application to calculate that how much content could be made possible to get fit on each page. Break page at that point. Number of lines that could get fit on page shall be calculated by the application in case text document has many lines. A point is created by the Point class which represent a location in (x,y)<br />
Height of a single line of text can be calculated by using the FontMetrics class.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">Font font = new Font(&quot;Serif&quot;, Font.PLAIN, 10);
FontMetrics metrics = graphics.getFontMetrics(font);
int lineHeight = metrics.getHeight();</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 printable area of the page is described by PageFormat parameter. Vertical span of the page is found by using this code fragment:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">double pageHeight = pageFormat.getImageableHeight();</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 No. of lines that might get fixed on a page &amp; the no. of page breaks can be calculated by using this code.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">int linesPerPage = ((int)pageHeight)/lineHeight);
int numBreaks = (textLines.length-1)/linesPerPage;
int&#91;&#93; pageBreaks = new int&#91;numBreaks&#93;;
for (int b=0; b &lt; numBreaks; b++) {
    pageBreaks&#91;b&#93; = (b+1)*linesPerPage; 
}</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1074-printing-multiple-page-document.html</guid>
		</item>
		<item>
			<title>Using Print Setup Dialogs</title>
			<link>http://www.java-forums.org/blogs/java-awt/1073-using-print-setup-dialogs.html</link>
			<pubDate>Wed, 07 Mar 2012 16:09:59 GMT</pubDate>
			<description>Typically a user wishes to see the print dialog box and page setup. One can select a printer from the print dialog, pages to be printed may be...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Typically a user wishes to see the print dialog box and page setup. One can select a printer from the print dialog, pages to be printed may be specified and also number of copies could be set.<br />
<br />
<div style="text-align: center;"><img src="http://www.java-forums.org/attachments/enterprise-javabeans-ejb/3189d1331136552-without-restarting-websphere-server-i-need-connect-newly-created-database-1.jpg" border="0" alt="Name:  1.JPG
Views: 382
Size:  26.7 KB" class="thumbnail" style="float:CONFIG" /></div><b><div style="text-align: center;">Print Setup Dialog</div></b><br />
<br />
A Print dialog is displayed by an application when a button of print command is pressed by user or he selects an item from print menu. In order to display this dialog<br />
<br />
Call the printdialog method of the PrinterJob class:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">PrinterJob pj = PrinterJob.getPrinterJob();
...
    if (pj.printDialog()) {
        try {pj.print();}
        catch (PrinterException exc) {
            System.out.println(exc);
         }
     }   
...</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 This method proves to be true when Ok is clicked by user so that to leave the dialog. Otherwise it would be considered as false. Choices of user in dialog get certain constraints that is dependent on the format as well number of pages that are being set for the PrinterJob.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1073-using-print-setup-dialogs.html</guid>
		</item>
		<item>
			<title>Basic Printing Program</title>
			<link>http://www.java-forums.org/blogs/java-awt/1072-basic-printing-program.html</link>
			<pubDate>Wed, 07 Mar 2012 16:07:44 GMT</pubDate>
			<description>Printing consists of following two parts: 
 
*Job Control: Following are part of job control.* 
 
* Creating a print job 
* Associate it with printer...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Printing consists of following two parts:<br />
<br />
<b>Job Control: Following are part of job control.</b><br />
<ul><li style="">Creating a print job</li><li style="">Associate it with printer</li><li style="">Specify no of copies</li><li style="">User print dialog interaction</li></ul><br />
<br />
<b>Page Imaging: It includes drawing content to a page.</b><br />
The java.awt.print package includes the classes to create a printer job and most other related classes are part of this package.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">import java.awt.print.*;
PrinterJob job = PrinterJob.getPrinterJob();
Following code renders the content to the page.
class HelloWorldPrinter implements Printable  { ... }
..
job.setPrintable(new HelloWorldPrinter());</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 A print dialog is displayer in an application so that user can select different options. Following code is used to display this dialog.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">boolean doPrint = job.printDialog();</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1072-basic-printing-program.html</guid>
		</item>
		<item>
			<title>Writing/Saving an Image</title>
			<link>http://www.java-forums.org/blogs/java-awt/1071-writing-saving-image.html</link>
			<pubDate>Wed, 07 Mar 2012 16:04:58 GMT</pubDate>
			<description><![CDATA[It has been explained to use the javax.imageio package so that to load image to Java 2D™'s internalBufferedImage format from an external image...]]></description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">It has been explained to use the javax.imageio package so that to load image to Java 2D™'s internalBufferedImage format from an external image format. Also, the usage of Graphics.drawImage()  has been explained to draw images with an optional filtering.<br />
<br />
To an external image format, the BufferedImage object is saved. This image might be the one that was loaded originally by Image I/O class, from external image format. It might also be the one which was constructed by Java 2D or was modified by using Java 2D APIs.<br />
<br />
The given example shows that simple ways are provided by Image I/O so that images could be saved in a number of image formats.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">static boolean ImageIO.write(RenderedImage im,
                             String formatName,
                             File output)</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1071-writing-saving-image.html</guid>
		</item>
		<item>
			<title>Creating and Drawing to an Image</title>
			<link>http://www.java-forums.org/blogs/java-awt/1070-creating-drawing-image.html</link>
			<pubDate>Wed, 07 Mar 2012 16:03:49 GMT</pubDate>
			<description>The process of loading an image is already known, which is created as well as stored on any network or your system. However, you would also want to...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">The process of loading an image is already known, which is created as well as stored on any network or your system. However, you would also want to make a new pixel data buffered image.<br />
<br />
BufferedImage object can be created manually by making use of 3 constructors of class:<br />
<ul><li style="">new BufferedImage(width, height, type) - creates a BufferedImage for one of the predefined type of image.</li><li style="">new BufferedImage(width, type,height, colorModel) - creates a BufferedImage of the predefined images: TYPE_BYTE_BINARY orTYPE_BYTE_INDEXED.</li><li style="">new BufferedImage(colorModel, raster, premultiplied, properties) - creates a new BufferedImage along with a ColorModeland Raster.</li></ul><br />
<br />
Component class methods could also be used, on the other hand. For a GraphicsConfiguration &amp; given component, such methods might do the analysis of the display resolution to construct an appropriate type image.<br />
<ul><li style="">Component.createImage(width, height)</li><li style="">GraphicsConfiguration.createCompatibleImage(width, height)</li><li style="">GraphicsConfiguration.createCompatibleImage(width, height, transparency)</li></ul><br />
<br />
BufferedImage type’s object is returned by the GraphicConfiguration. However, object of Image type is returned by the Component, if instead BufferedImage is needed than one may perform instanceof and also may cast BufferedImage in code.<br />
<br />
Images are not only rendered on screen. Image can be taken as a drawing surface. CreateGraphics() method of BufferedImage class can be used for such purposes:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">BufferedImage off_Image =
  new BufferedImage(100, 50,
                    BufferedImage.TYPE_INT_ARGB);

Graphics2D g2 = off_Image.createGraphics();</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1070-creating-drawing-image.html</guid>
		</item>
		<item>
			<title>Filtering Images</title>
			<link>http://www.java-forums.org/blogs/java-awt/1069-filtering-images.html</link>
			<pubDate>Wed, 07 Mar 2012 16:02:01 GMT</pubDate>
			<description>In addition to copying and scaling images, the Java 2D API also filter an image. Filtering is drawing or producing a new image by applying an...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">In addition to copying and scaling images, the Java 2D API also filter an image. Filtering is drawing or producing a new image by applying an algorithm to the pixels of the source image. Image filters can be applied by using the following method:<br />
<br />
Java 2D API filters images along with copy or scaling the images. Filtering means producing a new images by applying algorithm to the source image pixels.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">void Graphics2D.drawImage(BufferedImage img,
                          BufferedImageOp op,
                          int x, int y)</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Implementation of filter is done by the BufferedImageOp. Given applet presents the image that is drawn at the top of next. You can drag the slider to represent the text via image and can make image transparent (more or less).</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1069-filtering-images.html</guid>
		</item>
		<item>
			<title>Drawing an Image</title>
			<link>http://www.java-forums.org/blogs/java-awt/1068-drawing-image.html</link>
			<pubDate>Wed, 07 Mar 2012 16:00:48 GMT</pubDate>
			<description>Graphics.drawImage method is used to draw the images at a specific location: 
 
boolean Graphics.drawImage(Image img, 
                           int...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Graphics.drawImage method is used to draw the images at a specific location:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">boolean Graphics.drawImage(Image img,
                           int x, int y,
                           ImageObserver observer);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Top left position of an image is specified by x,y location. Observer parameters are usually null as they are not used frequently or directly &amp; is also not required for BufferedImage.<br />
<br />
This method is used just when there is a need to draw the entire image or mapping the image pixels. Sometimes just a portion of image needs to be drawn or scale the image or filter the image.<br />
<br />
The drawImage() method’s overloads perform these actions and operations. E.g. the given overload makes you able to draw specified area of specified image as much as it is available currently.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">boolean Graphics.drawImage(Image img,
           int dstx1, int dsty1, int dstx2, int dsty2,
           int srcx1, int srcy1, int srcx2, int srcy2,
           ImageObserver observer);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1068-drawing-image.html</guid>
		</item>
		<item>
			<title>Reading/Loading an Image</title>
			<link>http://www.java-forums.org/blogs/java-awt/1067-reading-loading-image.html</link>
			<pubDate>Wed, 07 Mar 2012 15:59:19 GMT</pubDate>
			<description>Sampled images formats come into mind when we think about digital images. Like GIF images thare used at web pages or JPEG images that are commonly...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Sampled images formats come into mind when we think about digital images. Like GIF images thare used at web pages or JPEG images that are commonly used in digital photography. Program using them shall 1st convert them into an internal format from an external format.<br />
<br />
Java 2D™ provides support to load such external image format to BufferedImage format. This is done by using Image I/O API that is present in javax.imageio package. Built in support is present in Image I/O for GIF,JPEG,WBMP, PNG and BMP.It is possible to make imageI/O extensible therefore administrators and developers could plu-in support, for the additional formats. E.g. plug-in are separately present for JPEG &amp; TIFF.<br />
<br />
Following code shall be used for loading image, from one specified file.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">BufferedImage img = null;
try {
    img = ImageIO.read(new File(&quot;strawberry.jpg&quot;));
} catch (IOException e) {
}</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 As JPEG format, file contents are recognized by Image I/O which then decodes it to BufferedImage which might be used directly by Java 2D.<br />
<br />
LoadImageApp.java tell that how image shall be displayed.<br />
<br />
If code run in an applet this means that it is an easy task to get the images, from the applet codebase :<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">try {
   URL url = new URL(getCodeBase(), &quot;strawberry.jpg&quot;);
   img = ImageIO.read(url);
} catch (IOException e) {
}</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1067-reading-loading-image.html</guid>
		</item>
		<item>
			<title>Working with Images</title>
			<link>http://www.java-forums.org/blogs/java-awt/1066-working-images.html</link>
			<pubDate>Wed, 07 Mar 2012 15:57:39 GMT</pubDate>
			<description><![CDATA[Common tasks present while working with images are: 
 
* To Load an external PNG, GIF & JPEG image format file, to Java 2D™'s internal image...]]></description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Common tasks present while working with images are:<br />
<ul><li style="">To Load an external PNG, GIF &amp; JPEG image format file, to Java 2D™'s internal image representation.</li><li style="">Creating Java 2D image directly &amp; also rendering to it.</li><li style="">Java 2D image contents drawn on a drawing surface.</li><li style="">Java 2D image contents saved to an external PNG, GIF or JPEG image file.</li></ul><br />
<br />
<br />
Two classes shall be learnt  so that to work with images:<br />
<ul><li style="">Java.awt.Image class being a superclass present the graphical images as the rectangle pixel arrays.</li><li style="">Java.awt.image.BufferedImage class that makes the image class extended so that to permit the application to be operated directly, with image data.</li></ul><br />
<br />
BufferedImage can be rendered by the Graphics2D and Graphics methods as it is the subclass of an Image.<br />
It is basically an image present with accessible data buffer. Therefore work could be done more efficiently with BufferedImage.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1066-working-images.html</guid>
		</item>
		<item>
			<title>Drawing Multiple Lines of Text</title>
			<link>http://www.java-forums.org/blogs/java-awt/1065-drawing-multiple-lines-text.html</link>
			<pubDate>Wed, 07 Mar 2012 15:56:11 GMT</pubDate>
			<description>LineBreakMeasurer shall be used in case you want your styled text paragraph to get fit in a specific width. Styled text is broken down into lines by...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">LineBreakMeasurer shall be used in case you want your styled text paragraph to get fit in a specific width. Styled text is broken down into lines by this class so that to make them fit in a visual advance. As a TextLayout object every line is returned, that presents the styled and unchangeable character data. This class accesses the layout information.<br />
<br />
The getDescent and getAscent methods of Textlayout make the information to be returned regarding font which positions the component lines.As AttributedCharacterIterator object, text is stored. It makes the point size and fonts to be stored with text.<br />
<br />
These applet positions styled text paragraph in a component, by using  TextLayout, LineBreakMeasurer, and AttributedCharacterIterator.<br />
<br />
This code makes an iterator along with a string vanGogh. The start as well as end of the iterator gets retrieved. A new LineBreakMeasurer is made from the iterator.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">    AttributedCharacterIterator paragraph =
        vanGogh.getIterator();
    paragraphStart = paragraph.getBeginIndex();
    paragraphEnd = paragraph.getEndIndex();
    FontRenderContext frc = g2d.getFontRenderContext();
    lineMeasurer =
        new LineBreakMeasurer(paragraph, frc);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1065-drawing-multiple-lines-text.html</guid>
		</item>
		<item>
			<title>Using Text Attributes to Style Text</title>
			<link>http://www.java-forums.org/blogs/java-awt/1064-using-text-attributes-style-text.html</link>
			<pubDate>Wed, 07 Mar 2012 15:54:48 GMT</pubDate>
			<description>Following text attributes needs to be applied by an application: 
 
* Underline –Underneath text, a line is drawn. 
* Strikethrough –Through the...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Following text attributes needs to be applied by an application:<br />
<ul><li style="">Underline –Underneath text, a line is drawn.</li><li style="">Strikethrough –Through the text, a horizontal line gets drawn.</li><li style="">Superscript or Subscript –A Letter of a text which slightly appears below or above a line.</li><li style="">Kerning – The space adjustments between characters</li></ul><br />
<br />
Such text attributes might get applied, by using the Java 2D™ TextAttribute class.<br />
<br />
Text attributes are applied by adding them to a Font object. E.g:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">Map&lt;TextAttribute, Object&gt; map =
    new Hashtable&lt;TextAttribute, Object&gt;();
map.put(TextAttribute.KERNING,
    TextAttribute.KERNING_ON);
font = font.deriveFont(map);
graphics.setFont(font);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 The code example given below specifies the application of text attributes, in the following order:<br />
Sample string (no text attributes applied)<br />
<ol class="decimal"><li style="">Kerning</li><li style="">Kerning and Underlining</li><li style="">Kerning,Underlining and Strikethrough</li><li style="">Kerning,Underlining, Strikethrough and Color</li></ol></blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1064-using-text-attributes-style-text.html</guid>
		</item>
		<item>
			<title>Displaying Antialiased Text by Using Rendering Hints</title>
			<link>http://www.java-forums.org/blogs/java-awt/1063-displaying-antialiased-text-using-rendering-hints.html</link>
			<pubDate>Wed, 07 Mar 2012 15:48:38 GMT</pubDate>
			<description>Rendering hints may affect the Java 2D™ text. 
 
Text drawing method that is the most important of all is given as following: 
...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Rendering hints may affect the Java 2D™ text.<br />
<br />
Text drawing method that is the most important of all is given as following:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">Graphics.drawString(String s, int x, int y);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Text antialiasing is a method which is used so that to smooth the text edges on screen. Applications are enabled by the Java 2D API to specify that such method shall be used or not and which algorithm shall be used by using text rendering hint, to the graphics.<br />
<br />
At the edge of text, blend of the most common rendering hint and text color takes place along with onscreen background pixels. An application shall invoke as following, for requesting this hint.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">graphics2D.setRenderingHint(
        RenderingHints.KEY_TEXT_ANTIALIASING,
        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1063-displaying-antialiased-text-using-rendering-hints.html</guid>
		</item>
		<item>
			<title>Measuring Text</title>
			<link>http://www.java-forums.org/blogs/java-awt/1062-measuring-text.html</link>
			<pubDate>Wed, 07 Mar 2012 15:46:56 GMT</pubDate>
			<description>For measuring text properly you shall be learning certain important methods and also few mistakes shall be avoided. Font metrics are considered as...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">For measuring text properly you shall be learning certain important methods and also few mistakes shall be avoided. Font metrics are considered as the measure of the text which has been rendered by the font object like, height of line in font. By using FontMetrics instance, you can measure text easily and this is one of the most common way to do so. E.g,<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">// get metrics from the graphics
FontMetrics metrics = graphics.getFontMetrics(font);
// get the height of a line of text in this
// font and render context
int hgt = metrics.getHeight();
// get the advance of my text in this font
// and render context
int adv = metrics.stringWidth(text);
// calculate the size of a box to hold the
// text with some padding.
Dimension size = new Dimension(adv+2, hgt+2);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 For many applications, such kind of way is sufficient to space the lines of text evenly or also to size the swing components.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1062-measuring-text.html</guid>
		</item>
		<item>
			<title>Advantages and Disadvantages of Using Physical and Logical Fonts</title>
			<link>http://www.java-forums.org/blogs/java-awt/1061-advantages-disadvantages-using-physical-logical-fonts.html</link>
			<pubDate>Wed, 07 Mar 2012 15:45:41 GMT</pubDate>
			<description>An application is enable by the physical fonts to get great advantage of the all present fonts. This is actually done to accomplish maximum language...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">An application is enable by the physical fonts to get great advantage of the all present fonts. This is actually done to accomplish maximum language coverage as well as different text appearances. However, this is a tough task to create those applications which yse these physical fonts.<br />
<br />
To bundle the physical fonts along with application makes you able to create those applications which possess same look and also the great control at those applications. However these bundled fonts are quite big in their size especially in case you want to support an application with Korean, Chinese and Japanese. Additionally, licensing issues need to be resolved.<br />
<br />
There is a guarantee that logical fonts work anywhere. Text rendering is also possible in the languages which are localized to host operating system. Physical fonts that are used to render text usually vary b/w locales, host operating systems and different implementation. Therefore, it is not possible for an application to get the similar look everywhere.<br />
<br />
Occasionally, range of characters which might be rendered is limited by mapping. Before 5.0, on JRE versions the latter was a bigger problem. E.g. it was possible to render the Japanese text at Japanese localized host operating system. It was not possible for any other no matter if the installation had been done of the Japanese font. Applications that were using 2D font rendering such kind of problem is quite rate for JRE version 5 as well as all other later as fonts are used and recognized  for supported writing systems by the mapping mechanism, if they are installed.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1061-advantages-disadvantages-using-physical-logical-fonts.html</guid>
		</item>
		<item>
			<title>Logical Fonts</title>
			<link>http://www.java-forums.org/blogs/java-awt/1060-logical-fonts.html</link>
			<pubDate>Wed, 07 Mar 2012 15:44:17 GMT</pubDate>
			<description>The following five logical font families are defined in the Java SE. 
 
* Dialog 
* DialogInput 
* Monospaced 
* Serif 
* SansSerif</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">The following five logical font families are defined in the Java SE.<br />
<ul><li style="">Dialog</li><li style="">DialogInput</li><li style="">Monospaced</li><li style="">Serif</li><li style="">SansSerif</li></ul><br />
<br />
These fonts are available on any Java platform and can be thought of as aliases for some underlying font that has the properties implied by its name. <br />
<ul><li style="">A Serif font is a font similar to Times New Roman, which is commonly used in print.</li><li style="">A Sans Serif font is more typical for onscreen use.</li></ul><br />
<br />
These fonts can be customized for the locale of the user. In addition these fonts support the widest range of code points.<br />
<br />
An application can create an instance of this font directly by specifying the following:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">Font font = new Font(&quot;Dialog&quot;, Font.PLAIN, 12);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1060-logical-fonts.html</guid>
		</item>
		<item>
			<title>Physical Fonts</title>
			<link>http://www.java-forums.org/blogs/java-awt/1059-physical-fonts.html</link>
			<pubDate>Tue, 06 Mar 2012 19:03:59 GMT</pubDate>
			<description>Actual font libraries are the physical fonts which contain glyph data as well as tables so that character sequence and glyph sequences are mapped....</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Actual font libraries are the physical fonts which contain glyph data as well as tables so that character sequence and glyph sequences are mapped. Font technology like PostScript Type 1 and True Type are used. Following shall be called to get the available installed font families in your system:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String &#91;&#93;fontFamilies = ge.getAvailableFontFamilyNames();</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1059-physical-fonts.html</guid>
		</item>
		<item>
			<title>Fill Patterns</title>
			<link>http://www.java-forums.org/blogs/java-awt/1058-fill-patterns.html</link>
			<pubDate>Tue, 06 Mar 2012 19:02:51 GMT</pubDate>
			<description>Paint attributes define fill pattern in Graphic2D rendering context.  An object’s instance is created for setting the paint attributes which makes...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Paint attributes define fill pattern in Graphic2D rendering context.  An object’s instance is created for setting the paint attributes which makes possible the implementation of the paint interface. setPaint method is called along with Graphic2D, as a parameter.<br />
<br />
Paint interface is implemented by using these 3 classes.<br />
<br />
<ul><li style="">Color</li><li style="">TexturePaint</li><li style="">GradientPaint</li></ul><br />
<br />
Create a GradientPaint by specifying.<br />
<br />
<ul><li style="">Beginning position/color</li><li style="">Ending position/color</li></ul><br />
<br />
Proportionally, gradient change takes place from 1 color to other, with line which connects 2 positions.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1058-fill-patterns.html</guid>
		</item>
		<item>
			<title>Line Styles</title>
			<link>http://www.java-forums.org/blogs/java-awt/1057-line-styles.html</link>
			<pubDate>Tue, 06 Mar 2012 19:01:34 GMT</pubDate>
			<description>Stroke attributes define the line style in Graphic2D rendering context. BasicStroke object shall be created and passed to Graphic2D setStroke method...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Stroke attributes define the line style in Graphic2D rendering context. BasicStroke object shall be created and passed to Graphic2D setStroke method so that to set the stroke attribute.<br />
<br />
Information in a BasicStroke object is:<br />
<br />
<ul><li style="">Line width</li><li style="">Join style</li><li style="">End cap style</li><li style="">Dash style</li></ul><br />
<br />
Use this information when shape is rendered with draw method.<br />
<br />
The line width is line thickness which is measured perpendicular, to its trajectory. The line width is specified, as in user coordinate units a float value that is equals to 1/72 of an inch, when we use the default transform.<br />
<br />
The join style is considered as the decoration applied when 2 line segments meet.</blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1057-line-styles.html</guid>
		</item>
		<item>
			<title>Stroking and Filling Graphics Primitives</title>
			<link>http://www.java-forums.org/blogs/java-awt/1056-stroking-filling-graphics-primitives.html</link>
			<pubDate>Tue, 06 Mar 2012 19:00:15 GMT</pubDate>
			<description>In this post, discussion will be done regarding the outlines and color which are applicable to the graphics. Stroking as well as filling will also be...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">In this post, discussion will be done regarding the outlines and color which are applicable to the graphics. Stroking as well as filling will also be discussed.<br />
<br />
Fi<ul><li style="">lling – To paint with color gradient or solid color.</li><li style="">Stroking – Outline of shape is drawn by applying color attribute, stroke width and line style.</li></ul><br />
<br />
Change paint attributes &amp; stroke that are given in Graphics2D context. This is done before line styles are rendered or patterns are filled to the geometric primitives.<br />
<br />
Geometric primitives are enriched along with stroking context and filling, by using these code lines.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">// draw RoundRectangle2D.Double
final static float dash1&#91;&#93; = {10.0f};
    final static BasicStroke dashed =
        new BasicStroke(1.0f,
                        BasicStroke.CAP_BUTT,
                        BasicStroke.JOIN_MITER,
                        10.0f, dash1, 0.0f);
g2.setStroke(dashed);
g2.draw(new RoundRectangle2D.Double(x, y,
                                   rectWidth,
                                   rectHeight,
                                   10, 10));
// fill Ellipse2D.Double
redtowhite = new GradientPaint(0,0,color.RED,100, 0,color.WHITE);
g2.setPaint(redtowhite);
g2.fill (new Ellipse2D.Double(0, 0, 100, 50));</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1056-stroking-filling-graphics-primitives.html</guid>
		</item>
		<item>
			<title>Drawing Arbitrary Shapes</title>
			<link>http://www.java-forums.org/blogs/java-awt/1055-drawing-arbitrary-shapes.html</link>
			<pubDate>Tue, 06 Mar 2012 18:56:03 GMT</pubDate>
			<description>This class is used to implement shape interface. It also presents geometric path that is constructed from: 
 
* Lines 
* Cubic Curves 
* Quadratic 
...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">This class is used to implement shape interface. It also presents geometric path that is constructed from:<br />
<ul><li style="">Lines</li><li style="">Cubic Curves</li><li style="">Quadratic</li></ul><br />
<br />
This class supports 3 constructors which creates GeneralPath. These constructors are supported by class along with default winding rule i.e. WIND_NON_ZERO, specified initial coordinate capacity and winding rule i.e.  WIND_NON_ZERO or WIND_EVEN_ODD<br />
<br />
How to determine interior of a path is specified by using the winding rule.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">public void Paint (Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    ...
}</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Call new GeneralPath() for creation of empty GeneralPath. Then segments are added to shape, by these methods.<br />
<br />
<ul><li style="">moveTo(float x, float y) –Current point of the path is moved to the given point</li><li style="">lineTo(float x, float y) –line segment is added to the current path</li><li style="">quadTo(float ctrlx, float ctrly, float x2, floaty2) –To the current path, quadratic curve segment is added.</li><li style="">curveTo(float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x3, floaty3) – To the current path, cubic curve segment is added.</li><li style="">closePath() – Current path is closed.</li></ul></blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1055-drawing-arbitrary-shapes.html</guid>
		</item>
		<item>
			<title>Drawing an Arc</title>
			<link>http://www.java-forums.org/blogs/java-awt/1054-drawing-arc.html</link>
			<pubDate>Tue, 06 Mar 2012 18:54:28 GMT</pubDate>
			<description>A piece of ellipse is drawn by Arc2D. Following present an arc class. 
 
* A bounding rectangle 
* An angular extent 
* A start angle 
* A closure...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">A piece of ellipse is drawn by Arc2D. Following present an arc class.<br />
<ul><li style="">A bounding rectangle</li><li style="">An angular extent</li><li style="">A start angle</li><li style="">A closure type</li></ul><br />
<br />
An ellipse in float &amp; double precision are specified.<br />
<ul><li style="">Arc2D.Double</li><li style="">Arc2D.Float</li></ul><br />
<br />
Arc2D class defines 3 types of arcs:<br />
<ul><li style="">OPEN</li><li style="">CHORD</li><li style="">PIE</li></ul><br />
 <br />
The parameters and size of the arc are set by applying these different methods:<br />
<ul><li style="">By supplied Dimension2D and Point2D.</li><li style="">Directly by coordinates.</li><li style="">By copying Arc2D that is already existing.</li></ul><br />
<br />
An arc creation is explained by this code given below.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">// draw Arc2D.Double
g2.draw(new Arc2D.Double(x, y,
                         rectwidth,
                         rectheight,
                         90, 135,
                         Arc2D.OPEN));</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1054-drawing-arc.html</guid>
		</item>
		<item>
			<title>Drawing an Ellipse</title>
			<link>http://www.java-forums.org/blogs/java-awt/1053-drawing-ellipse.html</link>
			<pubDate>Tue, 06 Mar 2012 18:52:42 GMT</pubDate>
			<description><![CDATA[Ellipse2D class presents the ellipse which is defined by bounded rectangles. An ellipse in float & precision are specified by these subclasses. 
 
...]]></description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">Ellipse2D class presents the ellipse which is defined by bounded rectangles. An ellipse in float &amp; precision are specified by these subclasses.<br />
<br />
<ul><li style="">Ellipse2D.Double</li><li style="">Ellipse2D.Float</li></ul><br />
<br />
Following attributes define ellipse:<br />
<br />
<ul><li style="">Location</li><li style="">Height</li><li style="">Width</li></ul><br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">Creation of an ellipse is explained by this example.
// draw Ellipse2D.Double
g2.draw(new Ellipse2D.Double(x, y,
                             rectwidth,
                             rectheight));</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1053-drawing-ellipse.html</guid>
		</item>
		<item>
			<title>Drawing a Rectangle</title>
			<link>http://www.java-forums.org/blogs/java-awt/1052-drawing-rectangle.html</link>
			<pubDate>Tue, 06 Mar 2012 18:51:17 GMT</pubDate>
			<description>RectangularShape class implements the shape interface, in which few more methods are added of its own. 
Such methods are used to find out certain...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">RectangularShape class implements the shape interface, in which few more methods are added of its own.<br />
Such methods are used to find out certain information regarding the size and location of shape so that to find out the rectangle’s center point and to set the shape’s bounds.<br />
<br />
Dimension w,x,h and location x,y defines a rectangle. These given methods specify rectangle in float or double precision.<br />
<br />
<ol class="decimal"><li style="">Rectangle2D.Double</li><li style="">Rectangle2D.Float</li></ol><br />
<br />
Creation of a rectangle is explained by this given code.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">// draw Rectangle2D.Double
g2.draw(new Rectangle2D.Double(x, y,
                               rectwidth,
                               rectheight));</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 Consider these parameters to specify rounded rectangles:<br />
<ul><li style="">Width</li><li style="">Location</li><li style="">Height</li><li style="">Height of the corner arc</li><li style="">Width of the corner arc</li></ul></blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1052-drawing-rectangle.html</guid>
		</item>
		<item>
			<title>Cubic Curve Segment</title>
			<link>http://www.java-forums.org/blogs/java-awt/1051-cubic-curve-segment.html</link>
			<pubDate>Tue, 06 Mar 2012 18:49:19 GMT</pubDate>
			<description>CubicCurve2D class used to implement the shape interface. In x,y coordinates space, cubic parametric curve segment is presented by this class. In...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">CubicCurve2D class used to implement the shape interface. In x,y coordinates space, cubic parametric curve segment is presented by this class. In float &amp; double precision, a cubic curve is specified by using these methods.<br />
<br />
<ul><li style="">CubicCurve2D.Double</li><li style="">CubicCurve2D.Float</li></ul><br />
<br />
Curve setting methods are same for the CubicCurve2D and QuadraticCurve class, except 2nd control point.E.g.<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">// create new CubicCurve2D.Double
CubicCurve2D c = new CubicCurve2D.Double();
// draw CubicCurve2D.Double with set coordinates
c.setCurve(x1, y1, ctrlx1,
           ctrly1, ctrlx2, ctrly2, x2, y2);
g2.draw(c);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1051-cubic-curve-segment.html</guid>
		</item>
		<item>
			<title>Quadratic Curve Segment</title>
			<link>http://www.java-forums.org/blogs/java-awt/1050-quadratic-curve-segment.html</link>
			<pubDate>Tue, 06 Mar 2012 18:48:00 GMT</pubDate>
			<description>QuadCurve2D class is used for the implementation of the Shape interface. In x,y coordinate segment, a quadratic parametric curve segment is represent...</description>
			<content:encoded><![CDATA[<blockquote class="blogcontent restore">QuadCurve2D class is used for the implementation of the Shape interface. In x,y coordinate segment, a quadratic parametric curve segment is represent by this given class. A quadratic class is specified by using these given subclasses, in float &amp; double precision.<br />
<br />
<ul><li style="">QuadCurve2D.Double</li><li style="">QuadCureve2D.Float</li></ul><br />
<br />
Curve’s control point &amp; 2D endpoints are specified by using many setCurve methods. To directly define the coordinates, use coordinates of other points and a given array.<br />
<br />
Quadratic curve is being set along with control point and same endpoints by using setCurve (QuadCurve2D).<br />
<br />
It can be explained by using this code:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Java Code: </div>

	<pre class="brush: java">// create new QuadCurve2D.Float
QuadCurve2D q = new QuadCurve2D.Float();
// draw QuadCurve2D.Float with set coordinates
q.setCurve(x1, y1, ctrlx, ctrly, x2, y2);
g2.draw(q);</pre>
	<script type="text/javascript">mh_sh_highlight_all('java');</script>

</div>
 </blockquote>

]]></content:encoded>
			<dc:creator>Java AWT</dc:creator>
			<guid isPermaLink="true">http://www.java-forums.org/blogs/java-awt/1050-quadratic-curve-segment.html</guid>
		</item>
	</channel>
</rss>
