diff --git a/Quellcodes/iud_key_inf7_breakmono/.gitignore b/Quellcodes/iud_key_inf7_breakmono/.gitignore new file mode 100644 index 0000000..c1f4551 --- /dev/null +++ b/Quellcodes/iud_key_inf7_breakmono/.gitignore @@ -0,0 +1,5 @@ +*.class +*.ctxt +*.sh +repo.adoc +*.~lock diff --git a/Quellcodes/iud_key_inf7_breakmono/Baustein.java b/Quellcodes/iud_key_inf7_breakmono/Baustein.java new file mode 100644 index 0000000..55954a1 --- /dev/null +++ b/Quellcodes/iud_key_inf7_breakmono/Baustein.java @@ -0,0 +1,42 @@ +public class Baustein implements Comparable{ + + // Anfang Attribute + private String zeichen; + private int anzahl; + // Ende Attribute + + public Baustein(String zeichen) { + super(); + anzahl = 1; + this.zeichen = zeichen; + } + // Anfang Methoden + + + + public int compareTo(Baustein c) { + + int anz = c.getAnzahl(); + + //ascending order + return anz - this.anzahl; + + //descending order + //return compareQuantity - this.quantity; + + } + public String getZeichen() { + return zeichen; + } + + public int getAnzahl() { + return anzahl; + } + + public void incAnzahl() { + anzahl++; + } + + + // Ende Methoden +} \ No newline at end of file diff --git a/Quellcodes/iud_key_inf7_breakmono/BreakMono.jar b/Quellcodes/iud_key_inf7_breakmono/BreakMono.jar new file mode 100644 index 0000000..99f913c Binary files /dev/null and b/Quellcodes/iud_key_inf7_breakmono/BreakMono.jar differ diff --git a/Quellcodes/iud_key_inf7_breakmono/BreakMono.java b/Quellcodes/iud_key_inf7_breakmono/BreakMono.java new file mode 100644 index 0000000..1c1329d --- /dev/null +++ b/Quellcodes/iud_key_inf7_breakmono/BreakMono.java @@ -0,0 +1,396 @@ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.table.*; +import java.util.ArrayList; +import java.util.Collections; +import javax.swing.text.DefaultHighlighter; +import javax.swing.text.Highlighter; +import javax.swing.text.Highlighter.HighlightPainter; +import javax.swing.text.BadLocationException; + + +/** + * + * Programm zur Kryptoanalyse + * von monoalphabetischen Substitutionen + * + * @version 1.0 from 23.11.2016 + * @author Thomas Schaller + */ + +public class BreakMono extends JFrame { + // Anfang Attribute + private JTextField[] buchstabe; + + private JButton jButton1 = new JButton(); + private JTable jTable1 = new JTable(10, 2); + private DefaultTableModel jTable1Model = (DefaultTableModel) jTable1.getModel(); + private JScrollPane jTable1ScrollPane = new JScrollPane(jTable1); + private JTable jTable2 = new JTable(10, 2); + private DefaultTableModel jTable2Model = (DefaultTableModel) jTable2.getModel(); + private JScrollPane jTable2ScrollPane = new JScrollPane(jTable2); + private JTable jTable3 = new JTable(10, 2); + private DefaultTableModel jTable3Model = (DefaultTableModel) jTable3.getModel(); + private JScrollPane jTable3ScrollPane = new JScrollPane(jTable3); + private JButton jBBuchstabe = new JButton(); + private JButton jBBigramm = new JButton(); + private JButton jBDoppel = new JButton(); + private String[] h = {"E : 17,4%", "N : 9,8%", "S : 7,9%", "I : 7,6%", "R : 7,0%", "A : 6,5%", "T: 6,2%", "D : 5,1%", "U : 4,4%", "L : 3,5%"}; + private String[] b = {"ER : 4,1%", "EN : 4,0%", "CH : 2,4%", "DE : 2,3%", "EI : 1,9%", "ND : 1,9%", "TE: 1,9%", "IN : 1,7%", "IE : 1,6%", "GE : 1,5%"}; + private String[] t = {"SS : 0,76%", "NN : 0,43%", "LL : 0,42%", "EE : 0,23%", "MM : 0,23%", "TT : 0,23%", "RR: 0,15%", "DD : 0,13%", "FF : 0,12%", "AA : 0,08%"}; + + private JTextArea jTextArea1 = new JTextArea(""); + private JScrollPane jTextArea1ScrollPane = new JScrollPane(jTextArea1); + private JTextArea jTextArea2 = new JTextArea(""); + private JScrollPane jTextArea2ScrollPane = new JScrollPane(jTextArea2); + private JLabel jLabel1 = new JLabel(); + private JLabel jLabel2 = new JLabel(); + private JLabel jLabel4 = new JLabel(); + // Ende Attribute + + public BreakMono (String title) { + super (title); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + int frameWidth = 702; + int frameHeight = 651; + setSize(frameWidth, frameHeight); + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + int x = (d.width - getSize().width) / 2; + int y = (d.height - getSize().height) / 2; + setLocation(x, y); + Container cp = getContentPane(); + cp.setLayout(null); + // Anfang Komponenten + jButton1.setBounds(216, 440, 241, 25); + jButton1.setText("Entschlüsselung versuchen"); + jButton1.setMargin(new Insets(2, 2, 2, 2)); + jButton1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jButton1_ActionPerformed(evt); + } + }); + cp.add(jButton1); + jTable1ScrollPane.setBounds(16, 176, 193, 177); + jTable1.getColumnModel().getColumn(1).setHeaderValue("Deutsch"); + jTable1.getColumnModel().getColumn(0).setHeaderValue("Dieser Text"); + jTable1.setFont(new Font("@Fixedsys", Font.PLAIN, 12)); + cp.add(jTable1ScrollPane); + jTable2ScrollPane.setBounds(240, 176, 201, 177); + jTable2.getColumnModel().getColumn(1).setHeaderValue("Deutsch"); + jTable2.getColumnModel().getColumn(0).setHeaderValue("Dieser Text"); + cp.add(jTable2ScrollPane); + jTable3ScrollPane.setBounds(480, 176, 193, 177); + jTable3.getColumnModel().getColumn(1).setHeaderValue("Deutsch"); + jTable3.getColumnModel().getColumn(0).setHeaderValue("Dieser Text"); + cp.add(jTable3ScrollPane); + jBBuchstabe.setBounds(16, 144, 193, 25); + jBBuchstabe.setText("Buchstabenhäufigkeit"); + jBBuchstabe.setMargin(new Insets(2, 2, 2, 2)); + jBBuchstabe.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jBBuchstabe_ActionPerformed(evt); + } + }); + cp.add(jBBuchstabe); + jBBigramm.setBounds(240, 144, 201, 25); + jBBigramm.setText("Bigramm-Häufigkeit"); + jBBigramm.setMargin(new Insets(2, 2, 2, 2)); + jBBigramm.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jBBigramm_ActionPerformed(evt); + } + }); + cp.add(jBBigramm); + jBDoppel.setBounds(480, 144, 193, 25); + jBDoppel.setText("Doppelbuchstaben-Häufigkeit"); + jBDoppel.setMargin(new Insets(2, 2, 2, 2)); + jBDoppel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jBDoppel_ActionPerformed(evt); + } + }); + cp.add(jBDoppel); + jTextArea1ScrollPane.setBounds(16, 24, 665, 105); + JScrollBar jsb = jTextArea1ScrollPane.getVerticalScrollBar(); + jsb.addAdjustmentListener(new AdjustmentListener() {; + public void adjustmentValueChanged(AdjustmentEvent evt) { + adjustScrollBars(1); + } + }); + jTextArea1.setLineWrap(true); + jTextArea1.setFont(new Font("Courier New", Font.BOLD, 16)); + jTextArea1.addCaretListener(new CaretListener() { + + @Override + public void caretUpdate(CaretEvent arg0) { + int dot = arg0.getDot(); + int mark = arg0.getMark(); + updateMarkierung(dot, mark); + } + }); + + cp.add(jTextArea1ScrollPane); + jTextArea2ScrollPane.setBounds(16, 480, 665, 105); + jsb = jTextArea2ScrollPane.getVerticalScrollBar(); + jsb.addAdjustmentListener(new AdjustmentListener() {; + public void adjustmentValueChanged(AdjustmentEvent evt) { + adjustScrollBars(2); + } + }); + jTextArea2.setLineWrap(true); + jTextArea2.setFont(new Font("Courier New", Font.BOLD, 16)); + jTextArea2.addCaretListener(new CaretListener() { + + @Override + public void caretUpdate(CaretEvent arg0) { + int dot = arg0.getDot(); + int mark = arg0.getMark(); + updateMarkierung(dot, mark); + } + }); + + + cp.add(jTextArea2ScrollPane); + jLabel1.setText("Kryptotext"); + jLabel1.setBounds(16, 3, 110, 20); + cp.add(jLabel1); + jLabel2.setBounds(16, 456, 110, 20); + jLabel2.setText("Klartext"); + cp.add(jLabel2); + jLabel4.setBounds(128, 584, 419, 33); + jLabel4.setText("(cc) Schaller (ZPG Informatik) - V1.0 (2017)"); + jLabel4.setHorizontalAlignment(SwingConstants.CENTER); + jLabel4.setFont(new Font("Dialog", Font.PLAIN, 12)); + cp.add(jLabel4); + // Ende Komponenten + buchstabe = new JTextField[26]; + for (int i = 0; i<26 ;i++ ) { + JLabel jLabel3 = new JLabel(); + jLabel3.setBounds(23+i*25, 375, 25, 25); + int c = 65+i; + jLabel3.setText(""+((char) c)); + cp.add(jLabel3); + buchstabe[i] = new JTextField(); + buchstabe[i].setBounds(16+i*25, 400, 25, 25); + buchstabe[i].setText(""); + buchstabe[i].setHorizontalAlignment(SwingConstants.CENTER); + buchstabe[i].addKeyListener(new KeyAdapter() { + public void keyReleased(KeyEvent e) { + e.consume(); + } + + public void keyTyped(KeyEvent e) { + e.consume(); + } + + public void keyPressed(KeyEvent e) { + JTextField textField = (JTextField) e.getSource(); + String text = textField.getText(); + if ((e.getKeyChar()>='a' && e.getKeyChar()<='z') ||(e.getKeyChar()>='A' && e.getKeyChar()<='Z')) { + text = ""+e.getKeyChar(); + } + if (e.getKeyChar()==' ' || e.getKeyChar() == KeyEvent.VK_BACK_SPACE || e.getKeyChar() == KeyEvent.VK_DELETE) { + text = ""; + + } // end of if + textField.setText(text.toUpperCase()); + e.consume(); + jButton1_ActionPerformed(null); + changeColors(); + + } // end of if + + }); + + cp.add(buchstabe[i]); + } // end of for + for (int i = 0; i<10 ; i++ ) { + jTable1.getModel().setValueAt(h[i],i,1); + jTable2.getModel().setValueAt(b[i],i,1); + jTable3.getModel().setValueAt(t[i],i,1); + } // end of for + + setResizable(false); + setVisible(true); + } + + + public void changeColors() { + System.out.println("askd"); + for (int i=0; i<26 ; i++ ) { + buchstabe[i].setBackground(new Color(150,250,150)); + if (buchstabe[i].getText().equals("")) { + buchstabe[i].setBackground(Color.white); + + + } // end of if + + } // end of for + for (int i= 0; i<26 ;i++ ) { + for (int j=i+1; j<26 ;j++ ) { + if (!buchstabe[i].getText().equals("") && buchstabe[i].getText().equals(buchstabe[j].getText())) { + buchstabe[i].setBackground(new Color(250,150,150)); + buchstabe[j].setBackground(new Color(250,150,150)); + } // end of if + } // end of for + } // end of for + } + + + // Anfang Methoden + public void jButton1_ActionPerformed(ActionEvent evt) { + String krypttext = jTextArea1.getText().toLowerCase(); + for (int i=0;i<26 ;i++ ) { + int c = i+97; + String z = buchstabe[i].getText().toUpperCase(); + if (z.equals("")) { + z = "*"; + } // end of if + if (z.length()>1) { + buchstabe[i].setText(z.substring(0,1)); + } // end of if + krypttext = krypttext.replace((char) c,z.charAt(0)); + + } // end of for + jTextArea2.setText(krypttext); + } // end of jButton1_ActionPerformed + + public void jBBuchstabe_ActionPerformed(ActionEvent evt) { + String s = jTextArea1.getText(); + s = s.toLowerCase(); + s = s.replace(" ",""); + ArrayList h = new ArrayList(); + for (int i=0; i < s.length() ; i++ ) { + String z = s.substring(i,i+1); + boolean g = false; + for (Baustein b : h ) { + if (b.getZeichen().equals(z)) { + b.incAnzahl(); + g = true; + break; + + } // end of if + } // end of for + if (!g) { + h.add(new Baustein(z)); + } + } // end of for + Collections.sort(h); + for (int i=0; i < 10 && i < h.size() ; i++ ) { + double x = h.get(i).getAnzahl(); + x = Math.round(x / (double) s.length()*1000.0)/10.0; + jTable1.getModel().setValueAt(h.get(i).getZeichen()+" : "+x+"%",i,0); + } // end of for + } // end of jBBuchstabe_ActionPerformed + + public void jBBigramm_ActionPerformed(ActionEvent evt) { + String s = jTextArea1.getText(); + s = s.toLowerCase(); + int anz=0; + ArrayList h = new ArrayList(); + for (int i=0; i < s.length()-1 ; i++ ) { + if (s.charAt(i) != ' ' && s.charAt(i+1) != ' ') { + anz++; + String z = s.substring(i,i+2); + boolean g = false; + for (Baustein b : h ) { + if (b.getZeichen().equals(z)) { + b.incAnzahl(); + g = true; + break; + + } // end of if + } // end of for + if (!g) { + h.add(new Baustein(z)); + } + + } // end of if + } // end of for + Collections.sort(h); + for (int i=0; i < 10 && i < h.size() ; i++ ) { + double x = h.get(i).getAnzahl(); + x = Math.round(x / anz*1000)/10.0; + jTable2.getModel().setValueAt(h.get(i).getZeichen()+" : "+x+"%",i,0); + } // end of for + } // end of jBBigramm_ActionPerformed + + public void jBDoppel_ActionPerformed(ActionEvent evt) { + String s = jTextArea1.getText(); + s = s.toLowerCase(); + int anz = 0; + ArrayList h = new ArrayList(); + + for (int i=0; i < s.length()-1 ; i++ ) { + + if (s.charAt(i) != ' ' && s.charAt(i+1) != ' ') { + anz++; + + if (s.charAt(i+1) == s.charAt(i) ) { + String z = s.substring(i,i+2); + boolean g = false; + for (Baustein b : h ) { + if (b.getZeichen().equals(z)) { + b.incAnzahl(); + g = true; + break; + + } // end of if + } // end of for + if (!g) { + h.add(new Baustein(z)); + } + + } // end of if + } + } // end of for + Collections.sort(h); + for (int i=0; i < 10 && i < h.size() ; i++ ) { + double x = h.get(i).getAnzahl(); + x = Math.round(x / anz*10000)/100.0; + jTable3.getModel().setValueAt(h.get(i).getZeichen()+" : "+x+"%",i,0); + } // end of for + } // end of jBDoppel_ActionPerformed + + public void adjustScrollBars(int i) { + if (i==1) { + jTextArea2ScrollPane.getVerticalScrollBar().setValue(jTextArea1ScrollPane.getVerticalScrollBar().getValue()); + + } else { + jTextArea1ScrollPane.getVerticalScrollBar().setValue(jTextArea2ScrollPane.getVerticalScrollBar().getValue()); + } + } + + public void updateMarkierung(int p1, int p2) { + Highlighter h1 = jTextArea2.getHighlighter(); + Highlighter h2 = jTextArea1.getHighlighter(); + h1.removeAllHighlights(); + h2.removeAllHighlights(); + int von = Math.min(p1,p2); + int bis = Math.max(p1,p2); + try{ + h1.addHighlight(von , + bis, + new DefaultHighlighter.DefaultHighlightPainter(Color.yellow)); + + }catch(BadLocationException e) {} + try{ + h2.addHighlight(von , + bis, + new DefaultHighlighter.DefaultHighlightPainter(Color.yellow)); + + }catch(BadLocationException e) {} + } + + + + + + // Ende Methoden + + public static void main(String[] args) { + new BreakMono("BreakMono"); + } +} diff --git a/Quellcodes/iud_key_inf7_breakmono/BreakMono.jfm b/Quellcodes/iud_key_inf7_breakmono/BreakMono.jfm new file mode 100644 index 0000000..973da04 --- /dev/null +++ b/Quellcodes/iud_key_inf7_breakmono/BreakMono.jfm @@ -0,0 +1,423 @@ +object breakMono: TFGUIForm + Left = 0 + Top = 0 + BorderIcons = [biSystemMenu] + Caption = 'BreakMono' + ClientHeight = 612 + ClientWidth = 691 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -10 + Font.Name = 'MS Sans Serif' + Font.Style = [] + FormStyle = fsMDIChild + OldCreateOrder = True + Position = poDesigned + ShowHint = True + Visible = True + WindowState = wsMaximized + OnClose = FormClose + OnCloseQuery = FormCloseQuery + OnResize = FormResize + FrameType = 5 + Resizable = False + Undecorated = False + Background = clBtnFace + PixelsPerInch = 96 + TextHeight = 13 + object jButton1: TJButton + Tag = 4 + Left = 216 + Top = 440 + Width = 241 + Height = 25 + Hint = 'jButton1' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jButton1_ActionPerformed' + Text = 'Entschl'#252'sselung versuchen' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jTable1: TJTable + Tag = 19 + Left = 16 + Top = 176 + Width = 193 + Height = 177 + Hint = 'jTable1' + Foreground = clWindowText + Background = clWhite + Font.Charset = GB2312_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = '@Fixedsys' + Font.Style = [] + RowHeight = 16 + ShowHorizontalLines = True + ShowVerticalLines = True + ShowGrid = True + Columns.Strings = ( + 'Title 1' + 'Title 2' + 'Title 3' + 'Title 4' + 'Title 5') + ColCount = 5 + RowCount = 5 + FillsViewportHeight = False + AutoCreateRowSorter = False + RowSelectionAllowed = True + ColumnSelectionAllowed = False + CellSelectionEnabled = False + DragEnabled = False + HorizontalScrollBarPolicy = AS_NEEDED + VerticalScrollBarPolicy = AS_NEEDED + end + object jTable2: TJTable + Tag = 19 + Left = 240 + Top = 176 + Width = 201 + Height = 177 + Hint = 'jTable2' + Foreground = 3355443 + Background = clWhite + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [] + RowHeight = 16 + ShowHorizontalLines = True + ShowVerticalLines = True + ShowGrid = True + Columns.Strings = ( + 'Title 1' + 'Title 2' + 'Title 3' + 'Title 4' + 'Title 5') + ColCount = 5 + RowCount = 5 + FillsViewportHeight = False + AutoCreateRowSorter = False + RowSelectionAllowed = True + ColumnSelectionAllowed = False + CellSelectionEnabled = False + DragEnabled = False + HorizontalScrollBarPolicy = AS_NEEDED + VerticalScrollBarPolicy = AS_NEEDED + end + object jTable3: TJTable + Tag = 19 + Left = 480 + Top = 176 + Width = 193 + Height = 177 + Hint = 'jTable3' + Foreground = 3355443 + Background = clWhite + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [] + RowHeight = 16 + ShowHorizontalLines = True + ShowVerticalLines = True + ShowGrid = True + Columns.Strings = ( + 'Title 1' + 'Title 2' + 'Title 3' + 'Title 4' + 'Title 5') + ColCount = 5 + RowCount = 5 + FillsViewportHeight = False + AutoCreateRowSorter = False + RowSelectionAllowed = True + ColumnSelectionAllowed = False + CellSelectionEnabled = False + DragEnabled = False + HorizontalScrollBarPolicy = AS_NEEDED + VerticalScrollBarPolicy = AS_NEEDED + end + object jBBuchstabe: TJButton + Tag = 4 + Left = 16 + Top = 144 + Width = 193 + Height = 25 + Hint = 'jButton2' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jBBuchstabe_ActionPerformed' + Text = 'Buchstabenh'#228'ufigkeit' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jBBigramm: TJButton + Tag = 4 + Left = 240 + Top = 144 + Width = 201 + Height = 25 + Hint = 'jButton3' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jBBigramm_ActionPerformed' + Text = 'Bigramm-H'#228'ufigkeit' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jBDoppel: TJButton + Tag = 4 + Left = 480 + Top = 144 + Width = 193 + Height = 25 + Hint = 'jButton4' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jBDoppel_ActionPerformed' + Text = 'Doppelbuchstaben-H'#228'ufigkeit' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jTextArea1: TJTextArea + Tag = 3 + Left = 16 + Top = 24 + Width = 665 + Height = 105 + Cursor = crIBeam + Hint = 'jTextArea1' + Foreground = clWindowText + Background = clWhite + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Courier New' + Font.Style = [fsBold] + LineWrap = True + HorizontalScrollBarPolicy = AS_NEEDED + VerticalScrollBarPolicy = AS_NEEDED + WrapStyleWord = False + TabSize = 8 + Editable = True + end + object jTextArea2: TJTextArea + Tag = 3 + Left = 8 + Top = 480 + Width = 673 + Height = 105 + Cursor = crIBeam + Hint = 'jTextArea2' + Foreground = clWindowText + Background = clWhite + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Courier New' + Font.Style = [fsBold] + LineWrap = True + HorizontalScrollBarPolicy = AS_NEEDED + VerticalScrollBarPolicy = AS_NEEDED + WrapStyleWord = False + TabSize = 8 + Editable = True + end + object jLabel1: TJLabel + Tag = 1 + Left = 16 + Top = 8 + Width = 110 + Height = 20 + Hint = 'jLabel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Kryptotext' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLabel2: TJLabel + Tag = 1 + Left = 8 + Top = 456 + Width = 110 + Height = 20 + Hint = 'jLabel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Klartext' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLabel4: TJLabel + Tag = 1 + Left = 128 + Top = 584 + Width = 419 + Height = 33 + Hint = 'jLabel4' + Foreground = clWindowText + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [] + Text = '(cc) Schaller (ZPG Informatik) - V1.0 (2017)' + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end +end diff --git a/Quellcodes/iud_key_inf7_breakmono/JEClasses.jar b/Quellcodes/iud_key_inf7_breakmono/JEClasses.jar new file mode 100644 index 0000000..7fa4892 Binary files /dev/null and b/Quellcodes/iud_key_inf7_breakmono/JEClasses.jar differ diff --git a/Quellcodes/iud_key_inf7_breakmono/readme.adoc b/Quellcodes/iud_key_inf7_breakmono/readme.adoc new file mode 100644 index 0000000..f611dbb --- /dev/null +++ b/Quellcodes/iud_key_inf7_breakmono/readme.adoc @@ -0,0 +1,12 @@ += Material : Breakmono (Angriff auf monoalphabetische Verschlüsselung) + +|=== +|Zuordnung| Informationsgesellschaft und Datensicherheit +|Klassenstufe| Informatik 7 +|Bildungsplanbezug | allgemeine monoalphabetische Verschlüsselung +|Werkzeug| Java +|Autoren| Thomas Schaller +|=== + +== Inhalt +Dieses Programm unterstützt das Brechen einer allmeinen monoalphabetischen Verschlüsselung durch eine Häufigkeitsanalyse (auch von Bigrammen und Doppelbuchstaben). diff --git a/Quellcodes/sonst_spiel_grosserpreis/.gitignore b/Quellcodes/sonst_spiel_grosserpreis/.gitignore new file mode 100644 index 0000000..c1f4551 --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/.gitignore @@ -0,0 +1,5 @@ +*.class +*.ctxt +*.sh +repo.adoc +*.~lock diff --git a/Quellcodes/sonst_spiel_grosserpreis/FrageGUI.java b/Quellcodes/sonst_spiel_grosserpreis/FrageGUI.java new file mode 100644 index 0000000..5cf6360 --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/FrageGUI.java @@ -0,0 +1,150 @@ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +/** + * + * GUI zur Anzeige einer einzigen Frage des Quizspiels + * + * @version 1.0 from 15.11.2016 + * @author Thomas Schaller + */ + +public class FrageGUI extends JDialog { + // Anfang Attribute + private JLabel jLabel1 = new JLabel(); + private JLabel jLFrage = new JLabel(); + private JButton jB_A1 = new JButton(); + private JButton jB_A2 = new JButton(); + private JButton jB_A3 = new JButton(); + private JButton jB_A4 = new JButton(); + private JLabel jLName = new JLabel(); + + private JPanel jPanel1 = new JPanel(null, true); + private int antwort = -1; + // Ende Attribute + + public FrageGUI (JFrame owner, String frage, String a1, String a2, String a3, String a4, int sp) { + super (owner, true); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + int frameWidth = 657; + int frameHeight = 447; + setSize(frameWidth, frameHeight); + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + int x = (d.width - getSize().width) / 2; + int y = (d.height - getSize().height) / 2; + setLocation(x, y); + Container cp = getContentPane(); + cp.setLayout(null); + // Anfang Komponenten + jLabel1.setBounds(8, 8, 78, 81); + jLabel1.setText("

Frage:

"); + jLabel1.setFont(new Font("Dialog", Font.BOLD, 20)); + jLabel1.setVerticalTextPosition(JLabel.TOP); + cp.add(jLabel1); + jLFrage.setBounds(96, 0, 534, 97); + jLFrage.setText(""+frage+""); + jLFrage.setFont(new Font("Dialog", Font.BOLD, 20)); + jLFrage.setVerticalTextPosition(SwingConstants.TOP); + cp.add(jLFrage); + jB_A1.setBounds(8, 96, 329, 121); + jB_A1.setText("

"+a1+"

"); + jB_A1.setMargin(new Insets(2, 2, 2, 2)); + jB_A1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jB_A1_ActionPerformed(evt); + } + }); + jB_A1.setFont(new Font("Dialog", Font.BOLD, 16)); + jB_A1.setBackground(new Color(0xB8CFE5)); + jB_A1.setHorizontalTextPosition(SwingConstants.CENTER); + cp.add(jB_A1); + jB_A2.setBounds(352, 96, 281, 121); + jB_A2.setText("

"+a2+"

"); + jB_A2.setMargin(new Insets(2, 2, 2, 2)); + jB_A2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jB_A2_ActionPerformed(evt); + } + }); + jB_A2.setFont(new Font("Dialog", Font.BOLD, 16)); + jB_A2.setBackground(new Color(0xB8CFE5)); + cp.add(jB_A2); + jB_A3.setBounds(8, 224, 329, 137); + jB_A3.setText("

"+a3+"

"); + jB_A3.setMargin(new Insets(2, 2, 2, 2)); + jB_A3.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jB_A3_ActionPerformed(evt); + } + }); + jB_A3.setFont(new Font("Dialog", Font.BOLD, 16)); + jB_A3.setBackground(new Color(0xB8CFE5)); + cp.add(jB_A3); + jB_A4.setBounds(352, 224, 281, 137); + jB_A4.setText("

"+a4+"

"); + jB_A4.setMargin(new Insets(2, 2, 2, 2)); + jB_A4.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jB_A4_ActionPerformed(evt); + } + }); + jB_A4.setFont(new Font("Dialog", Font.BOLD, 16)); + jB_A4.setBackground(new Color(0xB8CFE5)); + cp.add(jB_A4); + jLName.setBounds(8, 360, 624, 45); + jLName.setText("Spieler "+sp+" entscheide dich!"); + jLName.setFont(new Font("Dialog", Font.BOLD, 24)); + cp.add(jLName); + setUndecorated(true); + jPanel1.setBounds(0, 0, 641, 409); + jPanel1.setOpaque(false); + jPanel1.setBorder(new javax.swing.border.LineBorder(Color.BLACK, 2)); + cp.add(jPanel1); + // Ende Komponenten + setResizable(false); + } + + // Anfang Methoden + public void jB_A1_ActionPerformed(ActionEvent evt) { + antwort = 1; + jB_A1.setEnabled(false); + this.setVisible(false); + } // end of jB_A1_ActionPerformed + + public void jB_A2_ActionPerformed(ActionEvent evt) { + antwort = 2; + jB_A2.setEnabled(false); + this.setVisible(false); + } // end of jB_A2_ActionPerformed + + public void jB_A3_ActionPerformed(ActionEvent evt) { + antwort = 3; + jB_A3.setEnabled(false); + this.setVisible(false); + + } // end of jB_A3_ActionPerformed + + public void jB_A4_ActionPerformed(ActionEvent evt) { + antwort = 4; + jB_A4.setEnabled(false); + this.setVisible(false); + + } // end of jB_A4_ActionPerformed + + public int getAntwort() { + + return antwort; + + } + public void setSpieler(int sp) { + jLName.setText("Spieler "+sp+" entscheide dich!"); + + } + + +// Ende Methoden + + +} diff --git a/Quellcodes/sonst_spiel_grosserpreis/FrageGUI.jfm b/Quellcodes/sonst_spiel_grosserpreis/FrageGUI.jfm new file mode 100644 index 0000000..ee66c50 --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/FrageGUI.jfm @@ -0,0 +1,303 @@ +object frageGUI: TFGUIForm + Left = 160 + Top = 45 + BorderIcons = [biSystemMenu] + Caption = 'FrageGUI' + ClientHeight = 408 + ClientWidth = 641 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -10 + Font.Name = 'MS Sans Serif' + Font.Style = [] + FormStyle = fsMDIChild + OldCreateOrder = True + Position = poDesigned + ShowHint = True + Visible = True + OnClose = FormClose + OnCloseQuery = FormCloseQuery + OnResize = FormResize + FrameType = 5 + Resizable = False + Undecorated = True + Background = clBtnFace + PixelsPerInch = 96 + TextHeight = 13 + object jPanel1: TJPanel + Tag = 12 + Left = 0 + Top = 0 + Width = 641 + Height = 409 + Hint = 'jPanel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = LineBorder + Border.LineColor = clBlack + Border.LineThickness = 2 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jB_A1: TJButton + Tag = 4 + Left = 8 + Top = 96 + Width = 329 + Height = 121 + Hint = 'jButton1' + Foreground = clWindowText + Background = 15060920 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jB_A1_ActionPerformed' + Text = 'jButtonA1' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jB_A2: TJButton + Tag = 4 + Left = 352 + Top = 96 + Width = 281 + Height = 121 + Hint = 'jButton2' + Foreground = clWindowText + Background = 15060920 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jB_A2_ActionPerformed' + Text = 'jButton2' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jB_A3: TJButton + Tag = 4 + Left = 8 + Top = 224 + Width = 329 + Height = 137 + Hint = 'jButton3' + Foreground = clWindowText + Background = 15060920 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jB_A3_ActionPerformed' + Text = 'jButton3' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jB_A4: TJButton + Tag = 4 + Left = 352 + Top = 224 + Width = 281 + Height = 137 + Hint = 'jButton4' + Foreground = clWindowText + Background = 15060920 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jB_A4_ActionPerformed' + Text = 'jButton4' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jLName: TJLabel + Tag = 1 + Left = 8 + Top = 360 + Width = 624 + Height = 45 + Hint = 'jLabel2' + Foreground = clWindowText + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Spieler 1 entscheide dich!' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLFrage: TJLabel + Tag = 1 + Left = 96 + Top = 0 + Width = 534 + Height = 97 + Hint = 'jLabel2' + Foreground = clWindowText + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'text' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = TOP + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLabel1: TJLabel + Tag = 1 + Left = 8 + Top = 8 + Width = 78 + Height = 81 + Hint = 'jLabel1' + Foreground = clWindowText + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = '

Frage:

' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = TOP + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end +end diff --git a/Quellcodes/sonst_spiel_grosserpreis/ImageLabel.java b/Quellcodes/sonst_spiel_grosserpreis/ImageLabel.java new file mode 100644 index 0000000..655646a --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/ImageLabel.java @@ -0,0 +1,90 @@ +import java.awt.AlphaComposite; +import java.awt.Composite; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import javax.swing.ImageIcon; +import javax.swing.*; + +/** + * + * GUI Element zur Anzeige eines Textes vor einem Hintergrundbild + * + * @version 1.0 from 15.11.2016 + * @author Thomas Schaller + */ + + + public class ImageLabel extends JPanel{ + + protected ImageIcon image; + protected Dimension sizeImage; + protected String text; + + public ImageLabel(ImageIcon image) { + super(); + this.image = image; + init(); + } + + + + public ImageLabel(ImageIcon image, String text) { + super(); + this.image = image; + this.text = text; + init(); + } + + + + private void init() { + sizeImage=new Dimension(image.getIconHeight(),image.getIconWidth()); + + } + + public ImageIcon getImageIcon() { + return image; + } + + public void setImageIcon(ImageIcon image) { + this.image = image; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D graphics2D = (Graphics2D) g; + // graphics2D.fillRect(0,0,this.getWidth(),this.getHeight()); + Composite old=graphics2D.getComposite(); + if(image!=null) + { + //graphics2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f)); + graphics2D.drawImage(image.getImage(),0,0, + this.getWidth(),this.getHeight(),null); + } + graphics2D.setComposite(old); + graphics2D.drawString(text, 8, 40); + + + } + + public Dimension getSizeImage() { + return sizeImage; +} + + public void setSizeImage(Dimension sizeImage) { + this.sizeImage = sizeImage; + } + +} + + diff --git a/Quellcodes/sonst_spiel_grosserpreis/JEClasses.jar b/Quellcodes/sonst_spiel_grosserpreis/JEClasses.jar new file mode 100644 index 0000000..7fa4892 Binary files /dev/null and b/Quellcodes/sonst_spiel_grosserpreis/JEClasses.jar differ diff --git a/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.jar b/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.jar new file mode 100644 index 0000000..0c7f955 Binary files /dev/null and b/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.jar differ diff --git a/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.java b/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.java new file mode 100644 index 0000000..cc92c7f --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.java @@ -0,0 +1,355 @@ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.io.*; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; +import org.jdom.output.XMLOutputter; + + + +/** + * + * Quizspiel zur Wiederholung von Unterrichtsinhalten + * + * @version 1.1 from 23.02.2017 + * @author Thomas Schaller + */ + +public class Quizspiel extends JFrame { + // Anfang Attribute + private ImageLabel jLabel1; + + private ImageIcon jLabel1Icon = new ImageIcon("images/Titelleiste_Netzwerk.png"); + + private JPanel jPanel1 = new JPanel(null, true); + private JLabel jLabel2 = new JLabel(); + private JPanel jPanel2 = new JPanel(null, true); + private JPanel jPanel3 = new JPanel(null, true); + + private JLabel jLStatus = new JLabel(); + private JPanel jPanel4 = new JPanel(null, true); + private JButton jBEnde = new JButton(); + private JPanel jPSpieler1 = new JPanel(null, true); + private JLabel jLName1 = new JLabel(); + private JLabel jLPunkte1 = new JLabel(); + private JPanel jPSpieler2 = new JPanel(null, true); + private JLabel jLName2 = new JLabel(); + private JLabel jLPunkte2 = new JLabel(); + private JPanel jPSpieler3 = new JPanel(null, true); + private JLabel jLName3 = new JLabel(); + private JLabel jLPunkte3 = new JLabel(); + private JPanel jPSpieler4 = new JPanel(null, true); + private JLabel jLName4 = new JLabel(); + private JLabel jLPunkte4 = new JLabel(); + private JLabel jLabel4 = new JLabel(); + private JButton[][] jBTopics; + private int akt_sp = 0; + private int sp_anz = 4; + private int[] punkte = new int[4]; + private Document doc = null; + // Ende Attribute + + public Quizspiel (String title) { + super (title); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + int frameWidth = 1026; + int frameHeight = 580; + setSize(frameWidth, frameHeight); + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + int x = (d.width - getSize().width) / 2; + int y = (d.height - getSize().height) / 2; + setLocation(x, y); + Container cp = getContentPane(); + cp.setLayout(null); + // Anfang Komponenten + jLabel1 = new ImageLabel(jLabel1Icon, "Quiz"); + jLabel1.setBounds(2, 2, 1019, 65); + jLabel1.setText("Quiz"); + jLabel1.setImageIcon(jLabel1Icon); + jLabel1.setFont(new Font("Dialog", Font.BOLD, 30)); + jLabel1.setForeground(Color.white); + cp.add(jLabel1); + jLabel4.setBounds(310, 553, 400, 20); + jLabel4.setText("(cc) Schaller (ZPG Informatik) - V1.1 (2017)"); + jLabel4.setHorizontalAlignment(SwingConstants.CENTER); + jLabel4.setFont(new Font("Dialog", Font.PLAIN, 12)); + cp.add(jLabel4); + + setUndecorated(true); + + + jLStatus.setBounds(8, 488, 1011, 57); + jLStatus.setText(" Wähle bitte eine Frage..."); + jLStatus.setBackground(Color.GRAY); + jLStatus.setOpaque(true); + jLStatus.setFont(new Font("Dialog", Font.BOLD, 24)); + jLStatus.setForeground(Color.WHITE); + + cp.add(jLStatus); + jPanel4.setBounds(0, 0, 1026, 553); + jPanel4.setOpaque(false); + jPanel4.setBorder(new javax.swing.border.LineBorder(Color.BLACK, 2)); + cp.add(jPanel4); + jPSpieler1.setBounds(832, 72, 185, 89); + jPSpieler1.setOpaque(true); + jPSpieler1.setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.BLACK)); + jPSpieler1.setBackground(new Color(0xB8CFE5)); + jPanel4.add(jPSpieler1); + jLName1.setBounds(8, 8, 174, 33); + jLName1.setText("Spieler 1"); + jLName1.setFont(new Font("Dialog", Font.BOLD, 24)); + jLName1.setForeground(new Color(0x000080)); + jLName1.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler1.add(jLName1); + jLPunkte1.setBounds(11, 48, 166, 33); + jLPunkte1.setText("0 Punkte"); + jLPunkte1.setForeground(new Color(0x800000)); + jLPunkte1.setFont(new Font("Dialog", Font.BOLD, 24)); + jLPunkte1.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler1.add(jLPunkte1); + jPSpieler2.setBounds(832, 160, 185, 89); + jPSpieler2.setOpaque(true); + jPSpieler2.setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.BLACK)); + jPanel4.add(jPSpieler2); + jLName2.setBounds(8, 8, 174, 33); + jLName2.setText("Spieler 2"); + jLName2.setFont(new Font("Dialog", Font.BOLD, 24)); + jLName2.setForeground(new Color(0x000080)); + jLName2.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler2.add(jLName2); + jLPunkte2.setBounds(11, 48, 166, 33); + jLPunkte2.setText("0 Punkte"); + jLPunkte2.setFont(new Font("Dialog", Font.BOLD, 24)); + jLPunkte2.setForeground(new Color(0x800000)); + jLPunkte2.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler2.add(jLPunkte2); + jPSpieler3.setBounds(832, 248, 185, 89); + jPSpieler3.setOpaque(true); + jPSpieler3.setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.BLACK)); + jPSpieler3.setBackground(new Color(0xEEEEEE)); + jPanel4.add(jPSpieler3); + jLName3.setBounds(8, 8, 174, 33); + jLName3.setText("Spieler 3"); + jLName3.setFont(new Font("Dialog", Font.BOLD, 24)); + jLName3.setForeground(new Color(0x000080)); + jLName3.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler3.add(jLName3); + jLPunkte3.setBounds(11, 48, 166, 33); + jLPunkte3.setText("0 Punkte"); + jLPunkte3.setFont(new Font("Dialog", Font.BOLD, 24)); + jLPunkte3.setForeground(new Color(0x800000)); + jLPunkte3.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler3.add(jLPunkte3); + jPSpieler4.setBounds(832, 336, 185, 89); + jPSpieler4.setOpaque(true); + jPSpieler4.setBorder(BorderFactory.createBevelBorder(1, Color.WHITE, Color.BLACK)); + jPSpieler4.setBackground(new Color(0xEEEEEE)); + jPanel4.add(jPSpieler4); + jLName4.setBounds(8, 8, 174, 33); + jLName4.setText("Spieler 4"); + jLName4.setFont(new Font("Dialog", Font.BOLD, 24)); + jLName4.setForeground(new Color(0x000080)); + jLName4.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler4.add(jLName4); + jLPunkte4.setBounds(11, 48, 166, 33); + jLPunkte4.setText("0 Punkte"); + jLPunkte4.setFont(new Font("Dialog", Font.BOLD, 24)); + jLPunkte4.setForeground(new Color(0x800000)); + jLPunkte4.setHorizontalTextPosition(SwingConstants.CENTER); + jPSpieler4.add(jLPunkte4); + + jBEnde.setBounds(832, 432, 185, 49); + jBEnde.setText("Spiel beenden"); + jBEnde.setMargin(new Insets(2, 2, 2, 2)); + jBEnde.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + jBEnde_ActionPerformed(evt); + } + }); + jBEnde.setFont(new Font("Dialog", Font.BOLD, 24)); + jPanel4.add(jBEnde); + // Ende Komponenten + readQuestions(); + jLabel1.setText("Quiz: "+doc.getRootElement().getChild("Titel").getValue()); + jBTopics = new JButton[getAnzKategorien()][getAnzTopics()]; + for (x = 0; x < getAnzKategorien() ; x++) { + JPanel jPanel = new JPanel(); + jPanel.setBounds(2+193*x, 85, 193, 65); + jPanel.setOpaque(false); + jPanel.setBorder(BorderFactory.createBevelBorder(0, Color.WHITE, Color.BLACK)); + jPanel4.add(jPanel); + + JLabel jLabel = new JLabel(); + jLabel.setBounds(80, 60, 193, 64); + jLabel.setText("

"+getKategorie(x)+"

"); + jLabel.setHorizontalAlignment(SwingConstants.CENTER); + jLabel.setFont(new Font("Dialog", Font.BOLD, 24)); + jPanel.add(jLabel); + for (y = 0; y < getAnzTopics() ; y++ ) { + jBTopics[x][y] = new JButton(); + jBTopics[x][y].setText(getTopic(x,y).getChild("Punkte").getValue()); + jBTopics[x][y].setBounds(2+193*x, 150+y*65, 193, 65); + jBTopics[x][y].setMargin(new Insets(2,2,2,2)); + jBTopics[x][y].setFont(new Font("Dialog", Font.BOLD, 36)); + jBTopics[x][y].addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + button_ActionPerformed(evt); + } + }); + jPanel4.add(jBTopics[x][y]); + } // end of for + + } // end of for + + setResizable(false); + setVisible(true); + sp_anz = 0; + while (sp_anz <2 || sp_anz > 4) { + String s = javax.swing.JOptionPane.showInputDialog( "Bitte Anzahl der Spieler eingeben (2-4):" ); + try{ + int i = Integer.parseInt( s ); + sp_anz = i; + } catch (Exception e) { + } + + } // end of while + jPSpieler4.setVisible(sp_anz >= 4); + jPSpieler3.setVisible(sp_anz >= 3); + // end of if + + } + + // Anfang Methoden + public void button_ActionPerformed(ActionEvent evt) { + int x = 0; + int y = 0; + for (int i=0;i Die Antwort war leider falsch!"); + akt_f_sp = (akt_f_sp + 1)%sp_anz; + frage.setSpieler((akt_f_sp+1)); + try{ + Thread.sleep(200); } + catch(Exception e) { + } + } // end of if-else + + + } // end of while + akt_sp = (akt_sp+1)%sp_anz; + punkte[akt_f_sp] += Integer.parseInt(t.getChild("Punkte").getValue()); + + jLStatus.setText(" Die Antwort ist richtig. Spieler "+(akt_f_sp+1)+" erhält "+Integer.parseInt(t.getChild("Punkte").getValue())+" Punkte. Spieler "+(akt_sp+1)+" wähle bitte eine Frage..."); + ((JButton) (evt.getSource())).setEnabled(false); + showPunkte(); + } // end of jButton1_ActionPerformed + + + + public void jBEnde_ActionPerformed(ActionEvent evt) { + this.setVisible(false); + this.dispose(); + } // end of jBEnde_ActionPerformed + + // Ende Methoden + public void showPunkte() { + jLPunkte1.setText(""+punkte[0]+" Punkte"); + jLPunkte2.setText(""+punkte[1]+" Punkte"); + jLPunkte3.setText(""+punkte[2]+" Punkte"); + jLPunkte4.setText(""+punkte[3]+" Punkte"); + if (akt_sp==0) { + jPSpieler1.setBackground(new Color(0xB8CFE5)); + } else { + jPSpieler1.setBackground(new Color(0xEFEFEF)); + } // end of if-else + jPSpieler2.setBackground(new Color(0xEEEEEE)); + if (akt_sp==1) { + jPSpieler2.setBackground(new Color(0xB8CFE5)); + } else { + jPSpieler2.setBackground(new Color(0xEFEFEF)); + } // end of if-else + if (akt_sp==2) { + jPSpieler3.setBackground(new Color(0xB8CFE5)); + } else { + jPSpieler3.setBackground(new Color(0xEFEFEF)); + } // end of if-else + if (akt_sp==3) { + jPSpieler4.setBackground(new Color(0xB8CFE5)); + } else { + jPSpieler4.setBackground(new Color(0xEFEFEF)); + } // end of if-else + + } + + public int getAnzKategorien() { + return doc.getRootElement().getChildren("Kategorie").size(); + } + + public String getKategorie(int x) { + Element kat = (Element) doc.getRootElement().getChildren("Kategorie").get(x); + return kat.getAttributeValue("name"); + } + + public int getAnzTopics() { + Element kat0 = (Element) doc.getRootElement().getChildren("Kategorie").get(0); + return kat0.getChildren("Frage").size(); + } + + public Element getTopic(int x, int y) { + Element kategorie = (Element) (doc.getRootElement().getChildren("Kategorie").get(x)); + Element topic = (Element) (kategorie.getChildren("Frage")).get(y); + return topic; + } + + + + + public void readQuestions() { + + doc = null; + + InputStream is = Quizspiel.class.getResourceAsStream("questions.xml"); + File f = new File("questions.xml"); + try { + // Das Dokument erstellen + SAXBuilder builder = new SAXBuilder(); + doc = builder.build(f); + + } catch (JDOMException e) { + e.printStackTrace(); + + } catch (IOException e) { + e.printStackTrace(); + } + + } + + + + + public static void main(String[] args) { + new Quizspiel("Quizspiel"); + } +} diff --git a/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.jfm b/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.jfm new file mode 100644 index 0000000..cd31ab1 --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/Quizspiel.jfm @@ -0,0 +1,787 @@ +object quizspiel: TFGUIForm + Left = 0 + Top = -88 + BorderIcons = [biSystemMenu] + Caption = 'Quizspiel' + ClientHeight = 552 + ClientWidth = 1030 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -10 + Font.Name = 'MS Sans Serif' + Font.Style = [] + FormStyle = fsMDIChild + OldCreateOrder = True + Position = poDesigned + ShowHint = True + Visible = True + WindowState = wsMaximized + OnClose = FormClose + OnCloseQuery = FormCloseQuery + OnResize = FormResize + FrameType = 5 + Resizable = False + Undecorated = True + Background = clBtnFace + PixelsPerInch = 96 + TextHeight = 13 + object jPanel2: TJPanel + Tag = 12 + Left = 192 + Top = 72 + Width = 193 + Height = 65 + Hint = 'jPanel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clWhite + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jPanel3: TJPanel + Tag = 12 + Left = 384 + Top = 72 + Width = 193 + Height = 65 + Hint = 'jPanel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clWhite + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jPanel4: TJPanel + Tag = 12 + Left = 0 + Top = 0 + Width = 1026 + Height = 553 + Hint = 'jPanel4' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = LineBorder + Border.LineColor = clBlack + Border.LineThickness = 2 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + object jPSpieler1: TJPanel + Tag = 12 + Left = 832 + Top = 72 + Width = 185 + Height = 89 + Hint = 'jPanel5' + Foreground = 3355443 + Background = 15060920 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 1 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + object jLName1: TJLabel + Tag = 1 + Left = 8 + Top = 8 + Width = 174 + Height = 33 + Hint = 'jLabel3' + Foreground = clNavy + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clNavy + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Spieler 1' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLPunkte1: TJLabel + Tag = 1 + Left = 11 + Top = 48 + Width = 166 + Height = 33 + Hint = 'jLabel3' + Foreground = clMaroon + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clMaroon + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = '0 Punkte' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + end + object jPSpieler2: TJPanel + Tag = 12 + Left = 832 + Top = 160 + Width = 185 + Height = 89 + Hint = 'jPanel5' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 1 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + object jLName2: TJLabel + Tag = 1 + Left = 8 + Top = 8 + Width = 174 + Height = 33 + Hint = 'jLabel3' + Foreground = clNavy + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clNavy + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Spieler 2' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLPunkte2: TJLabel + Tag = 1 + Left = 11 + Top = 48 + Width = 166 + Height = 33 + Hint = 'jLabel3' + Foreground = clMaroon + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clMaroon + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = '0 Punkte' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + end + object jPSpieler3: TJPanel + Tag = 12 + Left = 832 + Top = 248 + Width = 185 + Height = 89 + Hint = 'jPanel5' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 1 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + object jLName3: TJLabel + Tag = 1 + Left = 8 + Top = 8 + Width = 174 + Height = 33 + Hint = 'jLabel3' + Foreground = clNavy + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clNavy + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Spieler 3' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLPunkte3: TJLabel + Tag = 1 + Left = 11 + Top = 48 + Width = 166 + Height = 33 + Hint = 'jLabel3' + Foreground = clMaroon + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clMaroon + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = '0 Punkte' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + end + object jPSpieler4: TJPanel + Tag = 12 + Left = 832 + Top = 336 + Width = 185 + Height = 89 + Hint = 'jPanel5' + Foreground = 3355443 + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 1 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + object jLName4: TJLabel + Tag = 1 + Left = 8 + Top = 8 + Width = 174 + Height = 33 + Hint = 'jLabel3' + Foreground = clNavy + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clNavy + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Spieler 4' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jLPunkte4: TJLabel + Tag = 1 + Left = 11 + Top = 48 + Width = 166 + Height = 33 + Hint = 'jLabel3' + Foreground = clMaroon + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clMaroon + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = '0 Punkte' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = CENTER + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + end + object jButton3: TJButton + Tag = 4 + Left = 2 + Top = 215 + Width = 193 + Height = 65 + Hint = 'jButton2' + Foreground = clWindowText + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -36 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jButton3_ActionPerformed' + Text = '40' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jButton4: TJButton + Tag = 4 + Left = 2 + Top = 343 + Width = 193 + Height = 65 + Hint = 'jButton2' + Foreground = clWindowText + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -36 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jButton4_ActionPerformed' + Text = '80' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jButton5: TJButton + Tag = 4 + Left = 2 + Top = 407 + Width = 193 + Height = 65 + Hint = 'jButton2' + Foreground = clWindowText + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -36 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jButton5_ActionPerformed' + Text = '100' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jBEnde: TJButton + Tag = 4 + Left = 832 + Top = 432 + Width = 185 + Height = 49 + Hint = 'jButton6' + Foreground = clWindowText + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jBEnde_ActionPerformed' + Text = 'Spiel beenden' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + end + object jPanel1: TJPanel + Tag = 12 + Left = 2 + Top = 85 + Width = 193 + Height = 65 + Hint = 'jPanel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Border.BorderType = BevelBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clWhite + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clWhite + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + object jLabel2: TJLabel + Tag = 1 + Left = 8 + Top = 8 + Width = 174 + Height = 44 + Hint = 'jLabel2' + Foreground = clWindowText + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'Router' + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + end + object jLStatus: TJLabel + Tag = 1 + Left = 8 + Top = 488 + Width = 1011 + Height = 57 + Hint = 'jLabel3' + Foreground = clWhite + Background = clGray + Font.Charset = DEFAULT_CHARSET + Font.Color = clWhite + Font.Height = -24 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'W'#228'hle bitte eine Frage...' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end + object jButton1: TJButton + Tag = 4 + Left = 2 + Top = 150 + Width = 193 + Height = 65 + Hint = 'jButton1' + Foreground = clWindowText + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -36 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jButton1_ActionPerformed' + Text = '20' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jButton2: TJButton + Tag = 4 + Left = 2 + Top = 279 + Width = 193 + Height = 65 + Hint = 'jButton2' + Foreground = clWindowText + Background = 15658734 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -36 + Font.Name = 'Dialog' + Font.Style = [fsBold] + actionPerformed = 'jButton2_ActionPerformed' + Text = '60' + Mnemonic = 0 + DisplayedMnemonicIndex = 0 + Selected = False + BorderPainted = True + FocusPainted = False + ContentAreaFilled = True + HorizontalAlignment = CENTER + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + RolloverEnabled = False + Border.BorderType = NoBorder + Border.LineColor = clBlack + Border.LineThickness = 0 + Border.LineRounded = False + Border.EtchHighlightColor = clBlack + Border.EtchShadowColor = clBlack + Border.Etchtype = 0 + Border.BevelHighlightColor = clBlack + Border.BevelShadowColor = clBlack + Border.Beveltype = 0 + Border.MatteColor = clBlack + Border.MatteTop = 0 + Border.MatteLeft = 0 + Border.MatteBottom = 0 + Border.MatteRight = 0 + end + object jLabel1: TJLabel + Tag = 1 + Left = 2 + Top = 2 + Width = 1019 + Height = 65 + Hint = 'jLabel1' + Foreground = 3355443 + Background = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Dialog' + Font.Style = [fsBold] + Text = 'text' + Icon = 'images/Titelleiste_Netzwerk.png' + HorizontalAlignment = LEFT + VerticalAlignment = CENTER + HorizontalTextPosition = RIGHT + VerticalTextPosition = CENTER + IconTextGap = 4 + DisplayedMnemonic = 0 + DisplayedMnemonicIndex = 0 + end +end diff --git a/Quellcodes/sonst_spiel_grosserpreis/images/Titelleiste_Netzwerk.png b/Quellcodes/sonst_spiel_grosserpreis/images/Titelleiste_Netzwerk.png new file mode 100644 index 0000000..9730973 Binary files /dev/null and b/Quellcodes/sonst_spiel_grosserpreis/images/Titelleiste_Netzwerk.png differ diff --git a/Quellcodes/sonst_spiel_grosserpreis/jdom-1.1.3.jar b/Quellcodes/sonst_spiel_grosserpreis/jdom-1.1.3.jar new file mode 100644 index 0000000..a287727 Binary files /dev/null and b/Quellcodes/sonst_spiel_grosserpreis/jdom-1.1.3.jar differ diff --git a/Quellcodes/sonst_spiel_grosserpreis/questions.xml b/Quellcodes/sonst_spiel_grosserpreis/questions.xml new file mode 100644 index 0000000..0727838 --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/questions.xml @@ -0,0 +1,195 @@ + + +Internet-Kommunikation + + + 20 + Was ist ein Router? + Ein Gerät, um Daten im Internet weiterzuschicken. + Ein Verkehrszeichen in England + Ein Routenplaner fürs Auto + Ein besonders schnelles Datenpaket + 1 + + + 40 + Kann man ohne Router mit dem Internet verbunden sein? + Ja, wenn man WLAN hat. + Ja, mit einem Handy (LTE oder UTMS). + Das kommt darauf an. + Nein, die Kommunikation über das Internet geht immer über Router. + 4 + + + 60 + Wie viele Netzwerkkabel führen zu einem Router? + Gar keins. + Genau eins. + Mindestens zwei. + Maximal zwei. + 3 + + + 80 + Was passiert, wenn ein Router ausfällt? + Das ganze Internet bricht zusammen. + Ein Techniker wechselt in Minutenschnelle den Router aus und dann geht das Internet wieder. + Die anderen Router merken dies und schicken die Pakete auf einem anderen Weg. + Router können gar nicht kaputt gehen. + 3 + + + 100 + Über wie viele Router läuft ein Datenpaket im Internet, wenn es einmal um die Welt geschickt wird? + ca. 5 + ca. 15 + ca. 150 + ca. 1500 + 2 + + + + + 20 + Welche Aussage über einen Server stimmt nicht? + Ein Server ist ein Computerprogramm, das Anfragen beantwortet. + Ein Server ist die meiste Zeit mit Warten beschäfftigt. + Ein Server ist ein Roboter zum Bedienen. + Server ist englisch und bedeutet Diener/Bedienung. + 3 + + + 40 + Wer speichert die noch nicht ausgelieferten WhatsApp Nachrichten? + Der Server von WhatsApp. + Sie bewegen sich im Internet umher, bis sie zugestellt werden. + Das Handy des Empfängers speichert sie, auch wenn es nicht online ist. + Das Handy des Absenders wartet bis der Empfänge online ist und schickt sie dann. + 1 + + + 60 + Was ist keine Client-Server-Anwendung? + Emailversand + Online-Computerspiel (z.B. Clash of clans) + World Wide Web (WWW) + Textverarbeitungsprogramm + 4 + + + + 80 + "Ein Filesharing-Programm (z.B. Bittorrent) ist sowohl Client wie auch Server". + Die Aussage stimmt, da man sowohl Dateien abrufen kann (Client-Funktion), als auch gleichzeitig eigene Dateien anbietet (Server-Funktion). + Die Aussage stimmt, da man sowohl Dateien abrufen kann (Server-Funktion), als auch gleichzeitig eigene Dateien anbietet (Client-Funktion). + Die Aussage stimmt nicht, da kein Programm gleichzeitig Client und Server sein kann. + Die Aussage stimmt nicht, da es sich hier überhaupt nicht um eine Client-Server-Anwendung handelt. + 1 + + + 100 + Kann dein Computer zu Hause ein Server sein? + Ja, ich muss dazu aber ein bestimmtes Programm starten. + Ja, jeder Computer, der im Internet ist, ist auch ein Server. + Nein, Server können nur spezielle Computer sein. + Nein, Server darf man als Privatperson nicht betreiben. + 1 + + + + + 20 + Wo kann man keine Dateien speichern? + In der Cloud (=Server im Internet) + In einem Silo. + Auf der lokalen Festplatte + Auf dem Schulserver + 2 + + + 40 + Bei welchem Speichermedium hat man den schnellsten Zugriff? + USB-Stick. + Cloud-Speicher + lokale Festplatte (SSD) + auf dem Schulserver + 3 + + + 60 + Welche Aussage über Cloud-Speicher stimmt nicht? + Die Daten werden vor der Speicherung über das Internet übertragen. + Die Daten sind von jedem an das Internet angeschlossene Rechner abrufbar. + Die Daten werden durch das Internet geschickt, bis sie wieder abgerufen werden. + Die Daten werden von einer kommerziellen Firma für den Anwender gespeichert. + 3 + + + 80 + Welche Aussage über das Homeverzeichnis in der Schule stimmt nicht? + Auf jedem Computer der Schule hat man Zugriff auf sein Homeverzeichnis. + Das Homeverzeichnis wird auf einem zentralen Server gespeichert. + Der Zugriff auf fremde Homeverzeichnisse ist durch ein Passwort geschützt. + Niemand kann auf die Daten in meinem Homeverzeichnis zugreifen. + 4 + + + 100 + Wie groß ist der Datenspeicher der NSA (Amerikanischer Geheimdienst)? + 10 Gigabyte + 10 Terabyte (10.000 GByte) + 10 Petabyte (10.000.000 GByte) + 10 Exabyte (10.000.000.000 GByte) + 4 + + + + + + 20 + Was bedeutet Internet wörtlich übersetzt? + Zwischennetz (von inter=lateinisch "zwischen", net=englisch "Netz") + Geheimnis (von intern (lateinisch)= nur in der Gruppe von Bedeutung) + Netz unter der Erde (von in terra (lateinisch) = "in der Erde", net=englisch "Netz") + Teilnehmernetz (von interesse (lateinisch) = "dabei sein") + 1 + + + 40 + Seit wann gibt es das ARPA-Net, den Vorläufer des Internets? + 1921 + 1968 + 1992 + 2002 + 2 + + + 60 + Wie viele Geräte sind 2014 an das Internet angeschlossen gewesen? + ca. 50.000 + ca. 6.000.000 + ca. 800.000.000 + ca. 9.000.000.000 + 4 + + + 80 + Wann wurde das erste Youtube-Video hochgeladen? + 1982 + 1995 + 2004 + 2009 + 3 + + + 100 + Wie viele Textseiten lassen sich pro Sekunde auf schnellen Internet-Datenleitungen (10 GBit/s) übertragen? + ca. 9.000 + ca. 700.000 + ca. 20.000.000 + ca. 1.500.000.000 + 2 + + + + \ No newline at end of file diff --git a/Quellcodes/sonst_spiel_grosserpreis/readme.adoc b/Quellcodes/sonst_spiel_grosserpreis/readme.adoc new file mode 100644 index 0000000..c61c512 --- /dev/null +++ b/Quellcodes/sonst_spiel_grosserpreis/readme.adoc @@ -0,0 +1,12 @@ += Material : Spiel "Der große Preis" + +|=== +|Zuordnung| Sonstiges +|Klassenstufe| beliebig +|Bildungsplanbezug | beliebeig +|Werkzeug| Java +|Autoren| Thomas Schaller +|=== + +== Inhalt +Mit diesem Programm kann "Der große Preis" mit bis zu vier Schülergruppen gespielt werden. Die Fragen werden in einer XML-Datei hinterlegt und können beliebig ausgetauscht werden.