@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); // 图所占范围大小 chart.setChartRange(w, h); chart2.setChartRange(w, h); }
@Override public boolean onTouchEvent(MotionEvent event) { // TODO Auto-generated method stub super.onTouchEvent(event); if (event.getAction() == MotionEvent.ACTION_UP) { triggerClick(event.getX(), event.getY()); } return true; }
/** Update the model when the user selects a color, and repaint the window. */ public void valueChanged(ListSelectionEvent event) { Color color = view.getSelectedColor(); model.setSelectedColor(color); view.repaint(); }
/** * Add a point to the model when the user drags the mouse, and repaint the window. Need more logic * to draw solid lines. */ public void mouseDragged(MouseEvent event) { Point point = event.getPoint(); // find point model.addPoint(point); view.repaint(); } // end method mouseDragged