Package org.anks.sudoku.util

Examples of org.anks.sudoku.util.Configuration


   */
  public void compose(Board board) throws UnableToComposeException
  {
    try
    {
      Configuration config = Configuration.getIstance();
      int puzzleCount = config.getInteger("sudoku.storedPuzzles.count");
      int index = (int) Math.floor(puzzleCount * Math.random());

      ZipInputStream zipStream = new ZipInputStream(
          ClassLoader.getSystemResourceAsStream(config.getStringValue("sudoku.storedPuzzles.path")));

      int counter = 0;

      while (zipStream.getNextEntry() != null)
      {
View Full Code Here


    repaint();
  }

  protected void paintComponent(Graphics g)
  {
    Configuration config = Configuration.getIstance();
    g.setColor(getCurrentColor());

    g.fill3DRect(0, 0, getWidth(), getHeight(), true);

    int hintMode = config.getInteger("sudoku.ui.hintMode");

    Integer value = this.cell.getValue();
    Set<Integer> allowedValues = cell.getAllowedValues();

    if (value != null)
      drawNumber(value.toString(), g,
          config.getColor("sudoku.ui.cell.textColor"), 0, 0,
          getWidth(), getHeight());
    else if (((isFocusOwner() && hintMode > 0) || hintMode == 2)
        && allowedValues != null)
    {
      int boardSize = config.getInteger("sudoku.core.size");
      int width = getWidth() / boardSize;
      int height = getHeight() / boardSize;

      Color allowedValuesTextColor = config.getColor("sudoku.ui.cell.hintsTextColor");

      for (Integer val : allowedValues)
      {
        int x = ((val.intValue() - 1) % boardSize) * width;
        int y = ((val.intValue() - 1) / boardSize) * width;
 
View Full Code Here

  }

  private Color getCurrentColor()
  {
    Color result = null;
    Configuration config = Configuration.getIstance();

    if (isFocusOwner())
      result = config.getColor("sudoku.ui.cell.focusOwnerColor");
    else if (config.getBoolean("sudoku.ui.showErrors")
        && cell.isConflict())
      result = config.getColor("sudoku.ui.cell.conflictColor");
    else if (cell.isLocked())
      result = config.getColor("sudoku.ui.cell.lockedColor");
    else
      result = config.getColor("sudoku.ui.cell.color");

    return result;
  }
View Full Code Here

TOP

Related Classes of org.anks.sudoku.util.Configuration

Copyright © 2018 www.massapicom. 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.