Пример #1
0
 /** Refresh the coordinates x[][] is the wrapped coordinates `n' may be less than x.length */
 public void refresh(double x[][], int n, boolean center, boolean adjScale) {
   if (model == null) {
     model = new XYZModel();
     adjScale = true;
   }
   model.updateXYZ(x, n, center);
   if (adjScale) realSpan = model.getSpan(x, n);
   repaint();
 }
Пример #2
0
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (model != null) {
     newImgBuf(); // refresh the image buffer if necessary
     // compute the real-to-screen ratio, this variable differs
     // from model.real2Screen by zoomScale
     Dimension sz = getSize();
     double real2Screen0 = model.getScaleFromSpan(realSpan, sz.width, sz.height);
     model.setMatrix(viewMatrix, real2Screen0 * zoomScale, sz.width / 2, sz.height / 2);
     imgG.setColor(Color.BLACK);
     imgG.fillRect(0, 0, sz.width, sz.height);
     model.paint(imgG);
     g.drawImage(img, 0, 0, this);
   }
 }