mirror of
https://codeberg.org/qg-info-unterricht/bluej-ueberlauf-demo.git
synced 2025-12-10 15:28:35 +01:00
First commit
This commit is contained in:
commit
30ac64f617
6 changed files with 252 additions and 0 deletions
BIN
+libs/JEClasses.jar
Normal file
BIN
+libs/JEClasses.jar
Normal file
Binary file not shown.
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*.class
|
||||
*.ctxt
|
||||
14
README.TXT
Normal file
14
README.TXT
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
------------------------------------------------------------------------
|
||||
Dies ist die README-Datei des Projekts. Hier sollten Sie Ihr Projekt
|
||||
beschreiben.
|
||||
Erzählen Sie dem Leser (jemand, der nichts über dieses Projekt weiss),
|
||||
alles, was er/sie wissen muss. Üblicherweise sollte der Kommentar
|
||||
zumindest die folgenden Angaben umfassen:
|
||||
------------------------------------------------------------------------
|
||||
|
||||
PROJEKTBEZEICHNUNG:
|
||||
PROJEKTZWECK:
|
||||
VERSION oder DATUM:
|
||||
WIE IST DAS PROJEKT ZU STARTEN:
|
||||
AUTOR(EN):
|
||||
BENUTZERHINWEISE:
|
||||
BIN
Zaehlen.jar
Normal file
BIN
Zaehlen.jar
Normal file
Binary file not shown.
204
Zaehlen.java
Normal file
204
Zaehlen.java
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* Applet zum ZahlUeberlauf
|
||||
*
|
||||
* @version 1.0 from 11.10.2016
|
||||
* @author Tom Schaller, Dirk Zechnall
|
||||
*/
|
||||
|
||||
public class Zaehlen extends JFrame {
|
||||
// Anfang Attribute
|
||||
private JButton jButton1 = new JButton();
|
||||
private JButton jButton2 = new JButton();
|
||||
private JLabel jLabel1 = new JLabel();
|
||||
private JLabel jLabel2 = new JLabel();
|
||||
private JLabel jLabel3 = new JLabel();
|
||||
private JLabel jLabel4 = new JLabel();
|
||||
private JLabel jLabel5 = new JLabel();
|
||||
private JLabel jLabel6 = new JLabel();
|
||||
private JButton jButton3 = new JButton();
|
||||
private JButton jButton4 = new JButton();
|
||||
private JButton jButton5 = new JButton();
|
||||
private JButton jButton6 = new JButton();
|
||||
private JLabel jLabel7 = new JLabel();
|
||||
private JLabel jLabel8 = new JLabel();
|
||||
private JButton jButton7 = new JButton();
|
||||
private JButton jButton8 = new JButton();
|
||||
|
||||
private byte b = 120;
|
||||
private short s = 32760;
|
||||
private int i = 2147483647;
|
||||
private long l = 9223372036854775807L;
|
||||
// Ende Attribute
|
||||
|
||||
public Zaehlen () {
|
||||
super ("Zaehlen mit elementaren Datentypen");
|
||||
int frameWidth = 494;
|
||||
int frameHeight = 177;
|
||||
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(288, 40, 75, 25);
|
||||
jButton1.setText("+1");
|
||||
jButton1.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton1_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton1);
|
||||
jButton2.setBounds(288, 72, 75, 25);
|
||||
jButton2.setText("+1");
|
||||
jButton2.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton2.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton2_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton2);
|
||||
jLabel1.setBounds(8, 40, 78, 20);
|
||||
jLabel1.setText("short");
|
||||
cp.add(jLabel1);
|
||||
jLabel2.setBounds(8, 72, 54, 20);
|
||||
jLabel2.setText("int");
|
||||
cp.add(jLabel2);
|
||||
jLabel3.setBounds(8, 104, 78, 20);
|
||||
jLabel3.setText("long");
|
||||
cp.add(jLabel3);
|
||||
jLabel4.setBounds(96, 40, 110, 20);
|
||||
jLabel4.setText("240");
|
||||
cp.add(jLabel4);
|
||||
jLabel5.setBounds(96, 72, 110, 20);
|
||||
jLabel5.setText("text");
|
||||
cp.add(jLabel5);
|
||||
jLabel6.setBounds(96, 104, 166, 20);
|
||||
jLabel6.setText("text");
|
||||
cp.add(jLabel6);
|
||||
jButton3.setBounds(288, 104, 75, 25);
|
||||
jButton3.setText("+1");
|
||||
jButton3.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton3.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton3_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton3);
|
||||
jButton4.setBounds(392, 40, 75, 25);
|
||||
jButton4.setText("-1");
|
||||
jButton4.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton4.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton4_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton4);
|
||||
jButton5.setBounds(392, 72, 75, 25);
|
||||
jButton5.setText("-1");
|
||||
jButton5.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton5.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton5_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton5);
|
||||
jButton6.setBounds(392, 104, 75, 25);
|
||||
jButton6.setText("-1");
|
||||
jButton6.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton6.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton6_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton6);
|
||||
jLabel7.setBounds(8, 8, 78, 20);
|
||||
jLabel7.setText("byte");
|
||||
cp.add(jLabel7);
|
||||
jLabel8.setBounds(96, 8, 110, 20);
|
||||
jLabel8.setText("text");
|
||||
cp.add(jLabel8);
|
||||
jButton7.setBounds(288, 8, 75, 25);
|
||||
jButton7.setText("+1");
|
||||
jButton7.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton7.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton7_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton7);
|
||||
jButton8.setBounds(392, 8, 75, 25);
|
||||
jButton8.setText("-1");
|
||||
jButton8.setMargin(new Insets(2, 2, 2, 2));
|
||||
jButton8.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
jButton8_ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cp.add(jButton8);
|
||||
jLabel4.setText(""+s);
|
||||
jLabel5.setText(""+i);
|
||||
jLabel6.setText(""+l);
|
||||
jLabel8.setText(""+b);
|
||||
|
||||
// Ende Komponenten
|
||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||
setResizable(false);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
// Anfang Methoden
|
||||
public void jButton1_ActionPerformed(ActionEvent evt) {
|
||||
s++;
|
||||
jLabel4.setText(""+s);
|
||||
} // end of jButton1_ActionPerformed
|
||||
|
||||
public void jButton2_ActionPerformed(ActionEvent evt) {
|
||||
i++;
|
||||
jLabel5.setText(""+i);
|
||||
} // end of jButton2_ActionPerformed
|
||||
|
||||
public void jButton3_ActionPerformed(ActionEvent evt) {
|
||||
l++;
|
||||
jLabel6.setText(""+l);
|
||||
} // end of jButton3_ActionPerformed
|
||||
|
||||
public void jButton4_ActionPerformed(ActionEvent evt) {
|
||||
s--;
|
||||
jLabel4.setText(""+s);
|
||||
} // end of jButton4_ActionPerformed
|
||||
|
||||
public void jButton5_ActionPerformed(ActionEvent evt) {
|
||||
i--;
|
||||
jLabel5.setText(""+i);
|
||||
} // end of jButton5_ActionPerformed
|
||||
|
||||
public void jButton6_ActionPerformed(ActionEvent evt) {
|
||||
l--;
|
||||
jLabel6.setText(""+l);
|
||||
} // end of jButton6_ActionPerformed
|
||||
|
||||
public void jButton7_ActionPerformed(ActionEvent evt) {
|
||||
b++;
|
||||
jLabel8.setText(""+b);
|
||||
} // end of jButton7_ActionPerformed
|
||||
|
||||
public void jButton8_ActionPerformed(ActionEvent evt) {
|
||||
b--;
|
||||
jLabel8.setText(""+b);
|
||||
} // end of jButton8_ActionPerformed
|
||||
|
||||
// Ende Methoden
|
||||
|
||||
public static void main(String[] args) {
|
||||
new Zaehlen();
|
||||
}
|
||||
}
|
||||
32
package.bluej
Normal file
32
package.bluej
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#BlueJ package file
|
||||
editor.fx.0.height=790
|
||||
editor.fx.0.width=967
|
||||
editor.fx.0.x=498
|
||||
editor.fx.0.y=4
|
||||
objectbench.height=75
|
||||
objectbench.width=467
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.7446808510638298
|
||||
package.editor.height=233
|
||||
package.editor.width=357
|
||||
package.editor.x=0
|
||||
package.editor.y=374
|
||||
package.frame.height=420
|
||||
package.frame.width=505
|
||||
package.numDependencies=0
|
||||
package.numTargets=1
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=48
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=50
|
||||
target1.name=Zaehlen
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=90
|
||||
target1.x=130
|
||||
target1.y=90
|
||||
Loading…
Add table
Add a link
Reference in a new issue