adds ArmButton.java (forgot to commit it before)

This commit is contained in:
Brendan Haines 2015-03-11 16:32:45 -06:00
parent 2971b4940d
commit c5390acbe0

View 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 );
}
}
}