• Revista PROGRAMAR: Já está disponível a edição #53 da revista programar. Faz já o download aqui!

Alvaro Martins

sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958) e afins

2 mensagens neste tópico

Viva,

Hoje é a minha vez...

Nao consigo dar a volta a estes erros, nao faço ideia pq é q a ligaçao nao tá a ser efectuada à bd.

Este programa já funcionou noutro pc, mas no meu teima em nao funcionar.

Este erro de execução é tirado do Jcreator:

NÒo conseguiu estabelecer a ligaþÒo
java.sql.SQLException: [Microsoft][Gestor de controladores de ODBC] O nome da or
igem de dados nÒo foi encontrado e nÒo foi especificado nenhum controlador prede
finido
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
        at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:3
23)
        at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
        at java.sql.DriverManager.getConnection(DriverManager.java:525)
        at java.sql.DriverManager.getConnection(DriverManager.java:193)
        at TrabalhoFinal5.<init>(TrabalhoFinal5.java:33)
        at TrabalhoFinal5.main(TrabalhoFinal5.java:1410)
Exception in thread "main" java.lang.NullPointerException
        at TrabalhoFinal5.getTable(TrabalhoFinal5.java:1338)
        at TrabalhoFinal5.<init>(TrabalhoFinal5.java:45)
        at TrabalhoFinal5.main(TrabalhoFinal5.java:1410)
Press any key to continue...

No texteditor qd corro o ctrl+3 para executar o codigo como applet dá um erro de segurança:

jx.jpg

Codigo integral para quem desejar experimentar.... e ajudar:

import java.awt.*;

import java.awt.image.*;

import javax.swing.*;

import javax.swing.border.*;

import java.awt.event.*;

import java.util.*;

import java.util.Date;

import java.awt.geom.*;

import java.sql.*;

import java.net.*;

import java.io.*;

/*

* Created by JFormDesigner on Thu Jun 08 12:28:35 BST 2006

*/

/**

* @author User3

*/

public class TrabalhoFinal5 extends JFrame {

  private Connection conn;

  private JTable table;

  public TrabalhoFinal5() {

      initComponents();

      String url = "jdbc:odbc:FusosHorarios.xls";

      // Carrega o driver que permite a ligação à Base de Dados

      try {

        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

        conn = DriverManager.getConnection(url);

      }

      catch (ClassNotFoundException cnfex) {

        System.err.println("Falhou o carregamento do driver JDBC/ODBC.");

        cnfex.printStackTrace();

        System.exit(1);

      }

      catch (SQLException sqlex) {

        System.err.println("Não conseguiu estabelecer a ligação");

        sqlex.printStackTrace();

      }

      getTable();

      setSize(750,350);

      //setVisible(true);

  }

