Skip to content

Commit

Permalink
Graphikdesign
Browse files Browse the repository at this point in the history
  • Loading branch information
mnk7 committed Feb 20, 2015
1 parent 12c1c25 commit 862ccbc
Show file tree
Hide file tree
Showing 29 changed files with 48 additions and 15 deletions.
Binary file modified bin/client/Client$1.class
Binary file not shown.
Binary file modified bin/client/Client.class
Binary file not shown.
Binary file modified bin/graphik/Gegenspieler.class
Binary file not shown.
Binary file modified bin/graphik/Graphik$1.class
Binary file not shown.
Binary file modified bin/graphik/Graphik.class
Binary file not shown.
Binary file modified bin/graphik/KartenLabel.class
Binary file not shown.
Binary file modified bin/graphik/Meldungen.class
Binary file not shown.
Binary file modified bin/graphik/MenuGUI$2.class
Binary file not shown.
Binary file modified bin/graphik/MenuGUI$3.class
Binary file not shown.
Binary file modified bin/graphik/MenuGUI.class
Binary file not shown.
Binary file modified bin/graphik/Spieler$1.class
Binary file not shown.
Binary file modified bin/graphik/Spieler.class
Binary file not shown.
Binary file modified bin/graphik/Spielerhand.class
Binary file not shown.
Binary file modified bin/graphik/SpielmodusDialog$1.class
Binary file not shown.
Binary file modified bin/graphik/SpielmodusDialog.class
Binary file not shown.
Binary file modified bin/graphik/Tisch.class
Binary file not shown.
Binary file modified bin/server/Server.class
Binary file not shown.
Binary file added hintergrund1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions src/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@ public Client(String IP, String name, MenuGUI menu) throws Exception{

netzwerk = new Netzwerk(ID, IP);

//Vorerst leeres Model erzeugen
model = new Model();

graphik = new Graphik(model, this);

listener = new Thread() {
public void run() {
listen();
}
};
listener.setName("Schafkopf-Client");
listener.start();

graphik = new Graphik(model, this);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/graphik/Gegenspieler.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package graphik;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.GridLayout;
Expand All @@ -25,6 +26,7 @@ public Gegenspieler() {
super();

this.setLayout(null);
this.setBackground(new Color(0,0,0,0));

kartenzahl = 6;

Expand Down
20 changes: 11 additions & 9 deletions src/graphik/Graphik.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import regeln.Control;
Expand All @@ -20,6 +21,7 @@
public class Graphik extends JFrame {

private String logo = "Logo.gif";
private String hintergrundbild = "hintergrund1.jpg";

private Model model;

Expand All @@ -44,7 +46,7 @@ public class Graphik extends JFrame {
private Tisch tisch;

//Hintergrund
private JPanel hintergrund;
private JLabel hintergrund;

public Graphik(Model model, final Client client) {
super();
Expand Down Expand Up @@ -76,7 +78,6 @@ public Graphik(Model model, final Client client) {
public void windowClosing(WindowEvent arg0) {
}
public void windowActivated(WindowEvent e) {
update();
}
public void windowClosed(WindowEvent e) {
client.abmelden();
Expand All @@ -88,7 +89,6 @@ public void windowDeiconified(WindowEvent e) {
public void windowIconified(WindowEvent e) {
}
public void windowOpened(WindowEvent e) {
update();
}
});
}
Expand All @@ -99,10 +99,11 @@ public void windowOpened(WindowEvent e) {
private void initGUI() {
try {

hintergrund = new JPanel();
hintergrund = new JLabel();
getContentPane().add(hintergrund);
//Das letzte fünftel des Fensters ist für Spielermeldungen
hintergrund.setBounds(0, 0, this.getWidth(), this.getHeight());
hintergrund.setIcon(new ImageIcon(hintergrundbild));
hintergrund.setVisible(true);
hintergrund.setLayout(null);

Expand Down Expand Up @@ -313,8 +314,9 @@ public modus spielstDu() {
boolean fertig = false;
while(!fertig) {
SpielmodusDialog dialog = new SpielmodusDialog(this);
//Dialog an Hauptfenster binden
dialog.setLocationRelativeTo(this);
//Dialog an Hauptfenster binden -> linke obere Ecke
dialog.setLocation((int)this.getContentPane().getLocationOnScreen().getX(),
(int) this.getContentPane().getLocationOnScreen().getY());
modus m = dialog.modusWahl();

//Prüft Client-seitig, ob ein Sauspiel, eine Hochzeit oder ein Si gespielt werden können.
Expand All @@ -326,19 +328,19 @@ public modus spielstDu() {
Karte.farbe f = dialog.farbe(m);
if(!new Regelwahl().sauspielMoeglich(f, model, ID)) {
JOptionPane.showMessageDialog(this, "Das geht nicht!");
dialog.dispose();
dialog.reset();
continue;
}
} if(m.equals(modus.SI)) {
if(!new Regelwahl().siMoeglich(model, ID)) {
JOptionPane.showMessageDialog(this, "Das geht nicht!");
dialog.dispose();
dialog.reset();
continue;
}
} if(m.equals(modus.HOCHZEIT)) {
if(!new Hochzeit().hochzeitMoeglich(model.gibSpielerKarten(ID))) {
JOptionPane.showMessageDialog(this, "Das geht nicht!");
dialog.dispose();
dialog.reset();
continue;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/graphik/KartenLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public KartenLabel(Karte bild, int width, int height) {

this.setLayout(null);
this.setSize(this.width, this.height);
this.setBackground(new Color(0,0,0,0));

setBild(bild);

Expand Down
9 changes: 8 additions & 1 deletion src/graphik/Meldungen.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package graphik;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JLabel;
Expand All @@ -17,13 +19,16 @@ public Meldungen(int histLaenge) {
super();

this.setLayout(null);
this.setBackground(new Color(0,0,0,0));
this.setSize(200, histLaenge*20);

meldung = new JLabel[histLaenge];
for(int i = 0; i < meldung.length; i++) {
meldung[i] = new JLabel();
this.add(meldung[i]);
meldung[i].setBounds(0, i*20, 300, 20);
meldung[i].setBackground(new Color(0,0,0,0));
meldung[i].setForeground(Color.white);
}
}

Expand All @@ -33,7 +38,8 @@ public Meldungen(int histLaenge) {
*/
public void festeAnzeige(String text) {
meldung[festeAnzeigen].setText(text);
meldung[festeAnzeigen].setForeground(java.awt.Color.DARK_GRAY);
Font schrift = meldung[festeAnzeigen].getFont();
meldung[festeAnzeigen].setFont(schrift.deriveFont(schrift.BOLD+ schrift.ITALIC));
}

/**
Expand All @@ -43,6 +49,7 @@ public void festeAnzeige(String text) {
public void nachricht(String text) {
for(int i = meldung.length - 1; i > festeAnzeigen; i--) {
//Rückt alle Anzeigen eins nach unten
meldung[i].setText("");
meldung[i].setText(meldung[i - 1].getText());
}
//Zeigt die neue Meldung an
Expand Down
1 change: 0 additions & 1 deletion src/graphik/MenuGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void initGUI() {
//Icon der Anwendung setzen
ImageIcon icon = new ImageIcon(logo);
this.setIconImage(icon.getImage());
JFrame.setDefaultLookAndFeelDecorated(true);

this.setLayout(null);
//Lässt alles so aussehen wie im jeweiligen OS üblich
Expand Down
5 changes: 5 additions & 0 deletions src/graphik/Spieler.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package graphik;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
Expand All @@ -19,6 +20,7 @@ public Spieler() {
super();

this.setLayout(null);
this.setBackground(new Color(0,0,0,0));
this.setSize(420, 100);

karten = new ArrayList<KartenButton>();
Expand All @@ -45,6 +47,9 @@ public void actionPerformed(ActionEvent evt) {
*/
public void update(ArrayList<Karte> model) {
ArrayList<Karte> spielerkarten = model;
if(model == null) {
model = new ArrayList<Karte>();
}

for(int i = 0; i < spielerkarten.size(); i++) {
//neues Bild zuteilen
Expand Down
2 changes: 2 additions & 0 deletions src/graphik/Spielerhand.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package graphik;

import java.awt.Color;
import java.util.ArrayList;

import javax.swing.JPanel;
Expand All @@ -12,6 +13,7 @@ public Spielerhand() {
super();

this.setLayout(null);
this.setBackground(new Color(0,0,0,0));

this.setSize(440, 120);

Expand Down
8 changes: 7 additions & 1 deletion src/graphik/SpielmodusDialog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package graphik;

import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

Expand Down Expand Up @@ -29,8 +30,10 @@ public SpielmodusDialog(JFrame root) {

this.root = root;

this.setUndecorated(true);
this.setVisible(true);
this.setLayout(null);
this.setAlwaysOnTop(true);

spiele = new JButton[7];

Expand Down Expand Up @@ -176,5 +179,8 @@ public farbe farbe(modus m) {

return null;
}


public void reset() {
rueckgabe = null;
}
}
3 changes: 3 additions & 0 deletions src/graphik/Tisch.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package graphik;

import java.awt.Color;

import javax.swing.JPanel;

import lib.Karte;
Expand All @@ -13,6 +15,7 @@ public Tisch() {
super();

this.setLayout(null);
this.setBackground(new Color(0,0,0,0));

karten = new KartenLabel[4];
//Setzt die Größe der Karten
Expand Down
5 changes: 4 additions & 1 deletion src/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ private void werspielt() throws Exception {
}

private modus bestesSpielFinden(ArrayList<modus> spielfolge) {
if(spielfolge.size() < 2) {
if(spielfolge.size() == 0) {
return modus.NICHTS;
}
if(spielfolge.size() == 1) {
return spielfolge.get(0);
}
//ermittelt das höchstwertige Spiel
Expand Down

0 comments on commit 862ccbc

Please sign in to comment.