Sunteți pe pagina 1din 16

JanConfig.

java

import java.awt.event.ActionEvent;

public class JanConfig implements ActionListener, WindowListener {

GridBagConstraints gbc_b_esq;

JPanel p_esq= new JPanel();


JPanel p_dir= new JPanel();
JPanel p_cima= new JPanel();
JPanel p_baixo= new JPanel();
JPanel p_centro= new JPanel();
JPanel p_gb_sonda01= new JPanel();//grupos de botões de instalaçãodas sondas
JPanel p_gb_sonda02= new JPanel();
JPanel p_gb_sonda03= new JPanel();
JPanel p_gb_sonda04= new JPanel();
JPanel p_gb_sonda05= new JPanel();
JPanel p_gb_sonda06= new JPanel();
JPanel p_gb_sonda07= new JPanel();
JPanel p_gb_sonda08= new JPanel();
JPanel p_gb_sonda09= new JPanel();
JPanel p_gb_sonda10= new JPanel();
JPanel p_gb_sonda11= new JPanel();//grupos de botões de instalaçãodas sondas
JPanel p_gb_sonda12= new JPanel();
JPanel p_gb_sonda13= new JPanel();
JPanel p_gb_sonda14= new JPanel();
JPanel p_gb_sonda15= new JPanel();
JPanel p_gb_sonda16= new JPanel();
JPanel p_gb_sonda17= new JPanel();
JPanel p_gb_sonda18= new JPanel();
JPanel p_gb_sonda19= new JPanel();
JPanel p_gb_sonda20= new JPanel();
JPanel p_log01= new JPanel();//grupos de botões de log das sondas
JPanel p_log02= new JPanel();
JPanel p_log03= new JPanel();
JPanel p_log04= new JPanel();
JPanel p_log05= new JPanel();
JPanel p_log06= new JPanel();
JPanel p_log07= new JPanel();
JPanel p_log08= new JPanel();
JPanel p_log09= new JPanel();
JPanel p_log10= new JPanel();
JPanel p_log11= new JPanel();//grupos de botões de log das sondas
JPanel p_log12= new JPanel();
JPanel p_log13= new JPanel();
JPanel p_log14= new JPanel();
JPanel p_log15= new JPanel();
JPanel p_log16= new JPanel();
JPanel p_log17= new JPanel();
JPanel p_log18= new JPanel();
JPanel p_log19= new JPanel();
JPanel p_log20= new JPanel();
JPanel p_status_sonda01= new JPanel();//status de instalação das sondas
JPanel p_status_sonda02= new JPanel();
JPanel p_status_sonda03= new JPanel();
JPanel p_status_sonda04= new JPanel();
JPanel p_status_sonda05= new JPanel();
JPanel p_status_sonda06= new JPanel();
JPanel p_status_sonda07= new JPanel();
JPanel p_status_sonda08= new JPanel();
JPanel p_status_sonda09= new JPanel();
JPanel p_status_sonda10= new JPanel();
JPanel p_status_sonda11= new JPanel();//status de instalação das sondas
JPanel p_status_sonda12= new JPanel();
JPanel p_status_sonda13= new JPanel();

Page 1
JanConfig.java

JPanel p_status_sonda14= new JPanel();


JPanel p_status_sonda15= new JPanel();
JPanel p_status_sonda16= new JPanel();
JPanel p_status_sonda17= new JPanel();
JPanel p_status_sonda18= new JPanel();
JPanel p_status_sonda19= new JPanel();
JPanel p_status_sonda20= new JPanel();

JButton b_inst_todas= new JButton ("Instalar Todas");

JButton b_instS01=new JButton("Instalar"); //botões das sondas


JButton b_desiS01=new JButton("Desinstalar");
JButton b_testS01=new JButton("Testar");
JButton b_instS02=new JButton("Instalar");
JButton b_desiS02=new JButton("Desinstalar");
JButton b_testS02=new JButton("Testar");
JButton b_instS03=new JButton("Instalar");
JButton b_desiS03=new JButton("Desinstalar");
JButton b_testS03=new JButton("Testar");
JButton b_instS04=new JButton("Instalar");
JButton b_desiS04=new JButton("Desinstalar");
JButton b_testS04=new JButton("Testar");
JButton b_instS05=new JButton("Instalar");
JButton b_desiS05=new JButton("Desinstalar");
JButton b_testS05=new JButton("Testar");
JButton b_instS06=new JButton("Instalar");
JButton b_desiS06=new JButton("Desinstalar");
JButton b_testS06=new JButton("Testar");
JButton b_instS07=new JButton("Instalar");
JButton b_desiS07=new JButton("Desinstalar");
JButton b_testS07=new JButton("Testar");
JButton b_instS08=new JButton("Instalar");
JButton b_desiS08=new JButton("Desinstalar");
JButton b_testS08=new JButton("Testar");
JButton b_instS09=new JButton("Instalar");
JButton b_desiS09=new JButton("Desinstalar");
JButton b_testS09=new JButton("Testar");
JButton b_instS10=new JButton("Instalar");
JButton b_desiS10=new JButton("Desinstalar");
JButton b_testS10=new JButton("Testar");
JButton b_instS11=new JButton("Instalar"); //botões das sondas
JButton b_desiS11=new JButton("Desinstalar");
JButton b_testS11=new JButton("Testar");
JButton b_instS12=new JButton("Instalar");
JButton b_desiS12=new JButton("Desinstalar");
JButton b_testS12=new JButton("Testar");
JButton b_instS13=new JButton("Instalar");
JButton b_desiS13=new JButton("Desinstalar");
JButton b_testS13=new JButton("Testar");
JButton b_instS14=new JButton("Instalar");
JButton b_desiS14=new JButton("Desinstalar");
JButton b_testS14=new JButton("Testar");
JButton b_instS15=new JButton("Instalar");
JButton b_desiS15=new JButton("Desinstalar");
JButton b_testS15=new JButton("Testar");
JButton b_instS16=new JButton("Instalar");
JButton b_desiS16=new JButton("Desinstalar");
JButton b_testS16=new JButton("Testar");
JButton b_instS17=new JButton("Instalar");
JButton b_desiS17=new JButton("Desinstalar");
JButton b_testS17=new JButton("Testar");
JButton b_instS18=new JButton("Instalar");
JButton b_desiS18=new JButton("Desinstalar");
JButton b_testS18=new JButton("Testar");

Page 2
JanConfig.java

JButton b_instS19=new JButton("Instalar");


JButton b_desiS19=new JButton("Desinstalar");
JButton b_testS19=new JButton("Testar");
JButton b_instS20=new JButton("Instalar");
JButton b_desiS20=new JButton("Desinstalar");
JButton b_testS20=new JButton("Testar");

JButton b_plotar=new JButton("Plotar Gráficos");

JLabel l_S01=new JLabel("S01");


JLabel l_S02=new JLabel("S02");
JLabel l_S03=new JLabel("S03");
JLabel l_S04=new JLabel("S04");
JLabel l_S05=new JLabel("S05");
JLabel l_S06=new JLabel("S06");
JLabel l_S07=new JLabel("S07");
JLabel l_S08=new JLabel("S08");
JLabel l_S09=new JLabel("S09");
JLabel l_S10=new JLabel("S10");
JLabel l_S11=new JLabel("S11");
JLabel l_S12=new JLabel("S12");
JLabel l_S13=new JLabel("S13");
JLabel l_S14=new JLabel("S14");
JLabel l_S15=new JLabel("S15");
JLabel l_S16=new JLabel("S16");
JLabel l_S17=new JLabel("S17");
JLabel l_S18=new JLabel("S18");
JLabel l_S19=new JLabel("S19");
JLabel l_S20=new JLabel("S20");

JMenuBar bm=new JMenuBar();


JMenu m_opcoes=new JMenu("Opções");
JMenuItem mi_config_serial=new JMenuItem("Configurar Serial");
JMenuItem mi_sair=new JMenuItem("Sair");

GridLayout gl_p_esq= new GridLayout(20,1);


GridLayout gl_p_dir= new GridLayout(20,1);
GridLayout gl_p_gb= new GridLayout(1,3);
GridBagLayout gbl=new GridBagLayout();
BorderLayout bl= new BorderLayout();

Dimension dim_botoes_p_esq= new Dimension(80,30);//tamanho dos botões de instalar,


des. e testar sondas
Dimension dim_p_esq=new Dimension(400,600);
Dimension dim_p_cima=new Dimension(800,50);
Dimension dim_p_logs=new Dimension(600,30);//são 10 e ficam dentro do painel centro
Dimension dim_p_centro=new Dimension(600,600);
Dimension dim_p_dir= new Dimension(100,600);
Dimension dim_jan_graf= new Dimension(1024,768);

TelaConfiguracoes tela_config;
TesteGraficoRealTime teste_grafico;

JComboBox cb_S01,cb_S02,cb_S03,cb_S04,cb_S05,cb_S06,cb_S07,cb_S08,cb_S09,cb_S10;
JComboBox cb_S11,cb_S12,cb_S13,cb_S14,cb_S15,cb_S16,cb_S17,cb_S18,cb_S19,cb_S20;

JFrame j_principal=new JFrame("Inobram Automações --- Teste de Sondas T/TU v0.03");

public JanConfig(){

gbc_b_esq=new GridBagConstraints();
//natural height, maximum width
gbc_b_esq.fill = GridBagConstraints.HORIZONTAL;

Page 3
JanConfig.java

gbc_b_esq.gridheight=30;
gbc_b_esq.gridwidth=250;
gbc_b_esq.insets= new Insets(0,5,0,5);

j_principal.setLayout(bl); //add BorderLayout


j_principal.setSize(1366, 768);
j_principal.getContentPane().setSize(1366, 768);
j_principal.setVisible(true);
j_principal.addWindowListener(this);

mi_config_serial.setMnemonic(KeyEvent.VK_C);
mi_config_serial.addActionListener(this);
mi_config_serial.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.eve
nt.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
mi_sair.setMnemonic(KeyEvent.VK_S);
mi_sair.addActionListener(this);
mi_sair.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEve
nt.VK_S, java.awt.event.InputEvent.CTRL_MASK));
m_opcoes.add(mi_config_serial);
m_opcoes.add(mi_sair);
m_opcoes.setMnemonic(KeyEvent.VK_O);
m_opcoes.addActionListener(this);
bm.add(m_opcoes);

