y este es uno de los JPANEL que puedo mandar llamar
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package EWH;
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import static javax.swing.Spring.sum;
import EWH.WorkFrame;
/**
*
* @author GerardoV
*/
public class CAMBIATE extends javax.swing.JPanel{
/**
* Creates new form CAMBIATE
*/
/// VARIABLES DE CONEXION
Conexion Conexion = new Conexion();
Conexion Conexion2 = new Conexion();
ResultSet resultadoTEMP = null;
///
/// VARIABLES
String CveTema;
String NomTema;
String Usuario;
String Usu;
String Profile;
///
public CAMBIATE() {
//WorkFrame.
//super(WorkFrame);
String Clase = super.getClass().toString();
//this.Profile = Profile;
Conexion.Conexion();
initComponents();
System.out.println("Usu es: "+Clase);
/// IDENTIFICA TEMA ACTUAL
try
{
resultadoTEMP=Conexion.sConexion.executeQuery("SEL ECT eswtecod From
[email protected] WHERE ESUSRKEY = '"+Usuario+"'");
while (resultadoTEMP.next())
{
System.out.println("Usu2 es: "+Usuario);
TemaLBL.setText(resultadoTEMP.getString(1));
//NomTema = resultadoTEMP.getString(2);
}
//resultadoTEMP.close();
}catch(Exception err){System.out.println("TEMERROR: conexion "+err);}
///
/// LLENA EL COMBO DE TEMAS
//ComboTema.removeAllItems();
ComboTema.removeAll();
ComboTema.addItem(" - ");
try
{ //System.out.println("sql es: "+SQL);
resultadoTEMP=Conexion.sConexion.executeQuery("SEL ECT ESWTECOD, ESWTENAM From
[email protected]");
while (resultadoTEMP.next())
{
CveTema = resultadoTEMP.getString(1);
NomTema = resultadoTEMP.getString(2);
ComboTema.addItem(CveTema+" - "+NomTema);
}
resultadoTEMP.close();
}catch(Exception err){System.out.println("TEMERROR: conexion "+err);}
///
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
TemaLBL = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
ComboTema = new javax.swing.JComboBox();
PreviewLBL = new javax.swing.JLabel();
setForeground(new java.awt.Color(255, 255, 255));
setOpaque(false);
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Template Actual: ");
TemaLBL.setForeground(new java.awt.Color(255, 255, 255));
TemaLBL.setText("Template");
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("Lista de Templates");
ComboTema.setForeground(new java.awt.Color(255, 255, 255));
ComboTema.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
ComboTemaItemStateChanged(evt);
}
});
PreviewLBL.setForeground(new java.awt.Color(255, 255, 255));
PreviewLBL.setText("Preview");
PreviewLBL.setVerticalAlignment(javax.swing.SwingC onstants.TOP);
PreviewLBL.setHorizontalTextPosition(javax.swing.S wingConstants.LEFT);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addGap(45, 45, 45)
.addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
.addComponent(ComboTema, 0, 172, Short.MAX_VALUE)
.addComponent(TemaLBL, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(PreviewLBL))
.addContainerGap(393, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(TemaLBL))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(ComboTema, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(PreviewLBL)
.addContainerGap(404, Short.MAX_VALUE))
);
}// </editor-fold>
private void ComboTemaItemStateChanged(java.awt.event.ItemEvent evt) {
System.out.println("Cambio item selecionado a "+ComboTema.getSelectedItem());
if(ComboTema.getSelectedItem().toString().equals(" - ")){}
else{
ImageIcon fondon = new ImageIcon(getClass().getResource("/Recursos/"+ComboTema.getSelectedItem().toString().substring (0, 5)+".jpg"));
String ruta = "/Recursos/"+ComboTema.getSelectedItem().toString().substring (0, 5)+".jpg";
PreviewLBL.setIcon(fondon);
}
}
// Variables declaration - do not modify
private javax.swing.JComboBox ComboTema;
private javax.swing.JLabel PreviewLBL;
private javax.swing.JLabel TemaLBL;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel3;
// End of variables declaration
}
lo ke necesito es ke el JPANEL pueda leer los valores que tiene el JFRAME y que se comuniquen entre si