Пример #1
0
 public static void setEstilo(String pEstilo) {
   Estilo estilo = Estilo.valueOf(pEstilo);
   switch (estilo) {
     case DEFAULT:
       COLOR_BLOQUE_PRINCIPAL = Color.RED;
       COLOR_CELDA = Color.BLACK;
       COLOR_NOMBRE_VARIABLE = Color.BLACK;
       COLOR_NOMBRE_LLAMADA = Color.BLUE;
       COLOR_LIENZO = Color.WHITE;
       break;
     case VERDENEGRO:
       COLOR_BLOQUE_PRINCIPAL = Color.GREEN.brighter();
       COLOR_CELDA = Color.GREEN.brighter();
       COLOR_NOMBRE_VARIABLE = Color.GREEN.brighter();
       COLOR_NOMBRE_LLAMADA = Color.GREEN.brighter();
       COLOR_LIENZO = Color.BLACK;
       break;
     case OPUESTO:
       COLOR_BLOQUE_PRINCIPAL = Color.RED;
       COLOR_CELDA = Color.WHITE;
       COLOR_NOMBRE_VARIABLE = Color.WHITE;
       COLOR_NOMBRE_LLAMADA = Color.BLUE;
       COLOR_LIENZO = Color.BLACK;
       break;
   }
 }
Пример #2
0
  protected void addIndexCodingAndBitmasks(Band smBand) {
    final IndexCoding coding = new IndexCoding("SM_coding");
    final MetadataAttribute land =
        coding.addSample("LAND", 0, "Not cloud, shadow or edge AND land");
    final MetadataAttribute flooded =
        coding.addSample("FLOODED", 1, "Not land and not cloud, shadow or edge");
    final MetadataAttribute suspect = coding.addSample("SUSPECT", 2, "Cloud shadow or cloud edge");
    final MetadataAttribute cloud = coding.addSample("CLOUD", 3, "Cloud");
    final MetadataAttribute water = coding.addSample("WATER", 4, "Not land");
    final MetadataAttribute snow = coding.addSample("SNOW", 5, "Snow");
    final MetadataAttribute invalid = coding.addSample("INVALID", 6, "Invalid");
    final Product product = smBand.getProduct();
    product.getIndexCodingGroup().add(coding);
    smBand.setSampleCoding(coding);
    final ColorPaletteDef.Point[] points =
        new ColorPaletteDef.Point[] {
          new ColorPaletteDef.Point(0, Color.GREEN.darker(), "land"),
          new ColorPaletteDef.Point(1, Color.BLUE, "flooded"),
          new ColorPaletteDef.Point(2, Color.ORANGE, "suspect"),
          new ColorPaletteDef.Point(3, Color.GRAY, "cloud"),
          new ColorPaletteDef.Point(4, Color.BLUE.darker(), "water"),
          new ColorPaletteDef.Point(5, Color.LIGHT_GRAY, "snow"),
          new ColorPaletteDef.Point(6, Color.RED, "invalid")
        };
    smBand.setImageInfo(new ImageInfo(new ColorPaletteDef(points)));

    addMask(land, "SM == 0", Color.GREEN.darker(), product);
    addMask(flooded, "SM == 1", Color.BLUE, product);
    addMask(suspect, "SM == 2", Color.ORANGE, product);
    addMask(cloud, "SM == 3", Color.GRAY, product);
    addMask(water, "SM == 4", Color.BLUE.darker(), product);
    addMask(snow, "SM == 5", Color.LIGHT_GRAY, product);
    addMask(invalid, "SM == 6", Color.RED, product);
  }
Пример #3
0
  private void paintElementsProgressBar(Graphics g) {
    int leftPadding = 20;
    int topPadding = 56;
    int splashWidth = getSplashScreen().getSize().width;
    int width = Math.min(10 * counter, splashWidth - (leftPadding * 2 + 2));

    g.setColor(Color.GREEN.darker());
    g.fillRect(leftPadding, topPadding, width, 3);
    g.setColor(Color.GREEN.brighter());
    g.fillRect(leftPadding, topPadding, width, 1);
  }
Пример #4
0
  public static void paintAboveline(Graphics g, JTextComponent tc, int pos0, int pos1)
      throws BadLocationException {
    g.setColor(Color.GREEN.darker());
    TextUI ui = tc.getUI();
    Rectangle r = ui.modelToView(tc, pos1 + 1);
    int h = r.y;

    int max = r.x - 2 + 1;
    int current = ui.modelToView(tc, pos0).x - 1;
    g.drawLine(current, h, max, h);
    g.drawLine(current, h + 1, current, h + 2);
    g.drawLine(max, h + 1, max, h + 2);
  }
Пример #5
0
 /* Color.toString() is not great so we need a way to convert a
  * Color to some easily readable format, since we only
  * support black, white, blue, green, red, & yellow we can
  * easily check these by looking at the RGB values of the
  * color found by calling Color.getRGB().
  */
 public String colorToString(Color color) {
   if (color.getRGB() == Color.BLACK.getRGB()) {
     return "Black";
   } else if (color.getRGB() == Color.BLUE.getRGB()) {
     return "Blue";
   } else if (color.getRGB() == Color.GREEN.getRGB()) {
     return "Green";
   } else if (color.getRGB() == Color.RED.getRGB()) {
     return "Red";
   } else if (color.getRGB() == Color.YELLOW.getRGB()) {
     return "Yellow";
   } else {
     return "No Color Information";
   }
 }
Пример #6
0
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g;
   synchronized (clicks) {
     g2.setColor(Color.RED.darker());
     for (Ellipse2D ellipse : clicks) {
       g2.fill(ellipse);
     }
   }
   g2.setColor(Color.GREEN.darker());
   synchronized (points) {
     for (Ellipse2D ellipse : points.values()) {
       g2.fill(ellipse);
     }
   }
 }
Пример #7
0
    void updateView(TicketItemModifier ticketItemModifier) {
      if (ticketItemModifier == null
          || ticketItemModifier.getModifierType() == TicketItemModifier.MODIFIER_NOT_INITIALIZED) {
        setBackground(null);
        // setIcon(null);
        return;
      }

      if (ticketItemModifier.getModifierType() == TicketItemModifier.NORMAL_MODIFIER) {
        // setIcon(normalIcon);
        setBackground(Color.GREEN.darker());
      } else if (ticketItemModifier.getModifierType() == TicketItemModifier.NO_MODIFIER) {
        // setIcon(noIcon);
        setBackground(Color.RED.darker());
      } else if (ticketItemModifier.getModifierType() == TicketItemModifier.EXTRA_MODIFIER) {
        // setIcon(extraIcon);
        setBackground(Color.ORANGE);
      }
    }
