Ejemplo n.º 1
0
  /**
   * DOCUMENT ME!
   *
   * @param c DOCUMENT ME!
   */
  private void updateStyle(JTextComponent c) {
    SeaGlassContext context = getContext(c, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    updateSearchStyle(c, context, getPropertyPrefix());

    if (style != oldStyle) {
      updateStyle(c, context, getPropertyPrefix());

      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }

    context.dispose();

    context = getContext(c, SeaGlassRegion.SEARCH_FIELD_FIND_BUTTON, ENABLED);
    findStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, SeaGlassRegion.SEARCH_FIELD_CANCEL_BUTTON, ENABLED);
    cancelStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();
  }
  private void updateStyle(JToolBar c) {
    SeaGlassContext context = getContext(c, Region.TOOL_BAR_CONTENT, null, ENABLED);
    contentStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.getComponent().setOpaque(false);
    context.dispose();

    context = getContext(c, Region.TOOL_BAR_DRAG_WINDOW, null, ENABLED);
    context.getComponent().setOpaque(false);
    dragWindowStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, ENABLED);
    context.getComponent().setOpaque(false);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);
    if (oldStyle != style) {
      handleIcon = style.getIcon(context, "ToolBar.handleIcon");
      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }
    context.dispose();
  }
  private void updateStyle(JTextComponent comp) {
    SeaGlassContext context = getContext(comp, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    if (style != oldStyle) {
      SeaGlassTextFieldUI.updateStyle(comp, context, getPropertyPrefix());

      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }
    context.dispose();
  }
Ejemplo n.º 4
0
  /**
   * Update the style.
   *
   * @param c the component.
   */
  private void updateStyle(JTable c) {
    SeaGlassContext context = getContext(c, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    selectionActiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionActiveBottom");
    selectionInactiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionInactiveBottom");
    transparentColor = UIManager.getColor("seaGlassTransparent");

    if (style != oldStyle) {
      table.remove(rendererPane);
      rendererPane = createCustomCellRendererPane();
      table.add(rendererPane);

      context.setComponentState(ENABLED | SELECTED);

      Color sbg = table.getSelectionBackground();

      if (sbg == null || sbg instanceof UIResource) {
        table.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND));
      }

      Color sfg = table.getSelectionForeground();

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

      context.setComponentState(ENABLED);

      Color gridColor = table.getGridColor();

      if (gridColor == null || gridColor instanceof UIResource) {
        gridColor = (Color) style.get(context, "Table.gridColor");
        if (gridColor == null) {
          gridColor = style.getColor(context, ColorType.FOREGROUND);
        }

        table.setGridColor(gridColor);
      }

      useTableColors = style.getBoolean(context, "Table.rendererUseTableColors", true);
      useUIBorder = style.getBoolean(context, "Table.rendererUseUIBorder", true);

      Object rowHeight = style.get(context, "Table.rowHeight");

      if (rowHeight != null) {
        LookAndFeel.installProperty(table, "rowHeight", rowHeight);
      }

      boolean showGrid = style.getBoolean(context, "Table.showGrid", true);

      if (!showGrid) {
        table.setShowGrid(false);
      }

      Dimension d = table.getIntercellSpacing();
      // if (d == null || d instanceof UIResource) {
      if (d != null) {
        d = (Dimension) style.get(context, "Table.intercellSpacing");
      }

      alternateColor = (Color) style.get(context, "Table.alternateRowColor");
      if (d != null) {
        table.setIntercellSpacing(d);
      }

      table.setOpaque(false);

      if (alternateColor != null) {
        table.setShowHorizontalLines(false);
      }

      // Make header column extend the width of the viewport (if there is
      // a viewport).
      table.getTableHeader().setBorder(createTableHeaderEmptyColumnPainter(table));
      setViewPortListeners(table);

      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }

    context.dispose();
  }