Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /openetl/src/org/tigris/openetl/ui/constants/, /openetl/src/org/tigris/openetl/ui/

openetl
Discussion topic

Back to topic list

CVS update: /openetl/src/org/tigris/openetl/ui/constants/, /openetl/src/org/tigris/openetl/ui/

Reply

Author ernani_joppert
Full name Ernani Joppert Pontes Martins
Date 2004-07-23 16:04:34 PDT
Message User: ernani_joppert
Date: 04/07/23 16:04:34

Added:
 /openetl/src/org/tig​ris/openetl/ui/const​ants/
  Application.java
 /openetl/src/org/tig​ris/openetl/ui/
  MenuBar.java, InternalFrame.java, MainFrame.java, OpenETLMdi.java

Log:
 First Ui definitions.

File Changes:

Directory: /openetl/src/org/tig​ris/openetl/ui/const​ants/
====================​====================​================

File [added]: Application.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/consta​nts/Application.java​?rev=1.1&content​-type=text/vnd.viewc​vs-markup
Added lines: 20
---------------
/*
 * Created on 23/07/2004
 */
package org.tigris.openetl.u​i.constants;

/**
 * @author Ernani Joppert Pontes Martins
 */
public interface Application {

    /**
     * The blank space difference from screen sixe
     */
    static int borderSize = 50;

    /**
     * The main title constant string.
     */
    static String MAIN_TITLE = "Application Main Title";
}

Directory: /openetl/src/org/tig​ris/openetl/ui/
====================​====================​======

File [added]: MenuBar.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/MenuBa​r.java?rev=1.1&c​ontent-type=text/vnd​.viewcvs-markup
Added lines: 45
---------------
/*
 * Created on 23/07/2004
 */
package org.tigris.openetl.ui;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

/**
 * @author Ernani Joppert Pontes Martins
 */
public class MenuBar extends JMenuBar {

    public MenuBar(MainFrame frame) {

        // Set up the lone menu.
        JMenu menu = new JMenu("Document");
        menu.setMnemonic(Key​Event.VK_D);
        this.add(menu);

        // Set up the first menu item.
        JMenuItem menuItem = new JMenuItem("New");
        menuItem.setMnemonic​(KeyEvent.VK_N);
        menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_N​,
                ActionEvent.ALT_MASK));
        menuItem.setActionCo​mmand("new");
        menuItem.addActionLi​stener(frame);
        menu.add(menuItem);

        // Set up the second menu item.
        menuItem = new JMenuItem("Quit");
        menuItem.setMnemonic​(KeyEvent.VK_Q);
        menuItem.setAccelera​tor(KeyStroke.getKey​Stroke(KeyEvent.VK_Q​,
                ActionEvent.ALT_MASK));
        menuItem.setActionCo​mmand("quit");
        menuItem.addActionLi​stener(frame);
        menu.add(menuItem);

    }
}

File [added]: InternalFrame.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/Intern​alFrame.java?rev=1.1​&content-type=te​xt/vnd.viewcvs-marku​p
Added lines: 37
---------------
/*
 * Created on 23/07/2004
 */
package org.tigris.openetl.ui;

import javax.swing.JInternalFrame;

/**
 * @author Ernani Joppert Pontes Martins
 */
public class InternalFrame extends JInternalFrame {

    static int openFrameCount = 0;

    static final int xOffset = 30, yOffset = 30;

    /**
     * Default constructor
     */
    public InternalFrame() {

        super("Document #" + (++openFrameCount), true, //resizable
                true, //closable
                true, //maximizable
                true);//iconifiable

        //...Create the GUI and put it in the window...

        //...Then set the window size or call pack...
        setSize(300, 300);

        //Set the window's location.
        setLocation(xOffset * openFrameCount, yOffset * openFrameCount);

        this.setVisible(true);
    }
}

File [added]: MainFrame.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/MainFr​ame.java?rev=1.1​&content-type=text/v​nd.viewcvs-markup
Added lines: 109
----------------
/*
 * Created on 23/07/2004
 */
package org.tigris.openetl.ui;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import org.tigris.openetl.u​i.constants.Applicat​ion;

/**
 * @author Ernani Joppert Pontes Martins
 */
public class MainFrame extends JFrame implements ActionListener {

    /**
     * The mdiForm desktop pane instance.
     */
    private OpenETLMdi mdiForm = new OpenETLMdi();

    /**
     * The border gap definition.
     */
    private int inSet = 50;

    /**
     * The screen dimension instance.
     */
    Dimension screenSize = Toolkit.getDefaultTo​olkit().getScreenSiz​e();

    public MainFrame() {

        super(Application.MAIN_TITLE);

        this.setBounds(inSet, inSet, screenSize.width - inSet * 2,
                screenSize.height - inSet * 2);
        this.createInternalFrame();
        this.setContentPane(mdiForm);
        this.setJMenuBar(new MenuBar(this));

    }

    /*
     * (non-Javadoc)
     *
     * @see java.awt.event.Actio​nListener#actionPerf​ormed(java.awt.event​.ActionEvent)
     */
    public void actionPerformed(ActionEvent e) {
        if ("new".equals(e.getA​ctionCommand())) { //new
            createInternalFrame();
        } else {
            quit();
        }
    }

    /**
     * Create a new internal frame on the mdi form.
     */
    protected void createInternalFrame() {
        InternalFrame childForm = new InternalFrame();
        mdiForm.add(childForm);
    }

    /**
     * Quit the application
     */
    protected void quit() {
        System.exit(0);
    }

    /**
     * Create the GUI and show it. For thread safety, this method should be
     * invoked from the event-dispatching thread.
     */
    private static void createAndShowGUI() {

        // Make sure we have nice window decorations.
        JFrame.setDefaultLoo​kAndFeelDecorated(tr​ue);

        // Create and set up the window.
        MainFrame frame = new MainFrame();

        // Set default close operation.
        frame.setDefaultClos​eOperation(JFrame.EX​IT_ON_CLOSE);

        // Display the window.
        frame.setVisible(true);
    }

    /**
     * Main method.
     *
     * @param args
     */
    public static void main(String[] args) {

        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                MainFrame.createAndShowGUI();
            }
        });
    }
}

File [added]: OpenETLMdi.java
Url: http://openetl.tigri​s.org/source/browse/​openetl/src/org/tigr​is/openetl/ui/OpenET​LMdi.java?rev=1.1​&content-type=text/​vnd.viewcvs-markup
Added lines: 19
---------------
/*
 * Created on 23/07/2004
 */
package org.tigris.openetl.ui;

import javax.swing.JDesktopPane;

/**
 * @author Ernani Joppert Pontes Martins
 */
public class OpenETLMdi extends JDesktopPane {

    /**
     * Default Constructor.
     */
    public OpenETLMdi() {
        this.setDragMode(Ope​nETLMdi.OUTLINE_DRAG​_MODE);
    }
}




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@open​etl.tigris.org
For additional commands, e-mail: cvs-help at openetl dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /openetl/src/org/tigris/openetl/ui/constants/, /openetl/src/org/tigris/openetl/ui/ ernani_joppert Ernani Joppert Pontes Martins 2004-07-23 16:04:34 PDT
Messages per page: