Guest User

Untitled

a guest
Jul 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. package SparkTabCore;
  2.  
  3.  
  4. public abstract class Module extends javax.swing.JPanel implements Runnable{
  5.  
  6. void incoming_message(String message){
  7.  
  8. }
  9.  
  10. String outgoing_message(){
  11. return "";
  12. }
  13.  
  14. String request_power_down(){
  15. return null;
  16. }
  17.  
  18. Boolean power_down(Boolean hard_shutdown){
  19. if(hard_shutdown){
  20. shutdown = true;
  21. }
  22. return true;
  23. }
  24.  
  25. abstract String returnConfigs();
  26.  
  27. abstract void setConfigs(String configs);
  28.  
  29. public abstract void run();
  30.  
  31. protected boolean shutdown = false;
  32. protected boolean busy = false;
  33. }
  34.  
  35.  
  36. //*******************************************************************************
  37.  
  38. package module1;
  39.  
  40.  
  41. import java.util.logging.Level;
  42. import java.util.logging.Logger;
  43.  
  44. public class module1 extends SparkTabCore.Module{
  45. // module1.module1 is not abstract and does not override abstract method
  46. //setConfigs(java.lang.String) in SparkTabCore.Module
  47.  
  48.  
  49. public module1() {
  50. initComponents();
  51. }
  52.  
  53. public void run(){
  54. while(!shutdown){
  55. System.out.println("Count: " + counter);
  56. //count.setText("Count: " + counter);
  57. counter += 1;
  58. try {
  59. Thread.sleep(1000);
  60. } catch (InterruptedException ex) {
  61. Logger.getLogger(module1.class.getName()).log(Level.SEVERE, null, ex);
  62. }
  63. if(counter > 12){
  64. shutdown = true;
  65. }
  66. }
  67. }
  68.  
  69. @SuppressWarnings("unchecked")
  70.  
  71. private void initComponents() {
  72.  
  73. count = new javax.swing.JLabel();
  74.  
  75. count.setText("Count: 0");
  76.  
  77. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  78. this.setLayout(layout);
  79. layout.setHorizontalGroup(
  80. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  81. .addGroup(layout.createSequentialGroup()
  82. .addGap(155, 155, 155)
  83. .addComponent(count)
  84. .addContainerGap(203, Short.MAX_VALUE))
  85. );
  86. layout.setVerticalGroup(
  87. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  88. .addGroup(layout.createSequentialGroup()
  89. .addGap(138, 138, 138)
  90. .addComponent(count)
  91. .addContainerGap(148, Short.MAX_VALUE))
  92. );
  93. }
  94.  
  95.  
  96. private javax.swing.JLabel count;
  97.  
  98. private int counter = 0;
  99.  
  100. @Override
  101. String returnConfigs() {
  102. throw new UnsupportedOperationException("Not supported yet.");
  103. }
  104.  
  105. @Override
  106. void setConfigs(String configs) {
  107. throw new UnsupportedOperationException("Not supported yet.");
  108. }
  109. }
Add Comment
Please, Sign In to add comment