Пример #8
0
  /**
   * This method is called whenever the observed object is changed. An application calls an
   * <tt>Observable</tt> object's <code>notifyObservers</code> method to have all the object's
   * observers notified of the change.
   *
   * @param obj the observable object.
   * @param arg an argument passed to the <code>notifyObservers</code> method.
   */
  public void update(final Observable obj, final Object arg) {
    final String line = (String) arg;
    final String thisLine =
        line.substring(
            line.indexOf("Text [") + "Text [".length(), line.indexOf("]", line.indexOf("Text [")));

    if (thisLine.indexOf(MSG) < 0 && thisLine.indexOf(MSG_LEADER) < 0) {
      return;
    }

    final StringTokenizer stok = new StringTokenizer(thisLine, ";");
    stok.nextToken();
    final String fromNodeId = stok.nextToken();

    final VizNode fromNode = displayNode(fromNodeId);

    // Check if node should be ignored
    if (fromNode == null) {
      return;
    }

    fromNode.setColorInt(Color.GREEN.getRGB());
  }
  private static void paintInvariant(
      Graphics g, Invariant i, int size, int ulcx, int ulcy, int width, int height) {
    boolean b = i.check();
    double w = width * (3 / 4.0) / size;

    if (i instanceof RegionInvariant) {
      RegionInvariant ri = (RegionInvariant) i;
      int A = ri.getA();
      int B = ri.getB();

      if (b) {
        g.setColor(Color.GREEN.brighter());
      } else {
        g.setColor(Color.RED.brighter());
      }

      // g.drawRect( 100 + (int)(A*w), 100, (int)((B-A+1)*w), 400 );
      g.drawRect(
          (int) (ulcx + width / 8.0 + A * w),
          (int) (ulcy + height / 6.0),
          (int) ((B - A + 1) * w),
          (int) (height * 2 / 3.0));
    }
  }
