Пример #1
0
 public void paint(Graphics g) {
   if (g instanceof Graphics2D) {
     Graphics2D g2 = (Graphics2D) g;
     g2.setRenderingHint(
         RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
     g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   }
   super.paint(g);
 }
Пример #2
0
 /**
  * Adds drag and drop functionality.
  *
  * @param comp component
  * @param dnd drag and drop handler
  */
 public static void addDrop(final JComponent comp, final DropHandler dnd) {
   comp.setDropTarget(
       new DropTarget(comp, DnDConstants.ACTION_COPY_OR_MOVE, null, true, null) {
         @Override
         public synchronized void drop(final DropTargetDropEvent dtde) {
           dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
           final Transferable tr = dtde.getTransferable();
           for (final Object o : contents(tr)) dnd.drop(o);
           comp.requestFocusInWindow();
         }
       });
 }
Пример #3
0
  /* (non-Javadoc)
   * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
   */
  protected void paintComponent(Graphics arg0) {
    // long time1 = System.currentTimeMillis();
    try {
      super.paintComponent(arg0);
      if (this.isOpaque()) {
        Rectangle clipBounds = arg0.getClipBounds();
        arg0.setColor(this.getBackground());
        arg0.fillRect(clipBounds.x, clipBounds.y, clipBounds.width, clipBounds.height);
      }
      this.rblock.paint(arg0);

      // Paint FrameContext selection

      RenderablePoint start = this.startSelection;
      RenderablePoint end = this.endSelection;
      if (start != null && end != null && !start.equals(end)) {
        this.rblock.paintSelection(arg0, false, start, end);
      }
    } finally {
      // long time2 = System.currentTimeMillis();
      // System.out.println("NonScrollableHtmlPanel.paintComponent(): numRenderables=" +
      // numRenderables + ",time=" + (time2 - time1) + " ms.");
    }
  }
Пример #4
0
 private void doRepaint() {
   super.repaint();
 }
Пример #5
0
 /**
  * Called by the AWT when this component is removed from it's parent. This stops clears the
  * currently focused component.
  */
 public void removeNotify() {
   super.removeNotify();
   if (focusedComponent == this) focusedComponent = null;
 }
Пример #6
0
 public void invalidate() {
   super.invalidate();
   this.rblock.invalidate();
 }