00001 /* 00002 * AbstractPlot.java 00003 * 00004 * Copyright (C) 2005 Project SQUID, http://www.cs.helsinki.fi/group/squid/ 00005 * 00006 * This file is part of Ikayaki. 00007 * 00008 * Ikayaki is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * Ikayaki is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with Ikayaki; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 package ikayaki.gui; 00024 00025 import javax.swing.*; 00026 import java.awt.*; 00027 00033 public abstract class AbstractPlot extends JPanel implements Plot { 00034 00035 00039 @Override public void paintComponent(Graphics g) { 00040 super.paintComponent(g); 00041 00042 Dimension d = getSize(); 00043 Graphics2D g2 = (Graphics2D) g; 00044 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 00045 g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); 00046 00047 render(d.width, d.height, g2); 00048 g2.dispose(); 00049 } 00050 00058 public abstract void render(int w, int h, Graphics2D g2); 00059 00060 }