import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;
//import com.cloudgarden.resource.SWTResourceManager;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit [url=http://www.cloudgarden.com]Cloud Garden (Java Resources)[/url] for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Display extends JFrame {
private JPanel jpanel1;
private JButton restart;
private JLabel as;
private boolean ab;
private JLabel bs;
private boolean bb;
private JLabel cs;
private boolean cb;
private JLabel fw;
private JLabel feld;
public Display(int[]positionen) {
this.setSize(new Dimension(640, 350));
this.setTitle("Sheep-Defender");
{
jpanel1 = new JPanel();
this.getContentPane().add(jpanel1, BorderLayout.CENTER);
this.add(jpanel1);
jpanel1.setLayout(null);
jpanel1.setBounds(0, 0, 640, 350);
jpanel1.setSize(640, 350);
jpanel1.setPreferredSize(new java.awt.Dimension(640, 350));
{
restart = new JButton();
jpanel1.add(restart);
restart.setText("Restart");
restart.setBounds(8, 6, 48, 21);
}
{
as = new JLabel(new ImageIcon("schaf.png"));
jpanel1.add(as);
as.setBounds(179, 18, 78, 55);
as.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
System.out.println("as.mouseClicked, event="+evt);
if (ab == false){
as = new JLabel (new ImageIcon("schaf2.png"));
ab = true;
}else if ( ab == true){
as = new JLabel (new ImageIcon("schaf.png"));
ab = false;
}
}
});
if (positionen[0]==0){
as.setBounds(39, 143, 75, 64);
}else if (positionen[0]==1){
as.setBounds(147, 31, 75, 64);
}else if (positionen[0]==4){
as.setBounds(277, 28, 75, 64);
}else if (positionen[0]==7){
as.setBounds(413, 34, 75, 64);
}else if (positionen[0]==2){
as.setBounds(147, 148, 75, 64);
}else if (positionen[0]==5){
as.setBounds(276, 147, 75, 64);
}else if (positionen[0]==8){
as.setBounds(413, 148, 75, 64);
}else if (positionen[0]==10){
as.setBounds(530, 148, 75, 64);
}else if (positionen[0]==3){
as.setBounds(148, 267, 75, 64);
}else if (positionen[0]==6){
as.setBounds(283, 267, 75, 64);
}else if (positionen[0]==9){
as.setBounds(413, 267, 75, 64);
}
}
{
bs = new JLabel(new ImageIcon("schaf.png"));
jpanel1.add(bs);
bs.setBounds(262, 18, 78, 55);
if (positionen[1]==0){
bs.setBounds(39, 143, 75, 64);
}else if (positionen[1]==1){
bs.setBounds(147, 31, 75, 64);
}else if (positionen[1]==4){
bs.setBounds(277, 28, 75, 64);
}else if (positionen[1]==7){
bs.setBounds(413, 34, 75, 64);
}else if (positionen[1]==2){
bs.setBounds(147, 148, 75, 64);
}else if (positionen[1]==5){
bs.setBounds(276, 147, 75, 64);
}else if (positionen[1]==8){
bs.setBounds(413, 148, 75, 64);
}else if (positionen[1]==10){
bs.setBounds(530, 148, 75, 64);
}else if (positionen[1]==3){
bs.setBounds(148, 267, 75, 64);
}else if (positionen[1]==6){
bs.setBounds(283, 267, 75, 64);
}else if (positionen[1]==9){
bs.setBounds(413, 267, 75, 64);
}
}
{
cs = new JLabel(new ImageIcon("schaf.png"));
jpanel1.add(cs);
cs.setBounds(345, 18, 78, 55);
if (positionen[2]==0){
cs.setBounds(39, 143, 75, 64);
}else if (positionen[2]==1){
cs.setBounds(147, 31, 75, 64);
}else if (positionen[2]==4){
cs.setBounds(277, 28, 75, 64);
}else if (positionen[2]==7){
cs.setBounds(413, 34, 75, 64);
}else if (positionen[2]==2){
cs.setBounds(147, 148, 75, 64);
}else if (positionen[2]==5){
cs.setBounds(276, 147, 75, 64);
}else if (positionen[2]==8){
cs.setBounds(413, 148, 75, 64);
}else if (positionen[2]==10){
cs.setBounds(530, 148, 75, 64);
}else if (positionen[2]==3){
cs.setBounds(148, 267, 75, 64);
}else if (positionen[2]==6){
cs.setBounds(283, 267, 75, 64);
}else if (positionen[2]==9){
cs.setBounds(413, 267, 75, 64);
}
}
{
fw = new JLabel(new ImageIcon("wolf.png"));
jpanel1.add(fw);
fw.setBounds(428, 5, 78, 82);
if (positionen[3]==0){
fw.setBounds(42, 119, 75, 64);
}else if (positionen[3]==1){
fw.setBounds(150, 7, 75, 64);
}else if (positionen[3]==4){
fw.setBounds(280, 4, 75, 64);
}else if (positionen[3]==7){
fw.setBounds(416, 10, 75, 64);
}else if (positionen[3]==2){
fw.setBounds(150, 124, 75, 64);
}else if (positionen[3]==5){
fw.setBounds(279, 123, 75, 64);
}else if (positionen[3]==8){
fw.setBounds(416, 124, 75, 64);
}else if (positionen[3]==10){
fw.setBounds(533, 124, 75, 64);
}else if (positionen[3]==3){
fw.setBounds(151, 243, 75, 64);
}else if (positionen[3]==6){
fw.setBounds(286, 243, 75, 64);
}else if (positionen[3]==9){
fw.setBounds(416, 243, 75, 64);
}
}
{
feld = new JLabel(new ImageIcon("feld2.png"));
jpanel1.add(feld);
feld.setBounds(-4, -1, 640, 350);
feld.setPreferredSize(new java.awt.Dimension(640, 350));
}
}
}
public static void main(String[] args) {
int [] a = {0,1,3,5};
Display ab = new Display (a);
ab.pack();
ab.setVisible(true);
}
}