Package javax.swing

Examples of javax.swing.RepaintManager$ProcessingRunnable


     * as a result of repaint) and getting the current RepaintManager and
     * turning off double buffering in the RepaintManager before calling
     * super.paintImmediately(g).
     */
    public void paintImmediately(int x,int y,int w, int h) {
        RepaintManager repaintManager = null;
        boolean save = true;
        if (!isDoubleBuffered()) {
             repaintManager = RepaintManager.currentManager(this);
             save = repaintManager.isDoubleBufferingEnabled();
             repaintManager.setDoubleBufferingEnabled(false);
        }
        super.paintImmediately(x, y, w, h);

        if (repaintManager != null) {
            repaintManager.setDoubleBufferingEnabled(save);
        }
    }
View Full Code Here


      }
       
    }
   
    public static void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
      }
View Full Code Here

        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
      }

      public static void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
      }
View Full Code Here

  public int print(Graphics g, PageFormat printFormat, int page)
  {
    int result = NO_SUCH_PAGE;

    // Disables double-buffering before printing
    RepaintManager currentManager = RepaintManager
        .currentManager(mxGraphComponent.this);
    currentManager.setDoubleBufferingEnabled(false);

    // Gets the current state of the view
    mxGraphView view = graph.getView();

    // Stores the old state of the view
    boolean eventsEnabled = view.isEventsEnabled();
    mxPoint translate = view.getTranslate();

    // Disables firing of scale events so that there is no
    // repaint or update of the original graph while pages
    // are being printed
    view.setEventsEnabled(false);

    // Uses the view to create temporary cell states for each cell
    mxTemporaryCellStates tempStates = new mxTemporaryCellStates(view,
        1 / pageScale);

    try
    {
      view.setTranslate(new mxPoint(0, 0));

      mxGraphics2DCanvas canvas = createCanvas();
      canvas.setGraphics((Graphics2D) g);
      canvas.setScale(1 / pageScale);

      view.revalidate();

      mxRectangle graphBounds = graph.getGraphBounds();
      Dimension pSize = new Dimension((int) Math.ceil(graphBounds.getX()
          + graphBounds.getWidth()) + 1, (int) Math.ceil(graphBounds
          .getY() + graphBounds.getHeight()) + 1);

      int w = (int) (printFormat.getImageableWidth());
      int h = (int) (printFormat.getImageableHeight());
      int cols = (int) Math.max(
          Math.ceil((double) (pSize.width - 5) / (double) w), 1);
      int rows = (int) Math.max(
          Math.ceil((double) (pSize.height - 5) / (double) h), 1);

      if (page < cols * rows)
      {
        int dx = (int) ((page % cols) * printFormat.getImageableWidth());
        int dy = (int) (Math.floor(page / cols) * printFormat
            .getImageableHeight());

        g.translate(-dx + (int) printFormat.getImageableX(), -dy
            + (int) printFormat.getImageableY());
        g.setClip(dx, dy, (int) (dx + printFormat.getWidth()),
            (int) (dy + printFormat.getHeight()));

        graph.drawGraph(canvas);

        result = PAGE_EXISTS;
      }
    }
    finally
    {
      view.setTranslate(translate);

      tempStates.destroy();
      view.setEventsEnabled(eventsEnabled);

      // Enables double-buffering after printing
      currentManager.setDoubleBufferingEnabled(true);
    }

    return result;
  }
View Full Code Here

        // we can fire listener events when the window is resized (unlike Forte). We can only do this if we are not adjusting.
        AWTEvent currentEvent = GlassPaneWithEvents.getCurrentEvent();
        if ((currentEvent instanceof MouseEvent || currentEvent instanceof KeyEvent) && !e.getValueIsAdjusting()) {
        // TF:31 Oct 2008:Don't post the event if we're in the process of laying out.
        Component source = ((JScrollPane)((JScrollBar)e.getSource()).getParent()).getViewport().getView();
        RepaintManager manager = RepaintManager.currentManager(source);
        if (!(manager instanceof ForteRepaintManager && ((ForteRepaintManager)manager).isValidating())) {
          EventManager.startEventChain();

          // Post the event on the actual component contained in the scroll pane
          ClientEventManager.postEvent(source, "AfterFieldScrolled");
View Full Code Here

        // we can fire listener events when the window is resized (unlike Forte). We can only do this if we are not adjusting.
        AWTEvent currentEvent = GlassPaneWithEvents.getCurrentEvent();
        if ((currentEvent instanceof MouseEvent || currentEvent instanceof KeyEvent) && !e.getValueIsAdjusting()) {
        // TF:31 Oct 2008:Don't post the event if we're in the process of laying out.
        Component source = ((JScrollPane)((JScrollBar)e.getSource()).getParent()).getViewport().getView();
        RepaintManager manager = RepaintManager.currentManager(source);
        if (!(manager instanceof ForteRepaintManager && ((ForteRepaintManager)manager).isValidating())) {
          EventManager.startEventChain();

          // Post the event on the actual component contained in the scroll pane
          ClientEventManager.postEvent(source, "AfterFieldScrolled");
View Full Code Here

        // we can fire listener events when the window is resized (unlike Forte). We can only do this if we are not adjusting.
        AWTEvent currentEvent = GlassPaneWithEvents.getCurrentEvent();
        if ((currentEvent instanceof MouseEvent || currentEvent instanceof KeyEvent) && !e.getValueIsAdjusting()) {
        // TF:31 Oct 2008:Don't post the event if we're in the process of laying out.
        Component source = ((JScrollPane)((JScrollBar)e.getSource()).getParent()).getViewport().getView();
        RepaintManager manager = RepaintManager.currentManager(source);
        if (!(manager instanceof ForteRepaintManager && ((ForteRepaintManager)manager).isValidating())) {
          EventManager.startEventChain();

          // Post the event on the actual component contained in the scroll pane
          ClientEventManager.postEvent(source, "AfterFieldScrolled");
View Full Code Here

    /**
     * Returns delegate {@code RepaintManager} for {@code component} hierarchy.
     */
    public static RepaintManager getDelegateRepaintManager(Component
                                                            component) {
        RepaintManager delegate = null;
        if (Boolean.TRUE == AppContext.getAppContext().get(
                                               DELEGATE_REPAINT_MANAGER_KEY)) {
            while (delegate == null && component != null) {
                while (component != null
                         && ! (component instanceof JComponent)) {
View Full Code Here

                    //it used to be 1, but now is not. Save the oldOpaque
                    oldOpaque = isOpaque();
                    setOpaque(false);
                }
               
                RepaintManager manager = RepaintManager.currentManager(this);
                RepaintManager trm = SwingXUtilities.getTranslucentRepaintManager(manager);
                RepaintManager.setCurrentManager(trm);
            } else if (alpha == 1) {
                //restore the oldOpaque if it was true (since opaque is false now)
                if (oldOpaque) {
                    setOpaque(true);
View Full Code Here

    /**
        Installs the NullRepaintManager.
    */
    public static void install() {
        RepaintManager repaintManager = new NullRepaintManager();
        repaintManager.setDoubleBufferingEnabled(false);
        RepaintManager.setCurrentManager(repaintManager);
    }
View Full Code Here

TOP

Related Classes of javax.swing.RepaintManager$ProcessingRunnable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.