Пример #10
0
 public void wdgmsg(Widget sender, String msg, Object... args) {
   if (sender == in) {
     if (args[0] != null || ((String) args[0]).length() > 0) {
       String cmdText = ((String) args[0]).trim().toUpperCase();
       String cmd =
           cmdText.contains(" ") ? cmdText.substring(0, cmdText.indexOf(" ")).trim() : cmdText;
       cmdText = cmdText.contains(" ") ? cmdText.substring(cmdText.indexOf(" ")).trim() : "";
       append("Command: " + cmd + "\nArguments: " + cmdText, Color.BLUE.darker());
       String[] cmdArgs = cmdText.split(" ");
       in.settext("");
       if (cmd.equals("NIGHTVISION")) {
         if (!cmdArgs[0].trim().equals("")) {
           if (cmdArgs[0].equals("ON") || cmdArgs[0].equals("TRUE"))
             CustomConfig.hasNightVision = true;
           if (cmdArgs[0].equals("OFF") || cmdArgs[0].equals("FALSE"))
             CustomConfig.hasNightVision = false;
         } else {
           append("NIGHTVISION - " + (CustomConfig.hasNightVision ? "ON" : "OFF"));
         }
       } else if (cmd.equals("IRC")) {
         if (!cmdArgs[0].trim().equals("")) {
           if (cmdArgs[0].equals("ON") || cmdArgs[0].equals("TRUE")) CustomConfig.isIRCOn = true;
           if (cmdArgs[0].equals("OFF") || cmdArgs[0].equals("FALSE"))
             CustomConfig.isIRCOn = false;
         } else {
           append("IRC - " + (CustomConfig.isIRCOn ? "ON" : "OFF"));
         }
       }
       if (cmd.equals("SCREENSIZE") || cmd.equals("WINDOWSIZE")) {
         if (!cmdArgs[0].trim().equals("") && cmdArgs.length >= 2) {
           try {
             int x = Integer.parseInt(cmdArgs[0]);
             int y = Integer.parseInt(cmdArgs[1]);
             if (x >= 800 && y >= 600) {
               CustomConfig.setWindowSize(x, y);
             }
             CustomConfig.saveSettings();
             append(
                 "Client must be restarted for new settings to take effect.", Color.RED.darker());
           } catch (NumberFormatException e) {
             append("Dimensions must be numbers");
           }
         } else {
           append("SCREENSIZE = " + CustomConfig.windowSize.toString());
         }
       } else if (cmd.equals("SOUND")) {
         int vol = 0;
         if (!cmdArgs[0].trim().equals("")) {
           try {
             if (cmdArgs[0].equals("ON") || cmdArgs[0].equals("TRUE")) {
               CustomConfig.isSoundOn = true;
             } else if (cmdArgs[0].equals("OFF") || cmdArgs[0].equals("FALSE")) {
               CustomConfig.isSoundOn = false;
             } else if ((vol = Integer.parseInt(cmdArgs[0])) >= 0 && vol <= 100) {
               CustomConfig.sfxVol = vol;
             } else throw new NumberFormatException("vol = " + vol);
           } catch (NumberFormatException e) {
             append("Volume must be an integer between 0-100");
           }
         } else {
           append(
               "SOUND = "
                   + (CustomConfig.isSoundOn ? "ON  " : "OFF ")
                   + "VOLUME = "
                   + CustomConfig.sfxVol);
         }
       } else if (cmd.equals("MUSIC")) {
         int vol = 0;
         if (!cmdArgs[0].trim().equals("")) {
           try {
             if (cmdArgs[0].equals("ON") || cmdArgs[0].equals("TRUE")) {
               CustomConfig.isMusicOn = true;
             } else if (cmdArgs[0].equals("OFF") || cmdArgs[0].equals("FALSE")) {
               CustomConfig.isMusicOn = false;
             } else if ((vol = Integer.parseInt(cmdArgs[0])) >= 0 && vol <= 100) {
               CustomConfig.musicVol = vol;
             } else throw new NumberFormatException("vol = " + vol);
           } catch (NumberFormatException e) {
             append("Volume must be an integer between 0-100");
           }
         } else {
           append(
               "MUSIC = "
                   + (CustomConfig.isMusicOn ? "ON  " : "OFF ")
                   + "VOLUME = "
                   + CustomConfig.musicVol);
         }
       } else if (cmd.equals("SAVE")) {
         CustomConfig.saveSettings();
       } else if (cmd.equals("FORCESAVE")) {
         CustomConfig.isSaveable = true;
         CustomConfig.saveSettings();
       } else if (cmd.equals("DEBUG")) {
         if (!cmdArgs[0].trim().equals("")) {
           if (cmdArgs[0].equals("IRC")) {
             if (cmdArgs.length >= 2) {
               if (cmdArgs[1].equals("ON") || cmdArgs[1].equals("TRUE")) {
                 CustomConfig.logIRC = true;
               } else if (cmdArgs[1].equals("OFF") || cmdArgs[1].equals("FALSE")) {
                 CustomConfig.logIRC = false;
               }
             } else {
               append("DEBUG LOGS", Color.BLUE.darker());
               append("IRC - " + (CustomConfig.logIRC ? "ON" : "OFF"), Color.GREEN.darker());
             }
           } else if (cmdArgs[0].equals("SRVMSG")) {
             if (cmdArgs.length >= 2) {
               if (cmdArgs[1].equals("ON") || cmdArgs[1].equals("TRUE")) {
                 CustomConfig.logServerMessages = true;
               } else if (cmdArgs[1].equals("OFF") || cmdArgs[1].equals("FALSE")) {
                 CustomConfig.logServerMessages = false;
               }
             } else {
               append("DEBUG LOGS", Color.BLUE.darker());
               append(
                   "SRVMSG - " + (CustomConfig.logServerMessages ? "ON" : "OFF"),
                   Color.GREEN.darker());
             }
           }
           if (cmdArgs[0].equals("LOAD")) {
             if (cmdArgs.length >= 2) {
               if (cmdArgs[1].equals("ON") || cmdArgs[1].equals("TRUE")) {
                 CustomConfig.logLoad = true;
               } else if (cmdArgs[1].equals("OFF") || cmdArgs[1].equals("FALSE")) {
                 CustomConfig.logLoad = false;
               }
             } else {
               append("DEBUG LOGS", Color.BLUE.darker());
               append("LOAD - " + (CustomConfig.logLoad ? "ON" : "OFF"), Color.GREEN.darker());
             }
           }
         } else {
           append("DEBUG LOGS", Color.BLUE.darker());
           append("IRC - " + (CustomConfig.logIRC ? "ON" : "OFF"), Color.GREEN.darker());
           append("LOAD - " + (CustomConfig.logLoad ? "ON" : "OFF"), Color.GREEN.darker());
           append(
               "SRVMSG - " + (CustomConfig.logServerMessages ? "ON" : "OFF"),
               Color.GREEN.darker());
         }
       } else if (cmd.equals("HELP")) {
         append(
             "You can check the current status of each variable by "
                 + "typing the command without arguments.",
             Color.RED.darker());
         append("NIGHTVISION TRUE | FALSE | ON | OFF - Turns nightvision on or off");
         append("SCREENSIZE #### #### - Sets the screensize to the specified size.");
         append(
             "SOUND TRUE | FALSE | ON | OFF | 0-100 - Turns the sound effects on/off, or sets "
                 + "the volume to the specified level");
         append(
             "MUSIC TRUE | FALSE | ON | OFF | 0-100 - Turns the music on/off, or sets "
                 + "the volume to the specified level");
         append("SAVE - Saves the current settings if they are saveable.");
         append(
             "FORCESAVE - Saves the current settings whether or not they are "
                 + "saveable (Might cause errors).");
         append(
             "DEBUG IRC | LOAD   ON | OFF - Enables/disables debug text being dumped into the console "
                 + "for the specified system.");
         append("HELP - Shows this text.");
       } else {
         append("Command not recognized.  Type /help to see a list of commands.");
       }
     }
   } else {
     super.wdgmsg(sender, msg, args);
   }
 }
 @Override
 protected void initConfig(WordsWithStyle wordsReservedLanguague) {
   /** ******************************************************** */
   StyleHTML styleHTML = new StyleHTML();
   styleHTML.setColor(Color.BLUE);
   styleHTML.setFontStyle(Font.ITALIC);
   styleHTML.setUnderline(true);
   wordsReservedLanguague.put("\\balgoritmo\\b", styleHTML);
   wordsReservedLanguague.put("\\bfimalgoritmo\\b", styleHTML);
   wordsReservedLanguague.put("\\bvar\\b", styleHTML);
   wordsReservedLanguague.put("\\bdos\\b", styleHTML);
   wordsReservedLanguague.put("\\binicio\\b", styleHTML);
   wordsReservedLanguague.put("\\bprocedimento\\b", styleHTML);
   wordsReservedLanguague.put("\\bfimprocedimento\\b", styleHTML);
   wordsReservedLanguague.put("\\bfuncao\\b", styleHTML);
   wordsReservedLanguague.put("\\bfimfuncao\\b", styleHTML);
   /** ******************************************************** */
   StyleHTML styleComments = new StyleHTML();
   styleComments.setColor(Color.GREEN.darker().darker());
   styleComments.setFontStyle(Font.ITALIC);
   wordsReservedLanguague.put("(?m)//.*$", styleComments);
   /** ******************************************************** */
   StyleHTML styleCommentsMultine = new StyleHTML();
   styleCommentsMultine.setColor(Color.BLUE.brighter());
   styleCommentsMultine.setFontStyle(Font.BOLD);
   wordsReservedLanguague.put("(?m)\\/\\*[\\s\\S]*?\\*\\/", styleCommentsMultine);
   /** ******************************************************** */
   StyleHTML styleString = new StyleHTML();
   styleString.setColor(Color.RED);
   wordsReservedLanguague.put("\\\"(?:\\.|(\\\\\\\")|[^\\\"\\\"\n])*\\\"", styleString);
   wordsReservedLanguague.put("\\'(?:\\.|(\\\\\\')|[^\\'\\'\n])*\\'", styleString);
   /** ******************************************************** */
   StyleHTML styleNumber = new StyleHTML();
   styleNumber.setColor(Color.RED);
   wordsReservedLanguague.put("\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b", styleNumber);
   wordsReservedLanguague.put("\\bfalso\\b", styleNumber);
   wordsReservedLanguague.put("\\bverdadeiro\\b", styleNumber);
   /** ******************************************************** */
   StyleHTML styleTypes = new StyleHTML();
   styleTypes.setColor(Color.RED.darker().darker().darker());
   styleTypes.setUnderline(true);
   wordsReservedLanguague.put("\\binteiro\\b", styleTypes);
   wordsReservedLanguague.put("\\breal\\b", styleTypes);
   wordsReservedLanguague.put("\\bcaractere\\b", styleTypes);
   wordsReservedLanguague.put("\\bcaracter\\b", styleTypes);
   wordsReservedLanguague.put("\\blogico\\b", styleTypes);
   wordsReservedLanguague.put("\\bvetor\\b", styleTypes);
   /** ******************************************************** */
   StyleHTML styleCode = new StyleHTML();
   styleCode.setColor(Color.BLUE.darker().darker());
   wordsReservedLanguague.put("\\bescreva\\b", styleCode);
   wordsReservedLanguague.put("\\bescreval\\b", styleCode);
   wordsReservedLanguague.put("\\bleia\\b", styleCode);
   wordsReservedLanguague.put("\\bse\\b", styleCode);
   wordsReservedLanguague.put("\\bentao\\b", styleCode);
   wordsReservedLanguague.put("\\bsenao\\b", styleCode);
   wordsReservedLanguague.put("\\bfimse\\b", styleCode);
   wordsReservedLanguague.put("\\bescolha\\b", styleCode);
   wordsReservedLanguague.put("\\bfimescolha\\b", styleCode);
   wordsReservedLanguague.put("\\bcaso\\b", styleCode);
   wordsReservedLanguague.put("\\boutrocaso\\b", styleCode);
   wordsReservedLanguague.put("\\bate\\b", styleCode);
   wordsReservedLanguague.put("\\bde\\b", styleCode);
   wordsReservedLanguague.put("\\bfaca\\b", styleCode);
   wordsReservedLanguague.put("\\bpara\\b", styleCode);
   wordsReservedLanguague.put("\\bfimpara\\b", styleCode);
   wordsReservedLanguague.put("\\bdiv\\b", styleCode);
   wordsReservedLanguague.put("\\brepita\\b", styleCode);
   /** ******************************************************** */
 }
  /**
   * A private constructor to create a new editor frame based on the specified prefs configuration.
   *
   * @param prefs: the configuration to use.
   */
  private PreferencesGUIEditorFrame(final ClientPreferences prefs) {
    super("Crystal Configuration Editor");
    Assert.assertNotNull(prefs);

    final ClientPreferences copyPrefs = prefs.clone();
    final Map<JComponent, Boolean> changedComponents = new HashMap<JComponent, Boolean>();
    final Map<JTextField, Boolean> validEditorText = new HashMap<JTextField, Boolean>();
    final Map<ProjectPreferences, Map<JTextField, Boolean>> validTextSet =
        new HashMap<ProjectPreferences, Map<JTextField, Boolean>>();
    final JFrame frame = this;
    frame.setIconImage(
        (new ImageIcon(
                Constants.class.getResource("/crystal/client/images/crystal-ball_blue_128.png")))
            .getImage());

    if (copyPrefs.getProjectPreference().isEmpty()) {
      // ClientPreferences client = new ClientPreferences("/usr/bin/hg/", "/tmp/crystalClient/");
      ProjectPreferences newGuy =
          new ProjectPreferences(
              new DataSource("", "", DataSource.RepoKind.HG, false, null), copyPrefs);
      try {
        copyPrefs.addProjectPreferences(newGuy);
        copyPrefs.setChanged(true);
      } catch (DuplicateProjectNameException e) {
        // Just ignore the duplicate project name
      }
    }

    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

    //		getContentPane().add(new JLabel("Closing this window will save the configuraion
    // settings."));

    //		JPanel hgPanel = new JPanel();
    //		hgPanel.setLayout(new BoxLayout(hgPanel, BoxLayout.X_AXIS));
    //		hgPanel.add(new JLabel("Path to hg executable:"));
    //		final JTextField hgPath = new JTextField(prefs.getHgPath());
    // hgPath.setSize(hgPath.getWidth(), 16);
    //		hgPanel.add(hgPath);
    //		hgPath.addKeyListener(new KeyListener() {
    //			public void keyPressed(KeyEvent arg0) {
    //			}
    //
    //			public void keyTyped(KeyEvent arg0) {
    //			}
    //
    //			public void keyReleased(KeyEvent arg0) {
    //				prefs.setHgPath(hgPath.getText());
    //				prefs.setChanged(true);
    //				frame.pack();
    //			}
    //		});
    //
    //		JButton hgButton = new JButton("find");
    //		hgPanel.add(hgButton);
    //		hgButton.addActionListener(new ActionListener() {
    //			public void actionPerformed(ActionEvent e) {
    //				new MyPathChooser("Path to hg executable", hgPath, JFileChooser.FILES_ONLY);
    //				prefs.setChanged(true);
    //			}
    //		});
    //		getContentPane().add(hgPanel);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new SpringLayout());

    for (int i = 0; i < 2; i++) {
      topPanel.add(new JLabel());
    }

    topPanel.add(new JLabel("Valid?"));

    JPanel tempPanel = new JPanel();
    tempPanel.setLayout(new BoxLayout(tempPanel, BoxLayout.X_AXIS));
    topPanel.add(new JLabel("Path to scratch space: "));

    final JTextField tempPath = new JTextField(copyPrefs.getTempDirectory());
    final JLabel tempPathState = new JLabel();
    tempPanel.add(tempPath);

    changedComponents.put(tempPath, false);
    boolean pathValid =
        ValidInputChecker.checkDirectoryPath(tempPath.getText())
            || ValidInputChecker.checkUrl(tempPath.getText());
    if (pathValid) {
      tempPathState.setText("  valid");
      tempPathState.setForeground(Color.GREEN.darker());
    } else {
      tempPathState.setText("invalid");
      tempPathState.setForeground(Color.RED.darker());
    }
    validEditorText.put(tempPath, pathValid);

    tempPath.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {}

          public void keyTyped(KeyEvent arg0) {}

          public void keyReleased(KeyEvent arg0) {
            // TODO check if text is valid text
            copyPrefs.setTempDirectory(tempPath.getText());
            changedComponents.put(tempPath, !prefs.getTempDirectory().equals(tempPath.getText()));

            boolean pathValid =
                ValidInputChecker.checkDirectoryPath(tempPath.getText())
                    || ValidInputChecker.checkUrl(tempPath.getText());
            validEditorText.put(tempPath, pathValid);
            if (pathValid) {
              tempPathState.setText("  valid");
              tempPathState.setForeground(Color.GREEN.darker());
            } else {
              tempPathState.setText("invalid");
              tempPathState.setForeground(Color.RED.darker());
            }
            // copyPrefs.setChanged(true);
            frame.pack();
          }
        });

    tempPath.addFocusListener(
        new FocusListener() {

          @Override
          public void focusGained(FocusEvent arg0) {
            tempPath.selectAll();
          }

          @Override
          public void focusLost(FocusEvent arg0) {}
        });
    JButton tempButton = new JButton("find");
    tempPanel.add(tempButton);
    tempButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new MyPathChooser("Path to scratch directory", tempPath, JFileChooser.DIRECTORIES_ONLY);
            // copyPrefs.setChanged(true);
          }
        });

    topPanel.add(tempPanel);
    topPanel.add(tempPathState);

    topPanel.add(new JLabel("Refresh rate: "));

    final JTextField refreshRate = new JTextField(String.valueOf(copyPrefs.getRefresh()));
    final JLabel rateState = new JLabel("  valid");
    rateState.setForeground(Color.GREEN.darker());
    topPanel.add(refreshRate);
    topPanel.add(rateState);
    changedComponents.put(refreshRate, false);
    validEditorText.put(refreshRate, true);

    refreshRate.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {}

          public void keyTyped(KeyEvent arg0) {}

          public void keyReleased(KeyEvent arg0) {

            changedComponents.put(
                refreshRate, !String.valueOf(prefs.getRefresh()).equals(refreshRate.getText()));
            try {
              copyPrefs.setRefresh(Long.valueOf(refreshRate.getText()));
            } catch (Exception e) {

            }
            boolean valid = ValidInputChecker.checkStringToLong(refreshRate.getText());
            validEditorText.put(refreshRate, valid);

            if (valid) {
              rateState.setText("  valid");
              rateState.setForeground(Color.GREEN.darker());
            } else {
              rateState.setText("invalid");
              rateState.setForeground(Color.RED.darker());
            }
            // copyPrefs.setChanged(true);
          }
        });

    SpringLayoutUtility.formGridInColumn(topPanel, 3, 3);
    getContentPane().add(topPanel);

    final JTabbedPane projectsTabs =
        new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    /*
     * projectsTabs.addChangeListener(new ChangeListener() {
     *
     * @Override public void stateChanged(ChangeEvent e) { frame.pack(); System.out.println("Tabs changed"); } });
     */

    for (final ProjectPreferences copyPref : copyPrefs.getProjectPreference()) {
      ProjectPanel current;
      try {
        Map<JTextField, Boolean> validPanel = new HashMap<JTextField, Boolean>();
        validTextSet.put(copyPref, validPanel);
        current =
            new ProjectPanel(
                copyPref,
                copyPrefs,
                frame,
                projectsTabs,
                changedComponents,
                prefs.getProjectPreferences(copyPref.getName()),
                validPanel);
        projectsTabs.addTab(current.getName(), current);
        JPanel pnl = new JPanel();
        JLabel tabName = new JLabel(current.getName());
        pnl.setOpaque(false);
        pnl.add(tabName);
        pnl.add(
            new DeleteProjectButton(
                copyPrefs, projectsTabs, frame, current, copyPref, validTextSet));
        projectsTabs.setTabComponentAt(projectsTabs.getTabCount() - 1, pnl);
        // projectsTabs.setTitleAt(projectsTabs.getTabCount() - 1, current.getName());
      } catch (NonexistentProjectException e1) {
        // never happens
      }
    }

    final JButton newProjectButton = new JButton("Add New Project");
    // final JButton deleteProjectButton = new JButton("Delete This Project");

    newProjectButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // deleteProjectButton.setEnabled(true);
            HashSet<String> shortNameLookup = new HashSet<String>();
            for (ProjectPreferences current : copyPrefs.getProjectPreference()) {
              shortNameLookup.add(current.getName());
            }
            int count = 1;
            while (shortNameLookup.contains("New_Project_" + count++)) ;

            final ProjectPreferences newGuy =
                new ProjectPreferences(
                    new DataSource(
                        "New_Project_" + --count, "", DataSource.RepoKind.HG, false, null),
                    copyPrefs);
            try {
              copyPrefs.addProjectPreferences(newGuy);
            } catch (DuplicateProjectNameException e1) {
              // This should never happen because we just found a clean project name to use.
              throw new RuntimeException(
                  "When I tried to create a new project, I found a nice, clean, unused name:\n"
                      + "New_Project_"
                      + count
                      + "\nbut then the preferences told me that name was in use.  \n"
                      + "This should never happen!");
            }
            Map<JTextField, Boolean> validPanel = new HashMap<JTextField, Boolean>();
            validTextSet.put(newGuy, validPanel);
            final ProjectPanel newGuyPanel =
                new ProjectPanel(
                    newGuy, copyPrefs, frame, projectsTabs, changedComponents, null, validPanel);
            projectsTabs.addTab("New_Project_" + count, newGuyPanel);
            JPanel pnl = new JPanel();
            JLabel tabName = new JLabel(newGuy.getName());

            pnl.setOpaque(false);
            pnl.add(tabName);
            pnl.add(
                new DeleteProjectButton(
                    copyPrefs, projectsTabs, frame, newGuyPanel, newGuy, validTextSet));
            projectsTabs.setTabComponentAt(projectsTabs.getTabCount() - 1, pnl);
            projectsTabs.setSelectedIndex(projectsTabs.getTabCount() - 1);
            copyPrefs.setChanged(true);
            frame.pack();
          }
        });

    /*
    deleteProjectButton.addActionListener(new ActionListener() {
    	public void actionPerformed(ActionEvent e) {
    		int current = projectsTabs.getSelectedIndex();
    		int option = JOptionPane.showConfirmDialog(null, "Do you want to delete project \"" + projectsTabs.getTitleAt(current) + "\"?",
    				"Empty cache", JOptionPane.YES_NO_OPTION);
    		// TODO wait for the current refresh to finish or kill it
    		if(option == JOptionPane.YES_OPTION) {
    			prefs.removeProjectPreferencesAtIndex(current);
    			projectsTabs.remove(current);
    			if (prefs.getProjectPreference().isEmpty())
    				deleteProjectButton.setEnabled(false);
    			prefs.setChanged(true);
    			frame.pack();
    		}
    	}
    });
    */

    getContentPane().add(newProjectButton);
    getContentPane().add(projectsTabs);
    // getContentPane().add(deleteProjectButton);

    JPanel savePanel = new JPanel();
    savePanel.setLayout(new FlowLayout());
    final JButton saveButton = new JButton("Save");
    final JButton cancelButton = new JButton("Cancel");
    savePanel.add(saveButton);
    savePanel.add(cancelButton);
    getContentPane().add(savePanel);

    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (copyPrefs.hasChanged() || changedComponents.values().contains(true)) {
              boolean validPanelText = true;
              for (Map<JTextField, Boolean> map : validTextSet.values()) {
                if (map.values().contains(false)) {
                  validPanelText = false;
                }
              }
              if (!validEditorText.values().contains(false) && validPanelText) {
                try {
                  ClientPreferences.savePreferencesToDefaultXML(copyPrefs);
                } catch (FileNotFoundException fnfe) {
                  _log.error("Could not write to the configuration file. " + fnfe);
                }
                // TODO
                copyPrefs.setChanged(false);
                frame.setVisible(false);
              } else {
                JOptionPane.showMessageDialog(
                    null, "You have invalid input.", "Warning", JOptionPane.ERROR_MESSAGE);
              }
            } else {

              frame.setVisible(false);
            }
          }
        });

    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editorFrame = new PreferencesGUIEditorFrame(prefs);
            copyPrefs.setChanged(false);
            frame.setVisible(false);
          }
        });

    addWindowListener(
        new WindowListener() {
          public void windowClosing(WindowEvent arg0) {
            setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            if (copyPrefs.hasChanged() || changedComponents.values().contains(true)) {
              int n =
                  JOptionPane.showConfirmDialog(
                      null,
                      "Do you want to save your data?",
                      "Saving data",
                      JOptionPane.YES_NO_CANCEL_OPTION);
              if (n == JOptionPane.YES_OPTION) {

                boolean validPanelText = true;
                for (Map<JTextField, Boolean> map : validTextSet.values()) {
                  if (map.values().contains(false)) {
                    validPanelText = false;
                  }
                }
                if (!validEditorText.values().contains(false) && validPanelText) {
                  try {
                    ClientPreferences.savePreferencesToDefaultXML(copyPrefs);
                  } catch (FileNotFoundException fnfe) {
                    _log.error("Could not write to the configuration file. " + fnfe);
                  }
                  // TODO
                  copyPrefs.setChanged(false);
                } else {
                  JOptionPane.showMessageDialog(
                      null, "You have invalid input.", "Warning", JOptionPane.ERROR_MESSAGE);
                  setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
                }
              } else if (n == JOptionPane.CANCEL_OPTION) {
                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              } else { // option is no
                editorFrame = new PreferencesGUIEditorFrame(prefs);
                copyPrefs.setChanged(false);
              }
            }
          }

          public void windowActivated(WindowEvent arg0) {}

          public void windowClosed(WindowEvent arg0) {}

          public void windowDeactivated(WindowEvent arg0) {
            // Reload the preferences
            ConflictSystemTray.getInstance().loadPreferences();
          }

          public void windowDeiconified(WindowEvent arg0) {}

          public void windowIconified(WindowEvent arg0) {}

          public void windowOpened(WindowEvent arg0) {}
        });

    pack();
    // setVisible(true);
  }
