aboutsummaryrefslogtreecommitdiff
path: root/robottino/all_versions/v4.0.1/src/RobotFrame.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/RobotFrame.java
downloadancient-projects-7167b4341ef290d56fb96e2af10883a4b925d83b.tar.gz
ancient-projects-7167b4341ef290d56fb96e2af10883a4b925d83b.zip
I found my old code!HEADmaster
Diffstat (limited to 'robottino/all_versions/v4.0.1/src/RobotFrame.java')
-rwxr-xr-xrobottino/all_versions/v4.0.1/src/RobotFrame.java118
1 files changed, 118 insertions, 0 deletions
diff --git a/robottino/all_versions/v4.0.1/src/RobotFrame.java b/robottino/all_versions/v4.0.1/src/RobotFrame.java
new file mode 100755
index 0000000..df099f1
--- /dev/null
+++ b/robottino/all_versions/v4.0.1/src/RobotFrame.java
@@ -0,0 +1,118 @@
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 RobotFrame extends JFrame implements ActionListener {
27 public static Main main;
28 public static RobotPanel robotPanel;
29 public static JMenuBar barraMenu;
30 public static JMenu modifica, raMenu, laMenu, rlMenu, llMenu;
31 public static JMenuItem raonMenuItem, raoffMenuItem, rachangeMenuItem, laonMenuItem, laoffMenuItem, lachangeMenuItem;
32 public static JMenuItem rlonMenuItem, rloffMenuItem, rlchangeMenuItem, llonMenuItem, lloffMenuItem, llchangeMenuItem;
33 RobotFrame( String titolo ) {
34 super ( titolo );
35 robotPanel = new RobotPanel( titolo );
36 raonMenuItem = new JMenuItem( "Alza" );
37 laonMenuItem = new JMenuItem( "Alza" );
38 rlonMenuItem = new JMenuItem( "Alza" );
39 llonMenuItem = new JMenuItem( "Alza" );
40 raoffMenuItem = new JMenuItem( "Abbassa" );
41 laoffMenuItem = new JMenuItem( "Abbassa" );
42 rloffMenuItem = new JMenuItem( "Abbassa" );
43 lloffMenuItem = new JMenuItem( "Abbassa" );
44 rachangeMenuItem = new JMenuItem( "Cambia posizione" );
45 lachangeMenuItem = new JMenuItem( "Cambia posizione" );
46 rlchangeMenuItem = new JMenuItem( "Cambia posizione" );
47 llchangeMenuItem = new JMenuItem( "Cambia posizione" );
48 raonMenuItem.addActionListener( this );
49 raoffMenuItem.addActionListener( this );
50 rachangeMenuItem.addActionListener( this );
51 laonMenuItem.addActionListener( this );
52 laoffMenuItem.addActionListener( this );
53 lachangeMenuItem.addActionListener( this );
54 rlonMenuItem.addActionListener( this );
55 rloffMenuItem.addActionListener( this );
56 rlchangeMenuItem.addActionListener( this );
57 llonMenuItem.addActionListener( this );
58 lloffMenuItem.addActionListener( this );
59 llchangeMenuItem.addActionListener( this );
60 raMenu = new JMenu( "Braccio destro" );
61 raMenu.add( raonMenuItem );
62 raMenu.add( raoffMenuItem );
63 raMenu.add( rachangeMenuItem );
64 laMenu = new JMenu( "Braccio sinistro" );
65 laMenu.add( laonMenuItem );
66 laMenu.add( laoffMenuItem );
67 laMenu.add( lachangeMenuItem );
68 rlMenu = new JMenu( "Gamba destra" );
69 rlMenu.add( rlonMenuItem );
70 rlMenu.add( rloffMenuItem );
71 rlMenu.add( rlchangeMenuItem );
72 llMenu = new JMenu( "Gamba sinistra" );
73 llMenu.add( llonMenuItem );
74 llMenu.add( lloffMenuItem );
75 llMenu.add( llchangeMenuItem );
76 modifica = new JMenu( "Modifica" );
77 modifica.add( raMenu );
78 modifica.add( laMenu );
79 modifica.add( rlMenu );
80 modifica.add( llMenu );
81 barraMenu = new JMenuBar();
82 barraMenu.add( modifica );
83 setJMenuBar( barraMenu );
84 add( robotPanel );
85 }
86 public void actionPerformed( ActionEvent e ) {
87 esegui( e );
88 }
89 public void esegui( ActionEvent e ) {
90 if ( e.getSource() == raonMenuItem )
91 main.list.getRobot( this.getTitle() ).rightArm = true;
92 else if ( e.getSource() == raoffMenuItem )
93 main.list.getRobot( this.getTitle() ).rightArm = false;
94 else if ( e.getSource() == rachangeMenuItem )
95 main.list.getRobot( this.getTitle() ).rightArm = !main.list.getRobot( this.getTitle() ).rightArm;
96 else if ( e.getSource() == laonMenuItem )
97 main.list.getRobot( this.getTitle() ).leftArm = true;
98 else if ( e.getSource() == laoffMenuItem )
99 main.list.getRobot( this.getTitle() ).leftArm = false;
100 else if ( e.getSource() == lachangeMenuItem )
101 main.list.getRobot( this.getTitle() ).leftArm = !main.list.getRobot( this.getTitle() ).leftArm;
102 if ( e.getSource() == rlonMenuItem )
103 main.list.getRobot( this.getTitle() ).rightLeg = true;
104 else if ( e.getSource() == rloffMenuItem )
105 main.list.getRobot( this.getTitle() ).rightLeg = false;
106 else if ( e.getSource() == rlchangeMenuItem )
107 main.list.getRobot( this.getTitle() ).rightLeg = !main.list.getRobot( this.getTitle() ).rightLeg;
108 else if ( e.getSource() == llonMenuItem )
109 main.list.getRobot( this.getTitle() ).leftLeg = true;
110 else if ( e.getSource() == lloffMenuItem )
111 main.list.getRobot( this.getTitle() ).leftLeg = false;
112 else if ( e.getSource() == llchangeMenuItem )
113 main.list.getRobot( this.getTitle() ).leftLeg = !main.list.getRobot( this.getTitle() ).leftLeg;
114 robotPanel.setImages();
115 repaint();
116 }
117
118} \ No newline at end of file

Generated with cgit - Back to sebastiano.tronto.net