📄 page_kline.java
字号:
popupMenu.add(menuMinLine);
if(iProductType != 2 && iProductType != 3 && iProductType != 4)
popupMenu.add(menuBill);
if(iProductType != 4)
popupMenu.addSeparator();
popupMenu.add(menuZoomIn);
popupMenu.add(menuZoomOut);
popupMenu.addSeparator();
popupMenu.add(menuPrevStock);
popupMenu.add(menuPostStock);
popupMenu.addSeparator();
popupMenu.add(menuQuote);
popupMenu.add(menuMarket);
setAllMenusEnable();
processCommonMenuEvent(popupMenu, this);
popupMenu.show(m_applet, x, y);
}
void setMenuEnable(String label, boolean b)
{
if(label.equals("zoomout"))
{
menuZoomOut.setEnabled(b);
return;
}
if(label.equals("zoomin"))
{
menuZoomIn.setEnabled(b);
return;
} else
{
return;
}
}
void setIndicatorSubMenusAllTrue()
{
int count = menuIndicator.getItemCount();
for(int i = 0; i < count; i++)
{
MenuItem mi = menuIndicator.getItem(i);
mi.setEnabled(true);
}
}
public void actionPerformed(ActionEvent e)
{
String cmd = e.getActionCommand();
if("USA".equals(cmd))
{
m_iCurKLineType = 1;
draw_KLine.ChangeKLineType(1);
return;
}
if("KLine".equals(cmd))
{
m_iCurKLineType = 0;
draw_KLine.ChangeKLineType(0);
return;
}
if("Poly".equals(cmd))
{
m_iCurKLineType = 2;
draw_KLine.ChangeKLineType(2);
return;
}
if(cmd.indexOf("cmd_") >= 0)
{
String requestType = cmd.substring(4);
if(requestType.equals("quote"))
{
executeQuoteCommand();
return;
}
if(requestType.equals("market"))
{
executeMarketCommand();
return;
}
} else
{
if(cmd.equals("zoomin"))
{
zoomInKLineGraph();
return;
}
if(cmd.equals("zoomout"))
{
zoomOutKLineGraph();
return;
}
if(cmd.equals("prevstock"))
{
m_applet.ChangeStock(true, true);
m_applet.repaint();
return;
}
if(cmd.equals("poststock"))
{
m_applet.ChangeStock(false, true);
m_applet.repaint();
return;
}
if(cmd.equals("day"))
{
m_applet.m_iKLineCycle = 1;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("week"))
{
m_applet.m_iKLineCycle = 2;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("month"))
{
m_applet.m_iKLineCycle = 3;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("min5"))
{
m_applet.m_iKLineCycle = 4;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("min15"))
{
m_applet.m_iKLineCycle = 5;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("min30"))
{
m_applet.m_iKLineCycle = 6;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("min60"))
{
m_applet.m_iKLineCycle = 7;
AskForKLine();
m_applet.repaint();
return;
}
if(cmd.equals("minline"))
{
m_applet.showPageMinLine();
return;
}
if(cmd.equals("bill"))
{
m_applet.UserCommand("01");
return;
}
if(cmd.startsWith("Indicator_"))
{
m_applet.m_strIndicator = cmd.substring(10);
draw_KLine.CreateIndicator();
m_applet.repaint();
} else
{
super.actionPerformed(e);
}
}
}
private void zoomOutKLineGraph()
{
boolean bNeedRepaint = draw_KLine.ChangeRatio(false);
if(bNeedRepaint)
{
if(!draw_KLine.ChangeRatio(false))
menuZoomOut.setEnabled(false);
else
draw_KLine.ChangeRatio(true);
if(!menuZoomIn.isEnabled())
menuZoomIn.setEnabled(true);
m_applet.repaint();
}
}
private void zoomInKLineGraph()
{
boolean bNeedRepaint = draw_KLine.ChangeRatio(true);
if(bNeedRepaint)
{
if(!draw_KLine.ChangeRatio(true))
menuZoomIn.setEnabled(false);
else
draw_KLine.ChangeRatio(false);
if(!menuZoomOut.isEnabled())
menuZoomOut.setEnabled(true);
m_applet.repaint();
}
}
void setCycleSubMenusAllTure()
{
menuCycleDay.setEnabled(true);
menuCycleWeek.setEnabled(true);
menuCycleMonth.setEnabled(true);
menuCycleMin5.setEnabled(true);
menuCycleMin15.setEnabled(true);
menuCycleMin30.setEnabled(true);
menuCycleMin60.setEnabled(true);
}
void setAllMenusEnable()
{
int iCount = menuIndicator.getItemCount();
for(int i = 0; i < iCount; i++)
{
MenuItem mi = menuIndicator.getItem(i);
String indicator = mi.getActionCommand();
if(m_applet.m_strIndicator.equals(indicator))
mi.setEnabled(false);
else
mi.setEnabled(true);
}
menuKTypeK.setEnabled(m_iCurKLineType != 0);
menuKTypeUSA.setEnabled(m_iCurKLineType != 1);
menuKTypePoly.setEnabled(m_iCurKLineType != 2);
setCycleSubMenusAllTure();
switch(m_applet.m_iKLineCycle)
{
case 1: // '\001'
menuCycleDay.setEnabled(false);
break;
case 2: // '\002'
menuCycleWeek.setEnabled(false);
break;
case 3: // '\003'
menuCycleMonth.setEnabled(false);
break;
case 4: // '\004'
menuCycleMin5.setEnabled(false);
break;
case 5: // '\005'
menuCycleMin15.setEnabled(false);
break;
case 6: // '\006'
menuCycleMin30.setEnabled(false);
break;
case 7: // '\007'
menuCycleMin60.setEnabled(false);
break;
}
}
private void executeQuoteCommand()
{
m_applet.UserCommand("60");
}
private void executeMarketCommand()
{
m_applet.UserCommand("80");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -