| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
import java.awt.event.ActionEvent; |
| 24 |
import java.awt.event.ActionListener; |
| 25 |
|
| 26 |
import javax.swing.JButton; |
| 27 |
import javax.swing.JFrame; |
| 28 |
import javax.swing.JPanel; |
| 29 |
import javax.swing.JLabel; |
| 30 |
import javax.swing.SwingUtilities; |
| 31 |
|
| 32 |
|
| 33 |
public class arduinopc extends JFrame { |
| 34 |
|
| 35 |
public arduinopc() { |
| 36 |
initUI(); |
| 37 |
} |
| 38 |
|
| 39 |
public final void initUI() { |
| 40 |
|
| 41 |
JPanel panel = new JPanel(); |
| 42 |
getContentPane().add(panel); |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
JButton ignoreButton = new JButton("Ignore"); |
| 47 |
|
| 48 |
ignoreButton.addActionListener(new ActionListener() { |
| 49 |
public void actionPerformed(ActionEvent event) { |
| 50 |
System.exit(0); |
| 51 |
} |
| 52 |
}); |
| 53 |
|
| 54 |
JButton addButton = new JButton("Add"); |
| 55 |
|
| 56 |
addButton.addActionListener(new ActionListener() { |
| 57 |
public void actionPerformed(ActionEvent event) { |
| 58 |
System.exit(1); |
| 59 |
} |
| 60 |
}); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
panel.add(new JLabel("<html>You need to be added to the \"dialout\"<br>group to upload code to an Arduino<br>microcontroller over the USB or<br>serial ports.<br><br>Click \"Add\" below to be added.<br><br>You must log out and log in again<br>before any group changes<br>will take effect.</html>", JLabel.CENTER)); |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
panel.add(ignoreButton); |
| 72 |
panel.add(addButton); |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
setTitle("Arduino Permission Checker"); |
| 77 |
setSize(300, 250); |
| 78 |
setLocationRelativeTo(null); |
| 79 |
setDefaultCloseOperation(EXIT_ON_CLOSE); |
| 80 |
} |
| 81 |
|
| 82 |
public static void main(String[] args) { |
| 83 |
SwingUtilities.invokeLater(new Runnable() { |
| 84 |
public void run() { |
| 85 |
arduinopc ex = new arduinopc(); |
| 86 |
ex.setVisible(true); |
| 87 |
} |
| 88 |
}); |
| 89 |
} |
| 90 |
} |