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 2044】 Weather Forecast
    【POJ 1703】 Find them,Catch them
    【SCOI 2005】 骑士精神
    字长与指针
    XModem协议
    SecureCRT乱码问题解决方法
    usb设备驱动程序
    如何检测 51单片机IO口的下降沿
    matlab神经网络工具箱创建神经网络
    九针串口接线问题, 232, 485
  • 原文地址:https://www.cnblogs.com/objective/p/1870985.html
Copyright © 2011-2022 走看看