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

📄 movinomenu.java

📁 一个不错的多媒体传输程序
💻 JAVA
字号:
/* * Movino J2ME Client * Copyright (C) 2007  Johannes Berg *  * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. */package org.movino;import javax.microedition.lcdui.Alert;import javax.microedition.lcdui.AlertType;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Display;import javax.microedition.lcdui.Displayable;import javax.microedition.lcdui.List;import javax.microedition.midlet.MIDletStateChangeException;import org.movino.connection.ConnectionMenu;import org.movino.connection.ConnectionThread;import org.movino.connection.MovinoConnection;public class MovinoMenu extends Returnable implements CommandListener{	private static final String CONNECT="Connect";	private static final String DISCONNECT="Disconnect";	private static final String STREAM_VIDEO="Record";	private static final String OPTIONS="Options";	private static final String EXIT="Exit";	private static final String[] MAIN_MENU = new String[]{CONNECT,STREAM_VIDEO,OPTIONS,EXIT};		private List mainMenu;	private Command selectCommand;		private ConnectionThread connectionThread;		private MovinoMidlet movinoMidlet;		public MovinoMenu(MovinoMidlet midlet){		movinoMidlet = midlet;		connectionThread = new ConnectionThread();		connectionThread.start();		Options.loadOptions();	}		public void show(Display display){		selectCommand = new Command("Select", Command.ITEM, 1);				mainMenu = new List("Movino",List.IMPLICIT,MAIN_MENU,null);		mainMenu.setCommandListener(this);		mainMenu.setSelectCommand(selectCommand);				if(MovinoConnection.currentConnection!=null){			mainMenu.set(0, DISCONNECT, null);		}				display.setCurrent(mainMenu);	}		public void reShow(Display display){		if(MovinoConnection.currentConnection!=null){			mainMenu.set(0, DISCONNECT, null);		}		display.setCurrent(mainMenu);	}			public void simpleAlert(String mess){		Alert alert = new Alert("Message",mess,null,AlertType.INFO);		alert.setTimeout(Alert.FOREVER);		Display display = Display.getDisplay(movinoMidlet);		display.setCurrent(alert);		System.out.println(mess);	}	public void commandAction(Command cmd, Displayable disp) {		if(disp==mainMenu){			if(cmd==selectCommand){				int sel_index = mainMenu.getSelectedIndex();				if(sel_index>=0){					String sel = mainMenu.getString(sel_index);					if(sel==CONNECT){						new ConnectionMenu().show(Display.getDisplay(movinoMidlet), this);					}					else if(sel==DISCONNECT){						MovinoConnection mc = MovinoConnection.currentConnection;						if(mc!=null){							mc.abort();						}						mainMenu.set(0, CONNECT, null);					}					else if(sel==STREAM_VIDEO){						new Capture().show(Display.getDisplay(movinoMidlet), this);					}					else if(sel==OPTIONS){						new Options().show(Display.getDisplay(movinoMidlet), this);					}					else if(sel==EXIT){						Options.saveOptions();						connectionThread.shutdownConnections();						try { movinoMidlet.destroyApp(false);						} catch (MIDletStateChangeException e) {}						movinoMidlet.notifyDestroyed();					}				}			}		}	}}

⌨️ 快捷键说明

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