Package games.stendhal.client.gui.styled

Source Code of games.stendhal.client.gui.styled.WoodStyle

/* $Id: WoodStyle.java,v 1.18 2011/01/16 12:01:42 kiheru Exp $ */
/***************************************************************************
*                   (C) Copyright 2003-2010 - Stendhal                    *
***************************************************************************
***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
***************************************************************************/
package games.stendhal.client.gui.styled;


import games.stendhal.client.sprite.Sprite;
import games.stendhal.client.sprite.SpriteStore;

import java.awt.Color;
import java.awt.Font;

import javax.swing.border.Border;

/**
* The wood style.
*/
public class WoodStyle implements Style {
  private static final Color highLightColor = new Color(163, 120, 97);
  private static final Color shadowColor = new Color(50, 25, 12);
  private static final Color plainColor = new Color(107, 72, 50);

  /**
   * A shared instance.
   */
  private static Style sharedInstance;

  /**
   * The background texture.
   */
  protected Sprite background;

  /**
   * The border.
   */
  protected Border border;
  /**
   * Downwards border (for buttons etc)
   */
  protected Border borderDown;

  /**
   * The default font.
   */
  protected Font font;

  public WoodStyle() {
    /*
     * Load the texture
     */
    final SpriteStore st = SpriteStore.get();
    background = st.getSprite("data/gui/panelwood119.jpg");

    border = new PixmapBorder(background, true);
    borderDown = new PixmapBorder(background, false);

    font = new Font("Dialog", Font.PLAIN, 12);
  }

  //
  // WoodStyle
  //

  /**
   * Get a shared instance.
   *
   * @return A shared instance.
   */
  public static synchronized Style getInstance() {
    if (sharedInstance == null) {
      sharedInstance = new WoodStyle();
    }

    return sharedInstance;
  }

  //
  // Style
  //

  /**
   * Get the background texture.
   *
   * @return A texture sprite.
   */
  public Sprite getBackground() {
    return background;
  }

  /**
   * Get component border.
   *
   * @return A border, or <code>null</code> to use default.
   */
  public Border getBorder() {
    return border;
  }
 
  /**
   * Get lowered component border.
   *
   * @return A border, or <code>null</code> to use default.
   */
  public Border getBorderDown() {
    return borderDown;
  }

  /**
   * Get the normal font.
   *
   * @return A font.
   */
  public Font getFont() {
    return font;
  }

  /**
   * Get the foreground color appropriate for the background texture.
   *
   * @return A color.
   */
  public Color getForeground() {
    return Color.white;
  }

  public Color getHighLightColor() {
    return highLightColor;
  }

  public Color getShadowColor() {
    return shadowColor;
  }
 
  /**
   * Get a color that roughly represents the background.
   *
   * @return plain color
   */
  public Color getPlainColor() {
    return plainColor;
  }
}
TOP

Related Classes of games.stendhal.client.gui.styled.WoodStyle

TOP
Copyright © 2018 www.massapi.com. 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.