b_plotar.addActionListener(this);
b_inst_todas.addActionListener(this);

b_instS01.setPreferredSize(dim_botoes_p_esq);
b_instS01.addActionListener(this);
b_desiS01.setPreferredSize(dim_botoes_p_esq);
b_desiS01.addActionListener(this);
b_testS02.setPreferredSize(dim_botoes_p_esq);
b_testS02.addActionListener(this);
b_instS02.setPreferredSize(dim_botoes_p_esq);
b_instS02.addActionListener(this);
b_desiS02.setPreferredSize(dim_botoes_p_esq);
b_desiS02.addActionListener(this);
b_testS02.setPreferredSize(dim_botoes_p_esq);
b_testS02.addActionListener(this);
b_instS03.setPreferredSize(dim_botoes_p_esq);
b_instS03.addActionListener(this);
b_desiS03.setPreferredSize(dim_botoes_p_esq);
b_desiS03.addActionListener(this);
b_testS03.setPreferredSize(dim_botoes_p_esq);
b_testS03.addActionListener(this);
b_instS04.setPreferredSize(dim_botoes_p_esq);
b_instS04.addActionListener(this);
b_desiS04.setPreferredSize(dim_botoes_p_esq);
b_desiS04.addActionListener(this);
b_testS04.setPreferredSize(dim_botoes_p_esq);
b_testS04.addActionListener(this);
b_instS05.setPreferredSize(dim_botoes_p_esq);
b_instS05.addActionListener(this);
b_desiS05.setPreferredSize(dim_botoes_p_esq);
b_desiS05.addActionListener(this);
b_testS05.setPreferredSize(dim_botoes_p_esq);
b_testS05.addActionListener(this);
b_instS06.setPreferredSize(dim_botoes_p_esq);
b_instS06.addActionListener(this);
b_desiS06.setPreferredSize(dim_botoes_p_esq);
b_desiS06.addActionListener(this);
b_testS06.setPreferredSize(dim_botoes_p_esq);
b_testS06.addActionListener(this);
b_instS07.setPreferredSize(dim_botoes_p_esq);

