public void run() {
    try {
      while (true) {
        String message = in.readLine();

        if (message.equals("mousePressed")) {
          try {
            String x = in.readLine();
            String y = in.readLine();
            String flag = in.readLine();
            String re = in.readLine();
            String gree = in.readLine();
            String blac = in.readLine();
            String size = in.readLine();
            int x_ = Integer.parseInt(x);
            int y_ = Integer.parseInt(y);
            int red = Integer.parseInt(re);
            int green = Integer.parseInt(gree);
            int black = Integer.parseInt(blac);
            flagtool = Integer.parseInt(flag);
            border = Integer.parseInt(size);
            flagcolor = new Color(red, green, black);
            onePoint pp1 = new onePoint(x_, y_, flagtool, flagcolor, border);
            points.add(pp1);
            repaint();
          } catch (Exception ex) {
            ex.getSuppressed();
          }
        } else if (message.equals("mouseReleased")) {
          String isPen = in.readLine();
          if (isPen.equals("isPen")) {
            if (isEraser == 0) points.addElement(new onePoint(-1, -1, 22, flagcolor, border));
            else if (isEraser == 1) points.addElement(new onePoint(-1, -1, 22, Color.WHITE, 6 * 2));
          } else {
            String x = in.readLine();
            String y = in.readLine();
            String flag = in.readLine();
            String re = in.readLine();
            String gree = in.readLine();
            String blac = in.readLine();
            String size = in.readLine();
            try {
              int x_ = Integer.parseInt(x);
              int y_ = Integer.parseInt(y);
              int red = Integer.parseInt(re);
              int green = Integer.parseInt(gree);
              int black = Integer.parseInt(blac);
              flagtool = Integer.parseInt(flag);
              border = Integer.parseInt(size);
              flagcolor = new Color(red, green, black);
              onePoint pp1 = new onePoint(x_, y_, flagtool, flagcolor, border);
              points.addElement(pp1);
              points.add(new onePoint(-1, -1, 22, flagcolor, border));
              repaint();
            } catch (NumberFormatException e) {
              e.getSuppressed();
            }
          }
        } else if (message.equals("itemStateChanged")) {
          String item = in.readLine();
          if (item.equals("colorchoice")) {
            String color = in.readLine();
            if (color.equals("black")) flagcolor = new Color(0, 0, 0);
            else if (color.equals("red")) flagcolor = new Color(255, 0, 0);
            else if (color.equals("blue")) flagcolor = new Color(0, 0, 255);
            else if (color.equals("green")) flagcolor = new Color(0, 255, 0);

          } else if (item.equals("sizechoice")) {
            String size = in.readLine();
            if (size.equals("1")) {
              border = 1;
            } else if (size.equals("2")) border = 2 * 2;
            else if (size.equals("4")) border = 4 * 2;
            else if (size.equals("6")) border = 6 * 2;
            else if (size.equals("8")) border = 8 * 2;
          }
        } else if (message.equals("actionPerformed")) {
          String ispen = in.readLine();
          if (ispen.equals("pen")) {
            flagtool = 0;
            isEraser = 0;
          } else if (ispen.equals("line")) {
            flagtool = 1;
          } else if (ispen.equals("clear")) {
            flagtool = 2;
            points.removeAllElements();
            repaint();
          } else if (ispen.equals("ellipse")) {
            flagtool = 3;
          } else if (ispen.equals("rect")) {
            flagtool = 4;
          } else if (ispen.equals("colorboard")) {
            try {
              String red = in.readLine();
              String green = in.readLine();
              String blue = in.readLine();
              flagcolor =
                  new Color(Integer.parseInt(red), Integer.parseInt(green), Integer.parseInt(blue));

            } catch (Exception e) {
              e.getSuppressed();
            }
          } else if (ispen.equals("eraser")) {
            flagtool = 0;
            isEraser = 1;
          }
        } else if (message.equals("mouseDragged")) {
          String a = in.readLine();
          if (a.equals("0")) {
            try {
              String x = in.readLine();
              String y = in.readLine();
              String flag = in.readLine();
              String red = in.readLine();
              String green = in.readLine();
              String blue = in.readLine();
              String bord = in.readLine();
              int x_ = Integer.parseInt(x);
              int y_ = Integer.parseInt(y);
              flagtool = Integer.parseInt(flag);
              flagcolor =
                  new Color(Integer.parseInt(red), Integer.parseInt(green), Integer.parseInt(blue));
              border = Integer.parseInt(bord);
              onePoint pp = new onePoint(x_, y_, flagtool, flagcolor, border);
              points.addElement(pp);
              repaint();
            } catch (Exception e) {
              e.getSuppressed();
            }
          } else if (a.equals("1")) {
            try {
              String x = in.readLine();
              String y = in.readLine();
              String flag = in.readLine();
              String red = in.readLine();
              String green = in.readLine();
              String blue = in.readLine();
              String bord = in.readLine();
              int x_ = Integer.parseInt(x);
              int y_ = Integer.parseInt(y);
              flagtool = Integer.parseInt(flag);
              flagcolor =
                  new Color(Integer.parseInt(red), Integer.parseInt(green), Integer.parseInt(blue));
              border = Integer.parseInt(bord);
              onePoint pp = new onePoint(x_, y_, flagtool, flagcolor, border);
              points.add(pp);
              repaint();
            } catch (Exception e) {
              e.getSuppressed();
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 2
0
 public void excluir(Oriundo oriundo) throws SQLException {
   Connection con =
       DriverManager.getConnection(
           new conexao().url,
           new conexao().config.getString("usuario"),
           new conexao().config.getString("senha"));
   PreparedStatement ps = null;
   String sqlExcluir = "DELETE FROM oriundo WHERE codigo=?";
   try {
     ps = con.prepareStatement(sqlExcluir);
     ps.setInt(1, oriundo.getCodigo());
     ps.executeUpdate();
     JOptionPane.showMessageDialog(
         null, "Ecluido Com Sucesso: ", "Mensagem do Sistema - Excluir", 1);
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(
         null, "NumberFormaterExeption Erro: " + e.getMessage(), "ClasseDAO Func.Excluir", 0);
     e.printStackTrace();
   } catch (NullPointerException e) {
     JOptionPane.showMessageDialog(
         null, "NullPointerException Erro: " + e.getMessage(), "ClasseDAO Func. Excluir", 0);
     e.printStackTrace();
   } catch (SQLException e) {
     JOptionPane.showMessageDialog(
         null, "SQLException Erro: " + e.getMessage(), "ClasseDAO Func. Excluir", 0);
     e.printStackTrace();
   } catch (Exception e) {
     JOptionPane.showMessageDialog(
         null, "Exception Erro: " + e.getMessage(), "ClasseDAO Func. Excluir", 0);
     e.printStackTrace();
   } finally {
     ps.close();
     con.close();
   }
 }
Ejemplo n.º 3
0
 private void onApply(boolean applyToAllRows) {
   try {
     applyGroupPropToTable(applyToAllRows);
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(this, "Invalid value: " + e.getMessage());
   }
 }
Ejemplo n.º 4
0
 public static int parseInteger(String s) {
   try {
     return (Integer.parseInt(s));
   } catch (NumberFormatException ex) {
     JOptionPane.showMessageDialog(
         null, ex.getMessage(), "Invalid number", JOptionPane.ERROR_MESSAGE);
     return (-1);
   }
 }
Ejemplo n.º 5
0
 /**
  * Return a integer parsed from the value associated with the given key, or "def" in key wasn't
  * found.
  */
 public static int parseProperty(Properties preferences, String key, int def) {
   String val = preferences.getProperty(key);
   if (val == null) return def;
   try {
     return Integer.parseInt(val);
   } catch (NumberFormatException nfe) {
     nfe.printStackTrace();
     return def;
   }
 }
Ejemplo n.º 6
0
 /** @return the pot */
 public static int getPort() {
   int port = 0;
   try {
     port = Integer.parseInt(pot.getText());
   } catch (NumberFormatException f) {
     f.printStackTrace();
     new WhatIDo("Entrer un port valide", f.toString());
   }
   return port;
 }
 /**
  * Returns the editted value.
  *
  * @return the editted value.
  * @throws TagFormatException if the tag value cannot be retrieved with the expected type.
  */
 public TagValue getTagValue() throws TagFormatException {
   try {
     long numer = Long.parseLong(m_numer.getText());
     long denom = Long.parseLong(m_denom.getText());
     Rational rational = new Rational(numer, denom);
     return new TagValue(m_value.getTag(), rational);
   } catch (NumberFormatException e) {
     e.printStackTrace();
     throw new TagFormatException(
         m_numer.getText() + "/" + m_denom.getText() + " is not a valid rational");
   }
 }
Ejemplo n.º 8
0
    public void actionPerformed(ActionEvent e) {
      JTextField fieldEdited = (JTextField) e.getSource();
      try {
        systemOrder = Integer.parseInt(fieldEdited.getText());
      } catch (NumberFormatException nfex) {
        System.out.println("Number format exception in getting system order");
        nfex.printStackTrace();
      }

      String updatedStatusText = prepareStatusText();
      statusAreaTop.setText(updatedStatusText);
    }
Ejemplo n.º 9
0
 public List<Oriundo> listar() throws SQLException {
   List<Oriundo> resultado = new ArrayList<Oriundo>();
   conexao propCon = new conexao();
   Connection con =
       DriverManager.getConnection(
           new conexao().url,
           propCon.config.getString("usuario"),
           propCon.config.getString("senha"));
   PreparedStatement ps = null;
   ResultSet rs = null;
   String sqlListar = "SELECT * FROM oriundo Order by codigo DESC";
   Oriundo oriundo;
   try {
     ps = con.prepareStatement(sqlListar);
     rs = ps.executeQuery();
     // if(rs==null){
     // return null;
     // }
     while (rs.next()) {
       oriundo = new Oriundo();
       oriundo.setCodigo(rs.getInt("codigo"));
       oriundo.setDescricao(rs.getString("descricao"));
       oriundo.setData_cadastro(rs.getDate("data_cadastro"));
       oriundo.setDia_fechamento(rs.getInt("dia_fechamento"));
       oriundo.setDia_pag(rs.getInt("dia_pag"));
       resultado.add(oriundo);
     }
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(
         null, "NumberFormaterExeption Erro: " + e.getMessage(), "ClasseDAO Func.Localizar", 0);
     e.printStackTrace();
   } catch (NullPointerException e) {
     JOptionPane.showMessageDialog(
         null, "NullPointerException Erro: " + e.getMessage(), "ClasseDAO Func. Localizar", 0);
     e.printStackTrace();
   } catch (SQLException e) {
     JOptionPane.showMessageDialog(
         null, "SQLException Erro: " + e.getMessage(), "ClasseDAO Func. Localizar", 0);
     e.printStackTrace();
   } catch (Exception e) {
     JOptionPane.showMessageDialog(
         null, "Exception Erro: " + e.getMessage(), "ClasseDAO Func. Localizar", 0);
     e.printStackTrace();
   } finally {
     ps.close();
     con.close();
   }
   return resultado;
 }
Ejemplo n.º 10
0
    @Override
    public void actionPerformed(ActionEvent e) {
      switch (e.getActionCommand()) {
        case "Cancel":
          screen.show("menu");
          break;

        case "Start game":
          Game startGame = null;
          // 1. if tjekker værdien af hvad der er valgt i comboBoxen og sammenligner med de spil som
          // for-loopet kører igennem
          // 2. if gør så hosten ikke kan joine sit eget spil
          for (Game g : games) {
            if (g.getName().equals(screen.getFindGamePanel().getSelectedGame())) {
              if (g.getHost().getId() != currentUser.getId()) startGame = g;
            }
          }
          if (startGame != null) {

            Gamer opponent = new Gamer();
            opponent.setId(currentUser.getId());
            opponent.setControls(screen.getFindGamePanel().getDirectionsTextfield());
            startGame.setOpponent(opponent);
            String joinGamemessage = api.joinGame(startGame);
            String startGamemessage = api.startGame(startGame);
            System.out.println(startGamemessage);
            String winnerName = "";

            for (User u : users) {

              try {

                if (u.getId() == Integer.parseInt(startGamemessage)) {
                  winnerName = u.getUsername();
                }
              } catch (NumberFormatException e1) {
                e1.printStackTrace();
              }
            }

            JOptionPane.showMessageDialog(
                screen, joinGamemessage + ". The winner was:" + winnerName);
          } else {
            JOptionPane.showMessageDialog(screen, "You can't join a game where you're the host");
          }
          break;
      }
    }
Ejemplo n.º 11
0
 public Oriundo localizar(Integer codigo) throws SQLException {
   Connection con =
       DriverManager.getConnection(
           new conexao().url,
           new conexao().config.getString("usuario"),
           new conexao().config.getString("senha"));
   PreparedStatement ps = null;
   ResultSet rs = null;
   String sqlLocalizar = "SELECT * FROM oriundo WHERE codigo=?";
   Oriundo oriundo = new Oriundo();
   try {
     ps = con.prepareStatement(sqlLocalizar);
     ps.setInt(1, codigo);
     rs = ps.executeQuery();
     // if(!rs.next()){
     // return null;
     // }
     oriundo.setCodigo(rs.getInt("codigo"));
     oriundo.setDescricao(rs.getString("descricao"));
     oriundo.setData_cadastro(rs.getDate("data_cadastro"));
     oriundo.setDia_fechamento(rs.getInt("dia_fechamento"));
     oriundo.setDia_pag(rs.getInt("dia_pag"));
     return oriundo;
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(
         null, "NumberFormaterExeption Erro: " + e.getMessage(), "ClasseDAO Func.Localizar", 0);
     e.printStackTrace();
   } catch (NullPointerException e) {
     JOptionPane.showMessageDialog(
         null, "NullPointerException Erro: " + e.getMessage(), "ClasseDAO Func. Localizar", 0);
     e.printStackTrace();
   } catch (SQLException e) {
     JOptionPane.showMessageDialog(
         null, "SQLException Erro: " + e.getMessage(), "ClasseDAO Func. Localizar", 0);
     e.printStackTrace();
   } catch (Exception e) {
     JOptionPane.showMessageDialog(
         null, "Exception Erro: " + e.getMessage(), "ClasseDAO Func. Localizar", 0);
     e.printStackTrace();
   } finally {
     ps.close();
     con.close();
   }
   return oriundo;
 }
Ejemplo n.º 12
0
  /** Utility method that will load mortgage data from a file. */
  private void loadMortgages() {
    // create a list of mortgages so we can dynamically add as many as our
    // data file allows. the first entry is always our default
    // "user entered" value so the combo box works consistently...
    final LinkedList mortgages = new LinkedList();
    mortgages.add(LABEL_USER_ENTERED_CHOICE);

    try {
      final InputStream resource =
          getClass().getClassLoader().getResourceAsStream(FILENAME_MORTGAGE_DATA);
      if (resource == null) {
        throw new IOException(FILENAME_MORTGAGE_DATA + " not found");
      }
      final BufferedReader reader = new BufferedReader(new InputStreamReader(resource));

      String line;
      while ((line = reader.readLine()) != null) {
        // split the line of data into tokens separated by commas; if
        // there are two tokens found, we assume we have a valid line
        // of data that can be parsed into rate and term values
        final String[] values = line.split(",");
        if (values.length == 2) {
          final double rate = Double.parseDouble(values[0].trim());
          final int term = Integer.parseInt(values[1].trim());

          // add a new set of mortgage terms to the list; the term
          // must be divided by 12 to convert to the number of years
          mortgages.add(new Mortgage(rate, term / 12));
        }
      }
    } catch (IOException ex) {
      JOptionPane.showMessageDialog(
          getRootPane(), ERR_DATA_FILE_IOERR, ERR_DATA_FILE_ERROR, JOptionPane.ERROR_MESSAGE);
      ex.printStackTrace(System.err);
    } catch (NumberFormatException ex) {
      JOptionPane.showMessageDialog(
          getRootPane(), ERR_DATA_FILE_CORRUPT, ERR_DATA_FILE_ERROR, JOptionPane.ERROR_MESSAGE);
      ex.printStackTrace(System.err);
    }

    fieldMortgageChoices.setModel(new DefaultComboBoxModel(mortgages.toArray()));
  }
Ejemplo n.º 13
0
 @Override
 public void actionPerformed(ActionEvent e) {
   try {
     if (e.getSource() == ok_button) {
       if (mainFrame != null) {
         Client client =
             new Client(serverAddress.getText(), Integer.parseInt(serverPort.getText()), 0);
         if (client.getClientThread().getClientSocket().isConnected()) mainFrame.setClient(client);
       }
       this.setVisible(false);
       this.dispose();
     } else if (e.getSource() == cancel_button) {
       mainFrame.setClient(null);
       this.setVisible(false);
       this.dispose();
     }
   } catch (NumberFormatException exception) {
     JOptionPane.showMessageDialog(this, "Invalid value: " + exception.getMessage());
   }
 }
Ejemplo n.º 14
0
 /**
  * @return a double parsed from the value associated with the given key in the given Properties.
  *     returns "def" in key wasn't found, or if a parsing error occured. If "value" contains a "%"
  *     sign, we use a <code>NumberFormat.getPercentInstance</code> to convert it to a double.
  */
 public static double parseProperty(Properties preferences, String key, double def) {
   NumberFormat formatPercent = NumberFormat.getPercentInstance(Locale.US); // for zoom factor
   String val = preferences.getProperty(key);
   if (val == null) return def;
   if (val.indexOf("%") == -1) { // not in percent format !
     try {
       return Double.parseDouble(val);
     } catch (NumberFormatException nfe) {
       nfe.printStackTrace();
       return def;
     }
   }
   // else it's a percent format -> parse it
   try {
     Number n = formatPercent.parse(val);
     return n.doubleValue();
   } catch (ParseException ex) {
     ex.printStackTrace();
     return def;
   }
 }
Ejemplo n.º 15
0
 public void atualizar(Oriundo oriundo) throws SQLException {
   Connection con =
       DriverManager.getConnection(
           new conexao().url,
           new conexao().config.getString("usuario"),
           new conexao().config.getString("senha"));
   PreparedStatement ps = null;
   String sqlAtualizar =
       "UPDATE oriundo SET descricao=?, data_cadastro=?, dia_fechamento=?, dia_pag=? WHERE codigo=?";
   try {
     ps = con.prepareStatement(sqlAtualizar);
     ps.setString(1, oriundo.getDescricao());
     ps.setDate(2, oriundo.getData_cadastro());
     ps.setInt(3, oriundo.getDia_fechamento());
     ps.setInt(4, oriundo.getDia_pag());
     ps.setInt(5, oriundo.getCodigo());
     ps.executeUpdate();
     JOptionPane.showMessageDialog(
         null, "Atualizado Com Sucesso: ", "Mensagem do Sistema - Atualizar", 1);
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(
         null, "NumberFormaterExeption Erro: " + e.getMessage(), "ClasseDAO Func.Atualizar", 0);
     e.printStackTrace();
   } catch (NullPointerException e) {
     JOptionPane.showMessageDialog(
         null, "NullPointerException Erro: " + e.getMessage(), "ClasseDAO Func. Atualizar", 0);
     e.printStackTrace();
   } catch (SQLException e) {
     JOptionPane.showMessageDialog(
         null, "SQLException Erro: " + e.getMessage(), "ClasseDAO Func. Atualizar", 0);
     e.printStackTrace();
   } catch (Exception e) {
     JOptionPane.showMessageDialog(
         null, "Exception Erro: " + e.getMessage(), "ClasseDAO Func. Atualizar", 0);
     e.printStackTrace();
   } finally {
     ps.close();
     con.close();
   }
 }
Ejemplo n.º 16
0
  protected void getDimensionsFromLogFile(BufferedReader reader, PicText text) {
    if (reader == null) {
      return;
    }
    String line = ""; // il rale si j'initialise pas ...
    boolean finished = false;
    while (!finished) {
      try {
        line = reader.readLine();
      } catch (IOException ioex) {
        ioex.printStackTrace();
        return;
      }
      if (line == null) {
        System.out.println("Size of text not found in log file...");
        return;
      }

      System.out.println(line);
      Matcher matcher = LogFilePattern.matcher(line);

      if (line != null && matcher.find()) {
        System.out.println("FOUND :" + line);
        finished = true;
        try {
          text.setDimensions(
              0.3515 * Double.parseDouble(matcher.group(1)), // height, pt->mm (1pt=0.3515 mm)
              0.3515 * Double.parseDouble(matcher.group(2)), // width
              0.3515 * Double.parseDouble(matcher.group(3))); // depth
          areDimensionsComputed = true;
        } catch (NumberFormatException e) {
          System.out.println("Logfile number format problem: $line" + e.getMessage());
        } catch (IndexOutOfBoundsException e) {
          System.out.println("Logfile regexp problem: $line" + e.getMessage());
        }
      }
    }
    return;
  }
Ejemplo n.º 17
0
 public void salvar(Oriundo oriundo) throws SQLException {
   Connection con =
       DriverManager.getConnection(
           new conexao().url,
           new conexao().config.getString("usuario"),
           new conexao().config.getString("senha"));
   PreparedStatement ps = null;
   String sqlSalvar =
       "INSERT INTO oriundo (descricao, data_cadastro, dia_fechamento, dia_pag ) VALUES (?, ?, ?, ?)";
   try {
     ps = con.prepareStatement(sqlSalvar);
     ps.setString(1, oriundo.getDescricao());
     ps.setDate(2, oriundo.getData_cadastro());
     ps.setInt(3, oriundo.getDia_fechamento());
     ps.setInt(4, oriundo.getDia_pag());
     ps.executeUpdate();
     // JOptionPane.showMessageDialog(null, "Inserido Com Sucesso: ", "Mensagem do Sistema -
     // Salvar", 1);
   } catch (NumberFormatException e) {
     JOptionPane.showMessageDialog(
         null, "NumberFormaterExeption Erro: " + e.getMessage(), "ClasseDAO Func.Salvar", 0);
     e.printStackTrace();
   } catch (NullPointerException e) {
     JOptionPane.showMessageDialog(
         null, "NullPointerException Erro: " + e.getMessage(), "ClasseDAO Func. Salvar", 0);
     e.printStackTrace();
   } catch (SQLException e) {
     JOptionPane.showMessageDialog(
         null, "SQLException Erro: " + e.getMessage(), "ClasseDAO Func. Salvar", 0);
     e.printStackTrace();
   } catch (Exception e) {
     JOptionPane.showMessageDialog(
         null, "Exception Erro: " + e.getMessage(), "ClasseDAO Func. Salvar", 0);
     e.printStackTrace();
   } finally {
     ps.close();
     con.close();
   }
 }
 private String convertNumberMethod(String inputNumber) {
   try {
     switch (baseTo) {
       case 2:
         return Integer.toString(Integer.parseInt(inputNumber, baseFrom), 2);
       case 3:
         return Integer.toString(Integer.parseInt(inputNumber, baseFrom), 3);
       case 8:
         return Integer.toString(Integer.parseInt(inputNumber, baseFrom), 8);
       case 10:
         return Integer.toString(Integer.parseInt(inputNumber, baseFrom), 10);
       case 16:
         return Integer.toString(Integer.parseInt(inputNumber, baseFrom), 16);
       default:
         return Constants.ERROR_MESSAGE;
     }
   } catch (NumberFormatException ex) {
     baseFrom = baseTo = 0;
     previousButton.setBackground(Constants.BUTTON_RELEASED);
     clearButton.setBackground(Constants.BUTTON_RELEASED);
     return Constants.ERROR_MESSAGE + ex.getMessage();
   }
 }
Ejemplo n.º 19
0
 public void actionPerformed(ActionEvent e) {
   Commands c = Commands.valueOf(e.getActionCommand());
   switch (c) {
     case KOPFRADIUS_CHANGE:
       jtf = (JTextField) e.getSource();
       text = jtf.getText();
       if (text.isEmpty()) {
         model.setSize(model.getRadius() * 2);
       }
       try {
         number = Integer.parseInt(text);
       } catch (NumberFormatException ex) {
         ex.printStackTrace();
         number = 0;
         break;
       }
       if (number < 150) {
         model.setSize(150 * 2);
       } else if (number > 2000) {
         model.setSize(2000 * 2);
       } else {
         model.setSize(number * 2);
       }
       eyeSize = model.getEyeRad();
       break;
     case AUGENROLLEN_RECHTS:
       rollright = true;
       model.setRoll(true);
       model.rotateEye(model.getEyeAngel() + 10);
       break;
     case AUGENROLLEN_LINKS:
       rollright = false;
       model.setRoll(false);
       model.rotateEye(model.getEyeAngel() + 10);
       break;
     case SMILE_CHANGE:
       model.changeSmile();
       break;
     case HAPPY:
       model.setSmile(true);
       model.setEyeRad(eyeSize + 15);
       break;
     case SAD:
       model.setSmile(false);
       model.setEyeRad(eyeSize - 15);
       break;
     case PLUS:
       if (model.getRadius() + 10 > 2000) {
         model.setSize(2000 * 2);
       } else {
         model.setSize((model.getRadius() + 10) * 2);
       }
       eyeSize = model.getEyeRad();
       break;
     case MINUS:
       if (model.getRadius() - 10 < 150) {
         model.setSize(150 * 2);
       } else {
         model.setSize((model.getRadius() - 10) * 2);
       }
       eyeSize = model.getEyeRad();
       break;
   }
 }