📄 hqapplet.java
字号:
// NMI's Java Code Viewer 6.0a
// www.trinnion.com/javacodeviewer
// Registered to Evaluation Copy
// Generated PGFZKD AyTB 14 2007 15:44:19
//source File Name: HQApplet.java
package gnnt.MEBS.HQApplet;
import gnnt.MEBS.hq.TradeTimeVO;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.net.URL;
import java.util.*;
// Referenced classes of package gnnt.MEBS.HQApplet:
// ProductData, HttpThread, SendThread, ReceiveThread,
// RHColor, Page_Bottom, InputDialog, Page_KLine,
// Draw_KLine, Page_Main, Common, Page_MarketStatus,
// Page_MultiQuote, CodeTable, Page_MinLine, AboutDialog,
// Page_Bill, Page_History
public class HQApplet extends Applet
implements FocusListener {
private static final long serialVersionUID = 0x5ba23793a3c0f861L;
private boolean isStandalone;
static final int PAGE_MULTIQUOTE = 0;
static final int PAGE_MINLINE = 1;
static final int PAGE_KLINE = 2;
static final int PAGE_F10 = 3;
static final int PAGE_BILL = 4;
static final int PAGE_MARKETSTATUS = 5;
static final int PAGE_HISTORY = 6;
int iCurrentPage;
public String strCurrentCode;
String indexMainCode;
int m_iKLineCycle;
String m_strIndicator;
int m_iCodeDate;
int m_iCodeTime;
int m_iDate;
int m_iTime;
//TradeTimeVO m_timeRange[];
public TradeTimeVO m_timeRange[];
int m_iMinLineInterval;
Vector m_codeList;
Hashtable m_htProduct;
Vector vProductData;
private Rectangle m_rcMain;
private Rectangle m_rcBottom;
Page_Main mainGraph;
Page_Bottom bottomGraph;
public static RHColor rhColor = null;
String strSocketIP;
int iSocketPort;
String strURLPath;
Socket socket;
SendThread sendThread;
ReceiveThread receiveThread;
HttpThread httpThread;
boolean bRunning;
PopupMenu popupMenu;
static int bDebug = 0;
int iShowBuySellPrice;
String m_strMarketName;
int m_bShowIndexAtBottom;
int m_bShowIndexKLine;
int m_iPrecision;
int m_iPrecisionIndex;
ResourceBundle m_resourceBundle;
String strLanguageName;
boolean bInputDlgShow;
boolean bAboutDlgShow;
private boolean m_bEndPaint;
private Image m_img;
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) : getParameter(key) == null ? def : getParameter(key);
}
public static void main(String args[]) {
HQApplet applet = new HQApplet();
applet.isStandalone = true;
Frame frame = new HQApplet1(applet);
frame.setTitle("Applet Frame");
frame.add(applet, "Center");
frame.setSize(800, 600);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
applet.init();
applet.start();
}
ProductData GetProductData(String code) {
for(int i = 0; i < vProductData.size(); i++)
if(((ProductData)vProductData.elementAt(i)).sCode.equals(code))
return (ProductData)vProductData.elementAt(i);
return null;
}
public HQApplet() {
isStandalone = false;
iCurrentPage = -1;
strCurrentCode = "";
indexMainCode = "";
m_iKLineCycle = 1;
m_strIndicator = "ORDER";
m_iDate = 0;
m_iTime = 0;
m_timeRange = null;
m_iMinLineInterval = 60;
m_codeList = new Vector();
m_htProduct = new Hashtable();
vProductData = new Vector();
m_rcMain = null;
m_rcBottom = null;
mainGraph = null;
bottomGraph = null;
socket = null;
bRunning = true;
popupMenu = new PopupMenu();
m_strMarketName = "";
m_bShowIndexAtBottom = 1;
m_bShowIndexKLine = 0;
m_iPrecision = 0;
m_iPrecisionIndex = 2;
strLanguageName = "zh";
bInputDlgShow = false;
bAboutDlgShow = false;
System.out.println("new HQApplet ");
}
public void init() {
bRunning = true;
try {
jbInit();
}
catch(Exception e) {
if(bDebug != 0)
e.printStackTrace();
}
if(bDebug != 0)
System.out.println("init HQApplet ");
}
private void jbInit() throws Exception {
if(isStandalone) {
strSocketIP = "218.25.163.212";
iSocketPort = 8002;
strURLPath = "http://" + strSocketIP + ":80/hqApplet/";
bDebug = 1;
iShowBuySellPrice = 1;
} else {
URL url = getDocumentBase();
strSocketIP = url.getHost();
iSocketPort = Integer.parseInt(getParameter("Port", "888"));
strURLPath = url.toString();
strURLPath = strURLPath.substring(0, strURLPath.lastIndexOf('/') + 1);
bDebug = Integer.parseInt(getParameter("Debug", "0"));
iShowBuySellPrice = Integer.parseInt(getParameter("ShowBuySell", "3"));
if(iShowBuySellPrice > 5 || iShowBuySellPrice <= 0)
iShowBuySellPrice = 3;
m_strMarketName = getParameter("MarketName", "");
m_bShowIndexAtBottom = Integer.parseInt(getParameter("ShowIndexAtBottom", "1"));
strLanguageName = getParameter("Language", "zh");
m_iPrecision = Integer.parseInt(getParameter("Precision", "0"));
m_iPrecisionIndex = Integer.parseInt(getParameter("IndexPrecision", "2"));
m_bShowIndexKLine = Integer.parseInt(getParameter("ShowIndexKLine", "0"));
}
try {
m_resourceBundle = ResourceBundle.getBundle("rc/string", new Locale(strLanguageName, ""));
}
catch(Exception e) {
System.out.println("Language resource loaded failed !");
e.printStackTrace();
}
m_rcMain = null;
(new HttpThread(0, this)).start();
sendThread = new SendThread(this);
sendThread.start();
receiveThread = new ReceiveThread(this);
receiveThread.start();
httpThread = new HttpThread(1, this);
httpThread.start();
String strColorStyle = getParameter("ColorStyle", "0");
rhColor = new RHColor(Integer.parseInt(strColorStyle));
setBackground(rhColor.clBackGround);
addComponentListener(new HQApplet2(this));
addKeyListener(new HQApplet3(this));
addMouseListener(new HQApplet4(this));
addMouseMotionListener(new HQApplet5(this));
addFocusListener(this);
this_componentResized(null);
bottomGraph = new Page_Bottom(getGraphics(), m_rcBottom, this);
requestFocus();
add(popupMenu);
popupMenu.addActionListener(mainGraph);
strCurrentCode = getParameter("CurrentCode", "");
if(strCurrentCode.length() == 0) {
UserCommand("60");
} else {
String strPage = getParameter("CurrentPage", "MinLinePage");
if(strPage.equalsIgnoreCase("MinLine"))
showPageMinLine();
else
if(strPage.equalsIgnoreCase("KLine")) {
showPageMinLine();
try {
Thread.sleep(1000L);
}
catch(InterruptedException interruptedexception) { }
showPageKLine();
} else {
UserCommand("60");
}
}
}
public String getAppletInfo() {
return "Applet Information \u91D1\u7F51\u5B89\u6CF0";
}
public String[][] getParameterInfo() {
return null;
}
public Frame getParentFrame(Component c) {
Frame mainFrame = null;
Container dad;
for(dad = c.getParent(); !(dad instanceof Frame) && dad != null; dad = dad.getParent());
if(dad instanceof Frame)
mainFrame = (Frame)dad;
return mainFrame;
}
void this_keyPressed(KeyEvent e) {
if(bInputDlgShow)
return;
char ch = e.getKeyChar();
if(Character.isLetterOrDigit(ch)) {
Frame f = getParentFrame(this);
Rectangle rc = getBounds();
Point p = getLocationOnScreen();
int x = (p.x + rc.width) - 125;
int y = (p.y + rc.height) - 160;
InputDialog dlg = new InputDialog(f, ch, this);
dlg.setBounds(x, y, 125, 160);
bInputDlgShow = true;
dlg.show();
bInputDlgShow = false;
String str = dlg.strCmd;
if(str == null || str.length() == 0)
return;
switch(str.charAt(0)) {
case 65: // 'A'
UserCommand(str.substring(1));
break;
case 84: // 'T'
m_strIndicator = str.substring(1);
((Page_KLine)mainGraph).draw_KLine.CreateIndicator();
repaint();
break;
case 67: // 'C'
rhColor = new RHColor(str.charAt(1) - 48);
setBackground(rhColor.clBackGround);
break;
case 80: // 'P'
QueryStock(str.substring(1));
break;
}
repaint();
return;
}
boolean bNeedRepaint = true;
int iKey = e.getKeyCode();
switch(iKey) {
case 27: // '\033'
if(mainGraph != null) {
bNeedRepaint = mainGraph.KeyPressed(e);
if(!bNeedRepaint && iCurrentPage != 0) {
byte type = (byte)Common.GetProductType(strCurrentCode);
if(iCurrentPage == 5)
type = ((Page_MarketStatus)mainGraph).currentStockType;
mainGraph = new Page_MultiQuote(m_rcMain, this, type);
bNeedRepaint = true;
}
}
break;
case 112: // 'p'
if(iCurrentPage == 1 || iCurrentPage == 2)
UserCommand("01");
break;
case 113: // 'q'
UserCommand("60");
break;
case 114: // 'r'
if(indexMainCode.length() > 0)
UserCommand("INDEX_" + indexMainCode);
break;
case 115: // 's'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -