/** * Constructor for separate display and data images. * * @param displayImg image to be displayed * * @param dataImg an image with bounds equal to, or enclosing, those of * displayImg and which contains data that will be reported in the status * bar; if null data will be drawn from the display image * * @param title title for the frame */ public ImageFrame(RenderedImage displayImg, RenderedImage dataImg, String title) { setTitle(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationByPlatform(true); ImagePane pane = new ImagePane(this, displayImg, dataImg); getContentPane().add(pane, BorderLayout.CENTER); sb = new StringBuilder(); statusBar = new JTextField(); statusBar.setEditable(false); statusBar.setMinimumSize(new Dimension(100, 30)); statusBar.setBorder(BorderFactory.createLoweredBevelBorder()); getContentPane().add(statusBar, BorderLayout.SOUTH); pack(); setSize(500, 500); }
/** * Constructor for separate display and data images. * * @param displayImg image to be displayed * * @param dataImg an image with bounds equal to, or enclosing, those of * displayImg and which contains data that will be reported in the status * bar; if null data will be drawn from the display image * * @param title title for the frame */ public ImageFrame(RenderedImage displayImg, RenderedImage dataImg, String title) { setTitle(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationByPlatform(true); ImagePane pane = new ImagePane(this, displayImg, dataImg); getContentPane().add(pane, BorderLayout.CENTER); sb = new StringBuilder(); statusBar = new JTextField(); statusBar.setEditable(false); statusBar.setMinimumSize(new Dimension(100, 30)); statusBar.setBorder(BorderFactory.createLoweredBevelBorder()); getContentPane().add(statusBar, BorderLayout.SOUTH); pack(); setSize(500, 500); }
public static void main(String[] args) { Ripples me = new Ripples(); TiledImage image = ImageUtilities.createConstantImage(300, 300, 0d); me.createRipplesImage(image); ImageFrame frame = new ImageFrame(image, "ripples"); frame.setSize(550, 550); frame.setVisible(true); }
public static void main(String[] args) throws JiffleException { RunProportionalRipples self = new RunProportionalRipples(); String script = "init { C = M_PI * 8; }" + "dx = 2*(x() - 0.5); \n" + "dy = 2*(y() - 0.5); \n" + "d = sqrt(dx*dx + dy*dy); \n" + "destImg = sin(C * d);" ; WritableRenderedImage destImage = ImageUtilities.createConstantImage(500, 500, 0d); self.runScriptWithJiffle(script, "destImg", destImage); ImageFrame frame = new ImageFrame(destImage, "Ripples"); frame.setSize(550, 550); frame.setVisible(true); }