Results 1 to 3 of 3
  1. #1
    Zexanima is offline Member
    Join Date
    Sep 2011
    Posts
    4
    Rep Power
    0

    Default Installer GUI - Need Help

    I'm trying to make an installer with a GUI. I've read forums and watched tutorials and they all lead me in random directions. I've got several things to work, just not do what I want. The installer is suppose to have a text area at the top where it updates you on progress like "Installing..." then "Complete!". Bellow that that it will have two buttons, Install and Exit. I'm trying to get these spaced out a little so I can add a background image to the installer. Also, I can't seem to get the buttons to work with my action listener I set up. Please do not link me to some tutorial or the oracle site believe me I've tired that, lots of that. I just need someone to explain this to me for my specific situation. What I should use, some of the methods I may need, mainly get me in the right direction. This is my first attempt at a GUI is why I have so many questions. I know I'm asking a lot, but I can't seem to figure this one out on my own.

    Main.java
    Java Code:
    import java.awt.*;
    
    import java.awt.event.*;
    
    import javax.swing.*;
    
    import java.net.*;
    
    
    
    public class Main {
    		
    	public static void main (String[] args)
    	{
    		WindowM window = new WindowM();
    		window.setVisible(true);
    				
    	}
    }
    WindowM.java
    Java Code:
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.net.URL;
    
    import javax.swing.*;
    
    public class WindowM extends JFrame{
    	
    	private JScrollPane info;
    	
    	URL imageURL = Main.class.getResource("images/z.jpg");
    	ImageIcon image = new ImageIcon(imageURL);
    	
    	public WindowM()
    	{
    	super("Installer");
    	setSize(300,200);
    	setLayout(new GridBagLayout());
    	GridBagConstraints c = new GridBagConstraints();
    
        
        JButton inbutton = new JButton("Install Mod");
    	inbutton.setToolTipText("Click to Install");
    	c.gridx = 2;
    	c.gridy = 0;
    	add(inbutton);
    	
    	JButton exit = new JButton("Exit");
    	exit.setToolTipText("Click to Exit");
    	c.gridx = 2;
    	c.gridy = 1;
    	add(exit);
    	
    	inbutton.addActionListener(new Handeler());
    	exit.addActionListener(new Handeler());
    	}
    	
    	private class Handeler implements ActionListener{
    		
    		public void actionPerformed(ActionEvent e) {
    			
    			if(e.getSource()== "Install Mod"){
    				System.out.println("Installing...");
    				//Installing stuff goes here
    				System.out.println("Complete");
    			} else if (e.getSource() == "Exit"){
    				dispose();
    				System.exit(0);
    			}
    			
    				
    			}
    		}
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Installer GUI - Need Help

    You need to tell us how things are not working. The more detail you can tell us, the better we can understand what your problem is. Otherwise, about all I can do is refer you to the tutorials. :)

    edit: also, you should really respond to folks who take the time to answer you even if to refer you to a tutorial (as you didn't do in your first two posts). No one will want to help if they think that the help will just be ignored (or even if it will just seem that way).

  3. #3
    Zexanima is offline Member
    Join Date
    Sep 2011
    Posts
    4
    Rep Power
    0

    Default Re: Installer GUI - Need Help

    I must have forgotten about my other post, I usually do respond but I'm a part of several forums and I rarely come on this one. My problem's are I can't arrange my buttons correctly, I don't know how to get my action handler working with my buttons, and I can't get a picture as a back ground image. I mean, it's wide range of problems. That's why I would like for someone to explain to me how they would go about doing this, being I've never made a GUI before. Tutorials and what not show me several different ways to do them, but I can't get them to work the way I want. A pseudocode of what I would need to do maybe would be nice. It's kind of a "how would you do this?" question. That way I'll have something to go by.

Similar Threads

  1. Installer Problem
    By subashprasanna in forum New To Java
    Replies: 5
    Last Post: 01-28-2011, 07:50 AM
  2. Java Installer
    By DJRichC in forum Advanced Java
    Replies: 6
    Last Post: 07-17-2010, 09:12 PM
  3. java installer
    By j2me64 in forum Advanced Java
    Replies: 4
    Last Post: 05-13-2010, 04:10 PM
  4. JRE 1.5 update 16 MSI installer
    By yogi1410 in forum Java Software
    Replies: 0
    Last Post: 01-22-2010, 10:49 AM
  5. installer
    By dinosoep in forum New To Java
    Replies: 3
    Last Post: 12-16-2009, 10:42 AM

Posting Permissions

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