Results 1 to 3 of 3
Thread: Installer GUI - Need Help
- 10-27-2011, 01:28 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 4
- Rep Power
- 0
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
WindowM.javaJava 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); } }
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); } } } }
-
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).
- 10-27-2011, 06:36 AM #3
Member
- Join Date
- Sep 2011
- Posts
- 4
- Rep Power
- 0
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
-
Installer Problem
By subashprasanna in forum New To JavaReplies: 5Last Post: 01-28-2011, 06:50 AM -
Java Installer
By DJRichC in forum Advanced JavaReplies: 6Last Post: 07-17-2010, 08:12 PM -
java installer
By j2me64 in forum Advanced JavaReplies: 4Last Post: 05-13-2010, 03:10 PM -
JRE 1.5 update 16 MSI installer
By yogi1410 in forum Java SoftwareReplies: 0Last Post: 01-22-2010, 09:49 AM -
installer
By dinosoep in forum New To JavaReplies: 3Last Post: 12-16-2009, 09:42 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks