Results 1 to 9 of 9
  1. #1
    Feriscool is offline Member
    Join Date
    Nov 2010
    Posts
    28
    Rep Power
    0

    Exclamation Turn JFormDesigner GUI Into Use-Able Program

    I used JFormDesigner to create a GUI, and now I need to find out how I can export it so that it's a use-able program with just one click. Here's the code (not sure if you'll need it):

    Java Code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    /*
     * Created by JFormDesigner on Wed Jun 15 20:34:16 EDT 2011
     */
    
    
    public class NPCSpawn extends JFrame {
        	public NPCSpawn() {
        		initComponents();
        	}
    
        	private void button1ActionPerformed(ActionEvent e) { //Generate
        		String tf1 = textField1.getText();
        		String tf2 = textField2.getText();
        		String tf3 = textField3.getText();
        		String tf4 = textField4.getText();
        		String tf5 = textField5.getText();
        		String tf6 = textField6.getText();
        		String tf7 = textField7.getText();
        		String tf8 = textField8.getText();
        		String tf9 = textField9.getText();
        		String tf10 = textField10.getText();
        		String tf11 = textField11.getText();
        		String tf12 = textField12.getText();
        		
        		textArea1.setText("<npcSpawn>" + " <!--" + tf2 + "-->" + "\n\t<npcId>" + tf1 + "</npcId>" + "\n\t<walkingType>" + tf3 + "</walkingType>" + "\n\t<spawnLocation>" + "\n\t\t<x>" + tf4 + "</x>" + "\n\t\t<y>" + tf5 + "</y>" + "\n\t\t<z>" + tf6 + "</z>" + "\n\t</spawnLocation>" + "\n\t<minLocation>" + "\n\t\t<x>" + tf7 + "</x>" + "\n\t\t<y>" + tf8 + "</y>" + "\n\t\t<z>" + tf9 + "</z>\n\t</minLocation>" + "\n\t<maxLocation>" + "\n\t\t<x>" + tf10 + "</x>" + "\n\t\t<y>" + tf11 + "</y>" + "\n\t\t<z>" + tf12 + "</z>" + "\n\t</maxLocation>" + "\n</npcSpawn>");
        	}
    
        	private void button2ActionPerformed(ActionEvent e) { //Reset
        		textField1.setText("");
        		textField2.setText("");
        		textField3.setText("");
        		textField4.setText("");
        		textField5.setText("");
        		textField6.setText("");
        		textField7.setText("");
        		textField8.setText("");
        		textField9.setText("");
        		textField10.setText("");
        		textField11.setText("");
        		textField12.setText("");
        	}
    
        	private void button3ActionPerformed(ActionEvent e) { //Add to XML
    
        	}
    
        	private void initComponents() {
        		// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        		menuBar1 = new JMenuBar();
        		menu2 = new JMenu();
        		menuItem1 = new JMenuItem();
        		scrollPane1 = new JScrollPane();
        		textArea1 = new JTextArea();
        		textField4 = new JTextField();
        		label1 = new JLabel();
        		textField1 = new JTextField();
        		textField7 = new JTextField();
        		textField8 = new JTextField();
        		textField12 = new JTextField();
        		textField9 = new JTextField();
        		textField5 = new JTextField();
        		textField6 = new JTextField();
        		textField10 = new JTextField();
        		textField11 = new JTextField();
        		textField2 = new JTextField();
        		label2 = new JLabel();
        		label3 = new JLabel();
        		textField3 = new JTextField();
        		label4 = new JLabel();
        		label5 = new JLabel();
        		label6 = new JLabel();
        		label7 = new JLabel();
        		label8 = new JLabel();
        		label9 = new JLabel();
        		label10 = new JLabel();
        		label11 = new JLabel();
        		label12 = new JLabel();
        		label13 = new JLabel();
        		button1 = new JButton();
        		button2 = new JButton();
        		button3 = new JButton();
    
        		//======== this ========
        		setTitle("GUI");
        		Container contentPane = getContentPane();
        		contentPane.setLayout(null);
    
        		//======== menuBar1 ========
        		{
    
        			//======== menu2 ========
        			{
        				menu2.setText("Editors");
    
        				//---- menuItem1 ----
        				menuItem1.setText("NPCSpawner");
        				menuItem1.setIcon(new ImageIcon("C:\\Users\\Patrick\\Desktop\\JFormDesigner\\monster.png"));
        				menu2.add(menuItem1);
        			}
        			menuBar1.add(menu2);
        		}
        		setJMenuBar(menuBar1);
    
        		//======== scrollPane1 ========
        		{
    
        			//---- textArea1 ----
        			textArea1.setToolTipText("The output of the code");
        			textArea1.setEditable(false);
        			scrollPane1.setViewportView(textArea1);
        		}
        		contentPane.add(scrollPane1);
        		scrollPane1.setBounds(10, 140, 560, 225);
    
        		//---- textField4 ----
        		textField4.setToolTipText("The X coordinate of the NPC's spawn");
        		contentPane.add(textField4);
        		textField4.setBounds(295, 25, 80, 20);
    
        		//---- label1 ----
        		label1.setText("Output");
        		contentPane.add(label1);
        		label1.setBounds(10, 120, 65, 20);
    
        		//---- textField1 ----
        		textField1.setToolTipText("ID of the NPC");
        		contentPane.add(textField1);
        		textField1.setBounds(10, 25, 80, 20);
    
        		//---- textField7 ----
        		textField7.setToolTipText("The minimum X coordinate of the NPC's spawn");
        		contentPane.add(textField7);
        		textField7.setBounds(10, 70, 80, 20);
    
        		//---- textField8 ----
        		textField8.setToolTipText("The minimum Y coordinate of the NPC's spawn");
        		contentPane.add(textField8);
        		textField8.setBounds(105, 70, 80, 20);
    
        		//---- textField12 ----
        		textField12.setToolTipText("The maximum Z coordinate of the NPC's spawn");
        		contentPane.add(textField12);
        		textField12.setBounds(485, 70, 80, 20);
    
        		//---- textField9 ----
        		textField9.setToolTipText("The minimum Z coordinate of the NPC's spawn");
        		contentPane.add(textField9);
        		textField9.setBounds(200, 70, 80, 20);
    
        		//---- textField5 ----
        		textField5.setToolTipText("The Y coordinate of the NPC's spawn");
        		contentPane.add(textField5);
        		textField5.setBounds(390, 25, 80, 20);
    
        		//---- textField6 ----
        		textField6.setToolTipText("The Z coordinate of the NPC's spawn");
        		contentPane.add(textField6);
        		textField6.setBounds(485, 25, 80, 20);
    
        		//---- textField10 ----
        		textField10.setToolTipText("The maximum X coordinate of the NPC's spawn");
        		contentPane.add(textField10);
        		textField10.setBounds(295, 70, 80, 20);
    
        		//---- textField11 ----
        		textField11.setToolTipText("The maximum Y coordinate of the NPC's spawn");
        		contentPane.add(textField11);
        		textField11.setBounds(390, 70, 80, 20);
    
        		//---- textField2 ----
        		textField2.setToolTipText("Name of the NPC");
        		contentPane.add(textField2);
        		textField2.setBounds(105, 25, 80, 20);
    
        		//---- label2 ----
        		label2.setText("ID");
        		contentPane.add(label2);
        		label2.setBounds(45, 10, 15, 15);
    
        		//---- label3 ----
        		label3.setText("Name");
        		contentPane.add(label3);
        		label3.setBounds(new Rectangle(new Point(130, 10), label3.getPreferredSize()));
    
        		//---- textField3 ----
        		textField3.setToolTipText("The WalkingType of the NPC");
        		contentPane.add(textField3);
        		textField3.setBounds(200, 25, 80, 20);
    
        		//---- label4 ----
        		label4.setText("WalkingType");
        		contentPane.add(label4);
        		label4.setBounds(new Rectangle(new Point(210, 10), label4.getPreferredSize()));
    
        		//---- label5 ----
        		label5.setText("SpawnX");
        		contentPane.add(label5);
        		label5.setBounds(new Rectangle(new Point(315, 10), label5.getPreferredSize()));
    
        		//---- label6 ----
        		label6.setText("SpawnY");
        		contentPane.add(label6);
        		label6.setBounds(new Rectangle(new Point(410, 10), label6.getPreferredSize()));
    
        		//---- label7 ----
        		label7.setText("SpawnZ");
        		contentPane.add(label7);
        		label7.setBounds(new Rectangle(new Point(505, 10), label7.getPreferredSize()));
    
        		//---- label8 ----
        		label8.setText("MinX");
        		contentPane.add(label8);
        		label8.setBounds(40, 55, label8.getPreferredSize().width, 15);
    
        		//---- label9 ----
        		label9.setText("MinY");
        		contentPane.add(label9);
        		label9.setBounds(new Rectangle(new Point(135, 55), label9.getPreferredSize()));
    
        		//---- label10 ----
        		label10.setText("MinZ");
        		contentPane.add(label10);
        		label10.setBounds(230, 55, label10.getPreferredSize().width, 14);
    
        		//---- label11 ----
        		label11.setText("MaxX");
        		contentPane.add(label11);
        		label11.setBounds(new Rectangle(new Point(320, 55), label11.getPreferredSize()));
    
        		//---- label12 ----
        		label12.setText("MaxY");
        		contentPane.add(label12);
        		label12.setBounds(new Rectangle(new Point(415, 55), label12.getPreferredSize()));
    
        		//---- label13 ----
        		label13.setText("MaxZ");
        		contentPane.add(label13);
        		label13.setBounds(new Rectangle(new Point(510, 55), label13.getPreferredSize()));
    
        		//---- button1 ----
        		button1.setText("Generate");
        		button1.setToolTipText("Generate the code");
        		button1.addActionListener(new ActionListener() {
        			@Override
        			public void actionPerformed(ActionEvent e) {
        				button1ActionPerformed(e);
        			}
        		});
        		contentPane.add(button1);
        		button1.setBounds(150, 100, 90, 25);
    
        		//---- button2 ----
        		button2.setText("Reset");
        		button2.addActionListener(new ActionListener() {
        			@Override
        			public void actionPerformed(ActionEvent e) {
        				button2ActionPerformed(e);
        			}
        		});
        		contentPane.add(button2);
        		button2.setBounds(245, 100, 90, 25);
    
        		//---- button3 ----
        		button3.setText("Add to XML");
        		button3.addActionListener(new ActionListener() {
        			@Override
        			public void actionPerformed(ActionEvent e) {
        				button3ActionPerformed(e);
        			}
        		});
        		contentPane.add(button3);
        		button3.setBounds(340, 100, 90, 25);
    
        		{ // compute preferred size
        			Dimension preferredSize = new Dimension();
        			for(int i = 0; i < contentPane.getComponentCount(); i++) {
        				Rectangle bounds = contentPane.getComponent(i).getBounds();
        				preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
        				preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        			}
        			Insets insets = contentPane.getInsets();
        			preferredSize.width += insets.right;
        			preferredSize.height += insets.bottom;
        			contentPane.setMinimumSize(preferredSize);
        			contentPane.setPreferredSize(preferredSize);
        		}
        		pack();
        		setLocationRelativeTo(getOwner());
        		// JFormDesigner - End of component initialization  //GEN-END:initComponents
        	}
    
        	// JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
        	private JMenuBar menuBar1;
        	private JMenu menu2;
        	private JMenuItem menuItem1;
        	private JScrollPane scrollPane1;
        	private JTextArea textArea1;
        	private JTextField textField4;
        	private JLabel label1;
        	private JTextField textField1;
        	private JTextField textField7;
        	private JTextField textField8;
        	private JTextField textField12;
        	private JTextField textField9;
        	private JTextField textField5;
        	private JTextField textField6;
        	private JTextField textField10;
        	private JTextField textField11;
        	private JTextField textField2;
        	private JLabel label2;
        	private JLabel label3;
        	private JTextField textField3;
        	private JLabel label4;
        	private JLabel label5;
        	private JLabel label6;
        	private JLabel label7;
        	private JLabel label8;
        	private JLabel label9;
        	private JLabel label10;
        	private JLabel label11;
        	private JLabel label12;
        	private JLabel label13;
        	private JButton button1;
        	private JButton button2;
        	private JButton button3;
        	// JFormDesigner - End of variables declaration  //GEN-END:variables
        }
    Cross-post: http://www.daniweb.com/software-deve...36#post1583836
    Last edited by Feriscool; 06-17-2011 at 02:22 AM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    how I can export it so that it's a use-able program with just one click.
    Are you asking how to execute your program with one click?
    Do some Operating Systems start execution of a program with a single click? Does linux?
    Can windows be configured to start execution with one click?

    Why are you concerned that it start with just one click instead of a double click?

  3. #3
    Feriscool is offline Member
    Join Date
    Nov 2010
    Posts
    28
    Rep Power
    0

    Default

    Maybe I was said it wrong. What I need to do is export that code so that it works like a program would (you double click it and it opens the program).

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    What does it generate that is executable? Is there a program that reads its output and does something.
    Like a browser reads an HTML file and displays the formatted contents.

  5. #5
    Feriscool is offline Member
    Join Date
    Nov 2010
    Posts
    28
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    What does it generate that is executable? Is there a program that reads its output and does something.
    Like a browser reads an HTML file and displays the formatted contents.
    Eclipse? :/

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    Not sure I understand. I thought Eclipse was an IDE.

    What does Eclipse do when it reads the output from your program?

    Or are you using Eclipse to develop your program and now want to compile your program and put its class files in a jar file with a manifest file so the jar file becomes an Executable jarfile that will execute your program when it is doubleclicked?

    This then is a question of how to use your IDE. There must be a forum somewhere or a part of this forum that takes questions about how to use an IDE.

  7. #7
    Feriscool is offline Member
    Join Date
    Nov 2010
    Posts
    28
    Rep Power
    0

    Default

    That's the problem...I'm not sure. That's why I'm asking.

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default

    Ask in the Eclipse portion of this forum for how to use it.

  9. #9
    Feriscool is offline Member
    Join Date
    Nov 2010
    Posts
    28
    Rep Power
    0

Similar Threads

  1. NetBeans and JFormDesigner
    By turkuaz07 in forum NetBeans
    Replies: 3
    Last Post: 03-09-2009, 11:38 AM
  2. JFormDesigner 4.0
    By Java Tip in forum Java Software
    Replies: 0
    Last Post: 07-19-2008, 05:19 PM
  3. how can i turn this java program to an applet
    By anotsu in forum New To Java
    Replies: 5
    Last Post: 03-11-2008, 12:48 AM
  4. JFormDesigner 3.1.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-30-2007, 07:10 PM
  5. JFormDesigner 3.1.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-29-2007, 07:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •