[JAVA] Java Swing

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

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

    BlueMustache

    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.

    Code:java
    1. package me.bluemustache.installer;
    2.  
    3. import javax.swing.JFrame;
    4. import javax.swing.WindowConstants;
    5.  
    6. public class Installer{
    7.  
    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. }
    15.  


    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

    BlueMustache

  3. Offline

    PandazNWafflez

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

    Ba7marker

    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

    BlueMustache

    imjack16
    Thanks, solved!
    +1 to you.

    PandazNWafflez
    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