aboutsummaryrefslogtreecommitdiff
path: root/robottino/all_versions/v4.1/src/RobotPanel.java
blob: b66d90e125d0d05759b2116ce74382f756534b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>

This file is part of Robottino.

    Robottino is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Robottino is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Robottino; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/

import javax.swing.*;
import java.awt.*;

public class RobotPanel extends JPanel {
	public static String nomeRobot;
	public static Main main;
	public static ImageIcon ra, la, rl, ll, body;
	public static int rax, ray, lax, lay, rlx, rly, llx, lly;
	RobotPanel( String nomeRobot ) {
		this.nomeRobot = nomeRobot;
		rax = 66;
		ray = 248;
		lax = 225;
		lay = 242;
		rlx = 84;
		rly = 367;
		llx = 148;
		lly = 367;
		body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) );
		ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
		la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
		rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
		ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
	}
	public void paint ( Graphics g ) {
		super.paint( g );
		body.paintIcon( this, g, 100, 60 );
		ra.paintIcon( this, g, this.rax, this.ray );
		la.paintIcon( this, g, this.lax, this.lay );
		rl.paintIcon( this, g, this.rlx, this.rly );
		ll.paintIcon( this, g, this.llx, this.lly );
	}
	public void setImages() {
		if ( main.list.getRobot( nomeRobot ).rightArm ) {
			this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raon.gif" ) );
			this.rax = 68;
			this.ray = 128;
		}
		else {
			this.ra = new ImageIcon( ClassLoader.getSystemResource( "img/raoff.gif" ) );
			this.rax = 66;
			this.ray = 248;
		}
		if ( main.list.getRobot( nomeRobot ).leftArm ) {
			this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laon.gif" ) );
			this.lax = 224;
			this.lay = 118;
		}
		else {
			this.la = new ImageIcon( ClassLoader.getSystemResource( "img/laoff.gif" ) );
			this.lax = 225;
			this.lay = 242;
		}
		if ( main.list.getRobot( nomeRobot ).rightLeg ) {
			this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rlon.gif" ) );
			this.rlx = 84;
			this.rly = 356;
		}
		else {
			this.rl = new ImageIcon( ClassLoader.getSystemResource( "img/rloff.gif" ) );
			this.rlx = 84;
			this.rly = 367;
		}
		if ( main.list.getRobot( nomeRobot ).leftLeg ) {
			this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/llon.gif" ) );
			this.llx = 140;
			this.lly = 363;
		}
		else {
			this.ll = new ImageIcon( ClassLoader.getSystemResource( "img/lloff.gif" ) );
			this.llx = 148;
			this.lly = 367;
		}
	}
}

Generated with cgit - Back to sebastiano.tronto.net