Subtrees hinzugefügt

This commit is contained in:
Thomas Schaller 2025-01-02 12:26:47 +01:00
parent 433a6f2eb1
commit a02bf698e6
19 changed files with 2775 additions and 0 deletions

View file

@ -0,0 +1,5 @@
*.class
*.ctxt
*.sh
repo.adoc
*.~lock

View file

@ -0,0 +1,42 @@
public class Baustein implements Comparable<Baustein>{
// 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
}

Binary file not shown.

View file

@ -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<Baustein> h = new ArrayList<Baustein>();
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<Baustein> h = new ArrayList<Baustein>();
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<Baustein> h = new ArrayList<Baustein>();
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");
}
}

View file

@ -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

Binary file not shown.

View file

@ -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).

View file

@ -0,0 +1,5 @@
*.class
*.ctxt
*.sh
repo.adoc
*.~lock

View file

@ -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("<html><p >Frage:</p></html>");
jLabel1.setFont(new Font("Dialog", Font.BOLD, 20));
jLabel1.setVerticalTextPosition(JLabel.TOP);
cp.add(jLabel1);
jLFrage.setBounds(96, 0, 534, 97);
jLFrage.setText("<html>"+frage+"</html>");
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("<html><p align=center valign=top>"+a1+"</p></html>");
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("<html><p align=center>"+a2+"</p></html>");
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("<html><p align=center>"+a3+"</p></html>");
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("<html><p align=center>"+a4+"</p></html>");
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
}

View file

@ -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 = '<html><p valign=top>Frage: </p></html>'
HorizontalAlignment = LEFT
VerticalAlignment = CENTER
HorizontalTextPosition = RIGHT
VerticalTextPosition = TOP
IconTextGap = 4
DisplayedMnemonic = 0
DisplayedMnemonicIndex = 0
end
end

View file

@ -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;
}
}

Binary file not shown.

Binary file not shown.

View file

@ -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("<html><p width=190 align=center>"+getKategorie(x)+"</p></html>");
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<getAnzKategorien() ;i++ ) {
for (int j=0;j<getAnzTopics();j++) {
if (evt.getSource()==jBTopics[i][j]) {x = i; y = j; }
} // end of for
} // end of for
int akt_f_sp = akt_sp;
Element t = getTopic(x,y);
int richtig = Integer.parseInt(t.getChild("Richtig").getValue());
FrageGUI frage = new FrageGUI(this, t.getChild("Frage").getValue(), ((Element) t.getChildren("Antwort").get(0)).getValue(),((Element) t.getChildren("Antwort").get(1)).getValue(),((Element) t.getChildren("Antwort").get(2)).getValue(),((Element) t.getChildren("Antwort").get(3)).getValue(), akt_f_sp+1);
while (frage.getAntwort()!=richtig) {
frage.setVisible(true);
if (frage.getAntwort()!=richtig) {
jLStatus.setText("<html>&nbsp;Die Antwort war leider falsch!</html>");
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("<html>&nbsp;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...</html>");
((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");
}
}

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

View file

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<Quiz>
<Titel>Internet-Kommunikation</Titel>
<Kategorie name="Router">
<Frage>
<Punkte>20</Punkte>
<Frage>Was ist ein Router?</Frage>
<Antwort>Ein Gerät, um Daten im Internet weiterzuschicken.</Antwort>
<Antwort>Ein Verkehrszeichen in England</Antwort>
<Antwort>Ein Routenplaner fürs Auto</Antwort>
<Antwort>Ein besonders schnelles Datenpaket</Antwort>
<Richtig>1</Richtig>
</Frage>
<Frage>
<Punkte>40</Punkte>
<Frage>Kann man ohne Router mit dem Internet verbunden sein?</Frage>
<Antwort>Ja, wenn man WLAN hat.</Antwort>
<Antwort>Ja, mit einem Handy (LTE oder UTMS).</Antwort>
<Antwort>Das kommt darauf an.</Antwort>
<Antwort>Nein, die Kommunikation über das Internet geht immer über Router.</Antwort>
<Richtig>4</Richtig>
</Frage>
<Frage>
<Punkte>60</Punkte>
<Frage>Wie viele Netzwerkkabel führen zu einem Router?</Frage>
<Antwort>Gar keins.</Antwort>
<Antwort>Genau eins.</Antwort>
<Antwort>Mindestens zwei.</Antwort>
<Antwort>Maximal zwei.</Antwort>
<Richtig>3</Richtig>
</Frage>
<Frage>
<Punkte>80</Punkte>
<Frage>Was passiert, wenn ein Router ausfällt?</Frage>
<Antwort>Das ganze Internet bricht zusammen.</Antwort>
<Antwort>Ein Techniker wechselt in Minutenschnelle den Router aus und dann geht das Internet wieder.</Antwort>
<Antwort>Die anderen Router merken dies und schicken die Pakete auf einem anderen Weg.</Antwort>
<Antwort>Router können gar nicht kaputt gehen.</Antwort>
<Richtig>3</Richtig>
</Frage>
<Frage>
<Punkte>100</Punkte>
<Frage>Über wie viele Router läuft ein Datenpaket im Internet, wenn es einmal um die Welt geschickt wird?</Frage>
<Antwort>ca. 5</Antwort>
<Antwort>ca. 15</Antwort>
<Antwort>ca. 150</Antwort>
<Antwort>ca. 1500</Antwort>
<Richtig>2</Richtig>
</Frage>
</Kategorie>
<Kategorie name="Client-Server">
<Frage>
<Punkte>20</Punkte>
<Frage>Welche Aussage über einen Server stimmt nicht?</Frage>
<Antwort>Ein Server ist ein Computerprogramm, das Anfragen beantwortet.</Antwort>
<Antwort>Ein Server ist die meiste Zeit mit Warten beschäfftigt.</Antwort>
<Antwort>Ein Server ist ein Roboter zum Bedienen.</Antwort>
<Antwort>Server ist englisch und bedeutet Diener/Bedienung.</Antwort>
<Richtig>3</Richtig>
</Frage>
<Frage>
<Punkte>40</Punkte>
<Frage>Wer speichert die noch nicht ausgelieferten WhatsApp Nachrichten?</Frage>
<Antwort>Der Server von WhatsApp.</Antwort>
<Antwort>Sie bewegen sich im Internet umher, bis sie zugestellt werden.</Antwort>
<Antwort>Das Handy des Empfängers speichert sie, auch wenn es nicht online ist.</Antwort>
<Antwort>Das Handy des Absenders wartet bis der Empfänge online ist und schickt sie dann.</Antwort>
<Richtig>1</Richtig>
</Frage>
<Frage>
<Punkte>60</Punkte>
<Frage>Was ist keine Client-Server-Anwendung?</Frage>
<Antwort>Emailversand</Antwort>
<Antwort>Online-Computerspiel (z.B. Clash of clans)</Antwort>
<Antwort>World Wide Web (WWW)</Antwort>
<Antwort>Textverarbeitungsprogramm</Antwort>
<Richtig>4</Richtig>
</Frage>
<Frage>
<Punkte>80</Punkte>
<Frage>"Ein Filesharing-Programm (z.B. Bittorrent) ist sowohl Client wie auch Server".</Frage>
<Antwort>Die Aussage stimmt, da man sowohl Dateien abrufen kann (Client-Funktion), als auch gleichzeitig eigene Dateien anbietet (Server-Funktion).</Antwort>
<Antwort>Die Aussage stimmt, da man sowohl Dateien abrufen kann (Server-Funktion), als auch gleichzeitig eigene Dateien anbietet (Client-Funktion).</Antwort>
<Antwort>Die Aussage stimmt nicht, da kein Programm gleichzeitig Client und Server sein kann.</Antwort>
<Antwort>Die Aussage stimmt nicht, da es sich hier überhaupt nicht um eine Client-Server-Anwendung handelt.</Antwort>
<Richtig>1</Richtig>
</Frage>
<Frage>
<Punkte>100</Punkte>
<Frage>Kann dein Computer zu Hause ein Server sein?</Frage>
<Antwort>Ja, ich muss dazu aber ein bestimmtes Programm starten.</Antwort>
<Antwort>Ja, jeder Computer, der im Internet ist, ist auch ein Server.</Antwort>
<Antwort>Nein, Server können nur spezielle Computer sein.</Antwort>
<Antwort>Nein, Server darf man als Privatperson nicht betreiben.</Antwort>
<Richtig>1</Richtig>
</Frage>
</Kategorie>
<Kategorie name="Datenspeicher">
<Frage>
<Punkte>20</Punkte>
<Frage>Wo kann man keine Dateien speichern?</Frage>
<Antwort>In der Cloud (=Server im Internet) </Antwort>
<Antwort>In einem Silo.</Antwort>
<Antwort>Auf der lokalen Festplatte</Antwort>
<Antwort>Auf dem Schulserver</Antwort>
<Richtig>2</Richtig>
</Frage>
<Frage>
<Punkte>40</Punkte>
<Frage>Bei welchem Speichermedium hat man den schnellsten Zugriff?</Frage>
<Antwort>USB-Stick.</Antwort>
<Antwort>Cloud-Speicher</Antwort>
<Antwort>lokale Festplatte (SSD)</Antwort>
<Antwort>auf dem Schulserver</Antwort>
<Richtig>3</Richtig>
</Frage>
<Frage>
<Punkte>60</Punkte>
<Frage>Welche Aussage über Cloud-Speicher stimmt nicht?</Frage>
<Antwort>Die Daten werden vor der Speicherung über das Internet übertragen.</Antwort>
<Antwort>Die Daten sind von jedem an das Internet angeschlossene Rechner abrufbar.</Antwort>
<Antwort>Die Daten werden durch das Internet geschickt, bis sie wieder abgerufen werden.</Antwort>
<Antwort>Die Daten werden von einer kommerziellen Firma für den Anwender gespeichert.</Antwort>
<Richtig>3</Richtig>
</Frage>
<Frage>
<Punkte>80</Punkte>
<Frage>Welche Aussage über das Homeverzeichnis in der Schule stimmt nicht?</Frage>
<Antwort>Auf jedem Computer der Schule hat man Zugriff auf sein Homeverzeichnis.</Antwort>
<Antwort>Das Homeverzeichnis wird auf einem zentralen Server gespeichert.</Antwort>
<Antwort>Der Zugriff auf fremde Homeverzeichnisse ist durch ein Passwort geschützt.</Antwort>
<Antwort>Niemand kann auf die Daten in meinem Homeverzeichnis zugreifen. </Antwort>
<Richtig>4</Richtig>
</Frage>
<Frage>
<Punkte>100</Punkte>
<Frage>Wie groß ist der Datenspeicher der NSA (Amerikanischer Geheimdienst)?</Frage>
<Antwort>10 Gigabyte </Antwort>
<Antwort>10 Terabyte (10.000 GByte)</Antwort>
<Antwort>10 Petabyte (10.000.000 GByte)</Antwort>
<Antwort>10 Exabyte (10.000.000.000 GByte)</Antwort>
<Richtig>4</Richtig>
</Frage>
</Kategorie>
<Kategorie name="Internet">
<Frage>
<Punkte>20</Punkte>
<Frage>Was bedeutet Internet wörtlich übersetzt?</Frage>
<Antwort>Zwischennetz (von inter=lateinisch "zwischen", net=englisch "Netz")</Antwort>
<Antwort>Geheimnis (von intern (lateinisch)= nur in der Gruppe von Bedeutung)</Antwort>
<Antwort>Netz unter der Erde (von in terra (lateinisch) = "in der Erde", net=englisch "Netz")</Antwort>
<Antwort>Teilnehmernetz (von interesse (lateinisch) = "dabei sein")</Antwort>
<Richtig>1</Richtig>
</Frage>
<Frage>
<Punkte>40</Punkte>
<Frage>Seit wann gibt es das ARPA-Net, den Vorläufer des Internets?</Frage>
<Antwort>1921</Antwort>
<Antwort>1968</Antwort>
<Antwort>1992</Antwort>
<Antwort>2002</Antwort>
<Richtig>2</Richtig>
</Frage>
<Frage>
<Punkte>60</Punkte>
<Frage>Wie viele Geräte sind 2014 an das Internet angeschlossen gewesen?</Frage>
<Antwort>ca. 50.000</Antwort>
<Antwort>ca. 6.000.000</Antwort>
<Antwort>ca. 800.000.000</Antwort>
<Antwort>ca. 9.000.000.000</Antwort>
<Richtig>4</Richtig>
</Frage>
<Frage>
<Punkte>80</Punkte>
<Frage>Wann wurde das erste Youtube-Video hochgeladen?</Frage>
<Antwort>1982</Antwort>
<Antwort>1995</Antwort>
<Antwort>2004</Antwort>
<Antwort>2009</Antwort>
<Richtig>3</Richtig>
</Frage>
<Frage>
<Punkte>100</Punkte>
<Frage>Wie viele Textseiten lassen sich pro Sekunde auf schnellen Internet-Datenleitungen (10 GBit/s) übertragen?</Frage>
<Antwort>ca. 9.000</Antwort>
<Antwort>ca. 700.000</Antwort>
<Antwort>ca. 20.000.000</Antwort>
<Antwort>ca. 1.500.000.000</Antwort>
<Richtig>2</Richtig>
</Frage>
</Kategorie>
</Quiz>

View file

@ -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.