Page 4
JanConfig.java

b_instS07.addActionListener(this);
b_desiS07.setPreferredSize(dim_botoes_p_esq);
b_desiS07.addActionListener(this);
b_testS07.setPreferredSize(dim_botoes_p_esq);
b_testS07.addActionListener(this);
b_instS08.setPreferredSize(dim_botoes_p_esq);
b_instS08.addActionListener(this);
b_desiS08.setPreferredSize(dim_botoes_p_esq);
b_desiS08.addActionListener(this);
b_testS08.setPreferredSize(dim_botoes_p_esq);
b_testS08.addActionListener(this);
b_instS09.setPreferredSize(dim_botoes_p_esq);
b_instS09.addActionListener(this);
b_desiS09.setPreferredSize(dim_botoes_p_esq);
b_desiS09.addActionListener(this);
b_testS09.setPreferredSize(dim_botoes_p_esq);
b_testS09.addActionListener(this);
b_instS10.setPreferredSize(dim_botoes_p_esq);
b_instS10.addActionListener(this);
b_desiS10.setPreferredSize(dim_botoes_p_esq);
b_desiS10.addActionListener(this);
b_testS10.setPreferredSize(dim_botoes_p_esq);
b_testS10.addActionListener(this);
b_instS11.setPreferredSize(dim_botoes_p_esq);
b_instS11.addActionListener(this);
b_desiS11.setPreferredSize(dim_botoes_p_esq);
b_desiS11.addActionListener(this);
b_testS12.setPreferredSize(dim_botoes_p_esq);
b_testS12.addActionListener(this);
b_instS12.setPreferredSize(dim_botoes_p_esq);
b_instS12.addActionListener(this);
b_desiS12.setPreferredSize(dim_botoes_p_esq);
b_desiS12.addActionListener(this);
b_testS12.setPreferredSize(dim_botoes_p_esq);
b_testS12.addActionListener(this);
b_instS13.setPreferredSize(dim_botoes_p_esq);
b_instS13.addActionListener(this);
b_desiS13.setPreferredSize(dim_botoes_p_esq);
b_desiS13.addActionListener(this);
b_testS13.setPreferredSize(dim_botoes_p_esq);
b_testS13.addActionListener(this);
b_instS14.setPreferredSize(dim_botoes_p_esq);
b_instS14.addActionListener(this);
b_desiS14.setPreferredSize(dim_botoes_p_esq);
b_desiS14.addActionListener(this);
b_testS14.setPreferredSize(dim_botoes_p_esq);
b_testS14.addActionListener(this);
b_instS15.setPreferredSize(dim_botoes_p_esq);
b_instS15.addActionListener(this);
b_desiS15.setPreferredSize(dim_botoes_p_esq);
b_desiS15.addActionListener(this);
b_testS15.setPreferredSize(dim_botoes_p_esq);
b_testS15.addActionListener(this);
b_instS16.setPreferredSize(dim_botoes_p_esq);
b_instS16.addActionListener(this);
b_desiS16.setPreferredSize(dim_botoes_p_esq);
b_desiS16.addActionListener(this);
b_testS16.setPreferredSize(dim_botoes_p_esq);
b_testS16.addActionListener(this);
b_instS17.setPreferredSize(dim_botoes_p_esq);
b_instS17.addActionListener(this);
b_desiS17.setPreferredSize(dim_botoes_p_esq);
b_desiS17.addActionListener(this);
b_testS17.setPreferredSize(dim_botoes_p_esq);

Page 5
JanConfig.java

b_testS17.addActionListener(this);
b_instS18.setPreferredSize(dim_botoes_p_esq);
b_instS18.addActionListener(this);
b_desiS18.setPreferredSize(dim_botoes_p_esq);
b_desiS18.addActionListener(this);
b_testS18.setPreferredSize(dim_botoes_p_esq);
b_testS18.addActionListener(this);
b_instS19.setPreferredSize(dim_botoes_p_esq);
b_instS19.addActionListener(this);
b_desiS19.setPreferredSize(dim_botoes_p_esq);
b_desiS19.addActionListener(this);
b_testS19.setPreferredSize(dim_botoes_p_esq);
b_testS19.addActionListener(this);
b_instS20.setPreferredSize(dim_botoes_p_esq);
b_instS20.addActionListener(this);
b_desiS20.setPreferredSize(dim_botoes_p_esq);
b_desiS20.addActionListener(this);
b_testS20.setPreferredSize(dim_botoes_p_esq);
b_testS20.addActionListener(this);
//

