elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  Java
| | | |-+  Manera eficiente de mostrar datos en jtabbedpane
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Manera eficiente de mostrar datos en jtabbedpane  (Leído 1,346 veces)
Juanma91

Desconectado Desconectado

Mensajes: 43


Ver Perfil
Manera eficiente de mostrar datos en jtabbedpane
« en: 5 Marzo 2014, 03:27 am »

Mi error es que a veces carga mis jpanel dentro de mi panel de pestañas pero otras veces no, quiero conseguir que me cargue mis jpanel al clicar una vez en mi nodo


Código:
 int filas = arbol.getRowForLocation(e.getX(), e.getY());
                TreePath ruta = arbol.getPathForLocation(e.getX(), e.getY());

                Object[] lista = ruta.getPath();

                if (filas != -1) {
                    if (lista[2] instanceof DefaultMutableTreeNode && lista[2] == listadoProducto) {
                        if (e.getClickCount() == 1) {

                            if (isListado == false) {
                                panelListado = new JPanel();
                                panelPestaña.addTab("Listado Producto", panelListado);//añadimos el panel al tabbedPane en una nueva viñeta
                                try {
                                    panelListado.add(new ListadoProducto(Vista.this));
                                } catch (Exception ex) {
                                    System.out.println(ex);
                                }
                                isListado = true;
                            } else {
                                panelListado.removeAll();
                                try {
                                    panelListado.add(new ListadoProducto(Vista.this));
                                } catch (Exception ex) {
                                    System.out.println(ex);
                                }
                                revalidate();
                                repaint();
                            }
                        }
                    } else if (lista[2] instanceof DefaultMutableTreeNode && lista[2] == listadoCategoria) {
                        if (e.getClickCount() == 1) {
                            if (isListado = false) {
                                panelListado = new JPanel();
                                panelPestaña.addTab("Listado Categoria", panelCreacion);
                                try {
                                    panelListado.add(new ListadoCategoría(Vista.this));
                                } catch (Exception er) {
                                    System.out.println(er);
                                }
                                isListado = true;
                            } else {
                                panelListado.removeAll();
                                try {
                                    panelListado.add(new ListadoCategoría(Vista.this));
                                } catch (Exception ex1) {
                                    System.out.println(ex1);
                                }
                                revalidate();
                                repaint();
                            }

                        }
                    } else if (lista[2] instanceof DefaultMutableTreeNode && lista[2] == creacionCategoria) {
                        if(e.getClickCount()==1){
                            if(isCreate==false){
                                panelPestaña.addTab("Creacion Categoria", panelCreacion);
                                panelCreacion.add(new CrearCategoria());
                                isCreate= true;
                            }else{
                                panelPestaña.removeAll();
                                panelCreacion.add(new CrearCategoria());
                                revalidate();
                                repaint();
                            }
                        }

                    } else if (lista[2] instanceof DefaultMutableTreeNode && lista[2] == creacionProducto) {
                        if(e.getClickCount()==1){
                            if(isCreate==false){
                                panelPestaña.addTab("Creacion Producto", panelCreacion);
                                panelCreacion.add(new CrearProducto());
                                isCreate=true;
                            }else{
                               panelPestaña.removeAll();
                               panelCreacion.add(new CrearProducto());
                               revalidate();
                               repaint();
                            }


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
manera mas eficiente de ...
PHP
pedraxito 5 2,548 Último mensaje 1 Agosto 2007, 10:03 am
por Sanjuu
Problema Al Mostrar Datos De Base De Datos
Java
ZedGe 2 2,839 Último mensaje 31 Julio 2012, 21:23 pm
por reylagarto19
popup!, mostrar datos, guardados en la base de datos!
Desarrollo Web
01munrra 4 6,001 Último mensaje 22 Septiembre 2012, 00:56 am
por 01munrra
Mostrar en Asp.Net la Información de esta manera
Desarrollo Web
nesticle8bit 0 1,485 Último mensaje 4 Agosto 2014, 21:03 pm
por nesticle8bit
Intel patenta un procesador para minar bitcoin de manera más eficiente
Noticias
wolfbcn 0 2,956 Último mensaje 1 Diciembre 2018, 01:35 am
por wolfbcn
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines