⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchforeshowform.java

📁 手机在线系统 采用Java 中的J2ME, JSP 跟MySql 运行环境是:jsdk1.4以上
💻 JAVA
字号:
/**
 * @(#)SearchForeshowForm.java	
 * Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
 * @version 	1.0, 10/05/2004
 * @author 	饶荣庆
 * @author 	余煜辉
 */
package com.j2me.football.england;	  

import com.j2me.main.*;	
import com.j2me.language.*;
import com.j2me.common.*;
import java.io.*;
import javax.microedition.lcdui.*;

/**
 *此类为搜索球队赛程的搜索类
 */
public class  SearchForeshowForm extends Form implements CommandListener 
{
	private Display display = null;
	private Foreshow foreshow = null;
	public DetailForeshowInfoForm detail;
	public static Alert errorAlert = null; 	  //找不到记录是显示错误信息

	/*输入比赛名*/
	public  TextField nameTextField= null;
	/*输入比赛轮数*/
	public  TextField degreeTextField= null;
	public Command okCommand = null;			//定义确定软键
	public Command backCommand = null;			//定义离开软键


	public SearchForeshowForm(String s)
	{
		super(s);
		this.errorAlert = new Alert("错误", "对不起!没有这个球队详细赛程!", null, AlertType.ERROR);	 //初始化信息
		this.errorAlert.setTimeout(1000);

		this.nameTextField = new TextField("比赛名:", null, 30, TextField.ANY);
		this.degreeTextField = new TextField("比赛轮数:", null, 30, TextField.ANY);

		this.append(nameTextField);
		this.append(degreeTextField);
		this.okCommand = new Command("查找", Command.OK, 2);	
		this.backCommand = new Command("返回", Command.BACK, 2);

		this.addCommand(backCommand);
		this.addCommand(okCommand);
		this.setCommandListener(this);
	}
    
	/*显示界面*/
	public void showForm(Display display, Foreshow foreshow)
	{
		this.display = display;
		this.foreshow = foreshow;
		this.display.setCurrent(this);
	}

	public void commandAction(Command c,Displayable s)
	{
		if(c == backCommand)
		{
			this.display.setCurrent(foreshow);
		}

		if (c == okCommand)
		{
			String html = "";
			String isOk = null ;  //判断找到没有
			//String str = searchTextField.getString().trim();	//获得要搜索的球队名
			int i = 0;//用于获得图片的绝对路径

			/* Thread t = new Thread() 
		    {   				 				 
			public void run() 
			{ */
			try
			{	
				//从列表中获取球队名字用于查询
				String parameter = "name=" + nameTextField.getString().trim() + "&degree=" + "英超第" + degreeTextField.getString().trim() + "轮";
				System.out.println(parameter);
				
				//获得服务器用户保存的内容
			    html = ConnectHttp.invokeJSP(WebServerURL.getURL() + "football/england_foreshow_info.jsp", parameter);
				
				

				//处理HTML标记语言
				html = DisposeHTML.getBody(html);	
				//System.out.println("dfsdfsd"+html);
				
				//把Unicode转换为中文
				html = Unicode.unicodeToString(html);	
				isOk = html;  //假如搜索不到这个球队则判断 
			}
			catch(IOException e)
			{
				this.display.setCurrent(errorAlert);
				
				System.out.println(e);
			}

			if (isOk.trim().compareTo("false") == 0 || nameTextField.getString() == null || degreeTextField.getString().trim() == null )
			{	  
				this.display.setCurrent(errorAlert);
			}
			else
			{
				DowloandGuage d = new DowloandGuage();	//连网的进度条
				//创建球队详细列表的对象
				if (Language.isEnglish)
				{
					detail = new DetailForeshowInfoForm("Team Foreshow Info", null, html, display, null, this);
				}
				else
				{
					detail = new DetailForeshowInfoForm("球队赛程详细信息", null, html, display, null, this);
				}
				d.showForm(display, detail);
			}

		}
	}
}

		



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -