コード例 #1
0
 private void btnAceptarVehiculoActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnAceptarVehiculoActionPerformed
   DefaultTableModel modeloTabla = (DefaultTableModel) tblVehiculo.getModel();
   GestorHibernate gestorH = new GestorHibernate();
   int fila = tblVehiculo.getSelectedRow();
   Iterator ite = gestorH.listarClase(Vehiculo.class).iterator();
   while (ite.hasNext()) {
     Vehiculo vehiculo = (Vehiculo) ite.next();
     if (vehiculo.getDominio().equals(modeloTabla.getValueAt(fila, 0))) {
       txtVehiculo.setText(vehiculo.getModelo().toString());
       txtDominio.setText(vehiculo.getDominio());
       txtTransportista.setText(vehiculo.getTransportista().toString());
       txtTara.setText(String.valueOf(vehiculo.getTara()));
       txtTipoVehiculo.setText(vehiculo.getTipoVehiculo().toString());
     }
   }
 } // GEN-LAST:event_btnAceptarVehiculoActionPerformed
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detalle_vehiculo);
    final User sesion = (User) getIntent().getExtras().getSerializable("sesion");
    final Vehiculo vehiculo = (Vehiculo) getIntent().getExtras().getSerializable("vehiculo");
    Toolbar toolbar = (Toolbar) findViewById(R.id.mitoolbar);
    setSupportActionBar(toolbar);
    assert vehiculo != null;
    getSupportActionBar().setTitle(vehiculo.getPatente());
    getSupportActionBar().setSubtitle("Patente");
    // boton volver
    toolbar.setNavigationIcon(
        ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_mtrl_am_alpha));
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent(DetalleVehiculoActivity.this, PanelActivity.class);
            intent.putExtra("sesion", sesion);
            intent.putExtra("vehiculo", vehiculo);
            startActivity(intent);
          }
        });
    marca = (TextView) findViewById(R.id.TV_DetalleVehiculo_Marca);
    modelo = (TextView) findViewById(R.id.TV_DetalleVehiculo_Modelo);
    año = (TextView) findViewById(R.id.TV_DetalleVehiculo_año);
    marca = (TextView) findViewById(R.id.TV_DetalleVehiculo_Marca);
    modelo = (TextView) findViewById(R.id.TV_DetalleVehiculo_Modelo);
    año = (TextView) findViewById(R.id.TV_DetalleVehiculo_año);

    imei();
    marca.setText(vehiculo.getMarca());
    modelo.setText(vehiculo.getModelo());
    año.setText(String.valueOf(vehiculo.getAño()));
  }