Пример #13
0
  /**
   * @param isLotsOfFastOutput use 'true' if you expect millions of lines of quickly produced
   *     output, ex. CLI -> "locate /"
   * @param dialogTitle non-HTML
   * @param cliable the port command thread to .start()
   * @param resultCodeListenable permits intelligence regarding failed port CLI commands, can be
   *     'null'
   */
  private JDialog_ProcessStream(
      final boolean isLotsOfFastOutput,
      final String dialogTitle,
      final Cliable cliable,
      final OneArgumentListenable<Integer> resultCodeListenable) {
    super(
        TheUiHolder.INSTANCE.getMainFrame() // stay on top
        ,
        dialogTitle,
        ModalityType.APPLICATION_MODAL);

    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // required
    this.setUndecorated(_IS_UI_IMMOBILE);
    this.setResizable(_IS_UI_IMMOBILE == false);
    ((JPanel) this.getContentPane())
        .setBorder(BorderFactory.createEmptyBorder(10, 10, 5, 10)); // T L B R

    final Window parent = this.getOwner();
    this.setLocation(parent.getX(), parent.getY());
    this.setSize(parent.getWidth(), parent.getHeight());

    final JList jList = new JList();
    jList.setFont(new Font(Font.MONOSPACED, Font.BOLD, 12));
    jList.setForeground(Color.GREEN.brighter());
    jList.setBackground(Color.BLACK);
    jList.setLayoutOrientation(JList.VERTICAL);
    jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jList.setVisibleRowCount(-1); // all

    final AbstractButton ab_Cancel = FocusedButtonFactory.create("Cancel", "");
    ab_Cancel.setEnabled(false);

    final JProgressBar jProgress = new JProgressBar();
    jProgress.setIndeterminate(true);

    // console
    final Listener listener =
        (isLotsOfFastOutput == true)
            ? new LateListening(this, jList, jProgress, ab_Cancel, resultCodeListenable)
            : new LiveListening(this, jList, jProgress, ab_Cancel, resultCodeListenable);

    //        try
    //        {   // try-catch to keep AWT thread alive for proper UI recovery

    final Thread runningThread = cliable.provideExecutingCommandLineInterfaceThread(listener);
    if (runningThread != null) {
      final JPanel southPanel = new JPanel(new GridLayout(1, 0));
      southPanel.add(jProgress);
      southPanel.add(ab_Cancel);

      final JScrollPane jsp =
          JScrollPaneFactory_.create(jList, EScrollPolicy.VERT_AS_NEEDED__HORIZ_NONE);

      // assemble rest of gui in this AWT thread
      this.add(Box.createHorizontalStrut(800), BorderLayout.NORTH);
      this.add(Box.createVerticalStrut(600), BorderLayout.EAST);
      this.add(jsp, BorderLayout.CENTER);
      this.add(southPanel, BorderLayout.SOUTH);

      // not working correctly to Cancel cli
      //        ab.addActionListener( new ActionListener() // anonymous class
      //                {   @Override public void actionPerformed( ActionEvent e )
      //                    {   thread.interrupt();
      //                        try
      //                        {   // Cancel
      //                            thread.join( 2000 );
      //                        }
      //                        catch( InterruptedException ex )
      //                        {}
      //                    }
      //                } );
    } else { // no Ports binary to run
      this.dispose();
    }

    //        }
    //        catch( Exception ex )
    //        {
    //            ex.printStackTrace();
    //        }
  }
Пример #14
0
 @Override
 public void apply(GameMap map, int pixel, int row, int column) {
   if (pixel == Color.GREEN.getRGB()) {
     map.addPill(new BigPill(row, column));
   }
 }
Пример #15
0
 @Override
 public Color getColor() {
   return Color.GREEN.brighter();
 }
  @Override
  public boolean startDownload() throws Exception {
    try {
      downloadable.setConnectionHandler(this.getManagedConnetionHandler());
      final DiskSpaceReservation reservation = downloadable.createDiskSpaceReservation();
      DownloadPluginProgress downloadPluginProgress = null;
      try {
        if (!downloadable.checkIfWeCanWrite(
            new ExceptionRunnable() {

              @Override
              public void run() throws Exception {
                downloadable.checkAndReserve(reservation);
                createOutputFiles();
                try {
                  downloadable.lockFiles(
                      outputCompleteFile, outputFinalCompleteFile, outputPartFile);
                } catch (FileIsLockedException e) {
                  downloadable.unlockFiles(
                      outputCompleteFile, outputFinalCompleteFile, outputPartFile);
                  throw new PluginException(LinkStatus.ERROR_ALREADYEXISTS);
                }
              }
            },
            null)) {
          throw new SkipReasonException(SkipReason.INVALID_DESTINATION);
        }
        startTimeStamp = System.currentTimeMillis();
        downloadPluginProgress =
            new DownloadPluginProgress(downloadable, this, Color.GREEN.darker());
        downloadable.addPluginProgress(downloadPluginProgress);
        downloadable.setAvailable(AvailableStatus.TRUE);
        download(filePath, downloadable.isResumable());
      } finally {
        try {
          downloadable.free(reservation);
        } catch (final Throwable e) {
          LogSource.exception(logger, e);
        }
        try {
          downloadable.addDownloadTime(System.currentTimeMillis() - getStartTimeStamp());
        } catch (final Throwable e) {
        }
        downloadable.removePluginProgress(downloadPluginProgress);
      }
      if (isDownloadComplete()) {
        logger.info("Download is complete");
        final HashResult hashResult = getHashResult(downloadable, outputPartFile);
        if (hashResult != null) {
          logger.info(hashResult.toString());
          downloadable.setHashResult(hashResult);
        }
        if (hashResult == null || hashResult.match()) {
          downloadable.setVerifiedFileSize(outputPartFile.length());
        } else {
          if (hashResult.getHashInfo().isTrustworthy()) {
            throw new PluginException(
                LinkStatus.ERROR_DOWNLOAD_FAILED,
                _JDT.T.system_download_doCRC2_failed(hashResult.getHashInfo().getType()));
          }
        }
        finalizeDownload(outputPartFile, outputCompleteFile);
        downloadable.setLinkStatus(LinkStatus.FINISHED);
        return true;
      }
      if (externalDownloadStop() == false) {
        throw new PluginException(
            LinkStatus.ERROR_DOWNLOAD_INCOMPLETE, _JDT.T.download_error_message_incomplete());
      }
      return false;
    } finally {
      downloadable.unlockFiles(outputCompleteFile, outputFinalCompleteFile, outputPartFile);
      cleanupDownladInterface();
    }
  }
