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

📄 cmainwindow.java

📁 一个关于手机短信的开发包!包括例子以及很详细的相关说明文档.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
//	jSMSEngine API.//	An open-source API package for sending and receiving SMS via a GSM device.//	Copyright (C) 2002-2006, Thanasis Delenikas, Athens/GREECE//		Web Site: http://www.jsmsengine.org////	jSMSEngine is a package which can be used in order to add SMS processing//		capabilities in an application. jSMSEngine is written in Java. It allows you//		to communicate with a compatible mobile phone or GSM Modem, and//		send / receive SMS messages.////	jSMSEngine is distributed under the LGPL license.////	This library is free software; you can redistribute it and/or//		modify it under the terms of the GNU Lesser General Public//		License as published by the Free Software Foundation; either//		version 2.1 of the License, or (at your option) any later version.//	This library 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//		Lesser General Public License for more details.//	You should have received a copy of the GNU Lesser General Public//		License along with this library; if not, write to the Free Software//		Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA//////	jSMSServer GUI Application.//	This application is based on the old jSMSServer GUI, and provides a general purpose//		graphical interface. It can be used for a quick-start, if you don't want//		to mess around with the API itself.//	Please read jSMSServer.txt for further information.//import java.io.*;import java.util.*;import java.awt.*;import java.awt.event.*;import java.awt.geom.*;import javax.swing.*;import javax.swing.event.*;class CMainWindow extends JFrame{	private CSettings settings;	private jSMSServer jSmsServer;	private CMainThread service;	private CAboutDialog aboutDialog = null;	private JMenuBar menuBar;	private JMenu fileMenu, aboutMenu;	private JMenuItem mniConnect, mniDisconnect, mniExit;	private JMenuItem mniAbout;	private JLabel lblManuf, lblModel, lblSerialNo, lblIMSI, lblSwVersion, lblBattery, lblSignal, lblStatus;	private JTextField txtManuf, txtModel, txtSerialNo, txtIMSI, txtSwVersion, txtStatus;	private JProgressBar pgbBattery, pgbSignal;	private JLabel lblInFrom, lblInDate, lblInText;	private JTextField txtInFrom, txtInDate;	private JTextArea txtInText;	private JLabel lblOutTo, lblOutDate, lblOutText;	private JTextField txtOutTo, txtOutDate;	private JTextArea txtOutText;	private JLabel lblUpSince, lblTraffic, lblTrafficIn, lblTrafficOut;	private JTextField txtUpSince, txtTrafficIn, txtTrafficOut;	private JLabel lblInterfaces, lblInterfaceDB, lblInterfaceXML, lblInterfaceRMI;	private JLabel lblRawLogs, lblRawInLog, lblRawOutLog;	public CMainWindow(jSMSServer jSmsServer, CSettings settings)	{		this.jSmsServer = jSmsServer;		this.settings = settings;		this.settings.setMainWindow(this);		service = new CUserThread(jSmsServer, this, settings);		setTitle(CConstants.MAIN_WINDOW_TITLE);		setSize(750, 580);		setLocation(5, 5);		getContentPane().setLayout(new GridBagLayout());		menuBar = new JMenuBar();		fileMenu = new JMenu(CConstants.MENU_FILE_MAIN);			mniConnect = new JMenuItem(CConstants.MENU_FILE_OPTION_01);				mniConnect.addActionListener(new					ActionListener()					{						public void actionPerformed(ActionEvent event)						{							service.connect(true);						}					});			mniDisconnect = new JMenuItem(CConstants.MENU_FILE_OPTION_02);				mniDisconnect.addActionListener(new					ActionListener()					{						public void actionPerformed(ActionEvent event)						{							service.disconnect(true);						}					});			mniExit = new JMenuItem(CConstants.MENU_FILE_OPTION_99);				mniExit.addActionListener(new					ActionListener()					{						public void actionPerformed(ActionEvent event)						{							System.exit(0);						}					});			fileMenu.add(mniConnect);			fileMenu.add(mniDisconnect);			fileMenu.addSeparator();			fileMenu.add(mniExit);		menuBar.add(fileMenu);		aboutMenu = new JMenu(CConstants.MENU_ABOUT_MAIN);			mniAbout = new JMenuItem(CConstants.MENU_ABOUT_OPTION_01);				mniAbout.addActionListener(new					ActionListener()					{						public void actionPerformed(ActionEvent event)						{							if (aboutDialog == null) aboutDialog = new CAboutDialog(CMainWindow.this);							aboutDialog.setVisible(true);						}					});			aboutMenu.add(mniAbout);		menuBar.add(aboutMenu);		setJMenuBar(menuBar);		GridBagConstraints gbc = new GridBagConstraints();		gbc.anchor = GridBagConstraints.WEST;		gbc.weightx = 100;		gbc.weighty = 100;		gbc.gridx = 0;		gbc.gridy = 0;		gbc.gridwidth = 1;		gbc.gridheight = 1;		gbc.insets.left = 5; gbc.insets.top = 5; gbc.insets.right = 5;		JPanel statusPanel = new JPanel();		statusPanel.setLayout(new GridBagLayout());			lblManuf = new JLabel(CConstants.LABEL_MANUFACTURER, JLabel.LEFT);			txtManuf = new JTextField("", 16);			txtManuf.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 0;			statusPanel.add(lblManuf, gbc);			gbc.gridx = 1;			gbc.gridy = 0;			statusPanel.add(txtManuf, gbc);			lblModel = new JLabel(CConstants.LABEL_MODEL, JLabel.LEFT);			txtModel = new JTextField("", 16);			txtModel.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 1;			statusPanel.add(lblModel, gbc);			gbc.gridx = 1;			gbc.gridy = 1;			statusPanel.add(txtModel, gbc);			lblSerialNo = new JLabel(CConstants.LABEL_SERIALNO, JLabel.LEFT);			txtSerialNo = new JTextField("", 20);			txtSerialNo.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 2;			statusPanel.add(lblSerialNo, gbc);			gbc.gridx = 1;			gbc.gridy = 2;			statusPanel.add(txtSerialNo, gbc);			lblIMSI = new JLabel(CConstants.LABEL_IMSI, JLabel.LEFT);			txtIMSI = new JTextField("", 20);			txtIMSI.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 3;			statusPanel.add(lblIMSI, gbc);			gbc.gridx = 1;			gbc.gridy = 3;			statusPanel.add(txtIMSI, gbc);			lblSwVersion = new JLabel(CConstants.LABEL_SWVERSION, JLabel.LEFT);			txtSwVersion = new JTextField("", 20);			txtSwVersion.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 4;			statusPanel.add(lblSwVersion, gbc);			gbc.gridx = 1;			gbc.gridy = 4;			statusPanel.add(txtSwVersion, gbc);			gbc.insets.top = 15;			lblBattery = new JLabel(CConstants.LABEL_BATTERY, JLabel.LEFT);			pgbBattery = new JProgressBar(0, 100);			pgbBattery.setStringPainted(true);			gbc.gridx = 0;			gbc.gridy = 5;			statusPanel.add(lblBattery, gbc);			gbc.gridx = 1;			gbc.gridy = 5;			statusPanel.add(pgbBattery, gbc);			gbc.insets.top = 5;			lblSignal = new JLabel(CConstants.LABEL_SIGNAL, JLabel.LEFT);			pgbSignal = new JProgressBar(0, 100);			pgbSignal.setStringPainted(true);			gbc.gridx = 0;			gbc.gridy = 6;			statusPanel.add(lblSignal, gbc);			gbc.gridx = 1;			gbc.gridy = 6;			statusPanel.add(pgbSignal, gbc);			gbc.insets.top = 15;			gbc.insets.bottom = 8;			lblStatus = new JLabel(CConstants.LABEL_STATUS, JLabel.LEFT);			txtStatus = new JTextField(CConstants.STATUS_DISCONNECTED, 20);			txtStatus.setEditable(false);			txtStatus.setHorizontalAlignment(JTextField.CENTER);			txtStatus.setFont(new Font("SansSerif", Font.BOLD, 12));			gbc.gridx = 0;			gbc.gridy = 7;			statusPanel.add(lblStatus, gbc);			gbc.gridx = 1;			gbc.gridy = 7;			statusPanel.add(txtStatus, gbc);		statusPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), CConstants.BORDER_MOBILE_INFORMATION));		gbc.anchor = GridBagConstraints.NORTH;		gbc.weightx = 100;		gbc.weighty = 100;		gbc.gridx = 0;		gbc.gridy = 0;		gbc.gridwidth = 1;		gbc.gridheight = 1;		gbc.insets.left = 5; gbc.insets.top = 5;		getContentPane().add(statusPanel, gbc);		gbc = new GridBagConstraints();		gbc.anchor = GridBagConstraints.WEST;		gbc.weightx = 100;		gbc.weighty = 100;		gbc.gridx = 0;		gbc.gridy = 0;		gbc.gridwidth = 1;		gbc.gridheight = 1;		gbc.insets.left = 5; gbc.insets.top = 5; gbc.insets.right = 5;		JPanel incomingPanel = new JPanel();		incomingPanel.setLayout(new GridBagLayout());			lblInFrom = new JLabel(CConstants.LABEL_INCOMING_FROM, JLabel.LEFT);			txtInFrom = new JTextField("", 16);			txtInFrom.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 0;			incomingPanel.add(lblInFrom, gbc);			gbc.gridx = 1;			gbc.gridy = 0;			incomingPanel.add(txtInFrom, gbc);			lblInDate = new JLabel(CConstants.LABEL_INCOMING_DATE, JLabel.LEFT);			txtInDate = new JTextField("", 20);			txtInDate.setEditable(false);			gbc.gridx = 0;			gbc.gridy = 1;			incomingPanel.add(lblInDate, gbc);			gbc.gridx = 1;			gbc.gridy = 1;			incomingPanel.add(txtInDate, gbc);			gbc.insets.bottom = 19;			lblInText = new JLabel(CConstants.LABEL_INCOMING_TEXT, JLabel.LEFT);			txtInText = new JTextArea(8, 20);			txtInText.setEditable(false);			txtInText.setLineWrap(true);			gbc.gridx = 0;			gbc.gridy = 2;			incomingPanel.add(lblInText, gbc);			gbc.gridx = 1;			gbc.gridy = 2;			gbc.gridheight = 8;			incomingPanel.add(txtInText, gbc);

⌨️ 快捷键说明

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