コード例 #1
0
  private void btnEncerrarActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnEncerrarActionPerformed
    // TODO add your handling code here:
    LoginVO lvo = LoginVO.getInstancia();
    DatagramSocket conexao = null;

    try {
      String mensagem = "1_2_";

      conexao = new DatagramSocket();
      byte[] m = mensagem.getBytes();

      InetAddress aHost = InetAddress.getByName(lvo.getIpServidor());
      int serverPort = 1970;

      System.out.println("ENVIOU: " + mensagem);

      DatagramPacket request = new DatagramPacket(m, m.length, aHost, serverPort);
      conexao.send(request);

      this.dispose();
    } catch (IOException e) {
      System.out.println("IOException: " + e);
    }
  } // GEN-LAST:event_btnEncerrarActionPerformed
コード例 #2
0
 private void formWindowActivated(
     java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowActivated
   // TODO add your handling code here:
   LoginVO lvo = LoginVO.getInstancia();
   lblNomeUsuario.setText("Logado como: " + lvo.getUser());
 } // GEN-LAST:event_formWindowActivated