Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 protected void uninstallListeners(JComponent c) {
   super.uninstallListeners(c);
   c.removePropertyChangeListener(this);
   if (viewportViewFocusHandler != null) {
     JViewport viewport = ((JScrollPane) c).getViewport();
     viewport.removeContainerListener(viewportViewFocusHandler);
     if (viewport.getView() != null) {
       viewport.getView().removeFocusListener(viewportViewFocusHandler);
     }
     viewportViewFocusHandler = null;
   }
 }
Exemplo n.º 2
0
  public void paintViewport(Graphics g, JViewport c) {
    if (!browser.isPreviewColumnFilled()) {
      Dimension vs = c.getSize();
      Dimension bs = browser.getSize();

      JScrollBar vb = getVerticalBar();

      g.setColor(Color.black);
      Dimension ss = vb.getPreferredSize();

      // Paint scroll bar tracks at the right to fill the viewport
      if (bs.width < vs.width) {
        int fixedCellWidth = browser.getFixedCellWidth();

        // FIXME - Apparently we have to do layout manually, because
        //         invoking cellRendererPane.paneComponent with
        //         "shouldValidate" set to true does not appear to have
        //         the desired effect.
        try {
          vb.setSize(ss.width, vs.height);
          vb.doLayout();
        } catch (NullPointerException e) {
          // We get NPE here in JDK 1.3. We ignore it.
        }

        for (int x = browser.getWidth() + fixedCellWidth;
            x < vs.width;
            x += fixedCellWidth + ss.width) {
          getCellRendererPane().paintComponent(g, vb, c, x, 0, ss.width, vs.height, false);
        }
      }
    }
  }