Foros del Web » Programación para mayores de 30 ;) » Java »

No se ve un boton y textfield

Estas en el tema de No se ve un boton y textfield en el foro de Java en Foros del Web. Chicos necesito una mano. Es sobre la carga de datos. No se ven los label DNI_cajero y DNI_farmaceutico. Tampoco se ve el boton limpiar, o ...
  #1 (permalink)  
Antiguo 24/02/2014, 20:20
 
Fecha de Ingreso: febrero-2014
Mensajes: 4
Antigüedad: 10 años, 2 meses
Puntos: 0
No se ve un boton y textfield

Chicos necesito una mano. Es sobre la carga de datos. No se ven los label DNI_cajero y DNI_farmaceutico. Tampoco se ve el boton limpiar, o en lugar de eso se podria meter algun metodo para borrar lo escrito una vez cargado los datos. . Tambien adjunto el programa.

Perdonen mi ignorancia, no sé como ponerlo acá. No me deja textos largos ni se como ponerlo en spoiler
  #2 (permalink)  
Antiguo 25/02/2014, 13:55
 
Fecha de Ingreso: agosto-2013
Mensajes: 90
Antigüedad: 10 años, 8 meses
Puntos: 1
Respuesta: No se ve un boton y textfield

Los códigos los puedes poner entre Hightlight o en .
Pon la parte de código en donde crees que tengas el error.

Saludos.
  #3 (permalink)  
Antiguo 25/02/2014, 15:57
 
Fecha de Ingreso: febrero-2014
Mensajes: 4
Antigüedad: 10 años, 2 meses
Puntos: 0
Respuesta: No se ve un boton y textfield

Cita:
public class farmacity2 implements ItemListener {

JPanel cards; //a panel that uses CardLayout
final static String SOLAPA1 = "DueniosEmpleados";


public JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15 ,t16;
public JLabel etiqueta1, etiqueta2, etiqueta3, etiqueta4, etiqueta5, etiqueta6, etiqueta7, etiqueta8, etiqueta9;
public JLabel etiqueta10,etiqueta11,etiqueta12,etiqueta13,etique ta14,etiqueta15,etiqueta16,etiqueta17,etiqueta18,e tiqueta19,etiqueta20, etiqueta21;
public JButton boton0,boton1,boton2,boton3, boton4, boton5;
private String nomb, nomb_caj, nomb_farmac, descrip_prod, fecha;
private int dni, dni_c, dni_f, porc, codprod, cant;
private double sueldo_caj, sueldo_farm, precio, Sueldos_farm=0, Sueldos_cajeros=0 ;
private double ganancia_duenio, gananciaTotal=0, ganancia, sueldos, desc;
private Hashtable duenios ;
private Hashtable cajeros ;
private Hashtable farmaceuticos ;
private Hashtable productos;
private JTextArea area1;


public farmacity2(){
duenios = new Hashtable();
cajeros = new Hashtable();
farmaceuticos = new Hashtable();
productos = new Hashtable();
}
public void addComponentToPane(Container pane) {
JPanel comboBoxPane = new JPanel() ; //use FlowLayout
String comboBoxItems[] = { SOLAPA1, SOLAPA2, SOLAPA3 };
JComboBox cb = new JComboBox(comboBoxItems);
cb.setEditable(false);
cb.addItemListener(this);
cb.addActionListener(cb);
comboBoxPane.add(cb);

//Create the Panels
Panel PanelGeneral = new Panel(new GridLayout(4,1)) ;

Panel EntradadeDatos = new Panel (new GridLayout(9,1)); //3 , 1
Panel PanelNombreDuenio= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelDNI= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelPorc= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelNombreCajero= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelDNICaj= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelSueldoCajero= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelNombreFarmac= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelDNIFarmac= new Panel(new FlowLayout(FlowLayout.LEFT));
Panel PanelSueldoFarmac= new Panel(new FlowLayout(FlowLayout.LEFT));

JPanel card1 = new JPanel();
t1 = new JTextField("",30);
t2 = new JTextField("",15);
t3 = new JTextField("",4);
t4 = new JTextField("",30);
t5 = new JTextField("",15);
t6 = new JTextField("",6);
t7 = new JTextField("",30);
t8 = new JTextField("",15);
t9 = new JTextField("",6);
etiqueta1 = new JLabel("Nombre(Dueño):",Label.LEFT);
etiqueta2 = new JLabel("DNI(Dueño):",Label.LEFT);
etiqueta3 = new JLabel("Porc(Dueño):",Label.LEFT);
etiqueta4 = new JLabel("Nombre(Cajero):",Label.LEFT);
etiqueta5 = new JLabel("DNI(Cajero):",Label.LEFT);
etiqueta6 = new JLabel("Sueldo:",Label.LEFT);
etiqueta7 = new JLabel("Nombre(Farmac):",Label.LEFT);
etiqueta8 = new JLabel("DNI(Farmac):",Label.LEFT);
etiqueta9 = new JLabel("Sueldo(Farmac):",Label.LEFT);
EntradadeDatos.add(PanelNombreDuenio);
EntradadeDatos.add(PanelDNI);
EntradadeDatos.add(PanelPorc);

EntradadeDatos.add(PanelNombreCajero);
EntradadeDatos.add(PanelDNICaj);
EntradadeDatos.add(PanelSueldoCajero);

EntradadeDatos.add(PanelNombreFarmac);
EntradadeDatos.add(PanelDNIFarmac);
EntradadeDatos.add(PanelSueldoFarmac);

PanelNombreDuenio.add(etiqueta1);
PanelNombreDuenio.add(t1);
PanelDNI.add(etiqueta2);
PanelDNI.add(t2);
PanelPorc.add(etiqueta3);
PanelPorc.add(t3);
PanelNombreCajero.add(etiqueta4);
PanelNombreCajero.add(t4);
PanelDNICaj.add(etiqueta5); //*
PanelDNICaj.add(t5);
PanelSueldoCajero.add(etiqueta6);
PanelSueldoCajero.add(t6);
PanelNombreFarmac.add(etiqueta7);
PanelNombreFarmac.add(t7);
PanelDNIFarmac.add(etiqueta8); //*
PanelDNIFarmac.add(t8);
PanelSueldoFarmac.add(etiqueta9);
PanelSueldoFarmac.add(t9);
card1.add(EntradadeDatos);
PanelGeneral.add(EntradadeDatos);
card1.add(PanelGeneral);
JButton boton1 = new JButton("CARGAR DATOS");
card1.add(boton1);

boton1.addItemListener(this);
JButton boton0 = new JButton("LIMPIAR");
card1.add(boton0);

boton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evento) {
farmacity2 farmacia = new farmacity2();
dueño d1 = new dueño();
cajero c1 = new cajero();
farmaceutico farm1 = new farmaceutico();
producto prod1 = new producto();
venta v1 = new venta();
persona p1 = new persona();

farmacia.setFarmaceutico(farm1);
farmacia.setCajero(c1);
farmacia.setDuenio(d1);

nomb=t1.getText();
d1.setNombre(nomb);
dni=Integer.parseInt(t2.getText());
d1.setDNI(dni);
porc=Integer.parseInt(t3.getText());
d1.setPorcentaje(porc);
farmacia.AddDueños(d1); //agrega nuevo duenio
t1.setText(" ");
t2.setText(" ");
t3.setText(" ");

nomb_caj=t4.getText();
c1.setNombre(nomb_caj);
dni_c=Integer.parseInt(t5.getText());
c1.setDNI(dni_c);
sueldo_caj=Double.parseDouble(t6.getText());
c1.setVentas(v1);// relacion entre cajero y una venta
c1.setSueldo(sueldo_caj);
farmacia.AddCajero(c1); //agrega nuevo cajero
t4.setText(" ");
t5.setText(" ");
t6.setText(" ");

nomb_farmac=t7.getText();
farm1.setNombre(nomb_farmac);
dni_f=Integer.parseInt(t8.getText());
farm1.setDNI(dni_f);
sueldo_farm=Double.parseDouble(t9.getText());
farm1.setVentas(v1);// relacion entre farmaceutico y una venta
farm1.setSueldo(sueldo_farm);
farmacia.AddFarmaceutico(farm1);//agrega nuevo farmaceutico
t7.setText(" ");
t8.setText(" ");
t9.setText(" ");
}});

