diff options
Diffstat (limited to 'Dozentenmodul/src/GUI/AddOS.java')
| -rw-r--r-- | Dozentenmodul/src/GUI/AddOS.java | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/Dozentenmodul/src/GUI/AddOS.java b/Dozentenmodul/src/GUI/AddOS.java deleted file mode 100644 index 1642b05b..00000000 --- a/Dozentenmodul/src/GUI/AddOS.java +++ /dev/null @@ -1,177 +0,0 @@ -package GUI;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Toolkit;
-import javax.swing.JFrame;
-import sql.sql;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.UIManager;
-import javax.swing.UnsupportedLookAndFeelException;
-import javax.swing.border.EmptyBorder;
-import javax.swing.JLabel;
-import java.awt.Font;
-import javax.swing.JTextField;
-import javax.swing.JComboBox;
-import javax.swing.JCheckBox;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.sql.Connection;
-import javax.swing.DefaultComboBoxModel;
-
-@SuppressWarnings("serial")
-public class AddOS extends JFrame {
-
- private final JPanel contentPanel = new JPanel();
- private JTextField textField;
- private JTextField textField_1;
- private JTextField textField_2;
- @SuppressWarnings("rawtypes")
- JComboBox comboBox;
- JCheckBox checkBox;
- sql sql=new sql();
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- try {
- AddOS dialog = new AddOS();
- dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
- dialog.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Create the dialog.
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public AddOS() {
- setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
- setTitle("Dozentenmodul *Prototyp*");
-
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (ClassNotFoundException | InstantiationException
- | IllegalAccessException | UnsupportedLookAndFeelException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- int top=(screenSize.height - 416) / 2;
- int left=(screenSize.width - 300) / 2;
- setBounds(left, top, 416, 300);
- //setBounds(100, 100, 288, 300);
- getContentPane().setLayout(new BorderLayout());
- contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
- getContentPane().add(contentPanel, BorderLayout.CENTER);
- contentPanel.setLayout(null);
- {
- JLabel lblNewLabel = new JLabel("Betriebssystem hinzuf\u00FCgen");
- lblNewLabel.setFont(new Font("Dialog", Font.PLAIN, 14));
- lblNewLabel.setBounds(10, 11, 194, 25);
- contentPanel.add(lblNewLabel);
- }
- {
- JLabel lblHersteller = new JLabel("Hersteller:*");
- lblHersteller.setBounds(10, 47, 100, 20);
- contentPanel.add(lblHersteller);
- }
- {
- textField = new JTextField();
- textField.setBounds(120, 47, 270, 20);
- contentPanel.add(textField);
- textField.setColumns(10);
- }
- {
- JLabel lblNewLabel_1 = new JLabel("Name:*");
- lblNewLabel_1.setBounds(10, 78, 100, 20);
- contentPanel.add(lblNewLabel_1);
- }
- {
- textField_1 = new JTextField();
- textField_1.setColumns(10);
- textField_1.setBounds(120, 78, 270, 20);
- contentPanel.add(textField_1);
- }
- {
- JLabel lblVersion = new JLabel("Version:*");
- lblVersion.setBounds(10, 109, 100, 20);
- contentPanel.add(lblVersion);
- }
- {
- textField_2 = new JTextField();
- textField_2.setColumns(10);
- textField_2.setBounds(120, 109, 270, 20);
- contentPanel.add(textField_2);
- }
- {
- JLabel lblArchitektur = new JLabel("Architektur:*");
- lblArchitektur.setBounds(10, 140, 100, 20);
- contentPanel.add(lblArchitektur);
- }
-
- comboBox = new JComboBox();
- comboBox.setModel(new DefaultComboBoxModel(new String[] {"32-bit", "64-bit"}));
- comboBox.setBounds(120, 140, 135, 20);
- contentPanel.add(comboBox);
-
- JLabel lblLizenzpflichtig = new JLabel("Lizenzpflichtig:*");
- lblLizenzpflichtig.setBounds(10, 171, 100, 20);
- contentPanel.add(lblLizenzpflichtig);
-
- checkBox = new JCheckBox("");
- checkBox.setBounds(120, 167, 97, 23);
- contentPanel.add(checkBox);
- {
- JPanel buttonPane = new JPanel();
- buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
- getContentPane().add(buttonPane, BorderLayout.SOUTH);
- {
- JButton okButton = new JButton("OK");
- okButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if(textField.getText().isEmpty()==false&&textField_2.getText().isEmpty()==false&&comboBox.getSelectedIndex()!=-1&&textField_1.getText().isEmpty()==false)
- {
- int Kosten=0;
- if(checkBox.isSelected()==true)
- {
- Kosten=1;
- }
- Connection con=sql.getConnection();
-
- sql.AddOS(con, textField_1.getText().toString(), textField_2.getText().toString(), comboBox.getSelectedItem().toString(), Kosten, textField.getText().toString());
-
- dispose();
-
- }
- else
- {
- JOptionPane.showMessageDialog(null, "Bitte geben Sie alle notwendigen Daten an!",
- "Error", JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- okButton.setActionCommand("OK");
- buttonPane.add(okButton);
- getRootPane().setDefaultButton(okButton);
- }
- {
- JButton cancelButton = new JButton("Zur\u00FCck");
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- dispose();
- }
- });
- cancelButton.setActionCommand("Cancel");
- buttonPane.add(cancelButton);
- }
- }
- }
-}
|
