0
public class TelaGrafico extends javax.swing.JFrame {
Connection conexao = null;
PreparedStatement pst = null;
ResultSet rs = null;
/**
* Creates new form TelaGrafico
*/
public TelaGrafico() {
initComponents();
conexao = ModuloConexao.conectar();
jRadioButtonNatal.setSelected(true);
jLabelGerarGrafico.setVisible(false);
jProgressBarGerarGrafico.setVisible(false);
Calendar calen = Calendar.getInstance();
int anos = calen.get(Calendar.YEAR);
jTextFieldAno.setText(Integer.toString(anos));
}
//MÉTODO PARA GERAR GRAFICO PELA LOCALIDADE:
private void GraficoLocalidade() {
String localidade = jComboBoxLocalidade.getSelectedItem().toString();
String ano = jTextFieldAno.getText();
String semIni = jTextFieldSemInicial.getText();
String semFin = jTextFieldSemFinal.getText();
switch (jComboBoxDistritos.getSelectedIndex()) {
case 0:
//NORTE:
break;
case 1:
//SUL:
break;
case 2:
//LESTE:
String dadosGrafico = "select sem_epi,ipo,ido from tb_indices_leste where localidade='" + localidade + "' and ano='" + ano + "' and sem_epi between '" + semIni + "' and '"+semFin+"'";
try {
pst = conexao.prepareStatement(dadosGrafico);
rs = pst.executeQuery();
if (rs.next()) {}
The code ends here and this SELECT above returns me to the table:
+---------+-------+-------+
| sem_epi | ipo | ido |
+---------+-------+-------+
| 1 | 100.0 | 23.1 |
| 2 | 88.9 | 85.0 |
| 3 | 77.8 | 145.3 |
| 4 | 77.8 | 4.0 |
| 5 | 100.0 | 5.0 |
+---------+-------+-------+
How to create an Array[][] using the result of this table in JAVA?
could if how is returned this Array? ie the code to get to that point!
– novic
The code does not return any array to me. The code stops at this (SELECT) query and the question is this, how to create an array with these table values.
– Amiraldo Rodrigues Filho
So share this code!
– novic
Ready. The complete code.
– Amiraldo Rodrigues Filho
Need to make a class and create a list of this class will be what you need?
– novic
I believe I don’t need another class, I just need to take these values and put them in an array[][]. I think this solves.
– Amiraldo Rodrigues Filho
If you are going to use this result where ?
– novic
@Virgilionovic It worked out too much! Thank you so much for the time and patience! Hug!
– Amiraldo Rodrigues Filho
whether it was useful to accept as an answer to your question
– novic