mirror of
https://github.com/brendanhaines/RasPi.git
synced 2024-11-09 16:44:40 -07:00
25 lines
728 B
Java
25 lines
728 B
Java
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 );
|
|
}
|
|
}
|
|
} |