From 205f059ec5df1a24daa87f8563d2bbb99344ecf9 Mon Sep 17 00:00:00 2001 From: tspitzer Date: Tue, 17 Sep 2013 15:38:08 +0200 Subject: g --- Dozentenmodul/src/GUI/EingabeSoftwareDaten.java | 298 ++++++++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 Dozentenmodul/src/GUI/EingabeSoftwareDaten.java (limited to 'Dozentenmodul/src/GUI/EingabeSoftwareDaten.java') diff --git a/Dozentenmodul/src/GUI/EingabeSoftwareDaten.java b/Dozentenmodul/src/GUI/EingabeSoftwareDaten.java new file mode 100644 index 00000000..f99fd88e --- /dev/null +++ b/Dozentenmodul/src/GUI/EingabeSoftwareDaten.java @@ -0,0 +1,298 @@ +package GUI; + +import java.awt.FlowLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.border.EmptyBorder; +import java.awt.Color; +import javax.swing.JLabel; +import java.awt.Font; +import javax.swing.JTextPane; +import java.awt.SystemColor; +import javax.swing.JTextField; +import sql.sql; +import ftp.ftp; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Arrays; +import javax.swing.JSeparator; +import java.awt.List; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import javax.swing.plaf.basic.BasicArrowButton; +import javax.swing.JMenuBar; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import Models.vm; + + +@SuppressWarnings("serial") +public class EingabeSoftwareDaten extends JDialog { + + private final JPanel contentPanel = new JPanel(); + String[] result; + ftp f=new ftp(); + sql sql=new sql(); + private JTextField textField; + List listavailable; + List listchoosed; + + /** + * Launch the application. + */ + public static void main(String[] args) { + try { + EingabeSoftwareDaten dialog = new EingabeSoftwareDaten(); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Create the dialog. + */ + @SuppressWarnings({ }) + public EingabeSoftwareDaten() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setTitle("Dozentenmodul"); + setBounds(100, 100, 603, 722); + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBounds(0, 0, 529, 71); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Eingabe der installierten Software (Schritt 5 von 6)"); + lblNewLabel.setBounds(10, 11, 509, 22); + panel.add(lblNewLabel); + lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); + } + + JTextPane txtpnBitteWhlenSie = new JTextPane(); + txtpnBitteWhlenSie.setEditable(false); + txtpnBitteWhlenSie.setBackground(SystemColor.menu); + txtpnBitteWhlenSie.setText("Bitte geben Sie nun die in Ihrem System installierte Software an."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 42); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 95, 567, 512); + contentPanel.setBackground(Color.WHITE); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + + JLabel lblSysteminformationen = new JLabel("Verf\u00FCgbare Software"); + lblSysteminformationen.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblSysteminformationen.setBounds(10, 11, 162, 14); + contentPanel.add(lblSysteminformationen); + + + JLabel lblAusgewhlteSoftware = new JLabel("Ausgew\u00E4hlte Software"); + lblAusgewhlteSoftware.setFont(new Font("Tahoma", Font.PLAIN, 14)); + lblAusgewhlteSoftware.setBounds(306, 11, 162, 14); + contentPanel.add(lblAusgewhlteSoftware); + + + + textField = new JTextField(); + textField.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + + + Connection con=sql.getConnection(); + ResultSet rs=sql.getSoftwareByName(con, textField.getText().toString()); + listavailable.removeAll(); + try { + while(rs.next()) + { + listavailable.add(rs.getString("SW")); + } + } catch (SQLException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + } + }); + + textField.setBounds(10, 36, 244, 20); + contentPanel.add(textField); + textField.setColumns(10); + + JButton btnSoftwareHinzufgen = new JButton("Software hinzuf\u00FCgen"); + btnSoftwareHinzufgen.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + AddSoftware as=new AddSoftware(); + as.setVisible(true); + } + }); + btnSoftwareHinzufgen.setBounds(10, 483, 162, 23); + contentPanel.add(btnSoftwareHinzufgen); + + listavailable = new List(); + Connection con=sql.getConnection(); + ResultSet he=sql.getAllHersteller(con); + + try { + while(he.next()) + { + + ResultSet sw=sql.getAllSoftware(con, he.getString("Name")); + + while(sw.next()) + { + + listavailable.add(he.getString("Name")+" "+sw.getString("Produktname")+" "+sw.getString("Version")+" "+sw.getString("Architektur")); + } + } + } catch (SQLException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + listavailable.setMultipleMode(true); + listavailable.setBounds(10, 62, 244, 415); + contentPanel.add(listavailable); + + listchoosed = new List(); + if(vm.vl.getSoftware()!=null) + { + for(int i=0;i