  private void initComponents() {

      // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents

      dialogPane = new JPanel();

      tabbedPane1 = new JTabbedPane();

      panel1 = new JPanel();

      panel48 = new JPanel();

      panel49 = new JPanel();

      label27 = new JLabel();

      panel50 = new JPanel();

      label28 = new JLabel();

      panel51 = new JPanel();

      comboBox5 = new JComboBox();

      panel52 = new JPanel();

      panel53 = new JPanel();

      label29 = new JLabel();

      panel54 = new JPanel();

      label30 = new JLabel();

      panel55 = new JPanel();

      label31 = new JLabel();

      panel56 = new JPanel();

      panel57 = new JPanel();

      comboBox6 = new JComboBox();

      panel58 = new JPanel();

      comboBox7 = new JComboBox();

      panel59 = new JPanel();

      comboBox8 = new JComboBox();

      panel60 = new JPanel();

      button6 = new JButton();

      panel61 = new JPanel();

      textField14 = new JTextField();

      panel14 = new JPanel();

      label3 = new JLabel();

      textField13 = new JTextField();

      panel3 = new JPanel();

      panel6 = new JPanel();

      label1 = new JLabel();

      panel7 = new JPanel();

      panel8 = new JPanel();

      label5 = new JLabel();

      panel9 = new JPanel();

      panel11 = new JPanel();

      panel10 = new JPanel();

      button3 = new JButton();

      button4 = new JButton();

      panel15 = new JPanel();

      scrollPane1 = new JScrollPane();

      panel19 = new JPanel();

      label21 = new JLabel();

      radioButton1 = new JRadioButton();

      label7 = new JLabel();

      radioButton2 = new JRadioButton();

      label8 = new JLabel();

      textField1 = new JTextField();

      label9 = new JLabel();

      textField2 = new JTextField();

      label6 = new JLabel();

      label10 = new JLabel();

      textField3 = new JTextField();

      checkBox1 = new JCheckBox();

      label11 = new JLabel();

      checkBox2 = new JCheckBox();

      label12 = new JLabel();

      textField4 = new JTextField();

      checkBox3 = new JCheckBox();

      label13 = new JLabel();

      textField5 = new JTextField();

      panel12 = new JPanel();

      panel16 = new JPanel();

      label2 = new JLabel();

      panel17 = new JPanel();

      button1 = new JButton();

      button5 = new JButton();

      panel18 = new JPanel();

      scrollPane2 = new JScrollPane();

      checkBox4 = new JCheckBox();

      label14 = new JLabel();

      textField6 = new JTextField();

      checkBox5 = new JCheckBox();

      label15 = new JLabel();

      textField7 = new JTextField();

      checkBox6 = new JCheckBox();

      label16 = new JLabel();

      textField8 = new JTextField();

      checkBox7 = new JCheckBox();

      label17 = new JLabel();

      textField9 = new JTextField();

      checkBox8 = new JCheckBox();

      label18 = new JLabel();

      textField10 = new JTextField();

      checkBox9 = new JCheckBox();

      label19 = new JLabel();

      textField11 = new JTextField();

      label20 = new JLabel();

      textField12 = new JTextField();

      button2 = new JButton();

      radioButton5 = new JRadioButton();

      radioButton7 = new JRadioButton();

      button8 = new JButton();

      radioButton6 = new JRadioButton();

      radioButton3 = new JRadioButton();

      panel13 = new JPanel();

      panel20 = new JPanel();

      panel21 = new JPanel();

      panel24 = new JPanel();

      label23 = new JLabel();

      label24 = new JLabel();

      label25 = new JLabel();

      label26 = new JLabel();

      label32 = new JLabel();

      label33 = new JLabel();

      label34 = new JLabel();

      panel4 = new JPanel();

      label4 = new JLabel();

      radioButton4 = new JRadioButton();

      radioButton8 = new JRadioButton();

      scrollPane3 = new JScrollPane();

      textArea1 = new JTextArea();

      radioButton9 = new JRadioButton();

      button7 = new JButton();

      panel2 = new JPanel();

      panel5 = new JPanel();

      label22 = new JLabel();

      panel22 = new JPanel();

      panel23 = new JPanel();

      scrollPane4 = new JScrollPane();

      textArea2 = new JTextArea();

      panel25 = new JPanel();

      panel27 = new JPanel();

      label35 = new JLabel();

      panel28 = new JPanel();

      panel29 = new JPanel();

      label36 = new JLabel();

      panel30 = new JPanel();

      panel31 = new JPanel();

      panel32 = new JPanel();

      panel26 = new JPanel();

      //======== this ========

      Container contentPane = getContentPane();

      contentPane.setLayout(new BorderLayout());

      //======== dialogPane ========

      {

      dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));

      dialogPane.setLayout(new BorderLayout());

      //======== tabbedPane1 ========

