Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.41 KB | None | 0 0
  1. import java.nio.charset.Charset;
  2. import java.util.ArrayList;
  3. import java.util.Arrays;
  4. import java.util.regex.Pattern;
  5.  
  6. import com.googlecode.lanterna.TerminalFacade;
  7. import com.googlecode.lanterna.gui.Action;
  8. import com.googlecode.lanterna.gui.Border;
  9. import com.googlecode.lanterna.gui.Component;
  10. import com.googlecode.lanterna.gui.GUIScreen;
  11. import com.googlecode.lanterna.gui.Window;
  12. import com.googlecode.lanterna.gui.Component.Alignment;
  13. import com.googlecode.lanterna.gui.component.Button;
  14. import com.googlecode.lanterna.gui.component.EmptySpace;
  15. import com.googlecode.lanterna.gui.component.Label;
  16. import com.googlecode.lanterna.gui.component.Panel;
  17. import com.googlecode.lanterna.gui.component.Table;
  18. import com.googlecode.lanterna.gui.component.TextBox;
  19. import com.googlecode.lanterna.gui.component.Panel.Orientation;
  20. import com.googlecode.lanterna.gui.layout.BorderLayout;
  21. import com.googlecode.lanterna.gui.layout.LinearLayout;
  22. import com.googlecode.lanterna.gui.layout.VerticalLayout;
  23. import com.googlecode.lanterna.screen.Screen;
  24. import com.googlecode.lanterna.terminal.Terminal;
  25. import com.googlecode.lanterna.terminal.TerminalSize;
  26.  
  27. public class Sklep {
  28.  
  29. static int i = 0;
  30.  
  31. public static void main(String[] args) {
  32.  
  33. //Obiekty Wina
  34. Obiekt obiekt = new Obiekt();
  35. Obiekt[] TablicaWina = new Obiekt[100];
  36. Obiekt[] TablicaPiwa = new Obiekt[100];
  37. Obiekt[] TablicaWodki = new Obiekt[100];
  38.  
  39. Obiekt Wino1 = new Obiekt("Amarena",12);
  40. Obiekt Wino2 = new Obiekt("Alazani",18);
  41. Obiekt Wino3 = new Obiekt("Carlo Rossi",25);
  42. Obiekt Wino4 = new Obiekt("Kvareli",60);
  43. Obiekt Wino5 = new Obiekt("Muscat",79);
  44. Obiekt Wino6 = new Obiekt("Mukuzani",100);
  45. Obiekt Wino7 = new Obiekt("Kisi",159);
  46. Obiekt Wino8 = new Obiekt("Pirosmani",2500);
  47.  
  48. //Obiekty Piwa
  49. Obiekt Piwo1 = new Obiekt("Tatra",3);
  50. Obiekt Piwo2 = new Obiekt("Zubr",3);
  51. Obiekt Piwo3 = new Obiekt("Wojak",4);
  52. Obiekt Piwo4 = new Obiekt("Tyskie",5);
  53. Obiekt Piwo5 = new Obiekt("Lomza",4);
  54. Obiekt Piwo6 = new Obiekt("Warka",3);
  55. Obiekt Piwo7 = new Obiekt("Zywiec",2);
  56. Obiekt Piwo8 = new Obiekt("Lech",4);
  57.  
  58. //Obiekty Wodki
  59. Obiekt Wodka1 = new Obiekt("Krupnik",20);
  60. Obiekt Wodka2 = new Obiekt("Sobieski",22);
  61. Obiekt Wodka3 = new Obiekt("Chrobry",23);
  62. Obiekt Wodka4 = new Obiekt("Smirnoff",26);
  63. Obiekt Wodka5 = new Obiekt("JA Baczewski",29);
  64. Obiekt Wodka6 = new Obiekt("Zubrowka",30);
  65. Obiekt Wodka7 = new Obiekt("Finlandia",37);
  66. Obiekt Wodka8 = new Obiekt("Stock",42);
  67.  
  68.  
  69. TablicaWina[0] = Wino1;
  70. TablicaWina[1] = Wino2;
  71. TablicaWina[2] = Wino3;
  72. TablicaWina[3] = Wino4;
  73. TablicaWina[4] = Wino5;
  74. TablicaWina[5] = Wino6;
  75. TablicaWina[6] = Wino7;
  76. TablicaWina[7] = Wino8;
  77.  
  78. TablicaPiwa[0] = Piwo1;
  79. TablicaPiwa[1] = Piwo2;
  80. TablicaPiwa[2] = Piwo3;
  81. TablicaPiwa[3] = Piwo4;
  82. TablicaPiwa[4] = Piwo5;
  83. TablicaPiwa[5] = Piwo6;
  84. TablicaPiwa[6] = Piwo7;
  85. TablicaPiwa[7] = Piwo8;
  86.  
  87. TablicaWodki[0] = Wodka1;
  88. TablicaWodki[1] = Wodka2;
  89. TablicaWodki[2] = Wodka3;
  90. TablicaWodki[3] = Wodka4;
  91. TablicaWodki[4] = Wodka5;
  92. TablicaWodki[5] = Wodka6;
  93. TablicaWodki[6] = Wodka7;
  94. TablicaWodki[7] = Wodka8;
  95.  
  96.  
  97. Button[] ButtonTable = new Button[8];
  98.  
  99. final GUIScreen guiScreen = TerminalFacade.createGUIScreen();
  100. final Window window = new Window("Pogotowie Alkoholowe");
  101.  
  102.  
  103.  
  104.  
  105. window.setWindowSizeOverride(new TerminalSize(5000, 5000));
  106. window.setSoloWindow(true);
  107.  
  108. final Window newWindow = new Window("Zamow Wino i zaspokoj pragnienie");
  109. newWindow.setWindowSizeOverride(new TerminalSize(5000, 5000));
  110. newWindow.setSoloWindow(true);
  111.  
  112. final Window End = new Window("Skompletuj koszyk i zaspokoj pragnienie"); //koszyk
  113. End.setWindowSizeOverride(new TerminalSize(5000, 5000));
  114. End.setSoloWindow(true);
  115.  
  116. final Window newPiwo = new Window("Zamow Piwo i zaspokoj pragnienie");
  117. newPiwo.setWindowSizeOverride(new TerminalSize(5000, 5000));
  118. newPiwo.setSoloWindow(true);
  119.  
  120. final Window newWodka = new Window("Zamow Wodke i zaspokoj pragnienie");
  121. newWodka.setWindowSizeOverride(new TerminalSize(5000,5000));
  122. newWodka.setSoloWindow(true);
  123.  
  124. final Window kontakt = new Window(" Kontakt ze sprzedajacym");
  125. kontakt.setWindowSizeOverride(new TerminalSize(5000,5000));
  126. kontakt.setSoloWindow(true);
  127.  
  128. final Window newPodsumowanie = new Window("Podsumowanie");
  129. newPodsumowanie.setWindowSizeOverride(new TerminalSize(5000,5000));
  130. newPodsumowanie.setSoloWindow(true);
  131.  
  132. final Window koniec = new Window("Podsumowanie");
  133. koniec.setWindowSizeOverride(new TerminalSize(5000,5000));
  134. koniec.setSoloWindow(true);
  135.  
  136. Table table = new Table(6);
  137. table.setColumnPaddingSize(0);
  138. Component[] row1 = new Component[1];
  139. row1[0] = new Label("");
  140. table.addRow(row1);
  141.  
  142.  
  143. //Obiekt[] Koszyk = new Obiekt[100];
  144.  
  145. ArrayList Koszyk = new ArrayList();
  146.  
  147.  
  148.  
  149. Obiekt obiekt1 = new Obiekt();
  150.  
  151. Obiekt Take = new Obiekt();
  152.  
  153. Take = TablicaWina[0];
  154. Table table1 = new Table(2);
  155. table.setColumnPaddingSize(10);
  156. Component[] component = new Component[2];
  157. component[0] = new Label(Take.nazwa);
  158. component[1] = new Label(Take.zwroc()+"$");
  159. table1.addRow(component);
  160.  
  161. Take = TablicaWina[1];
  162. Table table2 = new Table(2);
  163. table.setColumnPaddingSize(5);
  164. Component[] component1 = new Component[2];
  165. component1[0] = new Label(Take.nazwa);
  166. component1[1] = new Label(Take.zwroc()+"$");
  167. table2.addRow(component1);
  168.  
  169. Take = TablicaWina[2];
  170. Table table3 = new Table(2);
  171. table.setColumnPaddingSize(5);
  172. Component[] component2 = new Component[2];
  173. component2[0] = new Label(Take.nazwa);
  174. component2[1] = new Label(Take.zwroc()+"$");
  175. table3.addRow(component2);
  176.  
  177. Take = TablicaWina[3];
  178. Table table4 = new Table(2);
  179. table.setColumnPaddingSize(5);
  180. Component[] component3 = new Component[2];
  181. component3[0] = new Label(Take.nazwa);
  182. component3[1] = new Label(Take.zwroc()+"$");
  183. table4.addRow(component3);
  184.  
  185. Take = TablicaWina[4];
  186. Table table5 = new Table(2);
  187. table.setColumnPaddingSize(5);
  188. Component[] component4 = new Component[2];
  189. component4[0] = new Label(Take.nazwa);
  190. component4[1] = new Label(Take.zwroc()+"$");
  191. table5.addRow(component4);
  192.  
  193. Take = TablicaWina[5];
  194. Table table6 = new Table(2);
  195. table.setColumnPaddingSize(5);
  196. Component[] component5 = new Component[2];
  197. component5[0] = new Label(Take.nazwa);
  198. component5[1] = new Label(Take.zwroc()+"$");
  199. table6.addRow(component5);
  200.  
  201. Take = TablicaWina[6];
  202. Table table7 = new Table(2);
  203. table.setColumnPaddingSize(5);
  204. Component[] component6 = new Component[2];
  205. component6[0] = new Label(Take.nazwa);
  206. component6[1] = new Label(Take.zwroc()+"$");
  207. table7.addRow(component6);
  208.  
  209. Take = TablicaWina[7];
  210. Table table8 = new Table(2);
  211. table.setColumnPaddingSize(5);
  212. Component[] component7 = new Component[2];
  213. component7[0] = new Label(Take.nazwa);
  214. component7[1] = new Label(Take.zwroc()+"$");
  215. table8.addRow(component7);
  216.  
  217.  
  218. Button PokazWodke = new Button("Przegladaj Wodki", new Action() {
  219. public void doAction() {
  220.  
  221. window.close();
  222. guiScreen.showWindow(newWodka);
  223. }
  224. });
  225.  
  226. Button PokazPiwo = new Button("Przegladaj Piwa", new Action(){
  227.  
  228. public void doAction(){
  229.  
  230. window.close();
  231. guiScreen.showWindow(newPiwo);
  232. }
  233.  
  234. });
  235.  
  236. Button button = new Button("Przegladaj Wina", new Action()
  237. {
  238. public void doAction()
  239. {
  240. window.close();
  241. guiScreen.showWindow(newWindow);
  242. }
  243. });
  244.  
  245. Button exit = new Button("Wyjscie", new Action()
  246. {
  247. public void doAction(){
  248. newWindow.close();
  249. window.close();
  250. newPiwo.close();
  251. newWodka.close();
  252. newPodsumowanie.close();
  253. koniec.close();
  254. }
  255.  
  256. });
  257.  
  258. Button Dodaj = new Button("Dodaj do koszyka", new Action()
  259. {
  260. public void doAction()
  261. {
  262. Obiekt obiekt = new Obiekt();
  263. obiekt = TablicaWina[0];
  264. Koszyk.add(obiekt);
  265. }
  266.  
  267. });
  268. Button Dodaj1 = new Button("Dodaj do koszyka", new Action()
  269. {
  270. public void doAction()
  271. {
  272. Obiekt obiekt = new Obiekt();
  273. obiekt = TablicaWina[1];
  274. Koszyk.add(obiekt);
  275. }
  276.  
  277. });
  278. Button Dodaj2 = new Button("Dodaj do koszyka", new Action()
  279. {
  280. public void doAction()
  281. {
  282. Obiekt obiekt = new Obiekt();
  283. obiekt = TablicaWina[2];
  284. Koszyk.add(obiekt);
  285. }
  286.  
  287. });
  288. Button Dodaj3 = new Button("Dodaj do koszyka", new Action()
  289. {
  290. public void doAction()
  291. {
  292. Obiekt obiekt = new Obiekt();
  293. obiekt = TablicaWina[3];
  294. Koszyk.add(obiekt);
  295. }
  296.  
  297. });
  298. Button Dodaj4 = new Button("Dodaj do koszyka", new Action()
  299. {
  300. public void doAction()
  301. {
  302. Obiekt obiekt = new Obiekt();
  303. obiekt = TablicaWina[4];
  304. Koszyk.add(obiekt);
  305. }
  306.  
  307. });
  308. Button Dodaj5 = new Button("Dodaj do koszyka", new Action()
  309. {
  310. public void doAction()
  311. {
  312. Obiekt obiekt = new Obiekt();
  313. obiekt = TablicaWina[5];
  314. Koszyk.add(obiekt);
  315. }
  316.  
  317. });
  318. Button Dodaj6 = new Button("Dodaj do koszyka", new Action()
  319. {
  320. public void doAction()
  321. {
  322. Obiekt obiekt = new Obiekt();
  323. obiekt = TablicaWina[6];
  324. Koszyk.add(obiekt);
  325. }
  326.  
  327. });
  328. Button Dodaj7 = new Button("Dodaj do koszyka", new Action()
  329. {
  330. public void doAction()
  331. {
  332. Obiekt obiekt = new Obiekt();
  333. obiekt = TablicaWina[7];
  334. Koszyk.add(obiekt);
  335. }
  336.  
  337. });
  338.  
  339.  
  340. Button DodajDoKoszkaPiwo1 = new Button("Dodaj do koszyka", new Action()
  341. { public void doAction() {
  342. Obiekt obiekt = new Obiekt();
  343. obiekt = TablicaPiwa[0];
  344. Koszyk.add(obiekt);
  345. }});
  346. Button DodajDoKoszkaPiwo2 = new Button("Dodaj do koszyka", new Action()
  347. { public void doAction() {
  348. Obiekt obiekt = new Obiekt();
  349. obiekt = TablicaPiwa[1];
  350. Koszyk.add(obiekt);
  351. }});
  352. Button DodajDoKoszkaPiwo3 = new Button("Dodaj do koszyka", new Action()
  353. { public void doAction() {
  354. Obiekt obiekt = new Obiekt();
  355. obiekt = TablicaPiwa[2];
  356. Koszyk.add(obiekt);
  357. }});
  358. Button DodajDoKoszkaPiwo4 = new Button("Dodaj do koszyka", new Action()
  359. { public void doAction() {
  360. Obiekt obiekt = new Obiekt();
  361. obiekt = TablicaPiwa[3];
  362. Koszyk.add(obiekt);
  363. }});
  364. Button DodajDoKoszkaPiwo5 = new Button("Dodaj do koszyka", new Action()
  365. { public void doAction() {
  366. Obiekt obiekt = new Obiekt();
  367. obiekt = TablicaPiwa[4];
  368. Koszyk.add(obiekt);
  369. }});
  370. Button DodajDoKoszkaPiwo6 = new Button("Dodaj do koszyka", new Action()
  371. { public void doAction() {
  372. Obiekt obiekt = new Obiekt();
  373. obiekt = TablicaPiwa[5];
  374. Koszyk.add(obiekt);
  375. }});
  376. Button DodajDoKoszkaPiwo7 = new Button("Dodaj do koszyka", new Action()
  377. { public void doAction() {
  378. Obiekt obiekt = new Obiekt();
  379. obiekt = TablicaPiwa[6];
  380. Koszyk.add(obiekt);
  381. }});
  382. Button DodajDoKoszkaPiwo8 = new Button("Dodaj do koszyka", new Action()
  383. { public void doAction() {
  384. Obiekt obiekt = new Obiekt();
  385. obiekt = TablicaPiwa[7];
  386. Koszyk.add(obiekt);
  387. }});
  388.  
  389. ButtonTable[0]=DodajDoKoszkaPiwo1;
  390. ButtonTable[1]=DodajDoKoszkaPiwo2;
  391. ButtonTable[2]=DodajDoKoszkaPiwo3;
  392. ButtonTable[3]=DodajDoKoszkaPiwo4;
  393. ButtonTable[4]=DodajDoKoszkaPiwo5;
  394. ButtonTable[5]=DodajDoKoszkaPiwo6;
  395. ButtonTable[6]=DodajDoKoszkaPiwo7;
  396. ButtonTable[7]=DodajDoKoszkaPiwo8;
  397.  
  398. for(int j=0;j<8;j++){
  399.  
  400. Take = TablicaPiwa[j];
  401. Table piwo = new Table(2);
  402. table.setColumnPaddingSize(5);
  403. Component[] piwocom = new Component[2];
  404. piwocom[0] = new Label(Take.nazwa);
  405. piwocom[1] = new Label(Take.zwroc()+"$");
  406. piwo.addRow(piwocom);
  407.  
  408. Button podstaw = ButtonTable[j];
  409. podstaw.setAlignment(Component.Alignment.LEFT_CENTER);
  410. newPiwo.addComponent(piwo, LinearLayout.GROWS_HORIZONTALLY);
  411. newPiwo.addComponent(podstaw, LinearLayout.GROWS_HORIZONTALLY);
  412. if(j < 7)
  413. newPiwo.addEmptyLine();
  414.  
  415.  
  416. }
  417.  
  418.  
  419. Dodaj.setAlignment(Component.Alignment.LEFT_CENTER);
  420. Dodaj1.setAlignment(Component.Alignment.LEFT_CENTER);
  421. Dodaj2.setAlignment(Component.Alignment.LEFT_CENTER);
  422. Dodaj3.setAlignment(Component.Alignment.LEFT_CENTER);
  423. Dodaj4.setAlignment(Component.Alignment.LEFT_CENTER);
  424. Dodaj5.setAlignment(Component.Alignment.LEFT_CENTER);
  425. Dodaj6.setAlignment(Component.Alignment.LEFT_CENTER);
  426. Dodaj7.setAlignment(Component.Alignment.LEFT_CENTER);
  427.  
  428. Button doWino = new Button("Cofnij", new Action()
  429. {
  430. public void doAction()
  431. {
  432. End.close();
  433. guiScreen.showWindow(newWindow);
  434. }
  435.  
  436. });
  437. Button doMenu = new Button("Cofnij", new Action()
  438. {
  439. public void doAction()
  440. {
  441.  
  442. End.close();
  443. newWindow.close();
  444. newPiwo.close();
  445. newWodka.close();
  446. kontakt.close();
  447. newPodsumowanie.close();
  448. guiScreen.showWindow(window);
  449.  
  450. }
  451.  
  452. });
  453.  
  454. //wodka
  455. Button DodajDoKoszkaWodke1 = new Button("Dodaj do koszyka", new Action()
  456. { public void doAction() {
  457. Obiekt obiekt = new Obiekt();
  458. obiekt = TablicaWodki[0];
  459. Koszyk.add(obiekt);
  460. }});
  461. Button DodajDoKoszkaWodke2 = new Button("Dodaj do koszyka", new Action()
  462. { public void doAction() {
  463. Obiekt obiekt = new Obiekt();
  464. obiekt = TablicaWodki[1];
  465. Koszyk.add(obiekt);
  466. }});
  467. Button DodajDoKoszkaWodke3 = new Button("Dodaj do koszyka", new Action()
  468. { public void doAction() {
  469. Obiekt obiekt = new Obiekt();
  470. obiekt = TablicaWodki[2];
  471. Koszyk.add(obiekt);
  472. }});
  473. Button DodajDoKoszkaWodke4 = new Button("Dodaj do koszyka", new Action()
  474. { public void doAction() {
  475. Obiekt obiekt = new Obiekt();
  476. obiekt = TablicaWodki[3];
  477. Koszyk.add(obiekt);
  478. }});
  479. Button DodajDoKoszkaWodke5 = new Button("Dodaj do koszyka", new Action()
  480. { public void doAction() {
  481. Obiekt obiekt = new Obiekt();
  482. obiekt = TablicaWodki[4];
  483. Koszyk.add(obiekt);
  484. }});
  485. Button DodajDoKoszkaWodke6 = new Button("Dodaj do koszyka", new Action()
  486. { public void doAction() {
  487. Obiekt obiekt = new Obiekt();
  488. obiekt = TablicaWodki[5];
  489. Koszyk.add(obiekt);
  490. }});
  491. Button DodajDoKoszkaWodke7 = new Button("Dodaj do koszyka", new Action()
  492. { public void doAction() {
  493. Obiekt obiekt = new Obiekt();
  494. obiekt = TablicaWodki[6];
  495. Koszyk.add(obiekt);
  496. }});
  497. Button DodajDoKoszkaWodke8 = new Button("Dodaj do koszyka", new Action()
  498. { public void doAction() {
  499. Obiekt obiekt = new Obiekt();
  500. obiekt = TablicaWodki[7];
  501. Koszyk.add(obiekt);
  502. }});
  503.  
  504. ButtonTable[0]=DodajDoKoszkaWodke1;
  505. ButtonTable[1]=DodajDoKoszkaWodke2;
  506. ButtonTable[2]=DodajDoKoszkaWodke3;
  507. ButtonTable[3]=DodajDoKoszkaWodke4;
  508. ButtonTable[4]=DodajDoKoszkaWodke5;
  509. ButtonTable[5]=DodajDoKoszkaWodke6;
  510. ButtonTable[6]=DodajDoKoszkaWodke7;
  511. ButtonTable[7]=DodajDoKoszkaWodke8;
  512.  
  513. for(int j=0;j<8;j++){
  514.  
  515. Take = TablicaWodki[j];
  516. Table wodka = new Table(2);
  517. table.setColumnPaddingSize(5);
  518. Component[] wodkacom = new Component[2];
  519. wodkacom[0] = new Label(Take.nazwa);
  520. wodkacom[1] = new Label(Take.zwroc()+"$");
  521. wodka.addRow(wodkacom);
  522.  
  523. Button podstaw = ButtonTable[j];
  524. podstaw.setAlignment(Component.Alignment.LEFT_CENTER);
  525. newWodka.addComponent(wodka, LinearLayout.GROWS_HORIZONTALLY);
  526. newWodka.addComponent(podstaw, LinearLayout.GROWS_HORIZONTALLY);
  527. if(j < 7)
  528. newWodka.addEmptyLine();
  529.  
  530.  
  531. }
  532. for (int i = 0; i<2;i++)
  533. koniec.addEmptyLine();
  534.  
  535.  
  536. Panel username = new Panel(new Border.Invisible(), Panel.Orientation.VERTICAL);
  537.  
  538. TextBox Name = new TextBox(null, 15);
  539. TextBox secondName = new TextBox(null, 15);
  540. TextBox Street = new TextBox(null, 15);
  541. TextBox City = new TextBox(null, 15);
  542. TextBox Phone = new TextBox(null, 15);
  543. username.addComponent(new Label("Username: "));
  544. username.addComponent(Name);
  545. username.addComponent(new Label("SecondName: "));
  546. username.addComponent(secondName);
  547. username.addComponent(new Label("Street: "));
  548. username.addComponent(Street);
  549. username.addComponent(new Label("City: "));
  550. username.addComponent(City);
  551. username.addComponent(new Label("Phone: "));
  552. username.addComponent(Phone);
  553.  
  554.  
  555.  
  556.  
  557. Button Podsumowanie = new Button ("Podsumowanie", new Action()
  558. {
  559.  
  560. public void doAction()
  561. {
  562. int razem=0;
  563. End.removeAllComponents();
  564. Obiekt Take = new Obiekt();
  565. newWindow.close();
  566. window.close();
  567. newWodka.close();
  568. newPiwo.close();
  569.  
  570. for(int j=0;j<Koszyk.size();j++)
  571. {
  572. Take = (Obiekt) Koszyk.get(j);
  573. Table table5 = new Table(2);
  574. table.setColumnPaddingSize(0);
  575. Component[] component4 = new Component[2];
  576. component4[0] = new Label(Take.nazwa);
  577. component4[1] = new Label(Take.zwroc()+"$");
  578. table5.addRow(component4);
  579. End.addComponent(table5, LinearLayout.GROWS_HORIZONTALLY);
  580. razem=Take.cena+razem;
  581.  
  582. }
  583. String koniec = Integer.toString(razem);
  584. Table suma = new Table(2);
  585. table.setColumnPaddingSize(0);
  586. Component[] sumaa = new Component[2];
  587. sumaa[0] = new Label("Suma:");
  588. sumaa[1] = new Label(koniec + "$");
  589. suma.addRow(sumaa);
  590. End.close();
  591. newPodsumowanie.addComponent(suma, LinearLayout.GROWS_HORIZONTALLY);
  592. guiScreen.showWindow(newPodsumowanie);
  593.  
  594.  
  595. }
  596.  
  597.  
  598. });
  599.  
  600.  
  601. koniec.addComponent(new Label("Dziekujemy za zlozenie zamowienia"), LinearLayout.GROWS_HORIZONTALLY);
  602. koniec.addEmptyLine();
  603. //tu
  604.  
  605. Button koniecc = new Button("Zloz zamowienie", new Action()
  606. {
  607. public void doAction()
  608.  
  609. {
  610.  
  611. End.close();
  612. newPodsumowanie.close();
  613.  
  614. String Name1 = Name.getText();
  615. String SecondName1 = secondName.getText();
  616. String Street1 = Street.getText();
  617. String City1 = City.getText();
  618. String Phone1 = Phone.getText();
  619. koniec.addComponent(new Label("NAME:"), LinearLayout.GROWS_HORIZONTALLY);
  620. koniec.addComponent(new Label(Name1), LinearLayout.GROWS_HORIZONTALLY);
  621. koniec.addEmptyLine();
  622. koniec.addComponent(new Label("SECOND NAME:" ), LinearLayout.GROWS_HORIZONTALLY);
  623. koniec.addComponent(new Label(SecondName1), LinearLayout.GROWS_HORIZONTALLY);
  624. koniec.addEmptyLine();
  625. koniec.addComponent(new Label("STREET:"), LinearLayout.GROWS_HORIZONTALLY);
  626. koniec.addComponent(new Label(Street1), LinearLayout.GROWS_HORIZONTALLY);
  627. koniec.addEmptyLine();
  628. koniec.addComponent(new Label("CITY:"), LinearLayout.GROWS_HORIZONTALLY);
  629. koniec.addComponent(new Label(City1), LinearLayout.GROWS_HORIZONTALLY);
  630. koniec.addEmptyLine();
  631. koniec.addComponent(new Label("PHONE:"), LinearLayout.GROWS_HORIZONTALLY);
  632. koniec.addComponent(new Label(Phone1), LinearLayout.GROWS_HORIZONTALLY);
  633. koniec.addEmptyLine();
  634. koniec.addComponent(exit, LinearLayout.GROWS_HORIZONTALLY);
  635.  
  636.  
  637.  
  638.  
  639. guiScreen.showWindow(koniec);
  640.  
  641.  
  642. }
  643. }
  644. );
  645.  
  646. newPodsumowanie.addComponent(username);
  647. newPodsumowanie.addComponent(koniecc, LinearLayout.GROWS_HORIZONTALLY);
  648. newPodsumowanie.addComponent(doMenu, LinearLayout.GROWS_HORIZONTALLY);
  649.  
  650. Button Koszykk = new Button("Koszyk", new Action()
  651. {
  652. public void doAction()
  653. {
  654. int razem=0;
  655. End.removeAllComponents();
  656. Obiekt Take = new Obiekt();
  657. newWindow.close();
  658. window.close();
  659. newWodka.close();
  660. newPiwo.close();
  661.  
  662. for(int j=0;j<Koszyk.size();j++)
  663. {
  664. Take = (Obiekt) Koszyk.get(j);
  665. Table table5 = new Table(2);
  666. table.setColumnPaddingSize(0);
  667. Component[] component4 = new Component[2];
  668. component4[0] = new Label(Take.nazwa);
  669. component4[1] = new Label(Take.zwroc()+"$");
  670. table5.addRow(component4);
  671. End.addComponent(table5, LinearLayout.GROWS_HORIZONTALLY);
  672. razem=Take.cena+razem;
  673.  
  674. }
  675. String koniec = Integer.toString(razem);
  676. Table suma = new Table(2);
  677. table.setColumnPaddingSize(0);
  678. Component[] sumaa = new Component[2];
  679. sumaa[0] = new Label("Suma:");
  680. sumaa[1] = new Label(koniec + "$");
  681. suma.addRow(sumaa);
  682. End.addComponent(suma, LinearLayout.GROWS_HORIZONTALLY);
  683. End.addComponent(doMenu, LinearLayout.GROWS_HORIZONTALLY);
  684. End.addComponent(Podsumowanie, LinearLayout.GROWS_HORIZONTALLY);
  685. guiScreen.showWindow(End);
  686. }
  687.  
  688.  
  689. });
  690.  
  691. newPiwo.addComponent(Koszykk, LinearLayout.GROWS_HORIZONTALLY);
  692. newPiwo.addComponent(doMenu, LinearLayout.GROWS_HORIZONTALLY);
  693. newPiwo.addComponent(exit, LinearLayout.GROWS_HORIZONTALLY);
  694.  
  695. newWodka.addComponent(Koszykk, LinearLayout.GROWS_HORIZONTALLY);
  696. newWodka.addComponent(doMenu, LinearLayout.GROWS_HORIZONTALLY);
  697. newWodka.addComponent(exit, LinearLayout.GROWS_HORIZONTALLY);
  698.  
  699.  
  700. button.setAlignment(Component.Alignment.CENTER);
  701. exit.setAlignment(Component.Alignment.BOTTON_CENTER);
  702. window.addEmptyLine();
  703. window.addComponent(new Label(" ___ _ _ _ _____ _____ _ _ _____ _____ \r\n" +
  704. " / | | | | | / / / _ \\ / ___/ | | | | / _ \\ | _ \\ \r\n" +
  705. " / /| | | | | |/ / | | | | | |___ | |_| | | | | | | |_| | \r\n" +
  706. " / / | | | | | |\\ \\ | | | | \\___ \\ | _ | | | | | | ___/ \r\n" +
  707. " / / | | | |___ | | \\ \\ | |_| | ___| | | | | | | |_| | | | \r\n" +
  708. "/_/ |_| |_____| |_| \\_\\ \\_____/ /_____/ |_| |_| \\_____/ |_| "), LinearLayout.GROWS_HORIZONTALLY);
  709. window.addComponent(new Label(" # \r\n" +
  710. " :#: \r\n" +
  711. " : : \r\n" +
  712. " : : {}\r\n" +
  713. ".' '. ||\r\n" +
  714. ":_____: .___. .___. )(\r\n" +
  715. "| | | | | | (-) |__| \r\n" +
  716. "| %% | '. .' '. .' .-'-'-.| | \r\n" +
  717. "| | | | |-...-||% |\r\n" +
  718. "|_____| | | |;:.._||__|\r\n" +
  719. ":_____: -'- -'- `-...-'"), LinearLayout.GROWS_HORIZONTALLY);
  720. window.addEmptyLine();
  721.  
  722. Button Kontakt = new Button ("Kontakt", new Action()
  723.  
  724. {
  725.  
  726. public void doAction()
  727. {
  728.  
  729. window.close();
  730. guiScreen.showWindow(kontakt);
  731.  
  732. }
  733.  
  734.  
  735. });
  736. for (int i =0 ;i < 10;i++)
  737. kontakt.addEmptyLine();
  738. kontakt.addComponent(new Label("Artur Mogielnicki "), LinearLayout.GROWS_HORIZONTALLY);
  739. kontakt.addComponent(new Label("Aleksander Bołtryk "), LinearLayout.GROWS_HORIZONTALLY);
  740. kontakt.addComponent(doMenu, LinearLayout.GROWS_HORIZONTALLY);
  741. window.addComponent(button, LinearLayout.GROWS_HORIZONTALLY);
  742. window.addComponent(PokazPiwo, LinearLayout.GROWS_HORIZONTALLY);
  743. window.addComponent(PokazWodke,LinearLayout.GROWS_HORIZONTALLY);
  744. window.addComponent(Koszykk, LinearLayout.GROWS_HORIZONTALLY);
  745. window.addComponent(Kontakt, LinearLayout.GROWS_HORIZONTALLY);
  746. window.addComponent(exit, LinearLayout.GROWS_HORIZONTALLY);
  747.  
  748.  
  749.  
  750.  
  751.  
  752. newWindow.addComponent(table1, LinearLayout.GROWS_HORIZONTALLY);
  753. newWindow.addComponent(Dodaj, LinearLayout.GROWS_HORIZONTALLY);
  754. newWindow.addEmptyLine();
  755.  
  756. newWindow.addComponent(table2, LinearLayout.GROWS_HORIZONTALLY);
  757. newWindow.addComponent(Dodaj1, LinearLayout.GROWS_HORIZONTALLY);
  758. newWindow.addEmptyLine();
  759.  
  760. newWindow.addComponent(table3, LinearLayout.GROWS_HORIZONTALLY);
  761. newWindow.addComponent(Dodaj2, LinearLayout.GROWS_HORIZONTALLY);
  762. newWindow.addEmptyLine();
  763.  
  764. newWindow.addComponent(table4, LinearLayout.GROWS_HORIZONTALLY);
  765. newWindow.addComponent(Dodaj3, LinearLayout.GROWS_HORIZONTALLY);
  766. newWindow.addEmptyLine();
  767.  
  768. newWindow.addComponent(table5, LinearLayout.GROWS_HORIZONTALLY);
  769. newWindow.addComponent(Dodaj4, LinearLayout.GROWS_HORIZONTALLY);
  770. newWindow.addEmptyLine();
  771.  
  772. newWindow.addComponent(table6, LinearLayout.GROWS_HORIZONTALLY);
  773. newWindow.addComponent(Dodaj5, LinearLayout.GROWS_HORIZONTALLY);
  774. newWindow.addEmptyLine();
  775.  
  776. newWindow.addComponent(table7, LinearLayout.GROWS_HORIZONTALLY);
  777. newWindow.addComponent(Dodaj6, LinearLayout.GROWS_HORIZONTALLY);
  778. newWindow.addEmptyLine();
  779.  
  780. newWindow.addComponent(table8, LinearLayout.GROWS_HORIZONTALLY);
  781. newWindow.addComponent(Dodaj7, LinearLayout.GROWS_HORIZONTALLY);
  782.  
  783.  
  784. newWindow.addComponent(Koszykk, LinearLayout.GROWS_HORIZONTALLY);
  785.  
  786. newWindow.addComponent(doMenu, LinearLayout.GROWS_HORIZONTALLY);
  787.  
  788. window.addComponent(new EmptySpace());
  789. newWindow.addComponent(exit , LinearLayout.GROWS_HORIZONTALLY);
  790.  
  791. guiScreen.getScreen().startScreen();
  792. guiScreen.showWindow(window);
  793. guiScreen.getScreen().stopScreen();
  794.  
  795.  
  796. }
  797.  
  798. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement