aboutsummaryrefslogtreecommitdiff
path: root/robottino/all_versions/v4.0.1/src/Robot.java
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-03-26 19:27:18 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2026-03-26 19:27:18 +0100
commit7167b4341ef290d56fb96e2af10883a4b925d83b (patch)
tree1eb1b9e5ab82ddd89540e68d6b22ae69514575c6 /robottino/all_versions/v4.0.1/src/Robot.java
downloadancient-projects-master.tar.gz
ancient-projects-master.zip
I found my old code!HEADmaster
Diffstat (limited to 'robottino/all_versions/v4.0.1/src/Robot.java')
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/Robot.java107
1 files changed, 107 insertions, 0 deletions
diff --git a/robottino/all_versions/v4.0.1/src/Robot.java b/robottino/all_versions/v4.0.1/src/Robot.java
new file mode 100755
index 0000000..6a57c4d
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/Robot.java
@@ -0,0 +1,107 @@
1/*
2Copyright 2008, 2009 Sebastiano Tronto <sebastiano@luganega.org>
3
4This file is part of Robottino.
5
6 Robottino is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 Robottino is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Robottino; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20*/
21
22import javax.swing.*;
23import java.awt.event.*;
24import java.awt.*;
25
26public class Robot {
27 public static Main main = new Main();
28 boolean leftArm, rightArm, leftLeg, rightLeg;
29 String nomeRobot;
30 Robot precedenteRobot, prossimoRobot;
31 RobotFrame robotFrame;
32 Robot() {
33 this( false, false, false, false, "", main.list.ultimoRobot, null );
34 }
35 Robot( String nome ) {
36 this ( false, false, false, false, nome, main.list.ultimoRobot, null );
37 }
38 Robot( boolean la, boolean ra, boolean ll, boolean rl, String nome, Robot prec, Robot prox ) {
39 leftArm = la;
40 rightArm = ra;
41 leftLeg = ll;
42 rightLeg = rl;
43 nomeRobot = nome;
44 precedenteRobot = prec;
45 prossimoRobot = prox;
46 robotFrame = new RobotFrame( nome );
47 robotFrame.setSize( 350, 600 );
48 robotFrame.setVisible( true );
49 robotFrame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
50 robotFrame.addWindowListener(
51 new WindowAdapter() {
52 public void windowClosing( WindowEvent e ) {
53 int selezione = JOptionPane.showOptionDialog( Robot.this.robotFrame, "Eliminare il robottino " + Robot.this.getName() + " ?", "Robottino v4.0 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" );
54 if ( selezione == JOptionPane.YES_OPTION ) {
55 main.list.deleteRobot( Robot.this.getName() );
56 robotFrame.dispose();
57 }
58 else {
59 try {
60 Thread.currentThread().sleep( 50 );
61 } catch ( Exception e2 ) {}
62 robotFrame.repaint();
63 }
64 }
65 }
66 );
67 }
68 void setLA( boolean la ) {
69 setPositions( la, this.rightArm, this.leftLeg, this.rightLeg );
70 }
71 void setRA( boolean ra ) {
72 setPositions( this.leftArm, ra, this.leftLeg, this.rightLeg );
73 }
74 void setLL( boolean ll ) {
75 setPositions( this.leftArm, this.rightArm, ll, this.rightLeg );
76 }
77 void setRL( boolean rl ) {
78 setPositions( this.leftArm, this.rightArm, this.leftLeg, rl );
79 }
80 void setPositions( boolean la, boolean ra, boolean ll, boolean rl ) {
81 leftArm = la;
82 rightArm = ra;
83 leftLeg = ll;
84 rightLeg = rl;
85 }
86 void setName( String nome ) {
87 nomeRobot = nome;
88 }
89 boolean getLA() {
90 return leftArm;
91 }
92 boolean getRA() {
93 return rightArm;
94 }
95 boolean getLL() {
96 return leftLeg;
97 }
98 boolean getRL() {
99 return rightLeg;
100 }
101 String getName() {
102 return nomeRobot;
103 }
104 Robot getNext() {
105 return prossimoRobot;
106 }
107} \ No newline at end of file

Generated with cgit - Back to sebastiano.tronto.net