mirror of
https://github.com/brendanhaines/RasPi.git
synced 2025-04-11 19:24:51 -06:00
adds ArmButton.java (forgot to commit it before)
This commit is contained in:
parent
2971b4940d
commit
c5390acbe0
25
GroundStation/v2/ArmButton.java
Normal file
25
GroundStation/v2/ArmButton.java
Normal file
@ -0,0 +1,25 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
class ArmButton extends JButton implements ActionListener {
|
||||
private MessageContent content;
|
||||
|
||||
public ArmButton( MessageContent newContent ) {
|
||||
super( "Arm Flight Controller" );
|
||||
content = newContent;
|
||||
setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
addActionListener( this );
|
||||
}
|
||||
|
||||
public void actionPerformed( ActionEvent evt ) {
|
||||
if( getText().equals( "Arm Flight Controller" ) ) {
|
||||
setText( "Disarm Flight Controller" );
|
||||
content.setMotorsEnabled( true );
|
||||
}
|
||||
else {
|
||||
setText( "Arm Flight Controller" );
|
||||
content.setMotorsEnabled( false );
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user