1 32 33 package it.businesslogic.ireport.gui; 34 import java.awt.*; 35 import java.awt.image.*; 36 import javax.swing.*; 37 41 public class JSQLTablesPane extends javax.swing.JDesktopPane { 42 43 boolean repainting = false; 44 private Graphics2D offscreen = null; 45 private BufferedImage offscreenImage = null; 46 47 public JSQLTablesPane() { 48 49 Dimension offscreenDimension = Toolkit.getDefaultToolkit().getScreenSize(); 50 offscreenImage = new java.awt.image.BufferedImage (offscreenDimension.width, offscreenDimension.height, java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE); 51 52 offscreen = GraphicsEnvironment.getLocalGraphicsEnvironment().createGraphics(offscreenImage); 53 offscreen.setBackground(this.getBackground()); 54 offscreen.setColor(Color.BLACK); 55 this.setDoubleBuffered(false); 56 57 } 58 59 public void paint(Graphics g) 60 { 61 if (repainting) return; 62 repainting = true; 63 if (offscreen == null) return; 66 offscreen.clearRect(0,0, this.getWidth(), this.getHeight()); 67 JInternalFrame[] frames = this.getAllFrames(); 68 offscreen.drawLine( frames[0].getLocation().x+frames[0].getWidth()/2, 70 frames[0].getLocation().y+frames[0].getHeight()/2, 71 frames[1].getLocation().x+frames[1].getWidth()/2, 72 frames[1].getLocation().y+frames[1].getHeight()/2); 73 74 super.paintChildren(offscreen); 75 g.drawImage( offscreenImage,0,0,(ImageObserver)this); 76 repainting = false; 77 } 78 79 public void repaint() 80 { 81 paint( this.getGraphics() ); 82 } 83 90 } 91 | Popular Tags |