Example #1
0
  @Override
  public void SimulaSe(int DiffTime) {

    timerSelecionado = (timerSelecionado + DiffTime);

    if (selecionado) {
      timerSelecionado = 0;
    }

    if (tempoTotalVida != -1 && timerSelecionado >= tempoTotalVida) {

      setVivo(false);
      timerSelecionado = (0);
    }
    Iterator<Botao> it = botoes.iterator();
    while (it.hasNext()) {
      Botao bt = it.next();
      bt.SimulaSe((int) DiffTime);
      bt.mousex = Constantes.mouseXTela;
      bt.mousex = Constantes.mouseYTela;
      trataBotaoSelecionado(bt);

      if (bt.ativo == true) {
        trataBotao(bt);
      }
    }
  }
Example #2
0
  @Override
  public void DesenhaSe(Graphics2D dbg, int xMundo, int yMundo) {
    // TODO Auto-generated method stub

    // desenha menu
    dbg.setColor(Color.black);
    //		dbg.drawRect((int)getX()-xMundo,(int) (getY()-yMundo), getSizeX(),getSizeY());

    dbg.setColor(new Color(r, g, b, alpha));
    dbg.fillRect(
        (int) getX() - xMundo + 1, (int) (getY() - yMundo) + 1, getSizeX() - 1, getSizeY() - 1);

    // range
    dbg.setColor(Color.red);
    // dbg.drawOval((int)getX()-torrePai.getRange()/2-xMundo,
    // (int)getY()-torrePai.getRange()/2-yMundo, torrePai.getRange(), torrePai.getRange());
    //		//desenha botoes
    Iterator<Botao> it = botoes.iterator();
    while (it.hasNext()) {
      Botao bt = it.next();
      bt.DesenhaSe(dbg, xMundo, yMundo);
      trataDesenhoBotao(dbg, bt, xMundo, yMundo);
    }
    dbg.setColor(Color.black);

    // dbg.drawString(torrePai., x, y)

  }
Example #3
0
 @Override
 protected void trataBotao(Botao bt) {
   // TODO Auto-generated method stub
   if (bt.name == "range") {
     trataBotaoRange();
     bt.ativo = false;
   } else if (bt.name == "fire") {
     trataBotaoFire();
     bt.ativo = false;
   } else if (bt.name == "dano") {
     trataBotaoDano();
     bt.ativo = false;
   }
 }
Example #4
0
 private void trataDesenhoBotao(Graphics2D dbg, Botao bt, int XTela, int YTela) {
   // TODO Auto-generated method stub
   dbg.setFont(Constantes.FonteNormal);
   if (bt.name == "range") {
     dbg.setColor(Color.white);
     dbg.drawString(
         "$" + torrePai.armaAtiva.custoRange,
         (int) bt.getX() + bt.getSizeX() + 10 - XTela,
         (int) bt.getY() + bt.getSizeY() - 2 - YTela);
   }
   if (bt.name == "fire") {
     dbg.setColor(Color.white);
     dbg.drawString(
         "$" + torrePai.armaAtiva.custoFire,
         (int) bt.getX() + bt.getSizeX() + 10 - XTela,
         (int) bt.getY() + bt.getSizeY() - 2 - YTela);
   }
   if (bt.name == "dano") {
     dbg.setColor(Color.white);
     dbg.drawString(
         "$" + torrePai.armaAtiva.custoDano,
         (int) bt.getX() + bt.getSizeX() + 10 - XTela,
         (int) bt.getY() + bt.getSizeY() - 2 - YTela);
   }
 }
  public CadastrarPassageiro(int i, String tipoPassageiro) {
    limit = i;
    bn = Util.getBundle();
    this.passageiroDAO = new PassageiroDAO();
    passagem = new Passagem();
    passagemDAO = new PassagemDAO();
    painel = new Janela();

    // joga no frame pq o passageiro precisa saber seu cod.

    sTipoPassageiro = tipoPassageiro;
    layout = new GridBagLayout();
    painel.setLayout(layout);
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(5, 10, 0, 0);

    lbCodPas = new Rotulo(bn.getString("menuCadastrarPassageiro.bilhete"));

    lbNome = new Rotulo(bn.getString("menuCadastrarPassageiro.lbNome"));
    lbSobrenome = new Rotulo(bn.getString("menuCadastrarPassageiro.lbSobrenome"));
    lbDataNascimento = new Rotulo(bn.getString("menuCadastrarPassageiro.lbDataNascimento"));
    lbEmail = new Rotulo(bn.getString("menuCadastrarPassageiro.lbEmail"));
    lbTelefone = new Rotulo(bn.getString("menuCadastrarPassageiro.lbTelefone"));
    lbCpf = new Rotulo(bn.getString("menuCadastrarPassageiro.lbCpf"));
    lbFormaTratamento = new Rotulo(bn.getString("menuCadastrarPassageiro.lbFormaTratamento"));
    lbTipo = new Rotulo(bn.getString("menuCadastrarPassageiro.lbTipo"));

    btProximo = new Botao(bn.getString("menuComprarPassagem.btProximo"));
    btProximo.setPreferredSize(new Dimension(90, 40));
    btProximo.addActionListener(this);
    btCancelar = new Botao(bn.getString("menuComprarPassagem.btCancelar"));
    btCancelar.setPreferredSize(new Dimension(90, 40));
    btCancelar.addActionListener(this);
    btVoltar = new Botao(bn.getString("menuComprarPassagem.btVoltar"));
    btVoltar.setPreferredSize(new Dimension(90, 40));
    btVoltar.addActionListener(this);

    cTipoPassageiro = new ComboBox("Adulto");
    cTipoPassageiro.addItem(bn.getString("menuCadastrarPassageiro.adulto"));
    cTipoPassageiro.addItem(bn.getString("menuCadastrarPassageiro.crianca"));
    cTipoPassageiro.addItem(bn.getString("menuCadastrarPassageiro.bebe"));

    cFormaTratamento = new ComboBox("Sr");
    cFormaTratamento.addItem(bn.getString("menuCadastrarPassageiro.sra"));
    cFormaTratamento.addItem(bn.getString("menuCadastrarPassageiro.sr"));
    cFormaTratamento.addItem(bn.getString("menuCadastrarPassageiro.srta"));

    txNome = new CaixaDeTexto();
    txSobrenome = new CaixaDeTexto();
    txDataNascimento = new JFormattedTextField(Mascara("##/##/####"));
    txEmail = new CaixaDeTexto();
    txTelefone = new CaixaDeTexto();
    txCpf = new CaixaDeTexto();
    txTipo = new CaixaDeTexto();
    passagem = passagemDAO.getCodPassagem(limit);
    txCodPas = new CaixaDeTexto();
    txCodPas.setEditable(false);
    txCodPas.setText("" + passagem.getCodPas());
    txTipo.setEditable(false);
    txTipo.setText(sTipoPassageiro);
    // lbNome
    gbc.gridy = 0; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbNome, gbc);
    painel.add(lbNome);

    // txNome
    gbc.gridy = 0; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txNome, gbc);
    painel.add(txNome);

    // lbsobrenome
    gbc.gridy = 1; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbSobrenome, gbc);
    painel.add(lbSobrenome);

    // txSobrenome
    gbc.gridy = 1; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txSobrenome, gbc);
    painel.add(txSobrenome);

    // lbDatanasci
    gbc.gridy = 2; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbDataNascimento, gbc);
    painel.add(lbDataNascimento);

    // txDataNasci
    gbc.gridy = 2; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txDataNascimento, gbc);
    painel.add(txDataNascimento);

    // lbTelefone
    gbc.gridy = 3; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbTelefone, gbc);
    painel.add(lbTelefone);

    // txTelefone
    gbc.gridy = 3; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txTelefone, gbc);
    painel.add(txTelefone);

    // lbCpf
    gbc.gridy = 4; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbCpf, gbc);
    painel.add(lbCpf);

    // txCpf
    gbc.gridy = 4; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txCpf, gbc);
    painel.add(txCpf);

    // lbEmail
    gbc.gridy = 5; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbEmail, gbc);
    painel.add(lbEmail);

    // txEmail
    gbc.gridy = 5; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txEmail, gbc);
    painel.add(txEmail);

    // lbTipo
    gbc.gridy = 6; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbTipo, gbc);
    painel.add(lbTipo);

    // txCpf
    gbc.gridy = 6; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txTipo, gbc);
    painel.add(txTipo);

    // lbFormaTratamento
    gbc.gridy = 7; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbFormaTratamento, gbc);
    painel.add(lbFormaTratamento);

    // cFormaTratamento
    gbc.gridy = 7; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(cFormaTratamento, gbc);
    painel.add(cFormaTratamento);

    gbc.gridy = 8; // coluna
    gbc.gridx = 0; // linha
    layout.setConstraints(lbCodPas, gbc);
    painel.add(lbCodPas);
    gbc.gridy = 8; // coluna
    gbc.gridx = 1; // linha
    layout.setConstraints(txCodPas, gbc);
    painel.add(txCodPas);

    // botoes
    gbc.gridy = 9;
    gbc.gridx = 2;

    JPanel botoes = new JPanel(new FlowLayout());
    botoes.setBackground(minhaCor);
    botoes.add(btVoltar);
    botoes.add(btProximo);
    botoes.add(btCancelar);
    layout.setConstraints(botoes, gbc);
    painel.add(botoes);

    painel.setLocationRelativeTo(null);
    painel.setTitle(bn.getString("menuCadastrarPassageiro.titulo"));
    painel.setVisible(true);
    int op = painel.getDefaultCloseOperation(); // HIDE_ON_CLOSE
    painel.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    // painel.setResizable(false);
  }