コード例 #1
0
ファイル: DisplayImage.java プロジェクト: milianw/scivi
 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");
 }
コード例 #2
0
  /**
   * 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
          }
        });
  }