zoukankan      html  css  js  c++  java
  • 作为一名新手,我感觉压力好大

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

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

  • 相关阅读:
    POJ 2407 Relatives 欧拉函数
    HDU 4704 Sum 超大数幂取模
    HDU 4699 Editor 维护栈
    HDU 4696 Answers 水题
    HDU 4686 Arc of Dream 矩阵
    [转]高斯消元题集
    [转]计算几何题集
    POJ 2981 Strange Way to Express Integers 模线性方程组
    Linux 设置文件默认打开方式
    FZU 1402 猪的安家 中国剩余定理
  • 原文地址:https://www.cnblogs.com/objective/p/1870985.html
Copyright © 2011-2022 走看看