• 作为一名新手,我感觉压力好大


    //早上起来很想敲代码于是就出现了下面这段文字,只是有个问题,显示不出窗体、、、

    //ApplicationGraphicsInOut(MyJavaApplication)

    package linminpackage;

    import java.awt.*;
    import java.awt.event.*;

    public class ApplicationGraphicsInOut {

     public static void main(String args[]){
      new FrameInOut();
     }
    }

    class FrameInOut extends Frame implements ActionListener{
     /**
      *
      */
     private static final long serialVersionUID = -2724272517010256422L;//这段文字也是被迫的,数据时参考了网络上搜到的信息
     Label prompt;
     TextField input,output;
     Button btn;
     
     FrameInOut(){
      super("图形用界面的JAVA Aplication程序");
      prompt=new Label("请输入您的姓名:");
      input=new TextField(6);
      output=new TextField(20);
      btn=new Button("关闭");
      
      setLayout(new FlowLayout());
      add(prompt);
      add(input);
      add(output);
      add(btn);
      input.addActionListener(this);
      btn.addActionListener(this);
      setSize(300,200);
      boolean ture = false;//被迫添加了这句话
      setVisible(ture);//已经是说要显示出窗体,结果运行之后啥都没有
      
     }
     public void actionPerformed(final ActionEvent e){
      if(e.getSource()==input)
       output.setText(input.getText()+",welcome!");
      else
      {
       dispose();
       System.exit(0);
      }
     }
     
    }

  • 相关阅读:
    Linux编程make命令(转)
    如何处理Global symbol * requires explicit package name编译错误,以及use strict用法
    6235与旧版本的区别
    Linux下动态链接库的使用
    MTK Socket学习——HTTP请求
    指针和指针的引用
    VC/MFC Combo Box控件的用法
    makefile教程
    常用数据类型使用转换详解
    Linux发送与接收信息
  • 原文地址:https://www.cnblogs.com/objective/p/1870985.html
Copyright © 2020-2023  润新知