Пример #1
0
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    String sql1 =
        "select a.* FROM ANTENA a WHERE a.ID_antena='"
            + (newJPanel.jList1.getSelectedIndex() + 1)
            + "' ";
    String pom = "";
    System.out.println(sql1);
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      Connection conn;
      try {
        conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", user, password);

        Statement stmt1 = conn.createStatement();
        ResultSet rs1 = stmt1.executeQuery(sql1);
        while (rs1.next()) {
          NewJPanel.jTextField1.setText(rs1.getString("ID_antena"));
          NewJPanel.jTextField2.setText(rs1.getString("Producent"));
          NewJPanel.jTextField3.setText(rs1.getString("Numer_identyfikacyjny"));
          NewJPanel.jTextField4.setText(rs1.getString("Czestotliwosc"));
          NewJPanel.jTextField5.setText(rs1.getString("Polaryzacja"));
          NewJPanel.jTextField6.setText(rs1.getString("Moc"));
          NewJPanel.jTextField7.setText(rs1.getString("Rodzaj"));
        }
      } catch (SQLException e1) {
        System.out.println("tutaj 1");
        e1.printStackTrace();
      }
    } catch (ClassNotFoundException e1) {
      System.out.println("tutaj 2");
      e1.printStackTrace();
    }
  }
  public static void createCanvas(String appClass) {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);

    try {
      Class<? extends Application> clazz = (Class<? extends Application>) Class.forName(appClass);
      app = clazz.newInstance();
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
    } catch (InstantiationException ex) {
      ex.printStackTrace();
    } catch (IllegalAccessException ex) {
      ex.printStackTrace();
    }

    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas();

    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
  }
Пример #3
0
 /**
  * @return an instanciation of the given content-type class name, or null if class wasn't found
  */
 public static ContentType getContentTypeFromClassName(String contentTypeClassName) {
   if (contentTypeClassName == null)
     contentTypeClassName = getAvailableContentTypes()[DEFAULT_CONTENT_TYPE_INDEX];
   ContentType ct = null;
   try {
     Class clazz = Class.forName(contentTypeClassName);
     ct = (ContentType) clazz.newInstance();
   } catch (ClassNotFoundException cnfex) {
     if (jpicedt.Log.DEBUG) cnfex.printStackTrace();
     JPicEdt.getMDIManager()
         .showMessageDialog(
             "The pluggable content-type you asked for (class "
                 + cnfex.getLocalizedMessage()
                 + ") isn't currently installed, using default instead...",
             Localizer.currentLocalizer().get("msg.LoadingContentTypeClass"),
             JOptionPane.ERROR_MESSAGE);
   } catch (Exception ex) {
     if (jpicedt.Log.DEBUG) ex.printStackTrace();
     JPicEdt.getMDIManager()
         .showMessageDialog(
             ex.getLocalizedMessage(),
             Localizer.currentLocalizer().get("msg.LoadingContentTypeClass"),
             JOptionPane.ERROR_MESSAGE);
   }
   return ct;
 }
Пример #4
0
 public static void main(String[] args) {
   /*use an appropriate look and feel*/
   try {
     /*
     	UImanager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     	UImanager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
     */
     UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
   } catch (UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   } catch (IllegalAccessException ex) {
     ex.printStackTrace();
   } catch (InstantiationException ex) {
     ex.printStackTrace();
   } catch (ClassNotFoundException ex) {
     ex.printStackTrace();
   }
   /*turn off metal's use of bold fonts*/
   UIManager.put("swing.boldMetal", Boolean.FALSE);
   /*
   	Schedule a job for the event dispatch thread
   	creating and showing this application's GUI
   */
   javax.swing.SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           createAndShowGUI();
         }
       });
 }
Пример #5
0
  public void loadGame() {
    System.out.println("loading");
    FileInputStream finput = null;
    try {
      finput = new FileInputStream("save");

      ObjectInputStream in = new ObjectInputStream(finput);

      GameObject newRoot = (GameObject) in.readObject();

      @SuppressWarnings("unchecked")
      ArrayList<Button> buttons = (ArrayList<Button>) in.readObject();
      Input.getInstance().setButtons(buttons);

      transitionTo(newRoot);

      in.close();
      finput.close();

    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  public void ListePaletteConteneur(int numero) {

    try {

      Connexion connec = new Connexion(Connexion.log, Connexion.password);
      ResultSet rs = connec.listerPaletteConteneur(numero);

      if (rs.next()) {

        rs.previous();

        String[] nomColonnes = {"id_colis"};

        LinkedList<Object[]> liste = new LinkedList<Object[]>();
        Object[][] donnees;

        while (rs.next()) {
          Object[] data = new Object[8];

          data[0] = rs.getString(1);

          liste.add(data);
        }

        donnees = new Object[liste.size()][];

        for (int i = 0; i < donnees.length; i++) {
          donnees[i] = liste.get(i);
        }

        for (int i = 0; i < 8; i++) System.out.println(nomColonnes[i]);
        table = new JTable(donnees, nomColonnes);

        jp = new JPanel();

        jp.setLayout(new BorderLayout());
        jp.add(table.getTableHeader(), BorderLayout.PAGE_START);
        scroll = new JScrollPane(table);

        jp.add(scroll, BorderLayout.CENTER);

        jp.setVisible(true);
        jp.setSize(800, 700);

        fermer.addActionListener(this);
        JPanel panel = new JPanel(new BorderLayout());
        panel.add(jp, BorderLayout.CENTER);
        panel.add(fermer, BorderLayout.SOUTH);
        this.setContentPane(panel);
        this.setVisible(true);
      }

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Пример #7
0
 public static void main(String[] args) {
   /* Use an appropriate Look and Feel */
   try {
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
   } catch (UnsupportedLookAndFeelException ex) {
     ex.printStackTrace();
   } catch (IllegalAccessException ex) {
     ex.printStackTrace();
   } catch (InstantiationException ex) {
     ex.printStackTrace();
   } catch (ClassNotFoundException ex) {
     ex.printStackTrace();
   }
   /* Turn off metal's use of bold fonts */
   UIManager.put("swing.boldMetal", Boolean.FALSE);
   // Schedule a job for the event-dispatching thread:
   // adding TrayIcon.
   SwingUtilities.invokeLater(
       new Runnable() {
         public void run() {
           weather = new Wetter();
           createAndShowGUI();
         }
       });
 }
Пример #8
0
  void storeLatestWorkbenchGraph() {
    Graph latestWorkbenchGraph = workbench.getGraph();

    if (latestWorkbenchGraph.getNumNodes() == 0) {
      return;
    }

    SearchParams searchParams = algorithmRunner.getParams();

    try {
      Graph graph = new MarshalledObject<Graph>(latestWorkbenchGraph).get();

      if (graph == null) {
        throw new NullPointerException("Null graph");
      }

      if (searchParams != null) {
        searchParams.setSourceGraph(graph);
      }
    } catch (IOException e) {
      e.printStackTrace();

      if (searchParams != null) {
        searchParams.setSourceGraph(null);
      }
    } catch (ClassNotFoundException e) {
      if (searchParams != null) {
        searchParams.setSourceGraph(null);
      }

      e.printStackTrace();
    }
  }
Пример #9
0
 public OriundoDAO() {
   try {
     Class.forName(new conexao().config.getString("driver"));
   } catch (ClassNotFoundException ex) {
     JOptionPane.showMessageDialog(
         null, "Driver Erro: " + ex.getMessage(), "Construtor da Classe", 0);
     ex.printStackTrace();
   }
 }
 static Class class$(String s) {
   Class clazz = null;
   try {
     clazz = Class.forName(s);
   } catch (ClassNotFoundException e) {
     e.printStackTrace();
   }
   return clazz;
 }
Пример #11
0
    @Override
    public void actionPerformed(ActionEvent event) {
      String command = event.getActionCommand();
      if (command.equals("add")) {
        MultipleInputDialog inputDialog = new MultipleInputDialog();
        data.add(inputDialog.getDialogCar());

      } else if (command.equals("save")) {
        try {
          FileDialog fd = new FileDialog(Layout.this, "Válasszon egy célmappát", FileDialog.SAVE);
          fd.setVisible(true);
          String dir = fd.getDirectory();
          String filename = fd.getFile();

          FileOutputStream fileOut = new FileOutputStream(dir + filename);
          ObjectOutputStream out = new ObjectOutputStream(fileOut);
          out.writeObject(Layout.this.data);
          out.close();
          fileOut.close();
          System.out.println("save OK");
          System.out.println("Kiirva 1/1 adat " + data.get(1).getOne());

        } catch (IOException i) {
          i.printStackTrace();
        }
      } else if (command.equals("load")) {
        try {
          FileDialog fd = new FileDialog(Layout.this, "Válasszon egy célmappát", FileDialog.LOAD);
          fd.setVisible(true);
          String dir = fd.getDirectory();
          String filename = fd.getFile();

          FileInputStream fileIn = new FileInputStream(dir + filename);
          ObjectInputStream in = new ObjectInputStream(fileIn);

          Layout.this.data = (ArrayList<Car>) in.readObject();
          dataTable.repaint();

          fileIn.close();
          in.close();

          System.out.println("beolvasva");
          repaint();

          System.out.println("olvasva 1/1 adat data-ban " + data.get(1).getOne());
        } catch (IOException i) {
          i.printStackTrace();
        } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      } else if (command.equals("browse")) {
        FileDialog jf = new FileDialog(Layout.this, "Choose something", FileDialog.LOAD);
        jf.setVisible(true);
      }
    }
Пример #12
0
  private void deSerialize(ObjectInputStream in) throws DuplicateBibException {
    Object o;
    try {
      while ((o = in.readObject()) != null) {
        Race raceFromSerialized = (Race) o;

        this.date = raceFromSerialized.date;
        this.name = raceFromSerialized.name;
        this.location = raceFromSerialized.location;
        setNbrGates(raceFromSerialized.nbrGates); // this.nbrGates = race.nbrGates;// = 25;
        this.upstreamGates = raceFromSerialized.upstreamGates;
        this.judgingSections = raceFromSerialized.judgingSections;
        for (JudgingSection s : judgingSections) {
          // must assign all transients, otherwise they are null and cause problsm
          s.setClientDeviceAttached(new Boolean(false));
        }

        // Race Status
        this.pendingRerun = raceFromSerialized.pendingRerun;
        this.activeRuns = raceFromSerialized.activeRuns;
        this.completedRuns = raceFromSerialized.completedRuns;

        this.startList = raceFromSerialized.startList;
        this.runsStartedOrCompletedCnt = raceFromSerialized.runsStartedOrCompletedCnt;
        this.currentRunIteration =
            raceFromSerialized.currentRunIteration; // are we on 1st runs, or 2nd runs ?
        this.racers = raceFromSerialized.racers;
        this.tagHeuerEnabled =
            raceFromSerialized.tagHeuerEnabled; // todo REMOVE ->tagHeuerEmulation =
        // raceFromSerialized.tagHeuerEmulation;
        this.microgateEnabled = raceFromSerialized.microgateEnabled;
        this.microgateEnabled = raceFromSerialized.timyEnabled;

        this.icfPenalties = raceFromSerialized.icfPenalties;
      }

    } catch (InvalidClassException ice) {
      clearRace();
      System.out.println("All data cleared, incompatible race object version information");
    } catch (EOFException io) {
      // io.printStackTrace();

    } catch (IOException io) {
      io.printStackTrace();
    } catch (ClassNotFoundException cnfe) {
      cnfe.printStackTrace();
    }
    String duplicates = lookForDuplicateBibsInTheSameClass();
    if (duplicates != null) {
      log.error(duplicates);
      throw new DuplicateBibException();
    }
  }
Пример #13
0
 public void run() {
   String texto = "";
   while (repetir) {
     try {
       Empleados e = (Empleados) inObjeto.readObject();
       textarea1.setText("");
       textarea1.setForeground(Color.blue);
       if (e == null) {
         textarea1.setForeground(Color.red);
         PintaMensaje("<<EL EMPLEADO NO EXISTE>>");
       } else {
         texto =
             "Empleado: "
                 + e.getEmpNo()
                 + "\n   "
                 + "Oficio: "
                 + e.getOficio()
                 + "\tApellido: "
                 + e.getApellido()
                 + "\n    "
                 + "Comisión: "
                 + e.getComision()
                 + "\tDirección: "
                 + e.getDir()
                 + "\n    "
                 + "Alta: "
                 + e.getFechaAlt()
                 + "\tSalario: "
                 + e.getSalario()
                 + "\n    "
                 + "Departamento: "
                 + e.getDepartamentos().getDnombre();
         textarea1.append(texto);
       }
     } catch (SocketException s) {
       repetir = false;
     } catch (IOException e) {
       e.printStackTrace();
       repetir = false;
     } catch (ClassNotFoundException e) {
       e.printStackTrace();
       repetir = false;
     }
   }
   try {
     socket.close();
     System.exit(0);
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Пример #14
0
 private void deSerializeXML(ObjectInputStream in) {
   Object o;
   try {
     while ((o = in.readObject()) != null) {
       System.out.println(o);
     }
   } catch (IOException e) {
     e.printStackTrace(); // To change body of catch statement use File | Settings | File
     // Templates.
   } catch (ClassNotFoundException e) {
     e.printStackTrace(); // To change body of catch statement use File | Settings | File
     // Templates.
   }
 }
  public static void main(String[] args) {

    MyCustomizableGUI custGUI = new MyCustomizableGUI();
    UserPreferences savedPrefs;

    try (FileInputStream fileIn = new FileInputStream("preferences.ser");
        ObjectInputStream objectIn = new ObjectInputStream(fileIn); ) {

      savedPrefs = (UserPreferences) objectIn.readObject();

      if (savedPrefs.getColor().contains("Red")) {
        custGUI.textField.setForeground(Color.red);
        custGUI.color.setSelectedItem("Red");
      } else if (savedPrefs.getColor().contains("Green")) {
        custGUI.textField.setForeground(Color.green);
        custGUI.color.setSelectedItem("Green");
      } else if (savedPrefs.getColor().contains("Blue")) {
        custGUI.textField.setForeground(Color.blue);
        custGUI.color.setSelectedItem("Blue");
      } else if (savedPrefs.getColor().contains("Cyan")) {
        custGUI.textField.setForeground(Color.cyan);
        custGUI.color.setSelectedItem("Cyan");
      } else if (savedPrefs.getColor().contains("Magenta")) {
        custGUI.textField.setForeground(Color.magenta);
        custGUI.color.setSelectedItem("Magenta");
      } else if (savedPrefs.getColor().contains("Yellow")) {
        custGUI.textField.setForeground(Color.yellow);
        custGUI.color.setSelectedItem("Yellow");
      } else if (savedPrefs.getColor().contains("Black")) {
        custGUI.textField.setForeground(Color.black);
        custGUI.color.setSelectedItem("Black");
      }

      custGUI.setFont(savedPrefs.getFont(), savedPrefs.getFontSize());
      custGUI.font.setSelectedItem(savedPrefs.getFont());
      custGUI.fontSize.setSelectedItem("" + savedPrefs.getFontSize());

    } catch (FileNotFoundException noFile) {
      // load default font and color
      custGUI.setFont("Arial", 25);
      custGUI.textField.setForeground(Color.black);

    } catch (ClassNotFoundException noPrefs) {
      noPrefs.printStackTrace();
    } catch (IOException e) {
      System.out.println("I/O Error: " + e.getMessage());
    }
  }
Пример #16
0
  public static void updateDoljnost() {
    try {
      DBClass db = new DBClass();
      ArrayList<Doljnost> d = db.doljnostFromDB();
      comboBox_doljnost.removeAllItems();
      for (int i = 0; i < d.size(); i++) {
        comboBox_doljnost.addItem(d.get(i));
      }

    } catch (ClassNotFoundException e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(null, e.getMessage());
    } catch (SQLException ee) {
      ee.printStackTrace();
      JOptionPane.showMessageDialog(null, ee.getMessage());
    }
  }
Пример #17
0
  public static void updateKvalification() {
    try {

      DBClass db2 = new DBClass();
      ArrayList<Kvalification> k = db2.kvalificationFromDB();
      comboBox_kvalification.removeAllItems();
      for (int i = 0; i < k.size(); i++) {
        comboBox_kvalification.addItem(k.get(i));
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(null, e.getMessage());
    } catch (SQLException ee) {
      ee.printStackTrace();
      JOptionPane.showMessageDialog(null, ee.getMessage());
    }
  }
Пример #18
0
  /** Launch the application. */
  public static void main(String[] args) {
    giorniArray = new String[31];
    anniArray = new String[50];
    oreArray = new String[24];
    minutiArray = new String[60];

    for (int i = 1; i < 32; i++) {
      giorniArray[i - 1] = Integer.toString(i);
    }

    int j = 0;
    for (int i = 2000; i < 2050; i++) {
      anniArray[j++] = Integer.toString(i);
    }

    for (int i = 0; i < 60; i++) {
      minutiArray[i] = Integer.toString(i);
    }

    for (int i = 0; i < 24; i++) {
      oreArray[i] = Integer.toString(i);
    }

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }
    EventQueue.invokeLater(
        new Runnable() {
          public void run() {
            try {
              FrontEnd1 window = new FrontEnd1();
              window.frame.setVisible(true);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
  }
Пример #19
0
  public static void newIDEWindow() {

    try {
      System.getProperty("com.apple.laf.useScreenMenuBar", "true");
      System.getProperty("com.apple.mrj.application.apple.menu.about.name", "IDE");
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());

    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }
    new IDEWindow("IDE");
  }
Пример #20
0
  /** @param args */
  public static void main(final String[] args) {

    try {
      Properties props = new Properties();
      props.put("logoString", "");
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e1) {
      e1.printStackTrace();
    } catch (InstantiationException e1) {
      e1.printStackTrace();
    } catch (IllegalAccessException e1) {
      e1.printStackTrace();
    } catch (UnsupportedLookAndFeelException e1) {
      e1.printStackTrace();
    }

    PhysicsUI pui = new PhysicsUI();
    pui.init();
  }
  private void initProblemDefinition() {
    this.m_Mocco.m_JPanelParameters.removeAll();
    this.m_ProblemChooser = new JComboBox();
    JComponent tmpC = new JPanel();
    tmpC.setLayout(new BorderLayout());

    Class[] altern = null;
    try {
      altern =
          ReflectPackage.getAssignableClassesInPackage(
              "eva2.server.go.problems",
              Class.forName("eva2.server.go.problems.InterfaceMultiObjectiveDeNovoProblem"),
              true,
              true);
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    this.m_ProblemChooser.setModel(new DefaultComboBoxModel(altern));

    String objectName = (this.m_Mocco.m_State.m_OriginalProblem.getClass().getName());
    this.m_ProblemChooser.getModel().setSelectedItem(objectName);
    this.m_ProblemChooser.addActionListener(problemChanged);
    JPanel tmpP = new JPanel();
    tmpP.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 0;
    tmpP.add(
        this.makeHelpText(
            "Choose and parameterize the optimization problem to solve by means of MOCCO. "
                + "Please note that it is not necessary to include MOSO converters yet and that only problems complying "
                + "with the InterfaceMultiObjectiveDeNovoProblem can be optimized using the MOCCO approach."),
        gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    tmpP.add(this.m_ProblemChooser, gbc);
    this.m_Mocco.m_JPanelParameters.setLayout(new BorderLayout());
    this.m_Mocco.m_JPanelParameters.add(tmpP, BorderLayout.NORTH);
    JParaPanel paraPanel = new JParaPanel(this.m_Mocco.m_State.m_OriginalProblem, "MyGUI");
    this.m_Mocco.m_JPanelParameters.add(paraPanel.makePanel(), BorderLayout.CENTER);
  }
Пример #22
0
  // Вид формы при изменении сотрудника
  public void sotrDiaUpdate(Sotrudnik s) {
    label_id_hidden.setText(Integer.toString(s.getId_sotrudnika()));
    textField_familiya.setText(s.getFamiliya());
    textField_imya.setText(s.getImya());
    textField_otchestvo.setText(s.getOtchestvo());
    textField_phone.setText(s.getPhone());
    textField_date.setText(s.getData_priema().toString());
    comboBox_doljnost.removeAllItems();
    comboBox_kvalification.removeAllItems();

    try {
      DBClass db = new DBClass();
      ArrayList<Doljnost> d = db.doljnostFromDB();
      DBClass db2 = new DBClass();
      Doljnost dd = db2.doljnostFromDB(s);
      for (int i = 0; i < d.size(); i++) {
        comboBox_doljnost.addItem(d.get(i));
        Doljnost ddd = (Doljnost) comboBox_doljnost.getItemAt(i);
        if (dd.getNazvanie_doljnosti().equals(ddd.getNazvanie_doljnosti())) dd = ddd;
      }
      comboBox_doljnost.setSelectedItem(dd);

      DBClass db3 = new DBClass();
      ArrayList<Kvalification> k = db3.kvalificationFromDB();
      DBClass db4 = new DBClass();
      Kvalification kk = db4.kvalificationFromDB(s);
      for (int i = 0; i < k.size(); i++) {
        comboBox_kvalification.addItem(k.get(i));
        Kvalification kkk = (Kvalification) comboBox_kvalification.getItemAt(i);
        if (kk.getNazvanie_kvalification().equals(kkk.getNazvanie_kvalification())) kk = kkk;
      }

      comboBox_kvalification.setSelectedItem(kk);

    } catch (ClassNotFoundException e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(panelException, e.getMessage());
    } catch (SQLException ee) {
      ee.printStackTrace();
      JOptionPane.showMessageDialog(panelException, ee.getMessage());
    }
  }
Пример #23
0
  // Вид формы при добавлении нового сотрудника
  public void sotrDiaInsert() {
    label_id_hidden.setText("Новый сотрудник");
    textField_familiya.setText("");
    textField_imya.setText("");
    textField_otchestvo.setText("");
    textField_phone.setText("");
    comboBox_doljnost.removeAllItems();
    comboBox_kvalification.removeAllItems();

    Calendar calend = Calendar.getInstance();
    if (calend.get(Calendar.MONTH) <= 9) {
      textField_date.setText(
          String.valueOf(
              (calend.get(Calendar.YEAR) + "-" + ("0" + (1 + calend.get(Calendar.MONTH))) + "-")
                  + (calend.get(Calendar.DATE))));
    } else
      textField_date.setText(
          String.valueOf(
              ((calend.get(Calendar.YEAR)) + "-" + (1 + calend.get(Calendar.MONTH)) + "-")
                  + (calend.get(Calendar.DATE))));
    textField_date.setEnabled(false);

    try {
      DBClass db = new DBClass();
      ArrayList<Doljnost> d = db.doljnostFromDB();
      for (int i = 0; i < d.size(); i++) {
        comboBox_doljnost.addItem(d.get(i));
      }
      DBClass db2 = new DBClass();
      ArrayList<Kvalification> k = db2.kvalificationFromDB();
      for (int i = 0; i < k.size(); i++) {
        comboBox_kvalification.addItem(k.get(i));
      }
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(panelException, e.getMessage());
    } catch (SQLException ee) {
      ee.printStackTrace();
      JOptionPane.showMessageDialog(panelException, ee.getMessage());
    }
  }
Пример #24
0
  /**
   * the constructor of the class
   *
   * @param editor the editor
   */
  public ColorChooser(Editor editor) {

    this.editor = editor;

    // adds the w3c standard colors chooser panel
    SVGW3CColorChooserPanel w3cColorChooserPanel = new SVGW3CColorChooserPanel(editor);
    addChooserPanel(w3cColorChooserPanel);

    // creating the color flavors
    try {
      colorFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + ";class=java.awt.Color");
      w3cSVGColorFlavor =
          new DataFlavor(
              DataFlavor.javaJVMLocalObjectMimeType
                  + ";class=fr.itris.glips.library.color.SVGW3CColor");
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
      colorFlavor = DataFlavor.stringFlavor;
      w3cSVGColorFlavor = DataFlavor.stringFlavor;
    }
  }
Пример #25
0
  /**
   * The main method.
   *
   * @param args the arguments
   */
  public static void main(String[] args) {
    Questionnaire quiz = new Questionnaire();
    try {
      quiz.initQuestionnaire("question_tolkien.txt");
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (NoSuchMethodException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    }

    new QuestionnaireUI(quiz);
  }
Пример #26
0
  public static void main(String[] arguments) {
    // Schedule a job for the event dispatch thread:
    // creating and showing this application's GUI.

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (UnsupportedLookAndFeelException ex) {
      ex.printStackTrace();
    } catch (IllegalAccessException ex) {
      ex.printStackTrace();
    } catch (InstantiationException ex) {
      ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
    }

    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            createAndShowGUI();
          }
        });
  }
Пример #27
0
  private static void initUserInterface() {
    System.setProperty("apple.laf.useScreenMenuBar", "true");
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Draw 9-patch");
    try {
      if (Platform.isWindows()) {
        UIManager.put("RootPane.setupButtonVisible", false);
        BeautyEyeLNFHelper.translucencyAtFrameInactive = false;
        BeautyEyeLNFHelper.launchBeautyEyeLNF();

        // impl a demo PopupFactory
        PopupFactory.setSharedInstance(new CoolPopupFactory());
      } else UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #28
0
  public ReverseFlashCard() {
    // basic init
    setTitle("WayMemo -Reverse Flash Card Mode");
    this.setSize(800, 600);
    paneCenter = new JPanel(new GridLayout(7, 1));

    add(ln, "North");
    add(paneCenter, "Center");
    add(b2, "West");
    add(bReset, "South");
    add(b1, "East");
    paneCenter.add(l1);
    paneCenter.add(l2);
    paneCenter.add(l3);
    paneCenter.add(l4);
    paneCenter.add(l5);
    paneCenter.add(b3);
    paneCenter.add(pMark);
    pMark.add(bMark);
    pMark.add(bUnMark);
    pMark.add(lt);

    // text area init

    Utility.initTextAreaView(l1);
    Utility.initTextAreaView(l2);
    Utility.initTextAreaView(l3);
    Utility.initTextAreaView(l4);
    Utility.initTextAreaView(l5);

    // action

    //
    Action actionNext =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            num++;
            wordDisplay();
          }
        };
    b1.getInputMap().put(KeyStroke.getKeyStroke("C"), "pressed");
    b1.getActionMap().put("released", actionNext);
    //
    Action actionBack =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            num--;
            wordDisplay();
          }
        };
    b2.getInputMap().put(KeyStroke.getKeyStroke("Z"), "pressed");
    b2.getActionMap().put("released", actionBack);
    //
    Action actionShow =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            l1.setText(dtr[num]);
            l3.setText(d2[num]);
            l4.setText(d3[num]);
            l5.setText(d4[num]);
          }
        };
    b3.getInputMap().put(KeyStroke.getKeyStroke("X"), "pressed");
    b3.getActionMap().put("released", actionShow);
    //
    //
    Action actionMark =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            d1[num] = "[MARKED*]" + d1[num];
            l2.setText(d1[num]);
          }
        };
    bMark.getInputMap().put(KeyStroke.getKeyStroke("S"), "pressed");
    bMark.getActionMap().put("released", actionMark);
    //
    //
    //
    Action actionUnmark =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            d1[num] = od1[num];
            l2.setText(d1[num]);
          }
        };
    bUnMark.getInputMap().put(KeyStroke.getKeyStroke("F2"), "pressed");
    bUnMark.getActionMap().put("released", actionUnmark);
    //
    //
    Action actionReset =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            num = 0;
            wordDisplay();
          }
        };
    bReset.getInputMap().put(KeyStroke.getKeyStroke("r"), "pressed");
    bReset.getActionMap().put("released", actionReset);
    //
    //
    b1.setMnemonic(KeyEvent.VK_C);
    b2.setMnemonic(KeyEvent.VK_Z);
    b3.setMnemonic(KeyEvent.VK_X);
    bMark.setMnemonic(KeyEvent.VK_S);
    bUnMark.setMnemonic(KeyEvent.VK_D);
    bReset.setMnemonic(KeyEvent.VK_R);

    b1.addActionListener(actionNext);
    b2.addActionListener(actionBack);
    b3.addActionListener(actionShow);
    bReset.addActionListener(actionReset);
    bMark.addActionListener(actionMark);
    bUnMark.addActionListener(actionUnmark);
    //
    //
    try {
      this.fileScan(new OpenFileDTR().getPathDTR());
    } catch (IOException e) {
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (InstantiationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Пример #29
0
  public General_Info() {

    pic.setIcon(userPic);
    String url = "jdbc:odbc:lib";

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      connection = DriverManager.getConnection(url);
    } catch (ClassNotFoundException cnfex) {
      System.err.println("Failed to load driver");
      cnfex.printStackTrace();
      System.exit(1);
    } catch (SQLException sqlex) {
      System.err.println("unable to connect");
      sqlex.printStackTrace();
    }

    // validation for telephone
    tel_text.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            char c = e.getKeyChar();
            if (!((Character.isDigit(c)
                || (c == KeyEvent.VK_BACK_SPACE)
                || (c == KeyEvent.VK_DELETE)))) {
              getToolkit().beep();
              e.consume();
            }
          }
        });

    // validation for fax
    fax_text.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            char c = e.getKeyChar();
            if (!((Character.isDigit(c)
                || (c == KeyEvent.VK_BACK_SPACE)
                || (c == KeyEvent.VK_DELETE)))) {
              getToolkit().beep();
              e.consume();
            }
          }
        });

    patron_text.setText("P-");
    patron_text.addFocusListener(
        new MyActionListener() {
          public void focusLost(FocusEvent e) {

            try {
              Statement statement = connection.createStatement();

              String query2 =
                  "SELECT * FROM patronmaster " + "WHERE id = '" + patron_text.getText() + "'";

              ResultSet rs2 = statement.executeQuery(query2);
              int cnt = 0;
              while (rs2.next()) {
                cnt++;
              }
              if (cnt != 0) {

                try {
                  userPic = new ImageIcon(patron_text.getText() + ".gif");
                  pic.setIcon(userPic);
                } catch (Exception ex) {
                  ex.printStackTrace();
                  pic.setIcon(userPic);
                }

                String query1 =
                    "SELECT * FROM patronmaster " + "WHERE id = '" + patron_text.getText() + "'";

                ResultSet rs1 = statement.executeQuery(query1);
                try {
                  rs1.next();

                  int confirm =
                      JOptionPane.showConfirmDialog(
                          null,
                          "This record Exists, would you like to update it?",
                          "CONFIRM",
                          JOptionPane.YES_NO_OPTION);
                  if (confirm == JOptionPane.NO_OPTION) {
                    patron_text.setEditable(false);
                    name_text.setEditable(false);
                    passport_text.setEditable(false);
                    expiry_date_text.setEditable(false);
                    reg_by_text.setEditable(false);
                    reg_date_text.setEditable(false);
                    textArea.setEditable(false);
                    tel_text.setEditable(false);
                    fax_text.setEditable(false);
                    email_text.setEditable(false);
                  } else {

                  }
                  name_text.setText(rs1.getString(2));
                  passport_text.setText(rs1.getString(3));
                  expiry_date_text.setText(rs1.getString(6));
                  reg_by_text.setText(rs1.getString(7));
                  reg_date_text.setText(rs1.getString(8));
                  textArea.setText(rs1.getString(9));
                  tel_text.setText(rs1.getString(10));
                  fax_text.setText(rs1.getString(11));
                  email_text.setText(rs1.getString(12));
                  status_combo.setSelectedItem(rs1.getString(4));
                  salute_combo.setSelectedItem(rs1.getString(5));
                  group_combo.setSelectedItem(rs1.getString(13));

                  statement.close();

                } catch (SQLException sqlex) {
                  pic.setIcon(userPic);
                }
              }
            } catch (SQLException sqlex) {
              pic.setIcon(userPic);
            }
          }
        });

    scroll.add(address);
    scroll.add(scrollPane);

    text.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridy = 0;
    gbc.gridx = 0;
    text.add(tel, gbc);
    gbc.gridy = 1;
    text.add(fax, gbc);
    gbc.gridy = 2;
    text.add(email, gbc);
    gbc.gridy = 0;
    gbc.gridx = 2;
    text.add(tel_text, gbc);
    gbc.gridy = 1;
    text.add(fax_text, gbc);
    gbc.gridy = 2;
    text.add(email_text, gbc);

    pic.setSize(50, 50);
    pane1.add(scroll, BorderLayout.CENTER);
    pane1.add(pic, BorderLayout.EAST);
    pane1.add(text, BorderLayout.WEST);

    add(pane1);
  }
