Click here to Skip to main content
15,041,391 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
How to make Desktop Application just giver me example. how run in windows OS.
Posted
Comments
Mehdi Gholam 5-Dec-13 7:39am
   
ASP.net is a web technology based on .net (c#,vb.net etc.) and it is not java.
joshrduncan2012 5-Dec-13 9:10am
   
This isn't a well-formed question. What kind of desktop application are you referring to? If you are wanting to do ASP.NET, then it's web design. If you don't want web-design, then it's Windows Forms.

1 solution

According to your question, which is not very informative.

A little guideance:

1. you need a class

e.g.

Java
public class MyApp ()
{

}


2. main method for starting

Java
public class MyApp ()
{
    public static void main(String args[])
    {

    }
}


3. a Frame, without a Frame there will be nothing !

Java
public class MyApp ()
{
    //Our frame
    JFrame myFrame;
    public static void main(String args[])
    {
        
    }
}


4. constructor for the app and init in it

Java
public class MyApp ()
{
    //Our frame
    JFrame myFrame;
    public static void main(String args[])
    {
        //Creating myApp class
        new myApp();
    }

    //Constructor for my app
    public MyApp()
    {
        //creating Frame;
        myFrame = new JFrame("MyApp");
    }
}


5. A button and a wait Operation and the window size

Java
public class MyApp ()
{
    //Our frame
    JFrame myFrame;
    public static void main(String args[])
    {
        //Creating myApp class
        new myApp();
        //wait Operation (is this correct for Java)? 
        while(System.out.readln())
        {
        }
    }

    //Constructor for my app
    public MyApp()
    {
        //creating Frame;
        myFrame = new JFrame("MyApp");
        //Setting size
        myFrame.setPreferredSize(new Dimension(800,600));
        //creating Button
        Button myButton = new Button("Button");
        //adding button to Frame
        myFrame.add(button);
        //set button and Frame visible
        myFrame.setVisible(true);
        button.setVisible(true);
    }
}


If i missed nothing, i actually had no Java IDE at Hand,
this code should work and Display a Screen with a button.

hope this is what you'd asked :)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900