خرید بک لینک

Vote count: 0

My JFrame isn't executing or not even showing up when I press the run button. I am sure my code is right(Please Check) and I guess it could be an Eclipse Bug. Help would be Appreciated!

Eclipse Version: Neon

OS: Ubuntu Linux 16.04 LTS

Code:

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;

public class CreateServer {

    public static JFrame start= new JFrame("TRDServerCreator");

    public static void main(String[] args) 
    {
       CreateServer.startwin();
    }

    public static void startwin ()
    {
        start.setSize(500,500);
        start.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        start.setLocationRelativeTo(null);
        start.setResizable(false);

        JPanel cont= new JPanel();
        start.add(cont);

        JLabel n1=new JLabel("Thank you for choosing TRD Server Creator");
        n1.setVisible(true);
        JLabel n2=new JLabel("Pls select the Verison of your New Server");
        n2.setVisible(true);
        cont.add(n1,n2);
    }

}

asked 5 mins ago

1 Answer

Vote count: 0

You have to start.show() or add start.setVisible(true);

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;

public class CreateServer {

    public static JFrame start= new JFrame("TRDServerCreator");

    public static void main(String[] args) 
    {
       CreateServer.startwin();
    }

    public static void startwin ()
    {
        start.setSize(500,500);
        start.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        start.setLocationRelativeTo(null);
        start.setResizable(false);

        JPanel cont= new JPanel();
        start.add(cont);

        JLabel n1=new JLabel("Thank you for choosing TRD Server Creator");
        n1.setVisible(true);
        JLabel n2=new JLabel("Pls select the Verison of your New Server");
        n2.setVisible(true);
        cont.add(n1,n2);
        start.show();
    }
}

answered 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 13 مرداد 1395 ساعت: 8:45

صفحه بندی