Пример #30
0
  public void actionPerformed(ActionEvent e) {
    switch (pos) {
      case 0:
        try {
          btnNext.setEnabled(false);
          btnPrev.setEnabled(true);

          Class.forName(pnlDStarget.getDriver());
          dbConnTarget =
              DriverManager.getConnection(
                  pnlDStarget.getUrl(), pnlDStarget.getUser(), pnlDStarget.getPasswd());

          cardL.show(pnlContent, "DS_TARGET_MSG");
          DatabaseMetaData dbMeta = dbConnTarget.getMetaData();

          jtaMsgTarget.setText(null);
          jtaMsgTarget.append(
              "Connected to "
                  + dbMeta.getDatabaseProductName()
                  + " version "
                  + dbMeta.getDatabaseProductVersion()
                  + "\r\n");
          jtaMsgTarget.append(
              "Using driver "
                  + dbMeta.getDriverName()
                  + " version "
                  + dbMeta.getDriverVersion()
                  + "\r\n");
          jtaMsgTarget.append("Catalog term is " + dbMeta.getCatalogTerm() + "\r\n");
          jtaMsgTarget.append("Schema term is " + dbMeta.getSchemaTerm() + "\r\n");
          jtaMsgTarget.append("Connection to datasource successfully!");
          btnNext.setEnabled(true);
          btnPrev.setEnabled(true);
        } catch (SQLException ex) {
          ex.printStackTrace();
          return;
        } catch (ClassNotFoundException ex) {
          ex.printStackTrace();
          return;
        }
        pos++;
        break;

      case 1:
        if (e.getActionCommand().equals("NEXT")) {
          cardL.show(pnlContent, "DB_OPEN_FILE");
          pos++;
        } else {

        }
        break;

      case 2:
        if (e.getActionCommand().equals("NEXT")) {
          backupDiffLoader = new BackupLoaderPanel(rlp.getFileName());
          pnlContent.add(backupDiffLoader, "DB_BACKUP_LOADER");
          cardL.show(pnlContent, "DB_BACKUP_LOADER");
          pos++;
          backupDiffLoader.actionPerformed(null);
        } else {

        }
        break;

      case 3:
        if (e.getActionCommand().equals("NEXT")) {
          structDiffWriter =
              new StructDiffWriterPanel(dbConnTarget, backupDiffLoader.getDiffStmtList());
          pnlContent.add(structDiffWriter, "DB_STRUCT_DIFF");
          cardL.show(pnlContent, "DB_STRUCT_DIFF");
          pos++;
          structDiffWriter.actionPerformed(null);
        } else {

        }
        break;

      case 4:
        if (e.getActionCommand().equals("NEXT")) {
          dbPanelTarget = new DBTreeBuilderPanel(dbConnTarget, null, "public");
          pnlContent.add(dbPanelTarget, "DB_BUILDER_TARGET");
          cardL.show(pnlContent, "DB_BUILDER_TARGET");
          pos++;
          dbPanelTarget.actionPerformed(null);
        } else {

        }
        break;

      case 5:
        if (e.getActionCommand().equals("NEXT")) {
          DataDiffWriterPanel dataDiffWriter =
              new DataDiffWriterPanel(
                  dbConnTarget,
                  dbPanelTarget.getTableList(),
                  backupDiffLoader.getDbIncrementalData());
          pnlContent.add(dataDiffWriter, "DB_DATA_DIFF");
          cardL.show(pnlContent, "DB_DATA_DIFF");
          pos++;
          dataDiffWriter.actionPerformed(null);
        } else {

        }
        dbPanelTarget.getTableList();
        break;
    }
  }