Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.72 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3.  
  4. import javax.swing.*;
  5.  
  6. public class AssignmentMethods{
  7.  
  8. //first screen to be seen, asks user if they would like to open tutorial window
  9. public static void introScreen(){ //Main Programmer: Amarnath Parthiban
  10.  
  11. JPanel introScreen = new JPanel();
  12. introScreen.setLayout(null);
  13.  
  14. JFrame introFrame = new JFrame("Welcome");
  15. introFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  16. introFrame.add(introScreen);
  17.  
  18. //text to be displayed on screen
  19. JLabel introTitle = new JLabel("So you think you're Canadian, eh?");
  20. introTitle.setFont(new Font("Calibri", Font.PLAIN, 20));
  21. introTitle.setBounds(5, 0, 500, 25);
  22.  
  23. JLabel introText1 = new JLabel("Welcome to the CIA Canadian trivia quiz.");
  24. introText1.setFont(new Font("Calibri", Font.PLAIN, 16));
  25. introText1.setBounds(15, 25, 500, 25);
  26.  
  27. JLabel introText2 = new JLabel("Would you like to take the tutorial?");
  28. introText2.setFont(new Font("Calibri", Font.PLAIN, 16));
  29. introText2.setBounds(25, 50, 500, 25);
  30.  
  31. //buttons for user input
  32. JButton yesTutorial = new JButton("YES");
  33. yesTutorial.setFont(new Font("Calibri", Font.PLAIN, 16));
  34. yesTutorial.setBounds(55, 75, 70, 30);
  35.  
  36. JButton noTutorial = new JButton("NO");
  37. noTutorial.setFont(new Font("Calibri", Font.PLAIN, 16));
  38. noTutorial.setBounds(165, 75, 70, 30);
  39.  
  40. introScreen.add(introTitle);
  41. introScreen.add(introText1);
  42. introScreen.add(introText2);
  43. introScreen.add(yesTutorial);
  44. introScreen.add(noTutorial);
  45.  
  46. introFrame.setSize(310,160);
  47. introFrame.setVisible(true);
  48.  
  49. yesTutorial.addActionListener(new ActionListener(){
  50.  
  51. public void actionPerformed(ActionEvent e){
  52.  
  53. //removes first window and opens the tutorial window
  54. introFrame.dispose();
  55. tutorial();
  56.  
  57. }
  58. });
  59.  
  60. noTutorial.addActionListener(new ActionListener(){
  61.  
  62. public void actionPerformed(ActionEvent e){
  63.  
  64. //removes first window and opens main quiz window
  65. introFrame.dispose();
  66. quiz();
  67.  
  68. }
  69. });
  70.  
  71. }
  72.  
  73. //static panel and frame to allow only one instance of the window to be open
  74. static JPanel mainQuiz = new JPanel();
  75. static JFrame mainFrame = new JFrame("CAI Quiz");
  76. static CardLayout card1 = new CardLayout();
  77.  
  78. //used to determine if the main quiz screen is open, defaulted to false for safety
  79. static boolean quizState = false;
  80.  
  81. public static void quiz(){ //Main Programmer: Amarnath Parthiban
  82.  
  83. mainQuiz.setLayout(card1);
  84. mainFrame.add(mainQuiz);
  85.  
  86. JPanel quiz = new JPanel();
  87. //allows use of (x,y) positions on JPanel
  88. quiz.setLayout(null);
  89.  
  90. //changes the state to inform that main quiz is open and other windows can be closed without ending the program
  91. quizState = true;
  92.  
  93. mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  94. mainQuiz.add(quiz, "a");
  95.  
  96. //title
  97. JLabel mainTitle = new JLabel("CAI CANADIAN QUIZ");
  98. mainTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  99. mainTitle.setBounds(190, 25, 700, 60);
  100.  
  101. //buttons for each question type and level including a random and tutorial button
  102. JButton MCLevel1 = new JButton("Multiple Choice Level 1");
  103. MCLevel1.setFont(new Font("Calibri", Font.PLAIN, 25));
  104. MCLevel1.setBounds(150, 200, 300, 100);
  105.  
  106. JButton MCLevel2 = new JButton("Multiple Choice Level 2");
  107. MCLevel2.setFont(new Font("Calibri", Font.PLAIN, 25));
  108. MCLevel2.setBounds(150, 350, 300, 100);
  109.  
  110. JButton MCLevel3 = new JButton("Multiple Choice Level 3");
  111. MCLevel3.setFont(new Font("Calibri", Font.PLAIN, 25));
  112. MCLevel3.setBounds(150, 500, 300, 100);
  113.  
  114. JButton FIBLevel1 = new JButton("Fill in The Blank Level 1");
  115. FIBLevel1.setFont(new Font("Calibri", Font.PLAIN, 25));
  116. FIBLevel1.setBounds(550, 200, 300, 100);
  117.  
  118. JButton FIBLevel2 = new JButton("Fill in The Blank Level 2");
  119. FIBLevel2.setFont(new Font("Calibri", Font.PLAIN, 25));
  120. FIBLevel2.setBounds(550, 350, 300, 100);
  121.  
  122. JButton FIBLevel3 = new JButton("Fill in The Blank Level 3");
  123. FIBLevel3.setFont(new Font("Calibri", Font.PLAIN, 25));
  124. FIBLevel3.setBounds(550, 500, 300, 100);
  125.  
  126. JButton random = new JButton("Random");
  127. random.setFont(new Font("Calibri", Font.PLAIN, 25));
  128. random.setBounds(350, 650, 300, 100);
  129.  
  130. JButton tutorial = new JButton("Tutorial");
  131. tutorial.setFont(new Font("Calibri", Font.PLAIN, 20));
  132. tutorial.setBounds(10, 650, 100, 100);
  133.  
  134. quiz.add(mainTitle);
  135. quiz.add(MCLevel1);
  136. quiz.add(MCLevel2);
  137. quiz.add(MCLevel3);
  138. quiz.add(FIBLevel1);
  139. quiz.add(FIBLevel2);
  140. quiz.add(FIBLevel3);
  141. quiz.add(random);
  142. quiz.add(tutorial);
  143.  
  144. mainFrame.setSize(1000,800);
  145. mainFrame.setVisible(true);
  146. card1.show(mainQuiz, "a");
  147.  
  148. MCLevel1.addActionListener(new ActionListener(){
  149.  
  150. public void actionPerformed(ActionEvent e){
  151.  
  152. MCLevel1();
  153.  
  154. }
  155. });
  156.  
  157. MCLevel2.addActionListener(new ActionListener(){
  158.  
  159. public void actionPerformed(ActionEvent e){
  160.  
  161. MCLevel2();
  162.  
  163. }
  164. });
  165.  
  166. MCLevel3.addActionListener(new ActionListener(){
  167.  
  168. public void actionPerformed(ActionEvent e){
  169.  
  170. MCLevel3();
  171.  
  172. }
  173. });
  174.  
  175. FIBLevel1.addActionListener(new ActionListener(){
  176.  
  177. public void actionPerformed(ActionEvent e){
  178.  
  179. FIBLevel1();
  180.  
  181. }
  182. });
  183.  
  184. FIBLevel2.addActionListener(new ActionListener(){
  185.  
  186. public void actionPerformed(ActionEvent e){
  187.  
  188. FIBLevel2();
  189.  
  190. }
  191. });
  192.  
  193. FIBLevel3.addActionListener(new ActionListener(){
  194.  
  195. public void actionPerformed(ActionEvent e){
  196.  
  197. FIBLevel3();
  198.  
  199. }
  200. });
  201.  
  202. tutorial.addActionListener(new ActionListener(){
  203.  
  204. public void actionPerformed(ActionEvent e){
  205.  
  206. //allows user to open tutorial when needed
  207. tutorial();
  208.  
  209. }
  210. });
  211.  
  212. }
  213.  
  214. public static void MCLevel1(){ //Main Programmer: Amarnath Parthiban
  215.  
  216. JPanel MC1 = new JPanel();
  217. MC1.setLayout(null);
  218.  
  219. mainQuiz.add(MC1, "b");
  220.  
  221. JLabel MC1Title = new JLabel("Score");
  222. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  223. MC1Title.setBounds(380, 25, 700, 120);
  224.  
  225. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  226. + " On the main menu your score will be displayed once as your overall score."
  227. + " When in a session your total score as well as your session score will be visible."
  228. + " These scores will automaticly updated as you continue on with your session."
  229. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  230. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  231. scoreDescription.setBounds(150, 50, 700, 500);
  232.  
  233. JButton scoreBack = new JButton("Return");
  234. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  235. scoreBack.setBounds(350, 600, 300, 100);
  236.  
  237. MC1.add(MC1Title);
  238. MC1.add(scoreDescription);
  239. MC1.add(scoreBack);
  240.  
  241. card1.show(mainQuiz, "b");
  242.  
  243. scoreBack.addActionListener(new ActionListener(){
  244.  
  245. public void actionPerformed(ActionEvent e){
  246.  
  247. quiz();
  248.  
  249. }
  250. });
  251.  
  252. }
  253.  
  254. public static void MCLevel2(){ //Main Programmer: Amarnath Parthiban
  255.  
  256. JPanel MC2 = new JPanel();
  257. MC2.setLayout(null);
  258.  
  259. mainQuiz.add(MC2, "c");
  260.  
  261. JLabel MC1Title = new JLabel("Score");
  262. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  263. MC1Title.setBounds(380, 25, 700, 120);
  264.  
  265. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  266. + " On the main menu your score will be displayed once as your overall score."
  267. + " When in a session your total score as well as your session score will be visible."
  268. + " These scores will automaticly updated as you continue on with your session."
  269. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  270. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  271. scoreDescription.setBounds(150, 50, 700, 500);
  272.  
  273. JButton scoreBack = new JButton("Return");
  274. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  275. scoreBack.setBounds(350, 600, 300, 100);
  276.  
  277. MC2.add(MC1Title);
  278. MC2.add(scoreDescription);
  279. MC2.add(scoreBack);
  280.  
  281. card1.show(mainQuiz, "c");
  282.  
  283. scoreBack.addActionListener(new ActionListener(){
  284.  
  285. public void actionPerformed(ActionEvent e){
  286.  
  287. quiz();
  288.  
  289. }
  290. });
  291.  
  292. }
  293.  
  294. public static void MCLevel3(){ //Main Programmer: Amarnath Parthiban
  295.  
  296. JPanel MC3 = new JPanel();
  297. MC3.setLayout(null);
  298.  
  299. mainQuiz.add(MC3, "d");
  300.  
  301. JLabel MC1Title = new JLabel("Score");
  302. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  303. MC1Title.setBounds(380, 25, 700, 120);
  304.  
  305. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  306. + " On the main menu your score will be displayed once as your overall score."
  307. + " When in a session your total score as well as your session score will be visible."
  308. + " These scores will automaticly updated as you continue on with your session."
  309. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  310. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  311. scoreDescription.setBounds(150, 50, 700, 500);
  312.  
  313. JButton scoreBack = new JButton("Return");
  314. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  315. scoreBack.setBounds(350, 600, 300, 100);
  316.  
  317. MC3.add(MC1Title);
  318. MC3.add(scoreDescription);
  319. MC3.add(scoreBack);
  320.  
  321. card1.show(mainQuiz, "d");
  322.  
  323. scoreBack.addActionListener(new ActionListener(){
  324.  
  325. public void actionPerformed(ActionEvent e){
  326.  
  327. quiz();
  328.  
  329. }
  330. });
  331.  
  332. }
  333.  
  334. public static void FIBLevel1(){ //Main Programmer: Amarnath Parthiban
  335.  
  336. JPanel FIB1 = new JPanel();
  337. FIB1.setLayout(null);
  338.  
  339. mainQuiz.add(FIB1, "e");
  340.  
  341. JLabel MC1Title = new JLabel("Score");
  342. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  343. MC1Title.setBounds(380, 25, 700, 120);
  344.  
  345. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  346. + " On the main menu your score will be displayed once as your overall score."
  347. + " When in a session your total score as well as your session score will be visible."
  348. + " These scores will automaticly updated as you continue on with your session."
  349. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  350. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  351. scoreDescription.setBounds(150, 50, 700, 500);
  352.  
  353. JButton scoreBack = new JButton("Return");
  354. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  355. scoreBack.setBounds(350, 600, 300, 100);
  356.  
  357. FIB1.add(MC1Title);
  358. FIB1.add(scoreDescription);
  359. FIB1.add(scoreBack);
  360.  
  361. card1.show(mainQuiz, "e");
  362.  
  363. scoreBack.addActionListener(new ActionListener(){
  364.  
  365. public void actionPerformed(ActionEvent e){
  366.  
  367. quiz();
  368.  
  369. }
  370. });
  371.  
  372. }
  373.  
  374. public static void FIBLevel2(){ //Main Programmer: Amarnath Parthiban
  375.  
  376. JPanel FIB2 = new JPanel();
  377. FIB2.setLayout(null);
  378.  
  379. mainQuiz.add(FIB2, "f");
  380.  
  381. JLabel MC1Title = new JLabel("Score");
  382. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  383. MC1Title.setBounds(380, 25, 700, 120);
  384.  
  385. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  386. + " On the main menu your score will be displayed once as your overall score."
  387. + " When in a session your total score as well as your session score will be visible."
  388. + " These scores will automaticly updated as you continue on with your session."
  389. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  390. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  391. scoreDescription.setBounds(150, 50, 700, 500);
  392.  
  393. JButton scoreBack = new JButton("Return");
  394. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  395. scoreBack.setBounds(350, 600, 300, 100);
  396.  
  397. FIB2.add(MC1Title);
  398. FIB2.add(scoreDescription);
  399. FIB2.add(scoreBack);
  400.  
  401. card1.show(mainQuiz, "f");
  402.  
  403. scoreBack.addActionListener(new ActionListener(){
  404.  
  405. public void actionPerformed(ActionEvent e){
  406.  
  407. quiz();
  408.  
  409. }
  410. });
  411.  
  412. }
  413.  
  414. public static void FIBLevel3(){ //Main Programmer: Amarnath Parthiban
  415.  
  416. JPanel FIB3 = new JPanel();
  417. FIB3.setLayout(null);
  418.  
  419. mainQuiz.add(FIB3, "g");
  420.  
  421. JLabel MC1Title = new JLabel("Score");
  422. MC1Title.setFont(new Font("Calibri", Font.PLAIN, 75));
  423. MC1Title.setBounds(380, 25, 700, 120);
  424.  
  425. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  426. + " On the main menu your score will be displayed once as your overall score."
  427. + " When in a session your total score as well as your session score will be visible."
  428. + " These scores will automaticly updated as you continue on with your session."
  429. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  430. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  431. scoreDescription.setBounds(150, 50, 700, 500);
  432.  
  433. JButton scoreBack = new JButton("Return");
  434. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  435. scoreBack.setBounds(350, 600, 300, 100);
  436.  
  437. FIB3.add(MC1Title);
  438. FIB3.add(scoreDescription);
  439. FIB3.add(scoreBack);
  440.  
  441. card1.show(mainQuiz, "g");
  442.  
  443. scoreBack.addActionListener(new ActionListener(){
  444.  
  445. public void actionPerformed(ActionEvent e){
  446.  
  447. quiz();
  448.  
  449. }
  450. });
  451.  
  452. }
  453.  
  454. //static panel and frame to allow only one instance of the window to be open
  455. static JPanel mainTutorial = new JPanel();
  456. static JFrame tutorialFrame = new JFrame("Tutorial");
  457.  
  458. //allows for multiple JPanels on one JFrame
  459. static CardLayout card2 = new CardLayout();
  460.  
  461. public static void tutorial(){ //Main Programmer: Amarnath Parthiban
  462.  
  463. mainTutorial.setLayout(card2);
  464. tutorialFrame.add(mainTutorial);
  465.  
  466. //additional panel to set on top and interchange between other panels
  467. JPanel tutorial = new JPanel();
  468. tutorial.setLayout(null);
  469.  
  470. mainTutorial.add(tutorial, "one");
  471.  
  472. //determine if the tutorial window needs to stop the program or not
  473. if (quizState == true)
  474. tutorialFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  475. else
  476. tutorialFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  477.  
  478. //title for the panel
  479. JLabel tutorialTitle = new JLabel("Tutorial");
  480. tutorialTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  481. tutorialTitle.setBounds(380, 25, 700, 60);
  482.  
  483. //buttons for each topic, including a quiz button
  484. JButton score = new JButton("Score");
  485. score.setFont(new Font("Calibri", Font.PLAIN, 32));
  486. score.setBounds(150, 200, 300, 100);
  487.  
  488. JButton level = new JButton("Level");
  489. level.setFont(new Font("Calibri", Font.PLAIN, 32));
  490. level.setBounds(150, 400, 300, 100);
  491.  
  492. JButton type = new JButton("Type");
  493. type.setFont(new Font("Calibri", Font.PLAIN, 32));
  494. type.setBounds(550, 200, 300, 100);
  495.  
  496. JButton answering = new JButton("Answering");
  497. answering.setFont(new Font("Calibri", Font.PLAIN, 32));
  498. answering.setBounds(550, 400, 300, 100);
  499.  
  500. JButton main = new JButton("QUIZ SCREEN");
  501. main.setFont(new Font("Calibri", Font.PLAIN, 32));
  502. main.setBounds(350, 600, 300, 100);
  503.  
  504. tutorial.add(tutorialTitle);
  505. tutorial.add(score);
  506. tutorial.add(level);
  507. tutorial.add(type);
  508. tutorial.add(answering);
  509. tutorial.add(main);
  510.  
  511. tutorialFrame.setSize(1000,800);
  512. tutorialFrame.setVisible(true);
  513.  
  514. //displays the home tutorial panel
  515. card2.show(mainTutorial, "one");
  516.  
  517. //calling methods for each of the topics depending on button pushed
  518. score.addActionListener(new ActionListener(){
  519.  
  520. public void actionPerformed(ActionEvent e){
  521.  
  522. score();
  523.  
  524. }
  525. });
  526.  
  527. level.addActionListener(new ActionListener(){
  528.  
  529. public void actionPerformed(ActionEvent e){
  530.  
  531. level();
  532.  
  533. }
  534. });
  535.  
  536. type.addActionListener(new ActionListener(){
  537.  
  538. public void actionPerformed(ActionEvent e){
  539.  
  540. type();
  541.  
  542. }
  543. });
  544.  
  545. answering.addActionListener(new ActionListener(){
  546.  
  547. public void actionPerformed(ActionEvent e){
  548.  
  549. answering();
  550.  
  551. }
  552. });
  553.  
  554. main.addActionListener(new ActionListener(){
  555.  
  556. public void actionPerformed(ActionEvent e){
  557.  
  558. //open the quiz window, make the tutoral window disposible without ending the program
  559. tutorialFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  560. quiz();
  561.  
  562. }
  563. });
  564.  
  565. }
  566.  
  567. //START: methods used by the tutorial screen exclusively
  568.  
  569. //each method contains a title, a brief description and a button to return to the main tutorial screen
  570. public static void score(){ //Main Programmer: Amarnath Parthiban
  571.  
  572. JPanel scoreTutorial = new JPanel();
  573. scoreTutorial.setLayout(null);
  574.  
  575. mainTutorial.add(scoreTutorial, "two");
  576.  
  577. JLabel scoreTitle = new JLabel("Score");
  578. scoreTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  579. scoreTitle.setBounds(380, 25, 700, 120);
  580.  
  581. JLabel scoreDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  582. + " On the main menu your score will be displayed once as your overall score."
  583. + " When in a session your total score as well as your session score will be visible."
  584. + " These scores will automaticly updated as you continue on with your session."
  585. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  586. scoreDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  587. scoreDescription.setBounds(150, 50, 700, 500);
  588.  
  589. JButton scoreBack = new JButton("Return");
  590. scoreBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  591. scoreBack.setBounds(350, 600, 300, 100);
  592.  
  593. scoreTutorial.add(scoreTitle);
  594. scoreTutorial.add(scoreDescription);
  595. scoreTutorial.add(scoreBack);
  596.  
  597. card2.show(mainTutorial, "two");
  598.  
  599. scoreBack.addActionListener(new ActionListener(){
  600.  
  601. public void actionPerformed(ActionEvent e){
  602.  
  603. tutorial();
  604.  
  605. }
  606. });
  607.  
  608. }
  609.  
  610. public static void level(){ //Main Programmer: Amarnath Parthiban
  611.  
  612. JPanel levelTutorial = new JPanel();
  613. levelTutorial.setLayout(null);
  614.  
  615. mainTutorial.add(levelTutorial, "three");
  616.  
  617. JLabel levelTitle = new JLabel("Level");
  618. levelTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  619. levelTitle.setBounds(380, 25, 700, 120);
  620.  
  621. JLabel levelDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  622. + " On the main menu your score will be displayed once as your overall score."
  623. + " When in a session your total score as well as your session score will be visible."
  624. + " These scores will automaticly updated as you continue on with your session."
  625. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  626. levelDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  627. levelDescription.setBounds(150, 50, 700, 500);
  628.  
  629. JButton levelBack = new JButton("Return");
  630. levelBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  631. levelBack.setBounds(350, 600, 300, 100);
  632.  
  633. levelTutorial.add(levelTitle);
  634. levelTutorial.add(levelDescription);
  635. levelTutorial.add(levelBack);
  636.  
  637. card2.show(mainTutorial, "three");
  638.  
  639. levelBack.addActionListener(new ActionListener(){
  640.  
  641. public void actionPerformed(ActionEvent e){
  642.  
  643. tutorial();
  644.  
  645. }
  646. });
  647.  
  648. }
  649.  
  650. public static void type(){ //Main Programmer: Amarnath Parthiban
  651.  
  652. JPanel typeTutorial = new JPanel();
  653. typeTutorial.setLayout(null);
  654.  
  655. mainTutorial.add(typeTutorial, "four");
  656.  
  657. JLabel typeTitle = new JLabel("Type");
  658. typeTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  659. typeTitle.setBounds(380, 25, 700, 120);
  660.  
  661. JLabel typeDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  662. + " On the main menu your score will be displayed once as your overall score."
  663. + " When in a session your total score as well as your session score will be visible."
  664. + " These scores will automaticly updated as you continue on with your session."
  665. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  666. typeDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  667. typeDescription.setBounds(150, 50, 700, 500);
  668.  
  669. JButton typeBack = new JButton("Return");
  670. typeBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  671. typeBack.setBounds(350, 600, 300, 100);
  672.  
  673. typeTutorial.add(typeTitle);
  674. typeTutorial.add(typeDescription);
  675. typeTutorial.add(typeBack);
  676.  
  677. card2.show(mainTutorial, "four");
  678.  
  679. typeBack.addActionListener(new ActionListener(){
  680.  
  681. public void actionPerformed(ActionEvent e){
  682.  
  683. tutorial();
  684.  
  685. }
  686. });
  687.  
  688. }
  689.  
  690. public static void answering(){ //Main Programmer: Amarnath Parthiban
  691.  
  692. JPanel answeringTutorial = new JPanel();
  693. answeringTutorial.setLayout(null);
  694.  
  695. mainTutorial.add(answeringTutorial, "five");
  696.  
  697. JLabel answeringTitle = new JLabel("Answering");
  698. answeringTitle.setFont(new Font("Calibri", Font.PLAIN, 75));
  699. answeringTitle.setBounds(320, 25, 700, 120);
  700.  
  701. JLabel answeringDescription = new JLabel("<html>Your score, displayed as a percentage, will directly repersent the amount of question you answerd correnctl compared to the total amount of questions you've answered."
  702. + " On the main menu your score will be displayed once as your overall score."
  703. + " When in a session your total score as well as your session score will be visible."
  704. + " These scores will automaticly updated as you continue on with your session."
  705. + " If you choose to end session prematurely (before you have answered all the questions) your session pregress will not be saved and will not be added to your total score. </html>");
  706. answeringDescription.setFont(new Font("Calibri", Font.PLAIN, 25));
  707. answeringDescription.setBounds(150, 50, 700, 500);
  708.  
  709. JButton answeringBack = new JButton("Return");
  710. answeringBack.setFont(new Font("Calibri", Font.PLAIN, 32));
  711. answeringBack.setBounds(350, 600, 300, 100);
  712.  
  713. answeringTutorial.add(answeringTitle);
  714. answeringTutorial.add(answeringDescription);
  715. answeringTutorial.add(answeringBack);
  716.  
  717. card2.show(mainTutorial, "five");
  718.  
  719. answeringBack.addActionListener(new ActionListener(){
  720.  
  721. public void actionPerformed(ActionEvent e){
  722.  
  723. tutorial();
  724.  
  725. }
  726. });
  727.  
  728. }
  729. //END: methods used by the tutorial screen exclusively
  730. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement