예제 #1
0
파일: LJ3MDApp.java 프로젝트: eskilj/mvp
 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);
   }
 }