Пример #17
0
  @Override
  public void glyph(
      final Graphics2D g,
      final Rectangle2D rect,
      final CachedDimRangeSymbolizer symbol,
      final MapLayer layer) {

    int[] ARGB = new int[] {Color.RED.getRGB(), Color.GREEN.getRGB(), Color.BLUE.getRGB()};

    if (layer instanceof CoverageMapLayer) {
      final CoverageMapLayer cml = (CoverageMapLayer) layer;
      final CoverageReference ref = cml.getCoverageReference();
      try {
        final GridCoverageReader reader = ref.acquireReader();
        final GridCoverageReadParam param = new GridCoverageReadParam();
        param.setResolution(1, 1);
        GridCoverage2D cov = (GridCoverage2D) reader.read(0, param);
        ref.recycle(reader);
        cov = cov.view(ViewType.NATIVE);
        RenderedImage img = cov.getRenderedImage();
        ColorModel cm = img.getColorModel();

        if (cm instanceof IndexColorModel) {
          final IndexColorModel icm = (IndexColorModel) cm;

          final GridSampleDimension sampleDim = cov.getSampleDimension(0);

          int size = icm.getMapSize();
          ARGB = new int[size];
          icm.getRGBs(ARGB);
          final double minVal = sampleDim.getMinimumValue();
          final double maxVal = sampleDim.getMaximumValue();

          final ColorMap colorMap = new ColorMap();
          colorMap.setGeophysicsRange(
              ColorMap.ANY_QUANTITATIVE_CATEGORY,
              new MeasurementRange(
                  NumberRange.create(minVal, true, maxVal, true), sampleDim.getUnits()));

          GridSampleDimension ret = colorMap.recolor(sampleDim, ARGB);
        }

      } catch (CoverageStoreException | CancellationException ex) {
        Logging.getLogger("org.geotoolkit.display2d.ext.dimrange").log(Level.WARNING, null, ex);
      }
    }

    final float[] space = new float[ARGB.length];
    final Color[] colors = new Color[ARGB.length];
    for (int i = 0; i < space.length; i++) {
      space[i] = (float) i / (space.length - 1);
      colors[i] = new Color(ARGB[i]);
    }

    final LinearGradientPaint paint =
        new LinearGradientPaint(
            (float) rect.getMinX(),
            (float) rect.getMinY(),
            (float) rect.getMaxX(),
            (float) rect.getMinY(),
            space,
            colors);

    g.setPaint(paint);
    g.fill(rect);
  }
  /** Displays the data in a graph. */
  private void showPlot() {
    // Create a data series containing the heading error data...
    XYSeries headingErrorSeries = new XYSeries("Heading Error");
    Enumeration<HeadingDivergenceState> e = divergenceData.elements();
    while (e.hasMoreElements()) {
      HeadingDivergenceState currState = e.nextElement();
      headingErrorSeries.add(
          (currState.time - robotData.getExpStartTime()) / 1000, currState.headingError);
    }

    // Create two data series one containing the times when the robot starts heading
    // towards a waypoint, and another containing the times when the robot arrives at
    // a waypoint
    final XYSeries beginEdgeSeries = new XYSeries("Begin Edge Traveral");
    final XYSeries waypointArrivalSeries = new XYSeries("Waypoint Arrival");
    Vector<PathEdge> pathEdges = robotData.getPathEdges();
    Enumeration<PathEdge> e2 = pathEdges.elements();
    while (e2.hasMoreElements()) {
      PathEdge currEdge = e2.nextElement();
      double beginEdgeTime = (currEdge.getStartTime() - robotData.getExpStartTime()) / 1000.0;
      beginEdgeSeries.add(beginEdgeTime, 0);
      double wayPointArrivalTime = (currEdge.getEndTime() - robotData.getExpStartTime()) / 1000.0;
      waypointArrivalSeries.add(wayPointArrivalTime, 0);
    }

    // Create a dataset out of the data series
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(headingErrorSeries);
    dataset.addSeries(beginEdgeSeries);
    dataset.addSeries(waypointArrivalSeries);

    // Create the chart
    JFreeChart chart =
        ChartFactory.createXYLineChart(
            "Heading Error vs. Time", // chart title
            "Time (s)", // x axis label
            "Heading Error (radians)", // y axis label
            dataset, // the data
            PlotOrientation.VERTICAL, // plot orientation (y axis is vertical)
            true, // include legend
            true, // tooltips
            false // urls
            );

    // Place the legend on top of the chart just below the title.
    LegendTitle legend = chart.getLegend();
    legend.setPosition(RectangleEdge.TOP);

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = chart.getXYPlot();
    //        plot.setBackgroundPaint(Color.lightGray);
    //    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    //        plot.setDomainGridlinePaint(Color.white);
    //        plot.setRangeGridlinePaint(Color.white);

    // Display the points and not the lines connecting the points
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, true); // display the heading errors as a line
    renderer.setSeriesShapesVisible(0, false);
    renderer.setSeriesLinesVisible(
        1, false); // display the begin edge traversal points as blue dots
    renderer.setSeriesShapesVisible(1, true);
    renderer.setSeriesPaint(1, Color.BLUE);
    renderer.setSeriesShape(1, new java.awt.geom.Ellipse2D.Double(-3, -3, 6, 6));
    renderer.setSeriesLinesVisible(
        2, false); // display the begin edge traversal points as green dots
    renderer.setSeriesShapesVisible(2, true);
    renderer.setSeriesPaint(2, Color.GREEN.darker());
    renderer.setSeriesShape(2, new java.awt.geom.Ellipse2D.Double(-5, -5, 10, 10));
    plot.setRenderer(renderer);

    //        final NumberAxis domainAxis = (NumberAxis)plot.getDomainAxis();
    //        domainAxis.setRange(new Range(0,140));

    //        final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    //     // change the auto tick unit selection to integer units only...
    ////        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    //        rangeAxis.setRange(new Range(-Math.PI, Math.PI));

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(1000, 600));

    // Create a frame for the chart, then display it.
    ApplicationFrame appFrame = new ApplicationFrame("Heading Error for " + logFileName);
    appFrame.setContentPane(chartPanel);
    appFrame.pack();
    RefineryUtilities.centerFrameOnScreen(appFrame);
    appFrame.setVisible(true);
  }
 @Override
 public void focusGained(FocusEvent e) {
   // TODO parameter or component
   JTextComponent.class.cast(e.getSource()).setBackground(Color.GREEN.brighter().brighter());
 }
