From 7167b4341ef290d56fb96e2af10883a4b925d83b Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 26 Mar 2026 19:27:18 +0100 Subject: I found my old code! --- robottino/all_versions/v4.1/src/Frame.java | 66 +++++ robottino/all_versions/v4.1/src/List.java | 74 ++++++ robottino/all_versions/v4.1/src/Main.java | 36 +++ robottino/all_versions/v4.1/src/Robot.java | 101 ++++++++ robottino/all_versions/v4.1/src/RobotFrame.java | 312 ++++++++++++++++++++++++ robottino/all_versions/v4.1/src/RobotPanel.java | 96 ++++++++ robottino/all_versions/v4.1/src/img/birra1.jpg | Bin 0 -> 15478 bytes robottino/all_versions/v4.1/src/img/birra2.jpg | Bin 0 -> 18106 bytes robottino/all_versions/v4.1/src/img/birra3.jpg | Bin 0 -> 14673 bytes robottino/all_versions/v4.1/src/img/birra4.jpg | Bin 0 -> 36627 bytes robottino/all_versions/v4.1/src/img/birra5.gif | Bin 0 -> 13960 bytes robottino/all_versions/v4.1/src/img/boom.png | Bin 0 -> 53636 bytes robottino/all_versions/v4.1/src/img/laoff.gif | Bin 0 -> 4148 bytes robottino/all_versions/v4.1/src/img/laon.gif | Bin 0 -> 4151 bytes robottino/all_versions/v4.1/src/img/lloff.gif | Bin 0 -> 4552 bytes robottino/all_versions/v4.1/src/img/llon.gif | Bin 0 -> 2557 bytes robottino/all_versions/v4.1/src/img/raoff.gif | Bin 0 -> 5137 bytes robottino/all_versions/v4.1/src/img/raon.gif | Bin 0 -> 5121 bytes robottino/all_versions/v4.1/src/img/rloff.gif | Bin 0 -> 4802 bytes robottino/all_versions/v4.1/src/img/rlon.gif | Bin 0 -> 2705 bytes robottino/all_versions/v4.1/src/img/robot.gif | Bin 0 -> 15158 bytes 21 files changed, 685 insertions(+) create mode 100755 robottino/all_versions/v4.1/src/Frame.java create mode 100755 robottino/all_versions/v4.1/src/List.java create mode 100755 robottino/all_versions/v4.1/src/Main.java create mode 100755 robottino/all_versions/v4.1/src/Robot.java create mode 100755 robottino/all_versions/v4.1/src/RobotFrame.java create mode 100755 robottino/all_versions/v4.1/src/RobotPanel.java create mode 100755 robottino/all_versions/v4.1/src/img/birra1.jpg create mode 100755 robottino/all_versions/v4.1/src/img/birra2.jpg create mode 100755 robottino/all_versions/v4.1/src/img/birra3.jpg create mode 100755 robottino/all_versions/v4.1/src/img/birra4.jpg create mode 100755 robottino/all_versions/v4.1/src/img/birra5.gif create mode 100755 robottino/all_versions/v4.1/src/img/boom.png create mode 100755 robottino/all_versions/v4.1/src/img/laoff.gif create mode 100755 robottino/all_versions/v4.1/src/img/laon.gif create mode 100755 robottino/all_versions/v4.1/src/img/lloff.gif create mode 100755 robottino/all_versions/v4.1/src/img/llon.gif create mode 100755 robottino/all_versions/v4.1/src/img/raoff.gif create mode 100755 robottino/all_versions/v4.1/src/img/raon.gif create mode 100755 robottino/all_versions/v4.1/src/img/rloff.gif create mode 100755 robottino/all_versions/v4.1/src/img/rlon.gif create mode 100755 robottino/all_versions/v4.1/src/img/robot.gif (limited to 'robottino/all_versions/v4.1/src') diff --git a/robottino/all_versions/v4.1/src/Frame.java b/robottino/all_versions/v4.1/src/Frame.java new file mode 100755 index 0000000..a5283c1 --- /dev/null +++ b/robottino/all_versions/v4.1/src/Frame.java @@ -0,0 +1,66 @@ +/* +Copyright 2008, 2009 Sebastiano Tronto + +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.event.*; + +public class Frame extends JFrame { + public static Listener listener; + public static Main main; + public static JMenuBar barraMenu = new JMenuBar(); + public static JMenu file = new JMenu( "File" ); + public static JMenu info = new JMenu( "?" ); + public static JMenuItem exit = new JMenuItem( "Esci" ); + public static JMenuItem informazioni = new JMenuItem( "Informazioni" ); + public static JMenuItem nuovo = new JMenuItem( "Nuovo Robot" ); + public Frame() { + super( "Robottino versione 4.1" ); + listener = new Listener(); + main = new Main(); + exit.addActionListener( listener ); + exit.setMnemonic( 'E' ); + informazioni.addActionListener( listener ); + informazioni.setMnemonic( 'I' ); + nuovo.addActionListener( listener ); + nuovo.setMnemonic( 'N' ); + file.add( exit ); + file.add( nuovo ); + file.setMnemonic( 'F' ); + info.add( informazioni ); + info.setMnemonic( '?' ); + barraMenu.add( file ); + barraMenu.add( info ); + setJMenuBar( barraMenu ); + } + public class Listener implements ActionListener { + public void actionPerformed( ActionEvent e ) { + if ( e.getSource() == exit ) + System.exit(0); + else if ( e.getSource() == informazioni ) + JOptionPane.showMessageDialog( main.frame, "info", "Robottino v4.1 - Informazioni", JOptionPane.INFORMATION_MESSAGE ); + else if ( e.getSource() == nuovo ) { + String nome = JOptionPane.showInputDialog( main.frame, "Inserire il nome del nuovo robottino:", "Robot " + ( ++main.robots ) ); + if ( nome != null ) + main.list.newRobot( nome ); + } + } + } +} \ No newline at end of file diff --git a/robottino/all_versions/v4.1/src/List.java b/robottino/all_versions/v4.1/src/List.java new file mode 100755 index 0000000..13a8ab6 --- /dev/null +++ b/robottino/all_versions/v4.1/src/List.java @@ -0,0 +1,74 @@ +/* +Copyright 2008, 2009 Sebastiano Tronto + +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.JOptionPane; + +public class List { + public static Main main = new Main(); + public Robot primoRobot, ultimoRobot; + public List() { + primoRobot = ultimoRobot = null; + } + public boolean vuota() { + return primoRobot == null; + } + public Robot getRobot( String nome ) { + Robot i = primoRobot; + for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ; + return i; + } + public void newRobot() { + newRobot( false, false, false, false, "" ); + } + public void newRobot( String nome ) { + newRobot( false, false, false, false, nome ); + } + public void newRobot( boolean la, boolean ra, boolean ll, boolean rl, String nome ) { + if ( vuota() ) + primoRobot = ultimoRobot = new Robot( la, ra, ll, rl, nome, null, null ); + else { + ultimoRobot = new Robot( la, ra, ll, rl, nome, ultimoRobot, null ); + ultimoRobot.precedenteRobot.prossimoRobot = ultimoRobot; + } + } + public void deleteRobot( String nome ) { + if ( vuota() ) + JOptionPane.showMessageDialog( main.frame, "Nessun robottino presente. Impossibile cancellarne uno", "Robottino v4.1 - Errore", JOptionPane.ERROR_MESSAGE ); + else { + Robot i = primoRobot; + for ( ; !i.nomeRobot.equals( nome ); i = i.prossimoRobot ) ; + if ( i.precedenteRobot != null ) + i.precedenteRobot.prossimoRobot = i.prossimoRobot; + else + primoRobot = i.prossimoRobot; + if ( i.prossimoRobot != null ) + i.prossimoRobot.precedenteRobot = i.precedenteRobot; + else + ultimoRobot = i.precedenteRobot; + } + } + public void printList() { + String lista = ""; + for ( Robot i = primoRobot; i != null; i = i.prossimoRobot ) + lista += i.getName() + " "; + JOptionPane.showMessageDialog( main.frame, lista, "Robottino v4.1 - Robottini Presenti", JOptionPane.PLAIN_MESSAGE ); + } +} \ No newline at end of file diff --git a/robottino/all_versions/v4.1/src/Main.java b/robottino/all_versions/v4.1/src/Main.java new file mode 100755 index 0000000..4ef0206 --- /dev/null +++ b/robottino/all_versions/v4.1/src/Main.java @@ -0,0 +1,36 @@ +/* +Copyright 2008, 2009 Sebastiano Tronto + +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.JFrame; + +public class Main { + public static int robots; + public static List list; + public static Frame frame; + public static void main ( String args[] ) { + robots = 0; + list = new List(); + frame = new Frame(); + frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); + frame.setSize( 350, 150 ); + frame.setVisible( true ); + } +} \ No newline at end of file diff --git a/robottino/all_versions/v4.1/src/Robot.java b/robottino/all_versions/v4.1/src/Robot.java new file mode 100755 index 0000000..c52f29c --- /dev/null +++ b/robottino/all_versions/v4.1/src/Robot.java @@ -0,0 +1,101 @@ +/* +Copyright 2008, 2009 Sebastiano Tronto + +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.event.*; +import java.awt.*; + +public class Robot { + public static Main main = new Main(); + boolean leftArm, rightArm, leftLeg, rightLeg; + String nomeRobot; + Robot precedenteRobot, prossimoRobot; + RobotFrame robotFrame; + Robot() { + this( false, false, false, false, "", main.list.ultimoRobot, null ); + } + Robot( String nome ) { + this ( false, false, false, false, nome, main.list.ultimoRobot, null ); + } + Robot( boolean la, boolean ra, boolean ll, boolean rl, String nome, Robot prec, Robot prox ) { + leftArm = la; + rightArm = ra; + leftLeg = ll; + rightLeg = rl; + nomeRobot = nome; + precedenteRobot = prec; + prossimoRobot = prox; + robotFrame = new RobotFrame( nome ); + robotFrame.setSize( 350, 600 ); + robotFrame.setVisible( true ); + robotFrame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE ); + robotFrame.addWindowListener( + new WindowAdapter() { + public void windowClosing( WindowEvent e ) { + int selezione = JOptionPane.showOptionDialog( Robot.this.robotFrame, "Eliminare il robottino " + Robot.this.getName() + " ?", "Robottino v4.1 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" ); + if ( selezione == JOptionPane.YES_OPTION ) { + main.list.deleteRobot( Robot.this.getName() ); + robotFrame.dispose(); + } + } + } + ); + } + void setLA( boolean la ) { + setPositions( la, this.rightArm, this.leftLeg, this.rightLeg ); + } + void setRA( boolean ra ) { + setPositions( this.leftArm, ra, this.leftLeg, this.rightLeg ); + } + void setLL( boolean ll ) { + setPositions( this.leftArm, this.rightArm, ll, this.rightLeg ); + } + void setRL( boolean rl ) { + setPositions( this.leftArm, this.rightArm, this.leftLeg, rl ); + } + void setPositions( boolean la, boolean ra, boolean ll, boolean rl ) { + this.leftArm = la; + this.rightArm = ra; + this.leftLeg = ll; + this.rightLeg = rl; + } + void setName( String nome ) { + nomeRobot = nome; + } + boolean getLA() { + return leftArm; + } + boolean getRA() { + return rightArm; + } + boolean getLL() { + return leftLeg; + } + boolean getRL() { + return rightLeg; + } + String getName() { + return nomeRobot; + } + Robot getNext() { + return prossimoRobot; + } +} \ No newline at end of file diff --git a/robottino/all_versions/v4.1/src/RobotFrame.java b/robottino/all_versions/v4.1/src/RobotFrame.java new file mode 100755 index 0000000..c8cbf13 --- /dev/null +++ b/robottino/all_versions/v4.1/src/RobotFrame.java @@ -0,0 +1,312 @@ +/* +Copyright 2008, 2009 Sebastiano Tronto + +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.event.*; +import java.awt.*; + +public class RobotFrame extends JFrame implements ActionListener { + public static int numeroCopie, i; + public static Main main; + public static RobotPanel robotPanel; + public static Timer timer; + public static JMenuBar barraMenu; + public static JMenu file, modifica, azioni, info, raMenu, laMenu, rlMenu, llMenu; + public static JMenuItem raonMenuItem, raoffMenuItem, rachangeMenuItem, laonMenuItem, laoffMenuItem, lachangeMenuItem; + public static JMenuItem rlonMenuItem, rloffMenuItem, rlchangeMenuItem, llonMenuItem, lloffMenuItem, llchangeMenuItem; + public static JMenuItem rinomina, elimina, duplica, birra, balla, esplodi, informazioni; + RobotFrame( String titolo ) { + super ( titolo ); + numeroCopie = 0; + robotPanel = new RobotPanel( titolo ); + rinomina = new JMenuItem( "Cambia nome" ); + elimina = new JMenuItem( "Elimina" ); + duplica = new JMenuItem( "Duplica robot" ); + birra = new JMenuItem( "Birra" ); + balla = new JMenuItem( "Balla" ); + esplodi = new JMenuItem( "Esplodi" ); + informazioni = new JMenuItem( "Informazioni" ); + raonMenuItem = new JMenuItem( "Alza" ); + laonMenuItem = new JMenuItem( "Alza" ); + rlonMenuItem = new JMenuItem( "Alza" ); + llonMenuItem = new JMenuItem( "Alza" ); + raoffMenuItem = new JMenuItem( "Abbassa" ); + laoffMenuItem = new JMenuItem( "Abbassa" ); + rloffMenuItem = new JMenuItem( "Abbassa" ); + lloffMenuItem = new JMenuItem( "Abbassa" ); + rachangeMenuItem = new JMenuItem( "Cambia posizione" ); + lachangeMenuItem = new JMenuItem( "Cambia posizione" ); + rlchangeMenuItem = new JMenuItem( "Cambia posizione" ); + llchangeMenuItem = new JMenuItem( "Cambia posizione" ); + rinomina.addActionListener( this ); + elimina.addActionListener( this ); + duplica.addActionListener( this ); + birra.addActionListener( this ); + balla.addActionListener( this ); + esplodi.addActionListener( this ); + informazioni.addActionListener( this ); + raonMenuItem.addActionListener( this ); + raoffMenuItem.addActionListener( this ); + rachangeMenuItem.addActionListener( this ); + laonMenuItem.addActionListener( this ); + laoffMenuItem.addActionListener( this ); + lachangeMenuItem.addActionListener( this ); + rlonMenuItem.addActionListener( this ); + rloffMenuItem.addActionListener( this ); + rlchangeMenuItem.addActionListener( this ); + llonMenuItem.addActionListener( this ); + lloffMenuItem.addActionListener( this ); + llchangeMenuItem.addActionListener( this ); + raMenu = new JMenu( "Braccio destro" ); + raMenu.add( raonMenuItem ); + raMenu.add( raoffMenuItem ); + raMenu.add( rachangeMenuItem ); + laMenu = new JMenu( "Braccio sinistro" ); + laMenu.add( laonMenuItem ); + laMenu.add( laoffMenuItem ); + laMenu.add( lachangeMenuItem ); + rlMenu = new JMenu( "Gamba destra" ); + rlMenu.add( rlonMenuItem ); + rlMenu.add( rloffMenuItem ); + rlMenu.add( rlchangeMenuItem ); + llMenu = new JMenu( "Gamba sinistra" ); + llMenu.add( llonMenuItem ); + llMenu.add( lloffMenuItem ); + llMenu.add( llchangeMenuItem ); + modifica = new JMenu( "Modifica" ); + modifica.add( raMenu ); + modifica.add( laMenu ); + modifica.add( rlMenu ); + modifica.add( llMenu ); + file = new JMenu( "File" ); + file.add( rinomina ); + file.add( duplica ); + file.add( elimina ); + azioni = new JMenu( "Azioni" ); + azioni.add( birra ); + azioni.add( balla ); + azioni.add( esplodi ); + info = new JMenu( "?" ); + info.add( informazioni ); + barraMenu = new JMenuBar(); + barraMenu.add( file ); + barraMenu.add( azioni ); + barraMenu.add( modifica ); + barraMenu.add( info ); + setJMenuBar( barraMenu ); + add( robotPanel ); + } + public void actionPerformed( ActionEvent e ) { + esegui( e ); + } + public void esegui( ActionEvent e ) { + if ( e.getSource() == raonMenuItem ) + main.list.getRobot( this.getTitle() ).rightArm = true; + else if ( e.getSource() == raoffMenuItem ) + main.list.getRobot( this.getTitle() ).rightArm = false; + else if ( e.getSource() == rachangeMenuItem ) + main.list.getRobot( this.getTitle() ).rightArm = !main.list.getRobot( this.getTitle() ).rightArm; + else if ( e.getSource() == laonMenuItem ) + main.list.getRobot( this.getTitle() ).leftArm = true; + else if ( e.getSource() == laoffMenuItem ) + main.list.getRobot( this.getTitle() ).leftArm = false; + else if ( e.getSource() == lachangeMenuItem ) + main.list.getRobot( this.getTitle() ).leftArm = !main.list.getRobot( this.getTitle() ).leftArm; + else if ( e.getSource() == rlonMenuItem ) + main.list.getRobot( this.getTitle() ).rightLeg = true; + else if ( e.getSource() == rloffMenuItem ) + main.list.getRobot( this.getTitle() ).rightLeg = false; + else if ( e.getSource() == rlchangeMenuItem ) + main.list.getRobot( this.getTitle() ).rightLeg = !main.list.getRobot( this.getTitle() ).rightLeg; + else if ( e.getSource() == llonMenuItem ) + main.list.getRobot( this.getTitle() ).leftLeg = true; + else if ( e.getSource() == lloffMenuItem ) + main.list.getRobot( this.getTitle() ).leftLeg = false; + else if ( e.getSource() == llchangeMenuItem ) + main.list.getRobot( this.getTitle() ).leftLeg = !main.list.getRobot( this.getTitle() ).leftLeg; + else if ( e.getSource() == rinomina ) { + String newName = JOptionPane.showInputDialog( this, "Inserire il nuovo nome per questo robot:", this.getTitle() ); + if ( newName != null ) { + main.list.getRobot( this.getTitle() ).setName( newName ); + this.setTitle( newName ); + robotPanel.nomeRobot = newName; + } + } + else if ( e.getSource() == elimina ) { + int selezione = JOptionPane.showOptionDialog( this, "Eliminare il robottino " + this.getTitle() + " ?", "Robottino v4.1 - Cancellazione robottino", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Si", "No" }, "No" ); + if ( selezione == JOptionPane.YES_OPTION ) { + main.list.deleteRobot( this.getTitle() ); + this.dispose(); + } + } + else if ( e.getSource() == duplica ) { + String newName = JOptionPane.showInputDialog( this, "Inserire il nome per il nuovo robot:", this.getTitle() + " #" + (++numeroCopie) ); + if ( newName != null ) { + main.list.newRobot( main.list.getRobot( this.getTitle() ).leftArm, main.list.getRobot( this.getTitle() ).rightArm, main.list.getRobot( this.getTitle() ).leftLeg, main.list.getRobot( this.getTitle() ).rightLeg, newName ); + } + } + else if ( e.getSource() == birra ) { + ImageIcon birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra5.gif" ) ); + JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra ); + birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra1.jpg" ) ); + JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra ); + birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra2.jpg" ) ); + JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra ); + birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra3.jpg" ) ); + JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra ); + birra = new ImageIcon( ClassLoader.getSystemResource( "img/birra4.jpg" ) ); + JOptionPane.showMessageDialog( this, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, birra ); + JOptionPane.showMessageDialog( this, "Che bevuta!", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE ); + JOptionPane.showMessageDialog( this, "Buuuuuuurp!", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE ); + robotPanel.body = new ImageIcon( ClassLoader.getSystemResource( "img/robot.gif" ) ); + } + else if ( e.getSource() == balla ) { + this.i = 0; + main.list.getRobot( this.getTitle() ).setPositions( false, false, false, false ); + timer = new Timer( 250, + new ActionListener() { + public void actionPerformed( ActionEvent e ) { + RobotFrame.this.i++; + switch( RobotFrame.this.i ) { + case 1: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setRA( true ); + break; + case 2: + break; + case 3: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setLA( true ); + break; + case 4: + break; + case 5: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true ); + break; + case 6: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, true, false, false ); + break; + case 7: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false ); + break; + case 8: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, true, false, false ); + break; + case 9: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, false, false, true ); + break; + case 10: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false ); + break; + case 11: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, false, false, true ); + break; + case 12: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, true, true, false ); + break; + case 13: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false ); + break; + case 14: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, true, true, false ); + break; + case 15: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false ); + break; + case 16: + break; + case 17: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false ); + break; + case 18: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true ); + break; + case 19: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false ); + break; + case 20: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true ); + break; + case 21: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, true, false ); + break; + case 22: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, true ); + break; + case 23: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( true, true, true, true ); + break; + case 24: + break; + case 25: + break; + case 26: + RobotFrame.main.list.getRobot( RobotFrame.this.getTitle() ).setPositions( false, false, false, false ); + break; + case 27: + JOptionPane.showMessageDialog( RobotFrame.this, "Cha fatica!", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE ); + JOptionPane.showMessageDialog( RobotFrame.this, RobotFrame.this.getTitle() + " è tornato alla posizione di partenza", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE ); + break; + default: + timer.stop(); + break; + } + RobotFrame.robotPanel.setImages(); + RobotFrame.robotPanel.repaint(); + RobotFrame.this.repaint(); + } + } + ); + timer.start(); + } + if ( e.getSource() == esplodi ) { + String aux = this.getTitle(); + main.list.deleteRobot( this.getTitle() ); + this.dispose(); + ImageIcon boom = new ImageIcon( ClassLoader.getSystemResource( "img/boom.png" ) ); + JOptionPane.showMessageDialog( null, "", "Robottino v4.1", JOptionPane.PLAIN_MESSAGE, boom ); + JOptionPane.showMessageDialog( null, aux + " si è autodistrutto!", "Robottino v4.1", JOptionPane.WARNING_MESSAGE ); + } + if ( e.getSource() == informazioni ) { + String aux = this.getTitle() + ":\n\n"; + if ( main.list.getRobot( RobotFrame.this.getTitle() ).rightArm ) + aux += "Braccio destro: alzato\n"; + else + aux += "Braccio destro: abbassato\n"; + if ( main.list.getRobot( RobotFrame.this.getTitle() ).leftArm ) + aux += "Braccio sinistro: alzato\n"; + else + aux += "Braccio sinistro: abbassato\n"; + if ( main.list.getRobot( RobotFrame.this.getTitle() ).rightLeg ) + aux += "Gamba destra: alzata\n"; + else + aux += "Gamba destra: abbassata\n"; + if ( main.list.getRobot( RobotFrame.this.getTitle() ).leftLeg ) + aux += "Gamba sinistra: alzata\n"; + else + aux += "Gamba sinistra: abbassata\n"; + JOptionPane.showMessageDialog( this, aux, "Robottino - v4.1", JOptionPane.INFORMATION_MESSAGE ); + } + try { + robotPanel.setImages(); + robotPanel.repaint(); + repaint(); + } catch ( NullPointerException n ) { } + } +} \ No newline at end of file diff --git a/robottino/all_versions/v4.1/src/RobotPanel.java b/robottino/all_versions/v4.1/src/RobotPanel.java new file mode 100755 index 0000000..b66d90e --- /dev/null +++ b/robottino/all_versions/v4.1/src/RobotPanel.java @@ -0,0 +1,96 @@ +/* +Copyright 2008, 2009 Sebastiano Tronto + +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; + } + } +} \ No newline at end of file diff --git a/robottino/all_versions/v4.1/src/img/birra1.jpg b/robottino/all_versions/v4.1/src/img/birra1.jpg new file mode 100755 index 0000000..6cbf8a8 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/birra1.jpg differ diff --git a/robottino/all_versions/v4.1/src/img/birra2.jpg b/robottino/all_versions/v4.1/src/img/birra2.jpg new file mode 100755 index 0000000..3b3caae Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/birra2.jpg differ diff --git a/robottino/all_versions/v4.1/src/img/birra3.jpg b/robottino/all_versions/v4.1/src/img/birra3.jpg new file mode 100755 index 0000000..9bc6971 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/birra3.jpg differ diff --git a/robottino/all_versions/v4.1/src/img/birra4.jpg b/robottino/all_versions/v4.1/src/img/birra4.jpg new file mode 100755 index 0000000..970f2ff Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/birra4.jpg differ diff --git a/robottino/all_versions/v4.1/src/img/birra5.gif b/robottino/all_versions/v4.1/src/img/birra5.gif new file mode 100755 index 0000000..6318d90 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/birra5.gif differ diff --git a/robottino/all_versions/v4.1/src/img/boom.png b/robottino/all_versions/v4.1/src/img/boom.png new file mode 100755 index 0000000..59b507a Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/boom.png differ diff --git a/robottino/all_versions/v4.1/src/img/laoff.gif b/robottino/all_versions/v4.1/src/img/laoff.gif new file mode 100755 index 0000000..49d9db0 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/laoff.gif differ diff --git a/robottino/all_versions/v4.1/src/img/laon.gif b/robottino/all_versions/v4.1/src/img/laon.gif new file mode 100755 index 0000000..1880677 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/laon.gif differ diff --git a/robottino/all_versions/v4.1/src/img/lloff.gif b/robottino/all_versions/v4.1/src/img/lloff.gif new file mode 100755 index 0000000..3db1ceb Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/lloff.gif differ diff --git a/robottino/all_versions/v4.1/src/img/llon.gif b/robottino/all_versions/v4.1/src/img/llon.gif new file mode 100755 index 0000000..ab1ff75 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/llon.gif differ diff --git a/robottino/all_versions/v4.1/src/img/raoff.gif b/robottino/all_versions/v4.1/src/img/raoff.gif new file mode 100755 index 0000000..88aabc4 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/raoff.gif differ diff --git a/robottino/all_versions/v4.1/src/img/raon.gif b/robottino/all_versions/v4.1/src/img/raon.gif new file mode 100755 index 0000000..46190a8 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/raon.gif differ diff --git a/robottino/all_versions/v4.1/src/img/rloff.gif b/robottino/all_versions/v4.1/src/img/rloff.gif new file mode 100755 index 0000000..04bda22 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/rloff.gif differ diff --git a/robottino/all_versions/v4.1/src/img/rlon.gif b/robottino/all_versions/v4.1/src/img/rlon.gif new file mode 100755 index 0000000..447464b Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/rlon.gif differ diff --git a/robottino/all_versions/v4.1/src/img/robot.gif b/robottino/all_versions/v4.1/src/img/robot.gif new file mode 100755 index 0000000..db87686 Binary files /dev/null and b/robottino/all_versions/v4.1/src/img/robot.gif differ -- cgit v1.3