Beispiel #1
0
 public void setImage(BufferedImage image) {
   m_panel.setImage(image);
   setSize(image.getWidth(), image.getHeight());
   m_panel.setSize(image.getWidth(), image.getHeight());
   m_panel.repaint();
   update(getGraphics());
   if (!isVisible()) {
     setVisible(true);
   }
   System.out.println("update image");
 }
  /**
   * Constructor.
   *
   * @param functions the array of functions to plot
   * @param graphPanel the parent graph panel
   */
  HeaderPanel(Plottable functions[], GraphPanel graphPanel) {
    this();
    this.graphPanel = graphPanel;

    fpDimensions = maxFunctionDimensions(functions);

    buttonPanel.setLayout(new FlowLayout());
    buttonPanel.add(headerButton);

    imagePanel.setSize(fpDimensions);

    functionCard.add(buttonPanel, BorderLayout.WEST);
    functionCard.add(imagePanel, BorderLayout.CENTER);

    cardLayout.show(this, FUNCTION);

    // Header button handler.
    headerButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            HeaderPanel.this.graphPanel.doHeaderAction(); // callback
          }
        });
  }