Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * PackJacket - GUI frontend to IzPack to make Java-based installers
 * Copyright (C) 2008 - 2009  Amandeep Grewal, Manodasan Wignarajah
 *
 * PackJacket is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PackJacket is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PackJacket.  If not, see <http://www.gnu.org/licenses/>.
 */

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Main {
    /**
     * Gets the arg element
     * @param text the text content
     * @param xml the Document to use to create the element
     * @return the arg element
     */
    public static Element getArg(String text, Document xml, boolean value) {
        Element arg = xml.createElement("arg");
        if (value)
            arg.setAttribute("value", text);
        else
            arg.setTextContent(text);
        return arg;
    }

    /**
     * Creates and returns an element with the specified tag and text content
     * @param tag the tag of the element
     * @param textContent the text content of the element
     * @param xml the Document to use to create the element
     * @return The element with the specified tag and text content
     */
    public static Element createElement(String tag, String textContent, Document xml) {
        Element element = xml.createElement(tag);
        //Sets the text content of the element
        element.setTextContent(textContent);
        return element;
    }
}