Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. import java.awt.event.ActionEvent;
  2.  
  3. import javax.swing.JButton;
  4. import javax.swing.JFrame;
  5. import javax.swing.JPanel;
  6. import javax.swing.*;
  7. import MieClassi.*;
  8.  
  9.  
  10. public class ProgettoDBGestionePortiCommerciali {
  11.  
  12.  
  13. public static int a=0;
  14.  
  15. public static void main(String[] args) {
  16.  
  17.  
  18. JPanel panel = null;
  19.  
  20.  
  21.  
  22. boolean status0 = false;
  23. boolean status1 = false;
  24. boolean status2 = false;
  25. boolean status3 = false;
  26.  
  27. //creazione finestra
  28. JFrame frame =new JFrame("DB Gestione Portuale");
  29. frame.setVisible(true);
  30. frame.setSize(1024, 786);
  31. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  32.  
  33. while(a>-1){
  34.  
  35. switch(a){
  36. case 0:{
  37. if(status0 == false){
  38. if(panel!=null)
  39. panel.removeAll();
  40. panel = new JPanel();
  41. frame.add(panel);
  42. JButton Connection_button =new JButton ("Connessione");
  43. panel.add(Connection_button);
  44. Connection_button.addActionListener(new TryToConnect());
  45. status0 = true;
  46. status1 =false;
  47. status2 = false;
  48. status3 = false;
  49. panel.repaint();
  50. }
  51. break;
  52. }
  53. case 1:{
  54. if(status1 == false){
  55. if(panel!=null)
  56. panel =new JPanel();
  57. frame.add(panel);
  58.  
  59. JButton Disconnect_button=new JButton("Disconnessione");
  60. JButton Populate_button= new JButton("Aggiungi a Database");
  61. JButton Quary_button= new JButton ("Cerca nel database");
  62.  
  63. panel.add(Disconnect_button);
  64. panel.add(Populate_button);
  65. panel.add(Quary_button);
  66.  
  67. Disconnect_button.addActionListener(new Disconnettore());
  68. Populate_button.addActionListener(new Population());
  69. Quary_button.addActionListener(new Query());
  70.  
  71.  
  72. status0 = false;
  73. status1 = true;
  74. status2 = false;
  75. status3 = false;
  76. panel.repaint();
  77. }
  78. break;
  79. }
  80.  
  81. case 2:{
  82. if(status2==false){
  83. status0 = false;
  84. status1 = false;
  85. status2 = true;
  86. status3 = false;
  87. }
  88. break;
  89. }
  90.  
  91. case 3:{
  92. if(status3==false){
  93. status0 = false;
  94. status1 = false;
  95. status2 = false;
  96. status3 = true;
  97.  
  98. }
  99.  
  100. break;
  101.  
  102. }
  103.  
  104. }
  105. }
  106.  
  107. }
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement