Gui xalan xml

I am trying to program a java swing gui with one button that will
transform old.xml to new.xml using transform.xsl using xalan
but the compiler gives an error message:
Transform2.java:53: unreported exception javax.xml.transform.TransformerException; must be caught or declared to be thrown
transformation("hamlet.xml","transformation1.xsl","hamletnew.xml"
anyone know the solution of this problem
this is the complete code:
//using apache xalan to transform old.xml with tranform.xsl into new.xml
//with java swing gui
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class Transform2
public static void main(String[] args)throws TransformerException, TransformerConfigurationException,FileNotFoundException, IOException
JFrame frame = new JFrame("Event Handling Tombol & TextField");
final JButton button = new JButton("Transform");
ActionListener eventclick =
new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == button) {
transformation("old.xml","transform.xsl","new.xml");
button.addActionListener(eventclick);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(button);
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
private static void transformation(String inputfile,String xslfile,String outputfile)throws TransformerException, TransformerConfigurationException,FileNotFoundException, IOException
// Use the static TransformerFactory.newInstance() method to instantiate
// a TransformerFactory. The javax.xml.transform.TransformerFactory
// system property setting determines the actual class to instantiate --
// org.apache.xalan.transformer.TransformerImpl.
TransformerFactory tFactory = TransformerFactory.newInstance();
// Use the TransformerFactory to instantiate a Transformer that will work with
// the stylesheet you specify. This method call also processes the stylesheet
// into a compiled Templates object.
Transformer transformer = tFactory.newTransformer(new StreamSource(xslfile));
// Use the Transformer to apply the associated Templates object to an XML document
// (foo.xml) and write the output to a file (foo.out).
transformer.transform(new StreamSource(inputfile), new StreamResult(new FileOutputStream(outputfile)));

Function
private static void transformation(String inputfile,String xslfile,String outputfile)throws TransformerException, TransformerConfigurationException,FileNotFoundException, IOExceptionStates that that function might throw an on of the exceptions mentioned.. to do this you have to have
try{
   //the code that this function should do...
catch(Exception e)
    // if doing previous stuff fails... this will be executed.
    // here do the throwing..
    throw new IOException (this);
}also the main function propably should not throw exceptions..
P_s

Similar Messages

  • GUI in XML

    I am interested in writing some Swing GUI's in XML, and i know there are a couple of programs/libraries that do this (such as UIML), but can you please recommend me some good one? Anybody has any experience with this?
    Thanks in advance,
    Victor.

    There's a few levels of this question I'm sure. You could write Swing GUIs in XML using the XMLEncoder/XMLDecoder framework to effectively write Swing code.
    Then again, you could write XUL, which wouldn't be tied to Swing, but you could use a Swing implementation of it.

  • Xalan XML thru Web Start - how to include other classes

    Hello developers,
    I have an JAVA Swing application which needs an xml output, it creates an XML file which has to be stored in the clients hard drive. Though i have finished it, the application runs perfectly in the swing, if i deploy it using Java Webstart, the classes are not found,
    The classes for xercers and xalan or not understood by webstart, how do i include these classes too. Could any1 throw some light on how to use other classes too in webstart applications.
    thanks,
    Prashant.

    Depends on the version of the JRE you are supporting. If you are using 1.4 you should be able to get it to work with the classes shipped with it.
    If you really want to use the Xerces parser you will have to include the following in your .jnlp file.
    <jar href="xerces.jar" download="eager"/>
    <property name="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
    This forces the runtime to use Xerces instead of a locally available XML parser.

  • Logging: GUI for XML output? (Like Chainsaw for Log4j)?

    There is a nice GUI tool to view XML formatted output from Log4J log files. Is there some similar tool for Java logging XML formatted output?

    Hi,
    <?for-each:ROW?>
    <?end for-each?><xsl:variable name="cnt" select="count(//row|//ROW)" />
    <?for-each:xdoxslt:foreach_number($_XDOCTX,1,15-count(ROW),1)?> <?end if?>
    this will create 15 lines irrespective of you have that much rows of data in xml or not
    if you want more help , drop me mail @ [email protected]

  • Developing swing GUI using XML

    hi
    I must develop a GUI using swing by parsing XML documents.How to render the swing objects at run time, after parsing the XML document.I must know the process of creating the swing containers,components from XML document. Some open sources are available for the purpose but i must create a framework for our own purpose, so must know the process involved.
    kindly provide me any links or tutorial for the same.
    with Regards,
    A.Rajesh

    hey thanks for the help...i saw these tools but my problem will not be solved by these as the diagram i need to generate from XML is a class diagram. The components of class diagram cannot be made using swings...eg arrow,rectangle,aggregation symbol etc....

  • Creating a dynamic GUI with XMl

    Hey folks, i might have posted this already but i cant find it, so posting it again!!! I have an XML snippet that looks like this
    <button id=Add action=AddAction />
    Essentially what that does when parsed is creates a button and we load the AddAction using reflection and attach that as the actionlistenr for that button!! Now my problem is this, what if that the AddAction takes a parameter of say a Jtree, using reflection it tells me what parameters it takes but it doesnt tell me, "ok yep we pass in myTree as an argument into the construction of AddAction". Now im just looking for ideas for a solution to do this, how do i dynamically pass in references to objects i want to realize???
    Sorry if this appears twice but like i said i cant see it posted, any ideas or suggestions would be gratefull!!
    cheers,
    LL

    Also if any one has any thoughts on creating a front end using XML files, pros cons etc??? Just prototyping and wondering should i do down this road!!

  • Build GUI using XML

    Hi,
    I am interested in learning more about building a UI using XML...any suggestions? I have looked at SwiXml ....just looking for more. If you have used one/or more of them before, let me know what your opinions are to.
    Thanks!

    I know there are several of these things out there. The one I've tried was Thinlets. It looks good and is very lightweight. It's easy to get something running quickly, but you'll eventually run into limitations since the components are by far not as rich and flexible as swing. I still think it's great for what it does.
    If you're going to do a google search, I think one of the key words to use is XUL.

  • How to parse XML against XSD,DTD, etc.. locally (no internet connection) ?

    i've searched on how to parse xml against xsd,dtd,etc.. without the needs of internet connection..
    but unfortunately, only the xsd file can be set locally and still there needs the internet connection for the other features, properties.
    XML: GML file input from gui
    XSD: input from gui
    javax.xml
    package demo;
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.xml.XMLConstants;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    import org.xml.sax.SAXException;
    public class Sample1WithJavaxXML {
         public static void main(String[] args) {
              URL schemaFile = null;
              try {
                   //schemaFile = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
                   File file0 = new File("AppSchema-C01-v1_0.xsd");
                   schemaFile = new URL(file0.toURI().toString());
              } catch (MalformedURLException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              //Source xmlFile = new StreamSource(new File("web.xml"));
              Source xmlFile = new StreamSource(new File("C01.xml"));
              SchemaFactory schemaFactory = SchemaFactory
                  .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
              //File file1 = new File("XMLSchema.dtd");
              //SchemaFactory schemaFactory = SchemaFactory
                   //.newInstance("javax.xml.validation.SchemaFactory:XMLSchema.dtd");
              Schema schema = null;
              try {
                   schema = schemaFactory.newSchema(schemaFile);
              } catch (SAXException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              Validator validator = schema.newValidator();
              try {
                validator.validate(xmlFile);
                System.out.println(xmlFile.getSystemId() + " is valid");
              } catch (SAXException e) {
                System.out.println(xmlFile.getSystemId() + " is NOT valid");
                System.out.println("Reason: " + e.getLocalizedMessage());
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Xerces
    package demo;
    import java.io.File;
    import java.util.Date;
    import org.apache.xerces.parsers.DOMParser;
    public class SchemaTest {
         private String xmlFile = "";
         private String xsdFile = "";
         public SchemaTest(String xmlFile, String xsdFile) {
              this.xmlFile = xmlFile;
              this.xsdFile = xsdFile;
         public static void main (String args[]) {
              File file0 = new File("AppSchema-C01-v1_0.xsd");
              String xsd = file0.toURI().toString();
              SchemaTest testXml = new SchemaTest("C01.xml",xsd);
              testXml.process();
         public void process() {
              File docFile = new File(xmlFile);
              DOMParser parser = new DOMParser();
              try {
                   parser.setFeature("http://xml.org/sax/features/validation", true);
                   parser.setFeature("http://apache.org/xml/features/validation/schema", true);
                   parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                             xsdFile);
                   ErrorChecker errors = new ErrorChecker();
                   parser.setErrorHandler(errors);
                   System.out.println(new Date().toString() + " START");
                   parser.parse(docFile.toString());
              } catch (Exception e) {
                   System.out.print("Problem parsing the file.");
                   System.out.println("Error: " + e);
                   System.out.println(new Date().toString() + " ERROR");
                   return;
              System.out.println(new Date().toString() + " END");
    }

    Thanks a lot Sir DrClap..
    I tried to use and implement the org.w3c.dom.ls.LSResourceResolver Interface which is based on the SAX2 EntityResolver.
    please give comments the way I implement it. Here's the code:
    LSResourceResolver Implementation
    import org.w3c.dom.ls.LSInput;
    import org.w3c.dom.ls.LSResourceResolver;
    import abc.xml.XsdConstant.Path.DTD;
    import abc.xml.XsdConstant.Path.XSD;
    public class LSResourceResolverImpl implements LSResourceResolver {
         public LSResourceResolverImpl() {
          * {@inheritDoc}
         @Override
         public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
              ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
              LSInput input = new LSInputImpl(publicId, systemId, baseURI);
              if ("http://www.w3.org/2001/xml.xsd".equals(systemId)) {
                   input.setByteStream(classLoader.getResourceAsStream(XSD.XML));
              } else if (XsdConstant.PUBLIC_ID_XMLSCHEMA.equals(publicId)) {
                   input.setByteStream(classLoader.getResourceAsStream(DTD.XML_SCHEMA));
              } else if (XsdConstant.PUBLIC_ID_DATATYPES.equals(publicId)) {
                   input.setByteStream(classLoader.getResourceAsStream(DTD.DATATYPES));
              return input;
    }I also implement org.w3c.dom.ls.LSInput
    import java.io.InputStream;
    import java.io.Reader;
    import org.w3c.dom.ls.LSInput;
    public class LSInputImpl implements LSInput {
         private String publicId;
         private String systemId;
         private String baseURI;
         private InputStream byteStream;
         private String stringData;
         public LSInputImpl(String publicId, String systemId, String baseURI) {
              super();
              this.publicId = publicId;
              this.systemId = systemId;
              this.baseURI = baseURI;
         //getters & setters
    }Then, here's the usage/application:
    I create XMLChecker class (SchemaFactory implementation is Xerces)
    import java.io.File;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.xml.XMLConstants;
    import javax.xml.stream.FactoryConfigurationError;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import abc.xml.XsdConstant.Path.XSD;
    public class XMLChecker {
         private ErrorMessage errorMessage = new ErrorMessage();
         public boolean validate(String filePath){
              final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
              List<Source> schemas = new ArrayList<Source>();
              schemas.add(new StreamSource(classLoader.getResourceAsStream(XSD.XML_SCHEMA)));
              schemas.add(new StreamSource(classLoader.getResourceAsStream(XSD.XLINKS)));
              schemas.add(new StreamSource(classLoader.getResourceAsStream("abc/xml/AppSchema.xsd")));
              SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
              schemaFactory.setResourceResolver(new LSResourceResolverImpl());
              try {
                   Schema schema = schemaFactory.newSchema(schemas.toArray(new Source[schemas.size()]));
                   Validator validator = schema.newValidator();
                   validator.setErrorHandler(new ErrorHandler() {
                        @Override
                        public void error(SAXParseException e) throws SAXException {
                             errorMessage.setErrorMessage(e.getMessage());
                             errorMessage.setLineNumber(e.getLineNumber());
                             errorMessage.setColumnNumber(e.getLineNumber());
                             throw e;
                        @Override
                        public void fatalError(SAXParseException e) throws SAXException {
                             errorMessage.setErrorMessage(e.getMessage());
                             errorMessage.setLineNumber(e.getLineNumber());
                             errorMessage.setColumnNumber(e.getLineNumber());
                             throw e;
                        @Override
                        public void warning(SAXParseException e) throws SAXException {
                             errorMessage.setErrorMessage(e.getMessage());
                             errorMessage.setLineNumber(e.getLineNumber());
                             errorMessage.setColumnNumber(e.getLineNumber());
                             throw e;
                   StreamSource source = new StreamSource(new File(filePath));
                   validator.validate(source);
              } catch (SAXParseException e) {
                   return false;
              } catch (SAXException e) {
                   errorMessage.setErrorMessage(e.getMessage());
                   return false;
              } catch (FactoryConfigurationError e) {
                   errorMessage.setErrorMessage(e.getMessage());
                   return false;
              } catch (IOException e) {
                   errorMessage.setErrorMessage(e.getMessage());
                   return false;
              return true;
         public ErrorMessage getErrorMessage() {
              return errorMessage;
    }Edited by: erossy on Aug 31, 2010 1:56 AM

  • Help!xml can't transform property

    I want to transform xml using xslt and I download jakarta's xalan.But I find it seems has some problem.So I write a class to test the xalan package.My code is:
    /////////////////////////////////Test30.java///////////////////////////////////////
    import org.apache.xalan.xslt.XSLTProcessor;
    import org.apache.xalan.xslt.XSLTResultTarget;
    import org.apache.xalan.xslt.XSLTInputSource;
    import org.apache.xalan.xslt.XSLTProcessorFactory;
    //import com.lotus.xsl.*;
    import org.xml.sax.SAXException;
    import java.io.*;
    import org.xml.sax.*;
    10 public class Test30
    11 {
    12     public static void main(String[] args)
    13     {
    14          try
    15          {
    16          XSLTInputSource inputXML = new XSLTInputSource("trying1.xml");
    17          XSLTInputSource inputXSL = new XSLTInputSource("trying.xsl");
    18          XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    19          processor.process(inputXML, inputXSL, new XSLTResultTarget(System.out));
    20          }catch(Exception e)
    21          {
    22               System.out.println(e);
    23          }
    It is compiled successfully.But the console report error when I execute it.It report:"Exception in thread "main" java.lang.NoSuchFieldError: m_elemStack
    at org.apache.xalan.stree.StreeDOMBuilder.startElement(StreeDOMBuilder.j
    ava:221)
    at org.apache.xalan.stree.SourceTreeHandler.startElement(SourceTreeHandl
    er.java:525)
    at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1488)
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
    at org.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngin
    eImpl.java:744)
    at org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:332)
    at Test30.main(Test30.java:19)"
    I test it in servlet and the problem is the same as this.
    I don't know why this happen and I debug it all day.I can't find any error today.
    Anyone can help me? :(

    I used this example and it works fine for me :
    public static void transformXML(String xml, String xsl, OutputStream oStream)throws Exception {
    TransformerFactory tFactory = TransformerFactory.newInstance();
    if(tFactory.getFeature(DOMSource.FEATURE) && tFactory.getFeature(DOMResult.FEATURE)) {
    //Instantiate a DocumentBuilderFactory.
    DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
    // And setNamespaceAware, which is required when parsing xsl files
    dFactory.setNamespaceAware(true);
    //Use the DocumentBuilderFactory to create a DocumentBuilder.
    DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
    //Use the DocumentBuilder to parse the XSL stylesheet.
    Document xslDoc = dBuilder.parse(xsl);
    // Use the DOM Document to define a DOMSource object.
    DOMSource xslDomSource = new DOMSource(xslDoc);
    // Set the systemId: note this is actually a URL, not a local filename
    xslDomSource.setSystemId(xsl);
    // Process the stylesheet DOMSource and generate a Transformer.
    Transformer transformer = tFactory.newTransformer(xslDomSource);
    //Use the DocumentBuilder to parse the XML input.
    Document xmlDoc = dBuilder.parse(xml);
    // Use the DOM Document to define a DOMSource object.
    DOMSource xmlDomSource = new DOMSource(xmlDoc);
    // Set the base URI for the DOMSource so any relative URIs it contains can
    // be resolved.
    xmlDomSource.setSystemId(xml);
    // Create an empty DOMResult for the Result.
    DOMResult domResult = new DOMResult();
    // Perform the transformation, placing the output in the DOMResult.
    transformer.transform(xmlDomSource, domResult);
    //Instantiate an Xalan XML serializer and use it to serialize the output DOM to System.out
    // using a default output format.
    Serializer serializer = SerializerFactory.getSerializer(OutputProperties.getDefaultMethodProperties("xml"));
    serializer.setOutputStream(oStream);
    serializer.asDOMSerializer().serialize(domResult.getNode());
    } else {
    throw new org.xml.sax.SAXNotSupportedException("DOM node processing not supported!");
    }

  • JRockit 1.5.0_06-b05 incorrect running xalan (1.3 bytecode)

    Hi,
    JRockit seems to be broken running 1.3 bytecode from Xalan (either 2.6 or 2.7). Doing the same transformation in a loop will after some time start producing different (and incorrect) results.
    Recompiling xalan (2.7) with a higher version jdk seems to solve this problem. Also, switching to a Sun VM solves the problem.
    I noticed an old jrockit issue solved for 1.4.2: "CR229176
    A rare error when using apache-xalan xml/xslt transforms is fixed. Xalan uses the swap bytecode (seldom used by javac) which triggered bad behavior within BEA JRockit."
    Although it might be similar I suppose it should also be fixed in the jrockit 1.5 version
    I have derived a test case that demonstrates the problem.
    Is there any place where these details are best sent to?
    Version used:
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
    EA JRockit(R) (build R26.4.0-63-63688-1.5.0_06-20060626-2259-win-ia32, )
    Thanks

    Thanks for the reproducer. It appears that JRockit has a bug when optimizing the following method:
    org/apache/xpath/axes/LocPathIterator.execute(Lorg/apac
    he/xpath/XPathContext;)Lorg/apache/xpath/objects/XObject;
    Running with -Xnoopt will avoid the issue (at a performance loss).
    It is not reproducible with the upcoming JRockit R27.1, so it looks like it has been fixed. If you have a support contract and need a patch for R26.4, contact BEA Support referring to this forum thread and ask for a fix for CR295469.

  • QUICK XML BASIC QUESTION

    I have a program that has a hierarchical type of data that it stores. I want to make the data captured avaliable through a web page. I was going to use JDBC-ODBC driver and access then asp at the web server. Can I use XML instead for this purpose? It would seem more platform independant.
    Then xml file will be simple. What is the simplest way to create an XML file. I really dont want to have to download more class files so does jdk1.3,1 and above incolude the xml stuff that I will need. If not were should I look.
    Any help is much appreciated, I am sorry that I have no dukes to offer!

    Jimmy,
    You need to XML writing logic to put the data from you web GUI to XML file and tranfer the same across the network using JMS (thru jndi) or mqseries through queues . And you need XML parser to map your data to your data objects.
    Hope this helps.
    Dukkar Lee

  • Simple XML advice required

    Since I have never done XML before and while I am enjoying my Uni holidays, I thought I'd give my self a challenge.
    Is it possible to create a GUI to connect to a specific site, (my university website and access all the Information using GUI just as if I was using the website, except that all the relevant information and headlings are stored in specific TextFields and Panels?
    If it is then do I have to have access to the websites servers to modify it with my GUI XML.
    The University website has a student facility, and ofcourse has a Login screen and from there on the user can view his marks, unit material etc.
    Could some one please advice me with a helpful tutorial site so that I could try and incorporate it in my GUI application.
    Thank you

    XML is just a format for data. It isn't a language and it doesn't do anything. It isn't magic pixie dust either.
    You could store the configuration of your GUI in XML if you liked, or you could store it as serialized Java objects or as some other text format. But that has nothing to do with connecting to websites.
    You generally use a URLConnection object to connect to a website. But that has nothing to do with XML.

  • Change CSV to Excel in the Receiver Comm Channel

    Is there a way to insert custom code to change the FCC comma delimited (.csv) into an Excel file in the receiver communication channel file adapter? If so, how do I do this in XI? Thanks.

    Kristine Tiongson wrote:
    > GUI Mapping -> Adapter Module 1 that converts XML to CSV -> Adapter Module 2 that converts CSV to Excel -> File Adapter (FTP)
    >
    > Questions:
    > 1. Is there a standard SAP XI adapter module that can do Module 1?
    > 2. Is there a standard SAP XI adapter module that can do Module 2? 
    >
    > Please give me more information about the modules because I haven't used them before. Thank you for all your help!
    >
    > Kristine
    You flow should ideally be
    GUI Mapping (XML) -> Adapter Module -> File adapter
    Note modules are extensions to file adapter.
    Ref:
    How to create modules -
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a
    XI JAVA User Module Development using NWDI -
    /people/community.user/blog/2007/12/21/xi-java-user-module-development-using-nwdi

  • Set fields of derived class in base class constructor via reflection?

    Does the Java Language Specification explicitly allow setting of fields of a derived class from within the base class' constructor via reflection? The following test case runs green, but I would really like to know if this Java code is compatible among different VM implementations.
    Many thanks for your feedback!
    Norman
    public class DerivedClassReflectionWorksInBaseClassConstructorTest extends TestCase {
    abstract static class A {
        A() {
            try {
                getClass().getDeclaredField("x").setInt(this, 42);
            } catch (Exception e) {
                throw new RuntimeException(e);
    static class B extends A {
        int x;
        B() {
        B(int x) {
            this.x = x;
    public void testThatItWorks() {
        assertEquals(42, new B().x);
        assertEquals(99, new B(99).x);
    }

    why not just put a method in the superclass that the subclasses can call to initialize the subclass member variable?In derived classes (which are plug-ins), clients can use a field annotation which provides some parameter metadata such as validators and the default value. The framework must set the default value of fields, before the class' initializer or constructors are called. If the framework would do this after derived class' initializer or constructors are called, they would be overwritten:
    Framework:
    public abstract class Operator {
        public abstract void initialize();
    }Plug-In:
    public class SomeOperator extends Operator {
        @Parameter(defaultValue="42", interval="[0,100)")
        double threshold;
        @Parameter(defaultValue="C", valueSet="A,B,C")
        String mode;
        public void setThreshold(double threshold) {this.threshold = threshold;}
        public void setMode(String mode) {this.mode = mode;}
        // called by the framework after default values have been set
        public void initialize() {
    }On the other hand, the default values and other metadata are also used to create GUIs and XML I/O for the derived operator class, without having it instantiated. So we cannot use the initial instance field values for that, because we don't have an instance.

  • Can anyone tell me why javaFX better than applet?

    I just have read the example of javaFX.And I have a question.
    From the example.I don't see any good in javaFX.below is my opinion:
    1.It seems like that the javaFX application is deploy as a applet or jnlp.This is what swing can also do;
    2.javaFX's expression is sucks.Why don't use xml to declare the UI? I think as the application becomes larger,it is so difficult to maintain the project.But if I use swing or applet,I think it is better for me to maintain the project using oop.
    3.I think what javaFX can do is also can be done by swing,why javaFX?
    any apply is appreciated,thanks very much

    Hi
    1. JavaFx it is build over the Java2D and Swing. In fact it can not run without this 2 component ( at least now ). So what you can do in JavaFX you can also do on Swing and Java2D
    2. I don't think xml syntax it is good to describe stuff like this . XML was design to store data not actions. When you design user interface you must declare what components or shape do you want to draw on the screen but also you must write the interaction between them . I don't think you can do this easy and nice in XML. Look at the Flex approach . They used for declaration of the GUI an XML and for comportment ActionScript. I don't like this because i must learn and study two "languages" to make a GUI.I've preferred one language.As you said it is better to use OOP . How can you do OOP in XML in a nice way ?
    3. Because in JavaFX we do can more things easily . Look at this example : [http://silveiraneto.net/2008/07/31/javafx-creating-a-sphere-with-shadow/] . I don't think you can achieve the same results with Swing and Java2D with the same code line number.
    Another difference between JavaFX and Swing is the syntax. The Sun want to create a language that can be used by designer and by programmer . The Swing can not be used by a designer . JavaFX used a more natural syntax. For example if you want to insert a shape in an array you must type in JavaFX :
    insert Circle{radius:10} into array_variable . As you see it is more natural this syntax than Java equivalent.
    Another difference it is how easy you can do things in JavaFX correctly . When you program in Java2D and Swing you must know very good the architecture of this components if you want to work correctly . You must know what is the Event Dispatch Thread and how you can used it . You must how you can work with multiple threads in Java2D and Swing . In JavaFX you don't need this . All of the tricks it is done by JavaFX ( not in this release . I hope the final release it will contains all these tricks) .
    Best regards
    Andrei Dore

Maybe you are looking for

  • Tutorials for using the UI element  "Network" in webdynpro.

    Hello,   Where can I find tutorials or illustrations of using the Active component/UI element "Network" in webdynpro. Regards, Anupama.

  • Networking Linksys, iMac, Macbook and Belkin

    I live in an old stone house and have two routers: one for each side of the house so I can move around with my laptop since the walls are too thick. The Linksys (WRT300N) is in the basement where the DSL comes in and connects directly to it. The macb

  • Lumia cyan for 620

    When is Lumia cyan software update is going to roll out?

  • Premiere Elements file type for Elements Organiser

    I use PSE13 organiser ( for pictures and movies) and editor. I recently purchased Premiere Elements 13 and have just edited my first movie. I would like to only access Premiere Elements via the Photoshop Elements organiser, but I am unsure what file

  • How to Print Goods receipt Document

    Hi All, I ahve to make changes in Goods receipt Document. I am having the folling details with me . Program Name : - SAPM07DR Form Routine : - ENTRY_WE02 FORM : ZWESCHEINVERS2. When i take print out for Goods receipt Document using transaction MB02 i