cb_S01 = new JComboBox();


cb_S02 = new JComboBox();
cb_S03 = new JComboBox();
cb_S04 = new JComboBox();
cb_S05 = new JComboBox();
cb_S06 = new JComboBox();
cb_S07 = new JComboBox();
cb_S08 = new JComboBox();
cb_S09 = new JComboBox();
cb_S10 = new JComboBox();
cb_S11 = new JComboBox();
cb_S12 = new JComboBox();
cb_S13 = new JComboBox();
cb_S14 = new JComboBox();
cb_S15 = new JComboBox();
cb_S16 = new JComboBox();
cb_S17 = new JComboBox();
cb_S18 = new JComboBox();
cb_S19 = new JComboBox();
cb_S20 = new JComboBox();

cb_S01.addItem("T");
cb_S01.addItem("TU");
cb_S01.setSelectedIndex(0);
cb_S01.setVisible(true);
cb_S01.addActionListener(this);
cb_S02.addItem("T");
cb_S02.addItem("TU");
cb_S02.setSelectedIndex(0);
cb_S02.addActionListener(this);
cb_S02.setVisible(true);
cb_S03.addItem("T");
cb_S03.addItem("TU");
cb_S03.setSelectedIndex(0);
cb_S03.addActionListener(this);
cb_S04.addItem("T");
cb_S04.addItem("TU");
cb_S04.setSelectedIndex(0);
cb_S04.addActionListener(this);
cb_S05.addItem("T");
cb_S05.addItem("TU");
cb_S05.setSelectedIndex(0);

Page 6
JanConfig.java

cb_S05.addActionListener(this);
cb_S06.addItem("T");
cb_S06.addItem("TU");
cb_S06.setSelectedIndex(0);
cb_S06.addActionListener(this);
cb_S07.addItem("T");
cb_S07.addItem("TU");
cb_S07.setSelectedIndex(0);
cb_S07.addActionListener(this);
cb_S08.addItem("T");
cb_S08.addItem("TU");
cb_S08.setSelectedIndex(0);
cb_S08.addActionListener(this);
cb_S09.addItem("T");
cb_S09.addItem("TU");
cb_S09.setSelectedIndex(0);
cb_S09.addActionListener(this);
cb_S10.addItem("T");
cb_S10.addItem("TU");
cb_S10.setSelectedIndex(0);
cb_S10.addActionListener(this);
cb_S11.addItem("T");
cb_S11.addItem("TU");
cb_S11.setSelectedIndex(0);
cb_S11.setVisible(true);
cb_S11.addActionListener(this);
cb_S12.addItem("T");
cb_S12.addItem("TU");
cb_S12.setSelectedIndex(0);
cb_S12.addActionListener(this);
cb_S12.setVisible(true);
cb_S13.addItem("T");
cb_S13.addItem("TU");
cb_S13.setSelectedIndex(0);
cb_S13.addActionListener(this);
cb_S14.addItem("T");
cb_S14.addItem("TU");
cb_S14.setSelectedIndex(0);
cb_S14.addActionListener(this);
cb_S15.addItem("T");
cb_S15.addItem("TU");
cb_S15.setSelectedIndex(0);
cb_S15.addActionListener(this);
cb_S16.addItem("T");
cb_S16.addItem("TU");
cb_S16.setSelectedIndex(0);
cb_S16.addActionListener(this);
cb_S17.addItem("T");
cb_S17.addItem("TU");
cb_S17.setSelectedIndex(0);
cb_S17.addActionListener(this);
cb_S18.addItem("T");
cb_S18.addItem("TU");
cb_S18.setSelectedIndex(0);
cb_S18.addActionListener(this);
cb_S19.addItem("T");
cb_S19.addItem("TU");
cb_S09.setSelectedIndex(0);
cb_S09.addActionListener(this);
cb_S20.addItem("T");
cb_S20.addItem("TU");
cb_S20.setSelectedIndex(0);
cb_S20.addActionListener(this);

Page 7
JanConfig.java

p_cima.setPreferredSize(dim_p_cima);
p_cima.add(b_inst_todas);
p_cima.add(b_plotar);

p_gb_sonda01.setLayout(gbl);
p_gb_sonda01.add(l_S01,gbc_b_esq);
p_gb_sonda01.add(b_instS01,gbc_b_esq);
p_gb_sonda01.add(b_desiS01,gbc_b_esq);
p_gb_sonda01.add(b_testS01,gbc_b_esq);
p_gb_sonda01.add(cb_S01,gbc_b_esq);
p_gb_sonda01.setVisible(true);

p_gb_sonda02.setLayout(gbl);
p_gb_sonda02.add(l_S02,gbc_b_esq);
p_gb_sonda02.add(b_instS02,gbc_b_esq);
p_gb_sonda02.add(b_desiS02,gbc_b_esq);
p_gb_sonda02.add(b_testS02,gbc_b_esq);
p_gb_sonda02.add(cb_S02,gbc_b_esq);
p_gb_sonda02.setVisible(true);

