示例#1
0
  private void updateStyle(JComponent c) {
    SynthContext context = getContext(list, ENABLED);
    SynthStyle oldStyle = style;

    style = SynthLookAndFeel.updateStyle(context, this);

    if (style != oldStyle) {
      context.setComponentState(SELECTED);
      Color sbg = list.getSelectionBackground();
      if (sbg == null || sbg instanceof UIResource) {
        list.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND));
      }

      Color sfg = list.getSelectionForeground();
      if (sfg == null || sfg instanceof UIResource) {
        list.setSelectionForeground(style.getColor(context, ColorType.TEXT_FOREGROUND));
      }

      useListColors = style.getBoolean(context, "List.rendererUseListColors", true);
      useUIBorder = style.getBoolean(context, "List.rendererUseUIBorder", true);

      int height = style.getInt(context, "List.cellHeight", -1);
      if (height != -1) {
        list.setFixedCellHeight(height);
      }
      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }
    context.dispose();
  }
示例#2
0
  /**
   * Notifies this UI delegate to repaint the specified component. This method paints the component
   * background, then calls the {@link #paint(SynthContext,Graphics)} method.
   *
   * <p>In general, this method does not need to be overridden by subclasses. All Look and Feel
   * rendering code should reside in the {@code paint} method.
   *
   * @param g the {@code Graphics} object used for painting
   * @param c the component being painted
   * @see #paint(SynthContext,Graphics)
   */
  @Override
  public void update(Graphics g, JComponent c) {
    SynthContext context = getContext(c);

    SynthLookAndFeel.update(context, g);
    context.getPainter().paintScrollPaneBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
    paint(context, g);
  }
示例#3
0
  /** @inheritDoc */
  @Override
  protected void uninstallDefaults() {
    super.uninstallDefaults();

    SynthContext context = getContext(list, ENABLED);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;
  }
示例#4
0
 @Override
 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
   JComponent jc = (JComponent) c;
   SynthContext context = getContext(jc);
   SynthStyle style = context.getStyle();
   if (style == null) {
     assert false : "SynthBorder is being used outside after the " + " UI has been uninstalled";
     return;
   }
   context.getPainter().paintViewportBorder(context, g, x, y, width, height);
 }
示例#5
0
 /** @inheritDoc */
 @Override
 public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) {
   context.getPainter().paintListBorder(context, g, x, y, w, h);
 }
示例#6
0
 private SynthContext getContext(JComponent c, int state) {
   return SynthContext.getContext(
       SynthContext.class, c, SynthLookAndFeel.getRegion(c), style, state);
 }
示例#7
0
 ViewportBorder(SynthContext context) {
   this.insets = (Insets) context.getStyle().get(context, "ScrollPane.viewportBorderInsets");
   if (this.insets == null) {
     this.insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS;
   }
 }
示例#8
0
 private SynthContext getContext(JComponent c, int state) {
   return SynthContext.getContext(c, style, state);
 }