Пример #20
0
  /*Place the labels on top */
  private void placeLabels() {
    /*Place label On Rent */
    GLabel onRentLabel = new GLabel("ON RENT");
    onRentLabel.setFont(new Font("Serif", Font.BOLD, BIGFONTSIZE));
    onRentLabel.setColor(FONTCOLOR);
    add(onRentLabel, RENTX + RENTWIDTH / 2 - onRentLabel.getWidth() / 2, RENTY - EQUIPHEIGHT);

    /*Place label Available */
    GLabel availForRentLabel = new GLabel("AVAILABLE FOR RENT");
    availForRentLabel.setFont(new Font("Serif", Font.BOLD, BIGFONTSIZE));
    availForRentLabel.setColor(FONTCOLOR);
    add(
        availForRentLabel,
        AVAILX + AVAILWIDTH / 2 - availForRentLabel.getWidth() / 2,
        AVAILY - EQUIPHEIGHT);

    /*Place label Shop */
    GLabel shopLabel = new GLabel("SHOP");
    shopLabel.setFont(new Font("Serif", Font.BOLD, BIGFONTSIZE));
    shopLabel.setColor(FONTCOLOR);
    add(shopLabel, SHOPX + SHOPWIDTH / 2 - shopLabel.getWidth() / 2, SHOPY - EQUIPHEIGHT * 14);

    /*Place the lost sales label */
    lostSalesLabel1 = new GLabel("Lost Sales HR = " + lostSales.get(0));
    lostSalesLabel2 = new GLabel("Lost Sales MR = " + lostSales.get(1));
    lostSalesLabel3 = new GLabel("Lost Sales LR = " + lostSales.get(2));
    lostSalesLabel1.setFont(new Font("Serif", Font.BOLD, BIGFONTSIZE));
    lostSalesLabel2.setFont(new Font("Serif", Font.BOLD, BIGFONTSIZE));
    lostSalesLabel3.setFont(new Font("Serif", Font.BOLD, BIGFONTSIZE));
    lostSalesLabel1.setColor(FONTCOLOR);
    lostSalesLabel2.setColor(FONTCOLOR);
    lostSalesLabel3.setColor(FONTCOLOR);
    add(lostSalesLabel1, START_X + 4 * EQUIPWIDTH, 4 * EQUIPHEIGHT);
    add(
        lostSalesLabel2,
        START_X + 4 * EQUIPWIDTH,
        4 * EQUIPHEIGHT + lostSalesLabel1.getHeight() * 1.5);
    add(
        lostSalesLabel3,
        START_X + 4 * EQUIPWIDTH,
        4 * EQUIPHEIGHT + lostSalesLabel2.getHeight() * 3);

    /*Place the days elapsed label */
    daysElapsed = 0;
    daysElapsedLabel = new GLabel("DAY" + daysElapsed);
    daysElapsedLabel.setFont(new Font("Serif", Font.BOLD, 24));
    daysElapsedLabel.setColor(Color.red.darker());
    add(daysElapsedLabel, APPLICATION_WIDTH / 2, START_Y / 2);

    /*Place the sales Label */
    sales = 0;
    salesLabel = new GLabel("SALES: $" + sales);
    salesLabel.setFont(new Font("Serif", Font.BOLD, 24));
    salesLabel.setColor(Color.GREEN.darker());
    add(salesLabel, APPLICATION_WIDTH / 2, daysElapsedLabel.getY() + daysElapsedLabel.getY());

    /*Place the capitalInvested Label */
    capitalInvested = 0;
    capitalLabel = new GLabel("Capital Invested: $" + capitalInvested);
    capitalLabel.setFont(new Font("Serif", Font.BOLD, 18));
    capitalLabel.setColor(Color.RED.darker());
    add(
        capitalLabel,
        lostSalesLabel1.getX(),
        lostSalesLabel3.getY() + lostSalesLabel3.getHeight() * 2);
  }