p_gb_sonda03.setLayout(gbl);
p_gb_sonda03.add(l_S03,gbc_b_esq);
p_gb_sonda03.add(b_instS03,gbc_b_esq);
p_gb_sonda03.add(b_desiS03,gbc_b_esq);
p_gb_sonda03.add(b_testS03,gbc_b_esq);
p_gb_sonda03.add(cb_S03,gbc_b_esq);
p_gb_sonda03.setVisible(true);

p_gb_sonda04.setLayout(gbl);
p_gb_sonda04.add(l_S04,gbc_b_esq);
p_gb_sonda04.add(b_instS04,gbc_b_esq);
p_gb_sonda04.add(b_desiS04,gbc_b_esq);
p_gb_sonda04.add(b_testS04,gbc_b_esq);
p_gb_sonda04.add(cb_S04,gbc_b_esq);
p_gb_sonda04.setVisible(true);

p_gb_sonda05.setLayout(gbl);
p_gb_sonda05.add(l_S05,gbc_b_esq);
p_gb_sonda05.add(b_instS05,gbc_b_esq);
p_gb_sonda05.add(b_desiS05,gbc_b_esq);
p_gb_sonda05.add(b_testS05,gbc_b_esq);
p_gb_sonda05.add(cb_S05,gbc_b_esq);
p_gb_sonda05.setVisible(true);

p_gb_sonda06.setLayout(gbl);
p_gb_sonda06.add(l_S06,gbc_b_esq);
p_gb_sonda06.add(b_instS06,gbc_b_esq);
p_gb_sonda06.add(b_desiS06,gbc_b_esq);
p_gb_sonda06.add(b_testS06,gbc_b_esq);
p_gb_sonda06.add(cb_S06,gbc_b_esq);
p_gb_sonda06.setVisible(true);

p_gb_sonda07.setLayout(gbl);
p_gb_sonda07.add(l_S07,gbc_b_esq);
p_gb_sonda07.add(b_instS07,gbc_b_esq);
p_gb_sonda07.add(b_desiS07,gbc_b_esq);
p_gb_sonda07.add(b_testS07,gbc_b_esq);
p_gb_sonda07.add(cb_S07,gbc_b_esq);
p_gb_sonda07.setVisible(true);

p_gb_sonda08.setLayout(gbl);
p_gb_sonda08.add(l_S08,gbc_b_esq);
p_gb_sonda08.add(b_instS08,gbc_b_esq);
p_gb_sonda08.add(b_desiS08,gbc_b_esq);

Page 8
JanConfig.java

p_gb_sonda08.add(b_testS08,gbc_b_esq);
p_gb_sonda08.add(cb_S08,gbc_b_esq);
p_gb_sonda08.setVisible(true);

p_gb_sonda09.setLayout(gbl);
p_gb_sonda09.add(l_S09,gbc_b_esq);
p_gb_sonda09.add(b_instS09,gbc_b_esq);
p_gb_sonda09.add(b_desiS09,gbc_b_esq);
p_gb_sonda09.add(b_testS09,gbc_b_esq);
p_gb_sonda09.add(cb_S09,gbc_b_esq);
p_gb_sonda09.setVisible(true);

p_gb_sonda10.setLayout(gbl);
p_gb_sonda10.add(l_S10,gbc_b_esq);
p_gb_sonda10.add(b_instS10,gbc_b_esq);
p_gb_sonda10.add(b_desiS10,gbc_b_esq);
p_gb_sonda10.add(b_testS10,gbc_b_esq);
p_gb_sonda10.add(cb_S10,gbc_b_esq);
p_gb_sonda10.setVisible(true);

p_gb_sonda11.setLayout(gbl);
p_gb_sonda11.add(l_S11,gbc_b_esq);
p_gb_sonda11.add(b_instS11,gbc_b_esq);
p_gb_sonda11.add(b_desiS11,gbc_b_esq);
p_gb_sonda11.add(b_testS11,gbc_b_esq);
p_gb_sonda11.add(cb_S11,gbc_b_esq);
p_gb_sonda11.setVisible(true);

p_gb_sonda12.setLayout(gbl);
p_gb_sonda12.add(l_S12,gbc_b_esq);
p_gb_sonda12.add(b_instS12,gbc_b_esq);
p_gb_sonda12.add(b_desiS12,gbc_b_esq);
p_gb_sonda12.add(b_testS12,gbc_b_esq);
p_gb_sonda12.add(cb_S12,gbc_b_esq);
p_gb_sonda12.setVisible(true);

p_gb_sonda13.setLayout(gbl);
p_gb_sonda13.add(l_S13,gbc_b_esq);
p_gb_sonda13.add(b_instS13,gbc_b_esq);
p_gb_sonda13.add(b_desiS13,gbc_b_esq);
p_gb_sonda13.add(b_testS13,gbc_b_esq);
p_gb_sonda13.add(cb_S13,gbc_b_esq);
p_gb_sonda13.setVisible(true);

p_gb_sonda14.setLayout(gbl);
p_gb_sonda14.add(l_S14,gbc_b_esq);
p_gb_sonda14.add(b_instS14,gbc_b_esq);
p_gb_sonda14.add(b_desiS14,gbc_b_esq);
p_gb_sonda14.add(b_testS14,gbc_b_esq);
p_gb_sonda14.add(cb_S14,gbc_b_esq);
p_gb_sonda14.setVisible(true);