      {

      tabbedPane1.setFont(new Font("Tahoma", Font.PLAIN, 16));

      tabbedPane1.setRequestFocusEnabled(false);

      //======== panel1 ========

      {

      panel1.setLayout(new GridLayout());

      //======== panel48 ========

      {

      panel48.setLayout(new GridLayout(8, 1));

      //======== panel49 ========

      {

      panel49.setFont(new Font("Tahoma", Font.BOLD, 30));

      panel49.setLayout(new FlowLayout());

      //---- label27 ----

      label27.setText("Horas em todo o Mundo");

      label27.setFont(new Font("Tahoma", Font.BOLD, 30));

      panel49.add(label27);

      }

      panel48.add(panel49);

      //======== panel50 ========

      {

      panel50.setLayout(new FlowLayout());

      //---- label28 ----

      label28.setText("Escolher o pa\u00eds ou regi\u00e3o");

      label28.setFont(new Font("Tahoma", Font.BOLD, 16));

      panel50.add(label28);

      }

      panel48.add(panel50);

      //======== panel51 ========

      {

      panel51.setLayout(new FlowLayout());

      //---- comboBox5 ----

      comboBox5.setPreferredSize(new Dimension(400, 22));

      comboBox5.setToolTipText("Selecciona o pais pretendido");

      panel51.add(comboBox5);

      }

      panel48.add(panel51);

      //======== panel52 ========

      {

      panel52.setLayout(new GridLayout(1, 3));

      //======== panel53 ========

      {

      panel53.setLayout(new FlowLayout());

      //---- label29 ----

      label29.setText("Hemisf\u00e9rio ");

      label29.setFont(new Font("Tahoma", Font.BOLD, 18));

      panel53.add(label29);

      }

      panel52.add(panel53);

      //======== panel54 ========

      {

      panel54.setLayout(new FlowLayout());

      //---- label30 ----

      label30.setText("UTC ");

      label30.setFont(new Font("Tahoma", Font.BOLD, 18));

      panel54.add(label30);

      }

      panel52.add(panel54);

      //======== panel55 ========

      {

      panel55.setFont(new Font("Tahoma", Font.BOLD, 18));

      panel55.setLayout(new FlowLayout());

      //---- label31 ----

      label31.setText("Hor\u00e1rio de Ver\u00e3o");

      label31.setFont(new Font("Tahoma", Font.BOLD, 18));

      panel55.add(label31);

      }

      panel52.add(panel55);

      }

      panel48.add(panel52);

      //======== panel56 ========

      {

      panel56.setLayout(new GridLayout(1, 3));

      //======== panel57 ========

      {

      panel57.setLayout(new FlowLayout());

      //---- comboBox6 ----

      comboBox6.setPreferredSize(new Dimension(200, 22));

      comboBox6.setToolTipText("Indica o hemisf\u00e9rio ao qual o pais pertence");

      panel57.add(comboBox6);

      }

      panel56.add(panel57);

      //======== panel58 ========

      {

      panel58.setLayout(new FlowLayout());

      //---- comboBox7 ----

      comboBox7.setPreferredSize(new Dimension(200, 22));

      comboBox7.setToolTipText("Indica o UTC do pais escolhido");

      panel58.add(comboBox7);

      }

      panel56.add(panel58);

      //======== panel59 ========

      {

      panel59.setLayout(new FlowLayout());

      //---- comboBox8 ----

      comboBox8.setPreferredSize(new Dimension(200, 22));

      comboBox8.setToolTipText("Indica se o pais adopta ou n\u00e3o um hor\u00e1rio de ver\u00e3o");

      panel59.add(comboBox8);

      }

      panel56.add(panel59);

      }

      panel48.add(panel56);

      //======== panel60 ========

      {

      panel60.setLayout(new FlowLayout());

      //---- button6 ----

      button6.setText("Ver horas no pa\u00eds/regi\u00e3o ");

      button6.setMnemonic('V');

      button6.setToolTipText("pressionar para visualizar as horas no pais escolhido");

      panel60.add(button6);

      }

      panel48.add(panel60);

      //======== panel61 ========

      {

      panel61.setLayout(new FlowLayout());

      //---- textField14 ----

      textField14.setPreferredSize(new Dimension(400, 24));

      textField14.setFont(new Font("Tahoma", Font.ITALIC, 20));

      textField14.setColumns(6);

      textField14.setForeground(Color.blue);

      panel61.add(textField14);

      }

      panel48.add(panel61);

      //======== panel14 ========

      {

      panel14.setLayout(new FlowLayout());

      //---- label3 ----

      label3.setText("Horas em Portugal :  ");

      label3.setFont(new Font("Tahoma", Font.BOLD, 20));

      panel14.add(label3);

      //---- textField13 ----

      textField13.setColumns(17);

      textField13.setFont(new Font("Tahoma", Font.ITALIC, 20));

      textField13.setForeground(Color.blue);

      panel14.add(textField13);

      }

      panel48.add(panel14);

      }

      panel1.add(panel48);

      }

      tabbedPane1.addTab("Rel\u00f3gio", panel1);

      //======== panel3 ========

      {

      panel3.setLayout(new BorderLayout());

      //======== panel6 ========

      {

      panel6.setLayout(new FlowLayout());

      //---- label1 ----

      label1.setText("An\u00e1lise Estat\u00edstica");

      label1.setFont(new Font("Tahoma", Font.BOLD, 30));

      label1.setBorder(new MatteBorder(1, 1, 1, 1, Color.black));

      panel6.add(label1);

      }

      panel3.add(panel6, BorderLayout.NORTH);

      //======== panel7 ========

      {

      panel7.setLayout(new BorderLayout());

      //======== panel8 ========

      {

      panel8.setLayout(new GridBagLayout());

      ((GridBagLayout)panel8.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

      ((GridBagLayout)panel8.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

      ((GridBagLayout)panel8.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};

      ((GridBagLayout)panel8.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};

      //---- label5 ----

      label5.setText("Op\u00e7\u00e3o:");

      label5.setFont(new Font("Tahoma", Font.BOLD, 16));

      panel8.add(label5, new GridBagConstraints(1, 0, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //======== panel9 ========

      {

      panel9.setBorder(new MatteBorder(1, 1, 1, 1, Color.black));

      panel9.setLayout(new BorderLayout());

      //======== panel11 ========

      {

      panel11.setBorder(new MatteBorder(1, 1, 1, 1, Color.black));

      panel11.setLayout(new BorderLayout());

      //======== panel10 ========

      {

      panel10.setLayout(new FlowLayout());

      //---- button3 ----

      button3.setText("Ver Diagrama");

      button3.setMnemonic('D');

      panel10.add(button3);

      //---- button4 ----

      button4.setText("Limpar");

      button4.setMnemonic('L');

      panel10.add(button4);

      }

      panel11.add(panel10, BorderLayout.SOUTH);

      //======== panel15 ========

      {

      panel15.setBorder(null);

      panel15.setMaximumSize(new Dimension(33011, 32767));

      panel15.setToolTipText("pode visualizar aqui o diagrama de extremos e quartis da distribui\u00e7\u00e3o");

      panel15.setLayout(null);

      panel15.add(scrollPane1);

      scrollPane1.setBounds(0, 110, 400, scrollPane1.getPreferredSize().height);

      { // compute preferred size

      Dimension preferredSize = new Dimension();

      for(int i = 0; i < panel15.getComponentCount(); i++) {

      Rectangle bounds = panel15.getComponent(i).getBounds();

      preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);

      preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);

      }

      Insets insets = panel15.getInsets();

      preferredSize.width += insets.right;

      preferredSize.height += insets.bottom;

      panel15.setPreferredSize( preferredSize );

      }

      }

      panel11.add(panel15, BorderLayout.CENTER);

      }

      panel9.add(panel11, BorderLayout.CENTER);

      //======== panel19 ========

      {

      panel19.setLayout(new FlowLayout());

      //---- label21 ----

      label21.setText("Diagrama de Extremos e Quartis");

      label21.setHorizontalAlignment(SwingConstants.CENTER);

      label21.setFont(new Font("Tahoma", Font.BOLD, 12));

      panel19.add(label21);

      }

      panel9.add(panel19, BorderLayout.NORTH);

      }

      panel8.add(panel9, new GridBagConstraints(32, 0, 12, 7, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- radioButton1 ----

      radioButton1.setText("Gerar os numeros aleat\u00f3riamente");

      radioButton1.setSelected(true);

      radioButton1.setFont(new Font("Tahoma", Font.PLAIN, 12));

      radioButton1.setToolTipText("o programa vai gerar de uma forma aleat\u00f3ria numeros dentro do intervalo escolhido");

      panel8.add(radioButton1, new GridBagConstraints(1, 1, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label7 ----

      label7.setText("Introduzir Dados");

      label7.setFont(new Font("Tahoma", Font.BOLD, 16));

      panel8.add(label7, new GridBagConstraints(14, 1, 13, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- radioButton2 ----

      radioButton2.setText("Introduzior os numeros");

      radioButton2.setFont(new Font("Tahoma", Font.PLAIN, 12));

      radioButton2.setToolTipText("os numeros s\u00e3o introduzidos pelo utilizador");

      panel8.add(radioButton2, new GridBagConstraints(1, 2, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label8 ----

      label8.setText("Minimo");

      label8.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label8, new GridBagConstraints(14, 2, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField1 ----

      textField1.setColumns(12);

      textField1.setHorizontalAlignment(SwingConstants.LEFT);

      textField1.setText("0");

      textField1.setToolTipText("valor minimo da distribui\u00e7\u00e3o");

      panel8.add(textField1, new GridBagConstraints(22, 2, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label9 ----

      label9.setText("M\u00e1ximo");

      label9.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label9, new GridBagConstraints(14, 3, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField2 ----

      textField2.setHorizontalAlignment(SwingConstants.LEFT);

      textField2.setText("300");

      textField2.setColumns(12);

      textField2.setToolTipText("valor m\u00e1ximo da distribui\u00e7\u00e3o");

      panel8.add(textField2, new GridBagConstraints(22, 3, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label6 ----

      label6.setText("Parametros:");

      label6.setFont(new Font("Tahoma", Font.BOLD, 16));

      label6.setToolTipText("Escolher os parametros que pretende calcular");

      panel8.add(label6, new GridBagConstraints(1, 4, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label10 ----

      label10.setText("Dimens\u00e3o");

      label10.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label10, new GridBagConstraints(14, 4, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField3 ----

      textField3.setHorizontalAlignment(SwingConstants.LEFT);

      textField3.setText("100");

      textField3.setColumns(12);

      textField3.setToolTipText("dimens\u00e3o da distribui\u00e7\u00e3o");

      panel8.add(textField3, new GridBagConstraints(22, 4, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox1 ----

      checkBox1.setText("M\u00e9dia");

      checkBox1.setSelected(true);

      checkBox1.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox1, new GridBagConstraints(1, 5, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label11 ----

      label11.setText("Resultados");

      label11.setFont(new Font("Tahoma", Font.BOLD, 16));

      panel8.add(label11, new GridBagConstraints(14, 5, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox2 ----

      checkBox2.setText("Mediana");

      checkBox2.setSelected(true);

      checkBox2.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox2, new GridBagConstraints(1, 6, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label12 ----

      label12.setText("M\u00e9dia");

      label12.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label12, new GridBagConstraints(14, 6, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField4 ----

      textField4.setHorizontalAlignment(SwingConstants.LEFT);

      textField4.setColumns(12);

      panel8.add(textField4, new GridBagConstraints(22, 6, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox3 ----

      checkBox3.setText("Quartil 1");

      checkBox3.setSelected(true);

      checkBox3.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox3, new GridBagConstraints(1, 7, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label13 ----

      label13.setText("Mediana");

      label13.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label13, new GridBagConstraints(14, 7, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField5 ----

      textField5.setHorizontalAlignment(SwingConstants.LEFT);

      textField5.setColumns(12);

      panel8.add(textField5, new GridBagConstraints(22, 7, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //======== panel12 ========

      {

      panel12.setBorder(new MatteBorder(1, 1, 1, 1, Color.black));

      panel12.setLayout(new BorderLayout());

      //======== panel16 ========

      {

      panel16.setBorder(new MatteBorder(1, 1, 1, 1, Color.black));

      panel16.setLayout(new FlowLayout());

      //---- label2 ----

      label2.setText("Gr\u00e1fico");

      label2.setFont(new Font("Tahoma", Font.BOLD, 12));

      panel16.add(label2);

      }

      panel12.add(panel16, BorderLayout.NORTH);

      //======== panel17 ========

      {

      panel17.setLayout(new FlowLayout());

      //---- button1 ----

      button1.setText("Ver Gr\u00e1fico");

      button1.setMnemonic('V');

      panel17.add(button1);

      //---- button5 ----

      button5.setText("Limpar");

      button5.setMnemonic('I');

      panel17.add(button5);

      }

      panel12.add(panel17, BorderLayout.SOUTH);

      //======== panel18 ========

      {

      panel18.setToolTipText("pode visualizar quatro op\u00e7\u00f5es de gr\u00e1fico");

      panel18.setLayout(new BorderLayout());

      panel18.add(scrollPane2, BorderLayout.SOUTH);

      }

      panel12.add(panel18, BorderLayout.CENTER);

      }

      panel8.add(panel12, new GridBagConstraints(32, 7, 12, 8, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox4 ----

      checkBox4.setText("Quartil 3");

      checkBox4.setSelected(true);

      checkBox4.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox4, new GridBagConstraints(1, 8, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label14 ----

      label14.setText("Quartil 1");

      label14.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label14, new GridBagConstraints(14, 8, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField6 ----

      textField6.setHorizontalAlignment(SwingConstants.LEFT);

      textField6.setColumns(12);

      panel8.add(textField6, new GridBagConstraints(22, 8, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox5 ----

      checkBox5.setText("Amplitude");

      checkBox5.setSelected(true);

      checkBox5.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox5, new GridBagConstraints(1, 9, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label15 ----

      label15.setText("Quartil 3");

      label15.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label15, new GridBagConstraints(14, 9, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField7 ----

      textField7.setHorizontalAlignment(SwingConstants.LEFT);

      textField7.setColumns(12);

      panel8.add(textField7, new GridBagConstraints(22, 9, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox6 ----

      checkBox6.setText("Desvio Padr\u00e3o");

      checkBox6.setSelected(true);

      checkBox6.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox6, new GridBagConstraints(1, 10, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label16 ----

      label16.setText("Amplitude");

      label16.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label16, new GridBagConstraints(14, 10, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField8 ----

      textField8.setHorizontalAlignment(SwingConstants.LEFT);

      textField8.setColumns(12);

      panel8.add(textField8, new GridBagConstraints(22, 10, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox7 ----

      checkBox7.setText("Desvio Padr\u00e3o Corrigido");

      checkBox7.setSelected(true);

      checkBox7.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox7, new GridBagConstraints(1, 11, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label17 ----

      label17.setText("Desvio Padr\u00e3o");

      label17.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label17, new GridBagConstraints(14, 11, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField9 ----

      textField9.setHorizontalAlignment(SwingConstants.LEFT);

      textField9.setColumns(12);

      panel8.add(textField9, new GridBagConstraints(22, 11, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox8 ----

      checkBox8.setText("M\u00e1ximo");

      checkBox8.setSelected(true);

      checkBox8.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox8, new GridBagConstraints(1, 12, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label18 ----

      label18.setText("Desvio Padr\u00e3o Corrigido");

      label18.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label18, new GridBagConstraints(14, 12, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField10 ----

      textField10.setHorizontalAlignment(SwingConstants.LEFT);

      textField10.setColumns(12);

      panel8.add(textField10, new GridBagConstraints(22, 12, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- checkBox9 ----

      checkBox9.setText("Minimo");

      checkBox9.setSelected(true);

      checkBox9.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(checkBox9, new GridBagConstraints(1, 13, 10, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label19 ----

      label19.setText("M\u00e1ximo");

      label19.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label19, new GridBagConstraints(14, 13, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField11 ----

      textField11.setHorizontalAlignment(SwingConstants.LEFT);

      textField11.setColumns(12);

      panel8.add(textField11, new GridBagConstraints(22, 13, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- label20 ----

      label20.setText("Minimo");

      label20.setFont(new Font("Tahoma", Font.PLAIN, 12));

      panel8.add(label20, new GridBagConstraints(14, 14, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- textField12 ----

      textField12.setHorizontalAlignment(SwingConstants.LEFT);

      textField12.setColumns(12);

      panel8.add(textField12, new GridBagConstraints(22, 14, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- button2 ----

      button2.setText("Calcular");

      button2.setMnemonic('C');

      button2.setToolTipText("ao pressionar vai calcular os parametros seleccionados");

      panel8.add(button2, new GridBagConstraints(1, 15, 3, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- radioButton5 ----

      radioButton5.setText("Fun\u00e7\u00e3o seno");

      radioButton5.setSelected(true);

      panel8.add(radioButton5, new GridBagConstraints(33, 15, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- radioButton7 ----

      radioButton7.setText("F. seno distorcida");

      panel8.add(radioButton7, new GridBagConstraints(38, 15, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 5, 15), 0, 0));

      //---- button8 ----

      button8.setText("Gravar ");

      button8.setMnemonic('G');

      button8.setFont(new Font("Tahoma", Font.BOLD, 12));

      button8.setToolTipText("Grava os resultados num ficheiro excel");

      panel8.add(button8, new GridBagConstraints(14, 16, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 0, 15), 0, 0));

      //---- radioButton6 ----

      radioButton6.setText("Fun\u00e7\u00e3o coseno");

      panel8.add(radioButton6, new GridBagConstraints(33, 16, 4, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 0, 15), 0, 0));

      //---- radioButton3 ----

      radioButton3.setText("F. cos distorcida ");

      panel8.add(radioButton3, new GridBagConstraints(38, 16, 5, 1, 0.0, 0.0,

      GridBagConstraints.CENTER, GridBagConstraints.BOTH,

      new Insets(0, 0, 0, 15), 0, 0));

      }

      panel7.add(panel8, BorderLayout.CENTER);

      }

      panel3.add(panel7, BorderLayout.CENTER);

      }

      tabbedPane1.addTab("An\u00e1lise Estat\u00edstica", panel3);

      //======== panel13 ========

      {

      panel13.setLayout(new GridLayout(1, 2));

      //======== panel20 ========

      {

      panel20.setLayout(new GridLayout());

      //======== panel21 ========

      {

      panel21.setLayout(new FlowLayout());

      }

      panel20.add(panel21);

      //======== panel24 ========

      {

      panel24.setLayout(null);

      //---- label23 ----

      label23.setText("Legenda:");

      label23.setFont(new Font("Tahoma", Font.BOLD, 20));

      panel24.add(label23);

      label23.setBounds(new Rectangle(new Point(20, 10), label23.getPreferredSize()));

      //---- label24 ----

      label24.setText("Coluna hora de ver\u00e3o:");

      label24.setFont(new Font("Tahoma", Font.PLAIN, 18));

      panel24.add(label24);

      label24.setBounds(10, 55, 175, label24.getPreferredSize().height);

      //---- label25 ----

      label25.setText("0 - N\u00e3o tem hora de ver\u00e3o");

      label25.setFont(new Font("Tahoma", Font.PLAIN, 14));

      panel24.add(label25);

      label25.setBounds(20, 95, 155, label25.getPreferredSize().height);

      //---- label26 ----

      label26.setText("1 - Tem hora de ver\u00e3o");

      label26.setFont(new Font("Tahoma", Font.PLAIN, 14));

      panel24.add(label26);

      label26.setBounds(20, 125, 145, label26.getPreferredSize().height);

      //---- label32 ----

      label32.setText("Coluna Hemisf\u00e9rio:");

      label32.setFont(new Font("Tahoma", Font.PLAIN, 18));

      panel24.add(label32);

      label32.setBounds(10, 170, 150, label32.getPreferredSize().height);

      //---- label33 ----

      label33.setText("1 - Hemisf\u00e9rio Norte");

      label33.setFont(new Font("Tahoma", Font.PLAIN, 14));

      panel24.add(label33);

      label33.setBounds(20, 205, 135, label33.getPreferredSize().height);

      //---- label34 ----

      label34.setText("2 - Hemisf\u00e9rio Sul");

      label34.setFont(new Font("Tahoma", Font.PLAIN, 14));

      panel24.add(label34);

      label34.setBounds(new Rectangle(new Point(20, 235), label34.getPreferredSize()));

      { // compute preferred size

      Dimension preferredSize = new Dimension();

      for(int i = 0; i < panel24.getComponentCount(); i++) {

      Rectangle bounds = panel24.getComponent(i).getBounds();

      preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);

      preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);

      }

      Insets insets = panel24.getInsets();

      preferredSize.width += insets.right;

      preferredSize.height += insets.bottom;

      panel24.setPreferredSize( preferredSize );

      }

      }

      panel20.add(panel24);

      }

      panel13.add(panel20);

      }

      tabbedPane1.addTab("Tabela de Fusos Hor\u00e1rios", panel13);

      //======== panel4 ========

      {

      panel4.setLayout(null);

      //---- label4 ----

      label4.setText("Ajuda sobre:");

      label4.setFont(new Font("Tahoma", Font.BOLD, 20));

      label4.setToolTipText("Escolha o topico sobre o qual deseja saber mais inform\u00e7\u00e3o");

      panel4.add(label4);

      label4.setBounds(40, 70, 135, label4.getPreferredSize().height);

      //---- radioButton4 ----

      radioButton4.setText("ReL\u00f3gio de fusos hor\u00e1rios");

      radioButton4.setSelected(true);

      panel4.add(radioButton4);

      radioButton4.setBounds(new Rectangle(new Point(50, 125), radioButton4.getPreferredSize()));

      //---- radioButton8 ----

      radioButton8.setText("An\u00e1lise Estat\u00edstica");

      panel4.add(radioButton8);

      radioButton8.setBounds(50, 160, 150, radioButton8.getPreferredSize().height);

      //======== scrollPane3 ========

      {

      //---- textArea1 ----

      textArea1.setFont(new Font("Courier", Font.ITALIC, 16));

      textArea1.setEditable(false);

      scrollPane3.setViewportView(textArea1);

      }

      panel4.add(scrollPane3);

      scrollPane3.setBounds(270, 75, 580, 310);

      //---- radioButton9 ----

      radioButton9.setText("Tabela de Fusos Hor\u00e1rios");

      panel4.add(radioButton9);

      radioButton9.setBounds(50, 200, 195, radioButton9.getPreferredSize().height);

      //---- button7 ----

      button7.setText("Ver Ajuda");

      button7.setMnemonic('V');

      panel4.add(button7);

      button7.setBounds(55, 250, 125, button7.getPreferredSize().height);

      { // compute preferred size

      Dimension preferredSize = new Dimension();

      for(int i = 0; i < panel4.getComponentCount(); i++) {

      Rectangle bounds = panel4.getComponent(i).getBounds();

      preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);

      preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);

      }

      Insets insets = panel4.getInsets();

      preferredSize.width += insets.right;

      preferredSize.height += insets.bottom;

      panel4.setPreferredSize( preferredSize );

      }

      }

      tabbedPane1.addTab("Ajuda", panel4);

      //======== panel2 ========

      {

      panel2.setLayout(new BorderLayout());

      //======== panel5 ========

      {

      panel5.setLayout(new FlowLayout());

      //---- label22 ----

      label22.setText("O presente trabalho foi realizado por:");

      label22.setFont(new Font("Tahoma", Font.BOLD, 30));

      panel5.add(label22);

      }

      panel2.add(panel5, BorderLayout.NORTH);

      //======== panel22 ========

      {

      panel22.setLayout(new GridLayout(1, 3));

      //======== panel23 ========

      {

      panel23.setLayout(null);

      //======== scrollPane4 ========

      {

      //---- textArea2 ----

      textArea2.setRows(5);

      textArea2.setColumns(12);

      textArea2.setFont(new Font("Courier", Font.ITALIC, 16));

      textArea2.setForeground(Color.blue);

      textArea2.setEditable(false);

      scrollPane4.setViewportView(textArea2);

      }

      panel23.add(scrollPane4);

      scrollPane4.setBounds(35, 130, 220, 195);

      { // compute preferred size

      Dimension preferredSize = new Dimension();

      for(int i = 0; i < panel23.getComponentCount(); i++) {

      Rectangle bounds = panel23.getComponent(i).getBounds();

      preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);

      preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);

      }

      Insets insets = panel23.getInsets();

      preferredSize.width += insets.right;

      preferredSize.height += insets.bottom;

      panel23.setPreferredSize( preferredSize );

      }

      }

      panel22.add(panel23);

      //======== panel25 ========

      {

      panel25.setLayout(new GridLayout(2, 3));

      //======== panel27 ========

      {

      panel27.setToolTipText("Rui Carrilho, estudante de Inform\u00e1tica de Gest\u00e3o no ISPO");

      panel27.setLayout(new BorderLayout());

      //---- label35 ----

      label35.setText("Rui Carrilho");

      label35.setFont(new Font("Tahoma", Font.ITALIC, 16));

      label35.setHorizontalAlignment(SwingConstants.CENTER);

      label35.setForeground(Color.blue);

      panel27.add(label35, BorderLayout.SOUTH);

      }

      panel25.add(panel27);

      //======== panel28 ========

      {

      panel28.setLayout(new FlowLayout());

      }

      panel25.add(panel28);

      //======== panel29 ========

      {

      panel29.setToolTipText("Bruno Garcia, estudante de Inform\u00e1tica de Gest\u00e3o no ISPO");

      panel29.setLayout(new BorderLayout());

      //---- label36 ----

      label36.setText("Bruno Garcia");

      label36.setFont(new Font("Tahoma", Font.ITALIC, 16));

      label36.setHorizontalAlignment(SwingConstants.CENTER);

      label36.setForeground(Color.blue);

      panel29.add(label36, BorderLayout.SOUTH);

      }

      panel25.add(panel29);

      //======== panel30 ========

      {

      panel30.setLayout(new FlowLayout());

      }

      panel25.add(panel30);

      //======== panel31 ========

      {

      panel31.setLayout(new FlowLayout());

      }

      panel25.add(panel31);

      //======== panel32 ========

      {

      panel32.setLayout(new FlowLayout());

      }

      panel25.add(panel32);

      }

      panel22.add(panel25);

<

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Só mais uma coisinha,

http://www.javafree.org/javabb/viewtopic.jbb?t=1470

neste link diz qq coisa do tipo:

A chave pública é distribuída dentro de um certificado que é uma declaração assinada por uma entidade idônea, chamada Autoridade de Certificação (Certification Authority- CA), que confirma que a chave pública que está no mesmo é confiável. Existem várias Autoridades de Certificação, por exemplo, a VeriSign, Thawte, Entrust e Certisign (empresa brasileira). Toda CA requer um emissor para validar a sua identidade, até mesmo a de mais alto nível. Para estes casos, existem os certificados auto-assinados (self-signed), onde o emissor do certificado é o próprio sujeito.

Os browsers Netscape e Internet Explorer (IE) não usam a codificação de assinatura do JDK. Existem basicamente três tipos diferentes de assinatura de applets, para o IE, para o Netscape, e para o plug-in Java da Sun. Este último fornece aos browsers citados acima a capacidade de utilizar applets assinados através da Java Security API do kit JDK.

Algumas ferramentas necessárias para a assinatura, seguindo o padrão da Sun, encontram-se no JDK 1.2, são elas (7):

Jar (JAR Creation Tool)

Keytool (Key and Certificate Management Tool)

Jarsigner (JAR Signing and Verification Tool)

PolicyTool (Policy File Creation and Management Tool)

Para uma melhor compreensão, encontra-se descritos a seguir os passos utilizados no processo de assinatura e verificação do AppletClient.

Passos para assinar um Applet

Os passos para assinar um Applet estão representados na Figura 2:

0

Figura 2 ? Diagrama de blocos do processo de assinatura por parte do desenvolvedor [/size:1f763170b3]

Criar o arquivo JAR (2)Deve-se criar um arquivo JAR contendo o arquivo .class da Applet e todas as classes que serão utilizadas e que farão uso de recursos fora do sandbox conforme indicado no item 1 da Figura 2. É importante ressaltar que a ferramenta jarsigner somente assinará arquivos JAR criados pelo JDK, ou arquivos ZIP.

Uma ferramenta utilizada para criação deste arquivo é o jar do JDK. Para criar um JAR contendo o arquivo MeuApplet.class, com o nome MeuJar.jar basta fazer:

Quote:

jar cvf MeuJar.jar MeuApplet.class 

Utilizou-se a opção "exportar para arquivo JAR" do Visual Age (ambiente de desenvolvimento Java da IBM) para empacotar os arquivos necessários.

Pelo que percebi devo precisar de assinar a applet de forma a nao dar erros de segurança

Alguem sabe executar isto?

Abraços,

Alvaro

0

Partilhar esta mensagem


Link para a mensagem
Partilhar noutros sites

Crie uma conta ou ligue-se para comentar

Só membros podem comentar

Criar nova conta

Registe para ter uma conta na nossa comunidade. É fácil!


Registar nova conta

Entra

Já tem conta? Inicie sessão aqui.


Entrar Agora