コード例 #1
0
  @Override
  public void paint(Graphics g) {
    Image mImage = createImage(this.getWidth(), this.getHeight());
    Graphics2D ga = (Graphics2D) mImage.getGraphics();

    ga.setRenderingHint(
        RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
    ga.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    ga.setRenderingHint(
        RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
    ga.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
    ga.setRenderingHint(
        RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
    ga.setRenderingHint(
        RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
    ga.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
    ga.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
    ga.setRenderingHint(
        RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    for (String nome : canvasControl.getVisibleKeys()) {
      MainWindowControl.getUniqueInstance().getGraphCanvasList().get(nome).paint(ga, this);
    }

    g.drawImage(mImage, 0, 0, null);
  }
コード例 #2
0
  public FrameCanvas(FrameCanvasControl canvasControl) {
    super();

    this.canvasControl = canvasControl;

    /* adicionando listener no model, para quando houver edições */
    final GraphModel gm = MainWindowControl.getUniqueInstance().getGraphModel();
    gm.addListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            repaint();
          }
        });
  }