p_gb_sonda15.setLayout(gbl);
p_gb_sonda15.add(l_S15,gbc_b_esq);
p_gb_sonda15.add(b_instS15,gbc_b_esq);
p_gb_sonda15.add(b_desiS15,gbc_b_esq);
p_gb_sonda15.add(b_testS15,gbc_b_esq);
p_gb_sonda15.add(cb_S15,gbc_b_esq);
p_gb_sonda15.setVisible(true);

p_gb_sonda16.setLayout(gbl);
p_gb_sonda16.add(l_S16,gbc_b_esq);
p_gb_sonda16.add(b_instS16,gbc_b_esq);
p_gb_sonda16.add(b_desiS16,gbc_b_esq);

Page 9
JanConfig.java

p_gb_sonda16.add(b_testS16,gbc_b_esq);
p_gb_sonda16.add(cb_S16,gbc_b_esq);
p_gb_sonda16.setVisible(true);

p_gb_sonda17.setLayout(gbl);
p_gb_sonda17.add(l_S17,gbc_b_esq);
p_gb_sonda17.add(b_instS17,gbc_b_esq);
p_gb_sonda17.add(b_desiS17,gbc_b_esq);
p_gb_sonda17.add(b_testS17,gbc_b_esq);
p_gb_sonda17.add(cb_S17,gbc_b_esq);
p_gb_sonda17.setVisible(true);

p_gb_sonda18.setLayout(gbl);
p_gb_sonda18.add(l_S18,gbc_b_esq);
p_gb_sonda18.add(b_instS18,gbc_b_esq);
p_gb_sonda18.add(b_desiS18,gbc_b_esq);
p_gb_sonda18.add(b_testS18,gbc_b_esq);
p_gb_sonda18.add(cb_S18,gbc_b_esq);
p_gb_sonda18.setVisible(true);

p_gb_sonda19.setLayout(gbl);
p_gb_sonda19.add(l_S19,gbc_b_esq);
p_gb_sonda19.add(b_instS19,gbc_b_esq);
p_gb_sonda19.add(b_desiS19,gbc_b_esq);
p_gb_sonda19.add(b_testS19,gbc_b_esq);
p_gb_sonda19.add(cb_S19,gbc_b_esq);
p_gb_sonda19.setVisible(true);

p_gb_sonda20.setLayout(gbl);
p_gb_sonda20.add(l_S20,gbc_b_esq);
p_gb_sonda20.add(b_instS20,gbc_b_esq);
p_gb_sonda20.add(b_desiS20,gbc_b_esq);
p_gb_sonda20.add(b_testS20,gbc_b_esq);
p_gb_sonda20.add(cb_S20,gbc_b_esq);
p_gb_sonda20.setVisible(true);

p_status_sonda01.setBackground(Color.RED);
p_status_sonda01.setLayout(gbl);
p_status_sonda02.setBackground(Color.YELLOW);
p_status_sonda02.setLayout(gbl);
p_status_sonda03.setBackground(Color.RED);
p_status_sonda03.setLayout(gbl);
p_status_sonda04.setBackground(Color.YELLOW);
p_status_sonda04.setLayout(gbl);
p_status_sonda05.setBackground(Color.YELLOW);
p_status_sonda05.setLayout(gbl);
p_status_sonda06.setBackground(Color.RED);
p_status_sonda06.setLayout(gbl);
p_status_sonda07.setBackground(Color.YELLOW);
p_status_sonda07.setLayout(gbl);
p_status_sonda08.setBackground(Color.RED);
p_status_sonda08.setLayout(gbl);
p_status_sonda09.setBackground(Color.YELLOW);
p_status_sonda09.setLayout(gbl);
p_status_sonda10.setBackground(Color.YELLOW);
p_status_sonda10.setLayout(gbl);
p_status_sonda11.setBackground(Color.RED);
p_status_sonda11.setLayout(gbl);
p_status_sonda12.setBackground(Color.YELLOW);
p_status_sonda12.setLayout(gbl);
p_status_sonda13.setBackground(Color.RED);
p_status_sonda13.setLayout(gbl);
p_status_sonda14.setBackground(Color.YELLOW);
p_status_sonda14.setLayout(gbl);

Page 10
JanConfig.java

p_status_sonda15.setBackground(Color.YELLOW);
p_status_sonda15.setLayout(gbl);
p_status_sonda16.setBackground(Color.RED);
p_status_sonda16.setLayout(gbl);
p_status_sonda17.setBackground(Color.YELLOW);
p_status_sonda17.setLayout(gbl);
p_status_sonda18.setBackground(Color.RED);
p_status_sonda18.setLayout(gbl);
p_status_sonda19.setBackground(Color.YELLOW);
p_status_sonda19.setLayout(gbl);
p_status_sonda20.setBackground(Color.YELLOW);
p_status_sonda20.setLayout(gbl);

p_esq.setLayout(gl_p_esq);
p_esq.setVisible(true);
p_esq.setPreferredSize(dim_p_esq);

p_esq.add(p_gb_sonda01);
p_esq.add(p_gb_sonda02);
p_esq.add(p_gb_sonda03);
p_esq.add(p_gb_sonda04);
p_esq.add(p_gb_sonda05);
p_esq.add(p_gb_sonda06);
p_esq.add(p_gb_sonda07);
p_esq.add(p_gb_sonda08);
p_esq.add(p_gb_sonda09);
p_esq.add(p_gb_sonda10);
p_esq.add(p_gb_sonda11);
p_esq.add(p_gb_sonda12);
p_esq.add(p_gb_sonda13);
p_esq.add(p_gb_sonda14);
p_esq.add(p_gb_sonda15);
p_esq.add(p_gb_sonda16);
p_esq.add(p_gb_sonda17);
p_esq.add(p_gb_sonda18);
p_esq.add(p_gb_sonda19);
p_esq.add(p_gb_sonda20);

