Java 2D Graphics - Affine Transform to invert/flip y-axis

Friday, September 20, 2013

Nowadays I am working on a Java 2D Graphics related application, I faced a problem to invert y-axis for graphics drawing.

Default graphics coordinates as below.


Read more...

Navigate resources using Bookmarks in Eclipse










Read more...

Using JDOM API to create an XML document

Tuesday, April 2, 2013


As we know JDOM is a very useful library to provide a complete , java based solution for accessing, manipulating , and outputting XML data from java code.

The following example simply describes how to create an XML file by using JDOM library.

package com.app;
import java.io.FileWriter;
import java.io.IOException;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
public class JDOMXml { public static void main(String[] args) { Element note = new Element("note");
Document document = new Document();
document.setRootElement(note);
Element to = new Element("to"); to.setText("Unknown");
document.getRootElement().addContent(to);
Element from = new Element("from");
from.setText("Pradeep");
document.getRootElement().addContent(from);
Element heading = new Element("heading");
heading.setText("Heading");
document.getRootElement().addContent(heading);
Element message = new Element("message");
message.setText("Urgent message");
document.getRootElement().addContent(message);
XMLOutputter outputter = new XMLOutputter();
outputter.setFormat(Format.getPrettyFormat());
try {
outputter.output(document, new FileWriter("F:\\file.xml"));
System.out.println("Successfully create xml file.");
} catch (IOException e) {
System.out.println("Couldn't created xml file." + e.getMessage());
}
}
}

After running above programme it produces following outkput.


<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Unknown</to>
  <from>Pradeep</from>
  <heading>Heading</heading>
  <message>Urgent message</message>
</note>



Read more...

Read an XML document using JDOM API

to be continued...

Read more...

JDOM (Java-based document object model for XML)

Tuesday, March 19, 2013

More info about JDOM

Read more...

DOM API vs SAX API

XML processing with DOM and SAX API.

Read more...

StAX - Streaming API for XML

Monday, March 18, 2013

XML processing using StAX

Read more...

WindowBuilder for Java GUI applications

WindowBuilder more details click here

Read more...

The importance of Logging/Tracing in application development

Thursday, February 28, 2013

In software development logging is a very important aspect.

Read more...

Java Serialization with Protocol Buffers

Thursday, February 21, 2013

What are Protocol Buffer?
https://developers.google.com/protocol-buffers/

Read more...

  © Blogger template Writer's Blog by Ourblogtemplates.com 2008

Back to TOP