tenho q fazer um diario eletronico, chamadas diarias de escola, tipo assim.
estou na parte da chamada e não sei como trazer os campos e joga-los nos labels para o prof fazer a chamada da turma
não tenho mais ideias!!!
o codigo esta assim
import java.sql.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class Chamadas extends JFrame implements ActionListener{
JComboBox CBcurso,CBturma,CBper;
JTextField TFsala;
JLabel L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13,L14,L15,L16,L17,L18,L19,L20,Lsala;
JRadioButton RBp1,RBf1,RBp2,RBf2,RBp3,RBf3,RBp4,RBf4,RBp5,RBf5,RBp6,RBf6,RBp7,RBf7,RBp8,RBf8,RBp9,RBf9,RBp10,RBf10,RBp11,RBf11,RBp12,RBf12,RBp13,RBf13,RBp14,RBf14,RBp15,RBf15,RBp16,RBf16,RBp17,RBf17,RBp18,RBf18,RBp19,RBf19,RBp20,RBf20;
ButtonGroup alu1,alu2,alu3,alu4,alu5,alu6,alu7,alu8,alu9,alu10,alu11,alu12,alu13,alu14,alu15,alu16,alu17,alu18,alu19,alu20;
JButton BTNpronto, BTNok;
JPanel fundo1,fundo2,fundo3,fundo4;
GridBagLayout layout;
GridBagConstraints constraints;
Container container;
Statement MeuState;
ResultSet rs;
Chamadas(){
setTitle("Chamada da Turma");
container = getContentPane();
layout = new GridBagLayout();
container.setLayout(layout);
constraints = new GridBagConstraints();
fundo1 = new JPanel();
fundo1.setBackground(new Color(050,130,255));
fundo2 = new JPanel();
fundo2.setLayout(new GridLayout(20,1));
fundo2.setBackground(new Color(050,130,255));
fundo3 = new JPanel();
fundo3.setBackground(new Color(050,130,255));
fundo4 = new JPanel();
fundo4.setLayout(new GridLayout(20,2));
L1 = new JLabel("");
L1.setFont(new Font("arial",Font.BOLD,20));
L1.setToolTipText(L1.getText());
L2 = new JLabel("");
L2.setFont(new Font("arial",Font.BOLD,20));
L2.setToolTipText(L2.getText());
L3 = new JLabel("");
L3.setFont(new Font("arial",Font.BOLD,20));
L3.setToolTipText(L3.getText());
L4 = new JLabel("");
L4.setFont(new Font("arial",Font.BOLD,20));
L4.setToolTipText(L4.getText());
L5 = new JLabel("");
L5.setFont(new Font("arial",Font.BOLD,20));
L5.setToolTipText(L5.getText());
L6 = new JLabel("");
L6.setFont(new Font("arial",Font.BOLD,20));
L6.setToolTipText(L6.getText());
L7 = new JLabel("");
L7.setFont(new Font("arial",Font.BOLD,20));
L7.setToolTipText(L7.getText());
L8 = new JLabel();
L8.setFont(new Font("arial",Font.BOLD,20));
L8.setToolTipText(L8.getText());
L9 = new JLabel();
L9.setFont(new Font("arial",Font.BOLD,20));
L9.setToolTipText(L9.getText());
L10 = new JLabel();
L10.setFont(new Font("arial",Font.BOLD,20));
L10.setToolTipText(L10.getText());
L11 = new JLabel();
L11.setFont(new Font("arial",Font.BOLD,20));
L11.setToolTipText(L11.getText());
L12 = new JLabel();
L12.setFont(new Font("arial",Font.BOLD,20));
L12.setToolTipText(L12.getText());
L13 = new JLabel();
L13.setFont(new Font("arial",Font.BOLD,20));
L13.setToolTipText(L12.getText());
L14 = new JLabel();
L14.setFont(new Font("arial",Font.BOLD,20));
L14.setToolTipText(L12.getText());
L15 = new JLabel();
L15.setFont(new Font("arial",Font.BOLD,20));
L15.setToolTipText(L12.getText());
L16 = new JLabel();
L16.setFont(new Font("arial",Font.BOLD,20));
L16.setToolTipText(L12.getText());
L17 = new JLabel();
L17.setFont(new Font("arial",Font.BOLD,20));
L17.setToolTipText(L12.getText());
L18 = new JLabel();
L18.setFont(new Font("arial",Font.BOLD,20));
L18.setToolTipText(L12.getText());
L19 = new JLabel();
L19.setFont(new Font("arial",Font.BOLD,20));
L19.setToolTipText(L12.getText());
L20 = new JLabel();
L20.setFont(new Font("arial",Font.BOLD,20));
L20.setToolTipText(L12.getText());
Lsala = new JLabel("Sala");
String[] per = {"Período","1º","2º","3º","4º"};
CBper = new JComboBox(per);
String[] turm = {"Turma","T1","T2","T3","T4","T5"};
CBturma = new JComboBox(turm);
String[] cursos = {"Escolha o curso","Programação","seg. do Trabalho","Edificações","Intalações Eletricas","Eletronica Digital","Automação","",""};
CBcurso = new JComboBox(cursos);
RBp1 = new JRadioButton("P");
RBp1.setBackground(new Color(050,130,255));
RBf1 = new JRadioButton("F");
RBf1.setBackground(new Color(050,130,255));
RBp2 = new JRadioButton("P");
RBp2.setBackground(new Color(050,130,255));
RBf2 = new JRadioButton("F");
RBf2.setBackground(new Color(050,130,255));
RBp3 = new JRadioButton("P");
RBp3.setBackground(new Color(050,130,255));
RBf3 = new JRadioButton("F");
RBf3.setBackground(new Color(050,130,255));
RBp4 = new JRadioButton("P");
RBp4.setBackground(new Color(050,130,255));
RBf4 = new JRadioButton("F");
RBf4.setBackground(new Color(050,130,255));
RBp5 = new JRadioButton("P");
RBp5.setBackground(new Color(050,130,255));
RBf5 = new JRadioButton("F");
RBf5.setBackground(new Color(050,130,255));
RBp6 = new JRadioButton("P");
RBp6.setBackground(new Color(050,130,255));
RBf6 = new JRadioButton("F");
RBf6.setBackground(new Color(050,130,255));
RBp7 = new JRadioButton("P");
RBp7.setBackground(new Color(050,130,255));
RBf7 = new JRadioButton("F");
RBf7.setBackground(new Color(050,130,255));
RBp8 = new JRadioButton("P");
RBp8.setBackground(new Color(050,130,255));
RBf8 = new JRadioButton("F");
RBf8.setBackground(new Color(050,130,255));
RBp9 = new JRadioButton("P");
RBp9.setBackground(new Color(050,130,255));
RBf9 = new JRadioButton("F");
RBf9.setBackground(new Color(050,130,255));
RBp10 = new JRadioButton("P");
RBp10.setBackground(new Color(050,130,255));
RBf10 = new JRadioButton("F");
RBf10.setBackground(new Color(050,130,255));
RBp11 = new JRadioButton("P");
RBp11.setBackground(new Color(050,130,255));
RBf11 = new JRadioButton("F");
RBf11.setBackground(new Color(050,130,255));
RBp12 = new JRadioButton("P");
RBp12.setBackground(new Color(050,130,255));
RBf12 = new JRadioButton("F");
RBf12.setBackground(new Color(050,130,255));
RBp13 = new JRadioButton("P");
RBp13.setBackground(new Color(050,130,255));
RBf13 = new JRadioButton("F");
RBf13.setBackground(new Color(050,130,255));
RBp14 = new JRadioButton("P");
RBp14.setBackground(new Color(050,130,255));
RBf14 = new JRadioButton("F");
RBf14.setBackground(new Color(050,130,255));
RBp15 = new JRadioButton("P");
RBp15.setBackground(new Color(050,130,255));
RBf15 = new JRadioButton("F");
RBf15.setBackground(new Color(050,130,255));
RBp16 = new JRadioButton("P");
RBp16.setBackground(new Color(050,130,255));
RBf16 = new JRadioButton("F");
RBf16.setBackground(new Color(050,130,255));
RBp17 = new JRadioButton("P");
RBp17.setBackground(new Color(050,130,255));
RBf17 = new JRadioButton("F");
RBf17.setBackground(new Color(050,130,255));
RBp18 = new JRadioButton("P");
RBp18.setBackground(new Color(050,130,255));
RBf18 = new JRadioButton("F");
RBf18.setBackground(new Color(050,130,255));
RBp19 = new JRadioButton("P");
RBp19.setBackground(new Color(050,130,255));
RBf19 = new JRadioButton("F");
RBf19.setBackground(new Color(050,130,255));
RBp20 = new JRadioButton("P");
RBp20.setBackground(new Color(050,130,255));
RBf20 = new JRadioButton("F");
RBf20.setBackground(new Color(050,130,255));
TFsala = new JTextField(5);
//TFsala.setEditable(false);
Icon ok = new ImageIcon("E:/Projeto_GOKU/ImgGoku/Botao_ok.gif");
BTNpronto = new JButton("Pronto");
BTNpronto.addActionListener(this);
BTNok = new JButton(ok);
BTNok.addActionListener(this);
constraints.fill = GridBagConstraints.BOTH;
addComponent(fundo1,0,0,2,1);
addComponent (fundo2,1,0,4,1);
addComponent(fundo4,1,4,1,1);
addComponent(fundo3,2,0,1,1);
addComponent(BTNok,0,3,1,1);
fundo1.add(CBcurso);
fundo1.add(CBturma);
fundo1.add(CBper);
fundo1.add(Lsala);
fundo1.add(TFsala);
fundo2.add(L1);fundo4.add(RBp1);fundo4.add(RBf1);
fundo2.add(L2);fundo4.add(RBp2);fundo4.add(RBf2);
fundo2.add(L3);fundo4.add(RBp3);fundo4.add(RBf3);
fundo2.add(L4);fundo4.add(RBp4);fundo4.add(RBf4);
fundo2.add(L5);fundo4.add(RBp5);fundo4.add(RBf5);
fundo2.add(L6);fundo4.add(RBp6);fundo4.add(RBf6);
fundo2.add(L7);fundo4.add(RBp7);fundo4.add(RBf7);
fundo2.add(L8);fundo4.add(RBp8);fundo4.add(RBf8);
fundo2.add(L9);fundo4.add(RBp9);fundo4.add(RBf9);
fundo2.add(L10);fundo4.add(RBp10);fundo4.add(RBf10);;
fundo2.add(L11);fundo4.add(RBp11);fundo4.add(RBf11);
fundo2.add(L12);fundo4.add(RBp12);fundo4.add(RBf12);
fundo2.add(L13);fundo4.add(RBp13);fundo4.add(RBf13);
fundo2.add(L14);fundo4.add(RBp14);fundo4.add(RBf14);
fundo2.add(L15);fundo4.add(RBp15);fundo4.add(RBf15);
fundo2.add(L16);fundo4.add(RBp16);fundo4.add(RBf16);
fundo2.add(L17);fundo4.add(RBp17);fundo4.add(RBf17);
fundo2.add(L18);fundo4.add(RBp18);fundo4.add(RBf18);
fundo2.add(L19);fundo4.add(RBp19);fundo4.add(RBf19);
fundo2.add(L20);fundo4.add(RBp20);fundo4.add(RBf20);
fundo3.add(BTNpronto);
alu1 = new ButtonGroup();
alu1.add(RBp1);
alu1.add(RBf1);
alu2 = new ButtonGroup();
alu2.add(RBp2);
alu2.add(RBf2);
alu3 = new ButtonGroup();
alu3.add(RBp3);
alu3.add(RBf3);
alu4 = new ButtonGroup();
alu4.add(RBp4);
alu4.add(RBf4);
alu5 = new ButtonGroup();
alu5.add(RBp5);
alu5.add(RBf5);
alu6 = new ButtonGroup();
alu6.add(RBp6);
alu6.add(RBf6);
alu7 = new ButtonGroup();
alu7.add(RBp7);
alu7.add(RBf7);
alu8 = new ButtonGroup();
alu8.add(RBp8);
alu8.add(RBf8);
alu9 = new ButtonGroup();
alu9.add(RBp9);
alu9.add(RBf9);
alu10 = new ButtonGroup();
alu10.add(RBp10);
alu10.add(RBf10);
alu11 = new ButtonGroup();
alu11.add(RBp11);
alu11.add(RBf11);
alu12 = new ButtonGroup();
alu12.add(RBp12);
alu12.add(RBf12);
setLocation(150,100);
setVisible(true);
setEnabled(true);
setSize(790,590);
container.setBackground(new Color(050,130,255));
String url = "jdbc:odbc:DBgoku";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection MinhaConexao = DriverManager.getConnection(url);
MeuState = MinhaConexao.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
}catch(ClassNotFoundException ex){
JOptionPane.showMessageDialog(null,"Driver JDBC-ODBC não encontrado!!","ATENÇÃO",JOptionPane.ERROR_MESSAGE);
}catch(SQLException ex){
JOptionPane.showMessageDialog(null,"Problemas com a conexão com a fonte de dados","ATENÇÃO",JOptionPane.ERROR_MESSAGE);
}
}
private void addComponent(Component component, int row, int column,int width, int height){
constraints.gridx = column;
constraints.gridy = row;
constraints.gridwidth = width;
constraints.gridheight = height;
layout.setConstraints(component, constraints);
container.add(component);
}
public static void main(String args[]){
Chamadas form = new Chamadas();
form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e){
if (e.getSource() == BTNok){
try{
}catch(SQLException ex){
JOptionPane.showMessageDialog(null,"Registro não encontrado","ATENÇÃO",JOptionPane.INFORMATION_MESSAGE);
}
}
}
}
hellpp
[size=“11”][color=“red”]* Editado: Lembre-se de utilizar BBCode em seus códigos - Matheus [/color][/size]