p_dir.setBackground(new Color(23,234,12));
p_dir.setPreferredSize(dim_p_dir);
p_dir.setVisible(true);
p_dir.setLayout(gl_p_dir);

p_dir.add(p_status_sonda01);
p_dir.add(p_status_sonda02);
p_dir.add(p_status_sonda03);
p_dir.add(p_status_sonda04);
p_dir.add(p_status_sonda05);
p_dir.add(p_status_sonda06);
p_dir.add(p_status_sonda07);
p_dir.add(p_status_sonda08);
p_dir.add(p_status_sonda09);
p_dir.add(p_status_sonda10);
p_dir.add(p_status_sonda11);
p_dir.add(p_status_sonda12);
p_dir.add(p_status_sonda13);
p_dir.add(p_status_sonda14);
p_dir.add(p_status_sonda15);
p_dir.add(p_status_sonda16);
p_dir.add(p_status_sonda17);
p_dir.add(p_status_sonda18);
p_dir.add(p_status_sonda19);
p_dir.add(p_status_sonda20);

Page 11
JanConfig.java

p_log01.setPreferredSize(dim_p_logs);
p_log02.setPreferredSize(dim_p_logs);
p_log03.setPreferredSize(dim_p_logs);
p_log04.setPreferredSize(dim_p_logs);
p_log05.setPreferredSize(dim_p_logs);
p_log06.setPreferredSize(dim_p_logs);
p_log07.setPreferredSize(dim_p_logs);
p_log08.setPreferredSize(dim_p_logs);
p_log09.setPreferredSize(dim_p_logs);
p_log10.setPreferredSize(dim_p_logs);
p_log11.setPreferredSize(dim_p_logs);
p_log12.setPreferredSize(dim_p_logs);
p_log13.setPreferredSize(dim_p_logs);
p_log14.setPreferredSize(dim_p_logs);
p_log15.setPreferredSize(dim_p_logs);
p_log16.setPreferredSize(dim_p_logs);
p_log17.setPreferredSize(dim_p_logs);
p_log18.setPreferredSize(dim_p_logs);
p_log19.setPreferredSize(dim_p_logs);
p_log20.setPreferredSize(dim_p_logs);

p_log01.setBackground(Color.white);
p_log02.setBackground(new Color(255, 255, 200));
p_log03.setBackground(Color.white);
p_log04.setBackground(new Color(255, 255, 200));
p_log05.setBackground(Color.white);
p_log06.setBackground(new Color(255, 255, 200));
p_log07.setBackground(Color.white);
p_log08.setBackground(new Color(255, 255, 200));
p_log09.setBackground(Color.white);
p_log10.setBackground(new Color(255, 255, 200));
p_log11.setBackground(Color.white);
p_log12.setBackground(new Color(255, 255, 200));
p_log13.setBackground(Color.white);
p_log14.setBackground(new Color(255, 255, 200));
p_log15.setBackground(Color.white);
p_log16.setBackground(new Color(255, 255, 200));
p_log17.setBackground(Color.white);
p_log18.setBackground(new Color(255, 255, 200));
p_log19.setBackground(Color.white);
p_log20.setBackground(new Color(255, 255, 200));

p_centro.setBackground(Color.WHITE);
p_centro.setPreferredSize(dim_p_centro);
p_centro.setVisible(true);
p_centro.setLayout(gl_p_esq);

p_centro.add(p_log01);
p_centro.add(p_log02);
p_centro.add(p_log03);
p_centro.add(p_log04);
p_centro.add(p_log05);
p_centro.add(p_log06);
p_centro.add(p_log07);
p_centro.add(p_log08);
p_centro.add(p_log09);
p_centro.add(p_log10);
p_centro.add(p_log11);
p_centro.add(p_log12);
p_centro.add(p_log13);
p_centro.add(p_log14);
p_centro.add(p_log15);
p_centro.add(p_log16);
p_centro.add(p_log17);

Page 12
JanConfig.java

p_centro.add(p_log18);
p_centro.add(p_log19);
p_centro.add(p_log20);

p_centro.setBackground(Color.white);
p_centro.setVisible(true);
p_centro.setPreferredSize(dim_p_centro);
p_centro.repaint();

j_principal.setJMenuBar(bm);
j_principal.getContentPane().add(p_esq,BorderLayout.WEST);
j_principal.getContentPane().add(p_cima,BorderLayout.NORTH);
j_principal.getContentPane().add(p_centro,BorderLayout.CENTER);
j_principal.getContentPane().add(p_dir,BorderLayout.EAST);

