桌面应用开发 [英] Desktop Application Development

查看:62
本文介绍了桌面应用开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何制作桌面应用程序只是给我一个例子。如何在Windows操作系统中运行。

How to make Desktop Application just giver me example. how run in windows OS.

推荐答案

根据你的问题,这不是很有用的信息。



一个小指南:



1.你需要一个班级



例如



According to your question, which is not very informative.

A little guideance:

1. you need a class

e.g.

public class MyApp ()
{

}





2.主要开始方式





2. main method for starting

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

    }
}





3.一个框架,没有框架就没有了!





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

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





4. app和init的构造函数





4. constructor for the app and init in it

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.按钮和等待操作和窗口大小





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

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);
    }
}





如果我什么都不记得,我实际上没有Java IDE,
此代码应该可以工作并使用按钮显示屏幕。



希望这就是你所要求的:)



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 :)


这篇关于桌面应用开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