[JAVA] Java Swing

Discussion in 'Bukkit Discussion' started by BlueMustache, Aug 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    Hey Guys!
    I though of doing something a little different than plugins.
    I have always made plugins that are complex, and since I am self taught, I don't know some basics.
    For example, I decided I would make a stand alone application in Java.
    I basically tried to make a simple GUI application.
    I am using the Java 7 jdk in Eclipse.
    I made this class.

    1. package me.bluemustache.installer;
    3. import javax.swing.JFrame;
    4. import javax.swing.WindowConstants;
    6. public class Installer{
    8. public static void main(String args[]){
    9. JFrame myFrame = new JFrame("This is my frame");
    10. myFrame.setSize(300,400);
    11. myFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    12. myFrame.setVisible(true);
    13. }
    14. }

    Does anyone know if I am doing something wrong?
    I compiled this one class as a jar, then ran it, and poof. Nothing.
    Please help,
    -Blue :(
  2. Offline


  3. Offline


    BlueMustache before setSize, call setPreferredSize with the same argument. Also, call frame.setLocationRelativeTo(null); somewhere.
    BlueMustache likes this.
  4. Offline


    BlueMustache Did you set your main file? If you are using Eclipse you do it by exporting and clicking next until you see this Click Me then set your main file.
    BlueMustache likes this.
  5. Offline


    Thanks, solved!
    +1 to you.

    Helpful too!
    I am making an installer.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 9, 2016
Thread Status:
Not open for further replies.

Share This Page