summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/GUI/AddSoftware.java
diff options
context:
space:
mode:
authortspitzer2013-10-17 14:41:12 +0200
committertspitzer2013-10-17 14:41:12 +0200
commit9f7c44a1afe2a599a9e0249b480cfa3b4155e9e6 (patch)
treecc675d389f18ffea779dbd29530da99468927995 /Dozentenmodul/src/GUI/AddSoftware.java
parentMethode hinzugefügt um das Satelliten Script auszuführen (diff)
downloadtutor-module-9f7c44a1afe2a599a9e0249b480cfa3b4155e9e6.tar.gz
tutor-module-9f7c44a1afe2a599a9e0249b480cfa3b4155e9e6.tar.xz
tutor-module-9f7c44a1afe2a599a9e0249b480cfa3b4155e9e6.zip
Version vom 17.10
-Hinweise eingefügt -Freigabe GUI ohne funktionalität eingefügt -Fenster zentriert -Download und Upload um Informationen erweitert
Diffstat (limited to 'Dozentenmodul/src/GUI/AddSoftware.java')
-rw-r--r--Dozentenmodul/src/GUI/AddSoftware.java48
1 files changed, 37 insertions, 11 deletions
diff --git a/Dozentenmodul/src/GUI/AddSoftware.java b/Dozentenmodul/src/GUI/AddSoftware.java
index 4f9f2334..1539e1de 100644
--- a/Dozentenmodul/src/GUI/AddSoftware.java
+++ b/Dozentenmodul/src/GUI/AddSoftware.java
@@ -1,11 +1,17 @@
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;
@@ -18,7 +24,7 @@ import java.sql.Connection;
import javax.swing.DefaultComboBoxModel;
@SuppressWarnings("serial")
-public class AddSoftware extends JDialog {
+public class AddSoftware extends JFrame {
private final JPanel contentPanel = new JPanel();
private JTextField textField;
@@ -48,7 +54,20 @@ public class AddSoftware extends JDialog {
public AddSoftware() {
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setTitle("Dozentenmodul");
- setBounds(100, 100, 288, 300);
+
+ 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);
@@ -60,50 +79,50 @@ public class AddSoftware extends JDialog {
contentPanel.add(lblNewLabel);
}
{
- JLabel lblHersteller = new JLabel("Hersteller:");
+ JLabel lblHersteller = new JLabel("Hersteller: *");
lblHersteller.setBounds(10, 47, 100, 20);
contentPanel.add(lblHersteller);
}
{
textField = new JTextField();
- textField.setBounds(120, 47, 125, 20);
+ textField.setBounds(120, 47, 270, 20);
contentPanel.add(textField);
textField.setColumns(10);
}
{
- JLabel lblNewLabel_1 = new JLabel("Name:");
+ 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, 125, 20);
+ textField_1.setBounds(120, 78, 270, 20);
contentPanel.add(textField_1);
}
{
- JLabel lblVersion = new JLabel("Version:");
+ 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, 125, 20);
+ textField_2.setBounds(120, 109, 270, 20);
contentPanel.add(textField_2);
}
{
- JLabel lblArchitektur = new JLabel("Architektur:");
+ 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, 125, 20);
+ comboBox.setBounds(120, 140, 135, 20);
contentPanel.add(comboBox);
- JLabel lblLizenzpflichtig = new JLabel("Lizenzpflichtig:");
+ JLabel lblLizenzpflichtig = new JLabel("Lizenzpflichtig: *");
lblLizenzpflichtig.setBounds(10, 171, 100, 20);
contentPanel.add(lblLizenzpflichtig);
@@ -118,6 +137,8 @@ public class AddSoftware extends JDialog {
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)
{
@@ -126,6 +147,11 @@ public class AddSoftware extends JDialog {
Connection con=sql.getConnection();
sql.AddSoftware(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);
+ }
}
});