@Override
public void actionPerformed(ActionEvent ae) {
// TODO Auto-generated method stub
if(ae.getSource()==mi_sair)
{
System.exit(1);
}else

if(ae.getSource()==mi_config_serial){

new TelaConfiguracoes();

}else

if(ae.getSource()==b_plotar){

teste_grafico= new TesteGraficoRealTime();


teste_grafico.getContentPane().setPreferredSize(dim_jan_graf);
teste_grafico.setVisible(true);
teste_grafico.setBounds(0, 0, 1600, 768);
teste_grafico.startThread();

}else

if(ae.getSource()==b_instS01){
byte sonda=0x00;
SerialCom serialcom;
SerialComLeitura leitor= new SerialComLeitura ("COM1",9600,100);//valores
default
serialcom= new SerialCom();
serialcom.ListarPortas();
leitor.HabilitarEscrita();
leitor.ObterIdDaPorta();
leitor.AbrirPorta();
leitor.instalar_sonda(sonda);
leitor.FecharCom();

}else

if(ae.getSource()==b_instS02){
byte sonda=0x01;
SerialCom serialcom;
SerialComLeitura leitor= new SerialComLeitura
("COM1",9600,100);//valores default
serialcom= new SerialCom();

Page 13
JanConfig.java

serialcom.ListarPortas();
leitor.HabilitarEscrita();
leitor.ObterIdDaPorta();
leitor.AbrirPorta();
leitor.instalar_sonda(sonda);
leitor.FecharCom();

}else

if(ae.getSource()==b_instS03){
byte sonda=0x02;
SerialCom serialcom;
SerialComLeitura leitor= new SerialComLeitura
("COM1",9600,100);//valores default
serialcom= new SerialCom();
serialcom.ListarPortas();
leitor.HabilitarEscrita();
leitor.ObterIdDaPorta();
leitor.AbrirPorta();
leitor.instalar_sonda(sonda);
leitor.FecharCom();

}else

if(ae.getSource()==b_instS04){
byte sonda=0x03;
SerialCom serialcom;
SerialComLeitura leitor= new SerialComLeitura
("COM1",9600,100);//valores default
serialcom= new SerialCom();
serialcom.ListarPortas();
leitor.HabilitarEscrita();
leitor.ObterIdDaPorta();
leitor.AbrirPorta();
leitor.instalar_sonda(sonda);
leitor.FecharCom();

}else

if(ae.getSource()==b_instS05){
byte sonda=0x04;
SerialCom serialcom;
SerialComLeitura leitor= new SerialComLeitura
("COM1",9600,100);//valores default
serialcom= new SerialCom();
serialcom.ListarPortas();
leitor.HabilitarEscrita();
leitor.ObterIdDaPorta();
leitor.AbrirPorta();
leitor.instalar_sonda(sonda);
leitor.FecharCom();

}else

if(ae.getSource()==b_inst_todas){

Page 14
JanConfig.java

public byte[] retorna_tiposondas(){//função para saber tipo selecionado das sondas,


a qual é chamada
//de dentro da classe TesteGraficoRealTime.

byte tipo_sondas[]={0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54
,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54};//todas T como
default

if(cb_S01.getSelectedIndex()==0){tipo_sondas[0]=0x54;}else{tipo_sondas[0]
=0x53;}
if(cb_S02.getSelectedIndex()==0){tipo_sondas[1]=0x54;}else{tipo_sondas[1]
=0x53;}
if(cb_S03.getSelectedIndex()==0){tipo_sondas[2]=0x54;}else{tipo_sondas[2]
=0x53;}
if(cb_S04.getSelectedIndex()==0){tipo_sondas[3]=0x54;}else{tipo_sondas[3]
=0x53;}
if(cb_S05.getSelectedIndex()==0){tipo_sondas[4]=0x54;}else{tipo_sondas[4]
=0x53;}
if(cb_S06.getSelectedIndex()==0){tipo_sondas[5]=0x54;}else{tipo_sondas[5]
=0x53;}
if(cb_S07.getSelectedIndex()==0){tipo_sondas[6]=0x54;}else{tipo_sondas[6]
=0x53;}
if(cb_S08.getSelectedIndex()==0){tipo_sondas[7]=0x54;}else{tipo_sondas[7]
=0x53;}
if(cb_S09.getSelectedIndex()==0){tipo_sondas[8]=0x54;}else{tipo_sondas[8]
=0x53;}
if(cb_S10.getSelectedIndex()==0){tipo_sondas[9]=0x54;}else{tipo_sondas[9]
=0x53;}
if(cb_S11.getSelectedIndex()==0){tipo_sondas[10]=0x54;}else{tipo_sondas[10]
=0x53;}
if(cb_S12.getSelectedIndex()==0){tipo_sondas[11]=0x54;}else{tipo_sondas[11]
=0x53;}
if(cb_S13.getSelectedIndex()==0){tipo_sondas[12]=0x54;}else{tipo_sondas[12]
=0x53;}
if(cb_S14.getSelectedIndex()==0){tipo_sondas[13]=0x54;}else{tipo_sondas[13]
=0x53;}
if(cb_S15.getSelectedIndex()==0){tipo_sondas[14]=0x54;}else{tipo_sondas[14]
=0x53;}
if(cb_S16.getSelectedIndex()==0){tipo_sondas[15]=0x54;}else{tipo_sondas[15]
=0x53;}
if(cb_S17.getSelectedIndex()==0){tipo_sondas[16]=0x54;}else{tipo_sondas[16]
=0x53;}
if(cb_S18.getSelectedIndex()==0){tipo_sondas[17]=0x54;}else{tipo_sondas[17]
=0x53;}
if(cb_S19.getSelectedIndex()==0){tipo_sondas[18]=0x54;}else{tipo_sondas[18]
=0x53;}
if(cb_S20.getSelectedIndex()==0){tipo_sondas[19]=0x54;}else{tipo_sondas[19]
=0x53;}

return tipo_sondas;

@Override
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
j_principal.repaint(0, 0, 1366, 768);
j_principal.getContentPane().repaint();
}

@Override
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub

Page 15
JanConfig.java

System.exit(1);
}

@Override
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(1);
}

@Override
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub

@Override
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub

@Override
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub

@Override
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
j_principal.repaint(0, 0, 1366, 768);
j_principal.getContentPane().repaint();
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
new JanConfig();
}

Page 16

S-ar putea să vă placă și