boton0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evento) {
t1.setText(" ");
t2.setText(" ");
t3.setText(" ");
t4.setText(" ");
t5.setText(" ");
t6.setText(" ");
t7.setText(" ");
t8.setText(" ");
t9.setText(" ");
t10.setText(" ");
t11.setText(" ");
t12.setText(" ");
t13.setText(" ");
t14.setText(" ");
t15.setText(" ");
t16.setText(" ");
}});

public void itemStateChanged(ItemEvent evt) {

CardLayout cl = (CardLayout)(cards.getLayout());
cl.show(cards, (String)evt.getItem());
}

private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("CardLayoutDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
//frame.setSize(600,600);
//Create and set up the content pane.
farmacity2 farmacia = new farmacity2();
farmacia.addComponentToPane(frame.getContentPane() );
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) { /* Use an appropriate Look and Feel */
try{//UIManager.setLookAndFeel("com.sun.java.swing.plaf. windows.WindowsLookAndFeel");
UIManager.setLookAndFeel("javax.swing.plaf.metal.M etalLookAndFeel");
} catch (UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (InstantiationException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} /* Turn off metal's use of bold fonts */
UIManager.put("swing.boldMetal", Boolean.FALSE);
//Schedule a job for the event dispatch thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
public void setFarmaceutico(farmaceutico f){
farmaceutico farm1 = f;
}
public farmaceutico getFarmaceutico(farmaceutico f){
farmaceutico farm1 = null;
return farm1;
}
public void setCajero(cajero c){
cajero c1 = c;
}
public cajero getCajero(cajero c){
cajero c1 = null;
return c1;
}
public void setDuenio(dueño d){
dueño d1 = d;
}
public dueño getDuenio(dueño c){
dueño d1 = null;
return d1;
}

}
  #4 (permalink)  
Antiguo 26/02/2014, 16:17
 
Fecha de Ingreso: febrero-2014
Mensajes: 4
Antigüedad: 10 años, 2 meses
Puntos: 0
Respuesta: No se ve un boton y textfield

captura de pantalla del enunciado y planteo del problema.

https://imageshack.com/i/m9pkloj
  #5 (permalink)  
Antiguo 27/02/2014, 16:58
 
Fecha de Ingreso: febrero-2014
Mensajes: 4
Antigüedad: 10 años, 2 meses
Puntos: 0
Respuesta: No se ve un boton y textfield

Alguien puede responderme, por favor?

Como adjuntos los archivos acá?

Agradecería mucho la rta.

Etiquetas: boton, metodo, programa, textfield
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:16.