ManualRoutePlanner 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056
  1. package route;
  2. /**
  3. *
  4. */
  5. import javax.swing.UIManager.LookAndFeelInfo;
  6. import java.awt.*;
  7. import java.awt.event.ActionEvent;
  8. import java.awt.event.ActionListener;
  9. import java.awt.event.KeyAdapter;
  10. import java.awt.event.KeyEvent;
  11. import java.awt.event.MouseAdapter;
  12. import java.awt.event.MouseEvent;
  13. import java.awt.event.MouseWheelEvent;
  14. import java.awt.event.MouseWheelListener;
  15. import javax.swing.border.Border;
  16. import javax.swing.*;
  17. public class ManualRoutePlanner extends JFrame {
  18. private Routeplanner routeplanner;
  19. private JMenuBar menuBar;
  20. private JButton button1;
  21. private JButton button10;
  22. private JButton button11;
  23. private JButton button12;
  24. private JButton button13;
  25. private JButton button14;
  26. private JButton button15;
  27. private JButton button16;
  28. private JButton button17;
  29. private JButton button18;
  30. private JButton button19;
  31. private JButton button2;
  32. private JButton button20;
  33. private JButton button21;
  34. private JButton button22;
  35. private JButton button23;
  36. private JButton button24;
  37. private JButton button25;
  38. private JButton button26;
  39. private JButton button27;
  40. private JButton button28;
  41. private JButton button29;
  42. private JButton button3;
  43. private JButton button30;
  44. private JButton button31;
  45. private JButton button32;
  46. private JButton button33;
  47. private JButton button34;
  48. private JButton button35;
  49. private JButton button36;
  50. private JButton button4;
  51. private JButton button5;
  52. private JButton button6;
  53. private JButton button7;
  54. private JButton button8;
  55. private JButton button9;
  56. private JButton button37;
  57. private JButton button38;
  58. private JButton button39;
  59. private int intx;
  60. private int inty;
  61. private int intbx;
  62. private int intby;
  63. //Constructor
  64. public ManualRoutePlanner(){
  65. final Routeplanner routeplanner = new Routeplanner(10,10);
  66. intx = 10;
  67. inty = 10;
  68. intbx = 10;
  69. intby = 10;
  70. setTitle("ManualRoutePlanner");
  71. setSize(697,598);
  72. //pane with null layout
  73. JPanel contentPane = new JPanel(null);
  74. contentPane.setPreferredSize(new Dimension(697,598));
  75. contentPane.setBackground(new Color(255,255,204));
  76. button1 = new JButton();
  77. button1.setBounds(5,5,90,35);
  78. button1.setBackground(new Color(214,217,223));
  79. button1.setForeground(new Color(0,0,0));
  80. button1.setEnabled(true);
  81. button1.setFont(new Font("sansserif",0,12));
  82. button1.setText("0,5");
  83. button1.setVisible(true);
  84. //Set methods for mouse events
  85. //Call defined methods
  86. button1.addMouseListener(new MouseAdapter()
  87. {
  88. public void mouseClicked(MouseEvent evt) {
  89. if(intx == 10) {
  90. intx = 0;
  91. inty = 5;
  92. }
  93. else {
  94. intbx = 0;
  95. intby = 5;
  96. }
  97. }
  98. }
  99. );
  100. button10 = new JButton();
  101. button10.setBounds(305,55,90,35);
  102. button10.setBackground(new Color(214,217,223));
  103. button10.setForeground(new Color(0,0,0));
  104. button10.setEnabled(true);
  105. button10.setFont(new Font("sansserif",0,12));
  106. button10.setText("3,4");
  107. button10.setVisible(true);
  108. button10.addMouseListener(new MouseAdapter()
  109. {
  110. public void mouseClicked(MouseEvent evt) {
  111. if(intx == 10) {
  112. intx = 3;
  113. inty = 4;
  114. }
  115. else {
  116. intbx = 3;
  117. intby = 4;
  118. }
  119. }
  120. }
  121. );
  122. button11 = new JButton();
  123. button11.setBounds(405,55,90,35);
  124. button11.setBackground(new Color(214,217,223));
  125. button11.setForeground(new Color(0,0,0));
  126. button11.setEnabled(true);
  127. button11.setFont(new Font("sansserif",0,12));
  128. button11.setText("4,4");
  129. button11.setVisible(true);
  130. button11.addMouseListener(new MouseAdapter()
  131. {
  132. public void mouseClicked(MouseEvent evt) {
  133. if(intx == 10) {
  134. intx = 4;
  135. inty = 4;
  136. }
  137. else {
  138. intbx = 4;
  139. intby = 4;
  140. }
  141. }
  142. }
  143. );
  144. button12 = new JButton();
  145. button12.setBounds(505,55,90,35);
  146. button12.setBackground(new Color(214,217,223));
  147. button12.setForeground(new Color(0,0,0));
  148. button12.setEnabled(true);
  149. button12.setFont(new Font("sansserif",0,12));
  150. button12.setText("5,4");
  151. button12.setVisible(true);
  152. button12.addMouseListener(new MouseAdapter()
  153. {
  154. public void mouseClicked(MouseEvent evt) {
  155. if(intx == 10) {
  156. intx = 5;
  157. inty = 4;
  158. }
  159. else {
  160. intbx = 5;
  161. intby = 4;
  162. }
  163. }
  164. }
  165. );
  166. button13 = new JButton();
  167. button13.setBounds(5,105,90,35);
  168. button13.setBackground(new Color(214,217,223));
  169. button13.setForeground(new Color(0,0,0));
  170. button13.setEnabled(true);
  171. button13.setFont(new Font("sansserif",0,12));
  172. button13.setText("0,3");
  173. button13.setVisible(true);
  174. button13.addMouseListener(new MouseAdapter()
  175. {
  176. public void mouseClicked(MouseEvent evt) {
  177. if(intx == 10) {
  178. intbx = 0;
  179. intby = 3;
  180. }
  181. else {
  182. intbx = 0;
  183. intby = 3;
  184. }
  185. }
  186. }
  187. );
  188. button14 = new JButton();
  189. button14.setBounds(105,105,90,35);
  190. button14.setBackground(new Color(214,217,223));
  191. button14.setForeground(new Color(0,0,0));
  192. button14.setEnabled(true);
  193. button14.setFont(new Font("sansserif",0,12));
  194. button14.setText("1,3");
  195. button14.setVisible(true);
  196. button14.addMouseListener(new MouseAdapter()
  197. {
  198. public void mouseClicked(MouseEvent evt) {
  199. if(intx == 10) {
  200. intx = 1;
  201. inty = 3;
  202. }
  203. else {
  204. intbx = 1;
  205. intby = 3;
  206. }
  207. }
  208. }
  209. );
  210. button15 = new JButton();
  211. button15.setBounds(205,105,90,35);
  212. button15.setBackground(new Color(214,217,223));
  213. button15.setForeground(new Color(0,0,0));
  214. button15.setEnabled(true);
  215. button15.setFont(new Font("sansserif",0,12));
  216. button15.setText("2,3");
  217. button15.setVisible(true);
  218. button15.addMouseListener(new MouseAdapter()
  219. {
  220. public void mouseClicked(MouseEvent evt) {
  221. if(intx == 10) {
  222. intx = 2;
  223. inty = 3;
  224. }
  225. else {
  226. intbx = 2;
  227. intby = 3;
  228. }
  229. }
  230. }
  231. );
  232. button16 = new JButton();
  233. button16.setBounds(305,105,90,35);
  234. button16.setBackground(new Color(214,217,223));
  235. button16.setForeground(new Color(0,0,0));
  236. button16.setEnabled(true);
  237. button16.setFont(new Font("sansserif",0,12));
  238. button16.setText("3,3");
  239. button16.setVisible(true);
  240. button16.addMouseListener(new MouseAdapter()
  241. {
  242. public void mouseClicked(MouseEvent evt) {
  243. if(intx == 10) {
  244. intx = 3;
  245. inty = 3;
  246. }
  247. else {
  248. intbx = 3;
  249. intby = 3;
  250. }
  251. }
  252. }
  253. );
  254. button17 = new JButton();
  255. button17.setBounds(405,105,90,35);
  256. button17.setBackground(new Color(214,217,223));
  257. button17.setForeground(new Color(0,0,0));
  258. button17.setEnabled(true);
  259. button17.setFont(new Font("sansserif",0,12));
  260. button17.setText("4,3");
  261. button17.setVisible(true);
  262. button17.addMouseListener(new MouseAdapter()
  263. {
  264. public void mouseClicked(MouseEvent evt) {
  265. if(intx == 10) {
  266. intx = 4;
  267. inty = 3;
  268. }
  269. else {
  270. intbx = 4;
  271. intby = 3;
  272. }
  273. }
  274. }
  275. );
  276. button18 = new JButton();
  277. button18.setBounds(505,105,90,35);
  278. button18.setBackground(new Color(214,217,223));
  279. button18.setForeground(new Color(0,0,0));
  280. button18.setEnabled(true);
  281. button18.setFont(new Font("sansserif",0,12));
  282. button18.setText("5,3");
  283. button18.setVisible(true);
  284. button18.addMouseListener(new MouseAdapter()
  285. {
  286. public void mouseClicked(MouseEvent evt) {
  287. if(intx == 10) {
  288. intx = 5;
  289. inty = 3;
  290. }
  291. else {
  292. intbx = 5;
  293. intby = 3;
  294. }
  295. }
  296. }
  297. );
  298. button19 = new JButton();
  299. button19.setBounds(5,155,90,35);
  300. button19.setBackground(new Color(214,217,223));
  301. button19.setForeground(new Color(0,0,0));
  302. button19.setEnabled(true);
  303. button19.setFont(new Font("sansserif",0,12));
  304. button19.setText("0,2");
  305. button19.setVisible(true);
  306. button19.addMouseListener(new MouseAdapter()
  307. {
  308. public void mouseClicked(MouseEvent evt) {
  309. if(intx == 10) {
  310. intx = 0;
  311. inty = 2;
  312. }
  313. else {
  314. intbx = 0;
  315. intby = 2;
  316. }
  317. }
  318. }
  319. );
  320. button2 = new JButton();
  321. button2.setBounds(105,5,90,35);
  322. button2.setBackground(new Color(214,217,223));
  323. button2.setForeground(new Color(0,0,0));
  324. button2.setEnabled(true);
  325. button2.setFont(new Font("sansserif",0,12));
  326. button2.setText("1,5");
  327. button2.setVisible(true);
  328. button2.addMouseListener(new MouseAdapter()
  329. {
  330. public void mouseClicked(MouseEvent evt) {
  331. if(intx == 10) {
  332. intx = 1;
  333. inty = 5;
  334. }
  335. else {
  336. intbx = 1;
  337. intby = 5;
  338. }
  339. }
  340. }
  341. );
  342. button20 = new JButton();
  343. button20.setBounds(105,155,90,35);
  344. button20.setBackground(new Color(214,217,223));
  345. button20.setForeground(new Color(0,0,0));
  346. button20.setEnabled(true);
  347. button20.setFont(new Font("sansserif",0,12));
  348. button20.setText("1,2");
  349. button20.setVisible(true);
  350. button20.addMouseListener(new MouseAdapter()
  351. {
  352. public void mouseClicked(MouseEvent evt) {
  353. if(intx == 10) {
  354. intx = 1;
  355. inty = 2;
  356. }
  357. else {
  358. intbx = 1;
  359. intby = 2;
  360. }
  361. }
  362. }
  363. );
  364. button21 = new JButton();
  365. button21.setBounds(205,155,90,35);
  366. button21.setBackground(new Color(214,217,223));
  367. button21.setForeground(new Color(0,0,0));
  368. button21.setEnabled(true);
  369. button21.setFont(new Font("sansserif",0,12));
  370. button21.setText("2,2");
  371. button21.setVisible(true);
  372. button21.addMouseListener(new MouseAdapter()
  373. {
  374. public void mouseClicked(MouseEvent evt) {
  375. if(intx == 10) {
  376. intx = 2;
  377. inty = 2;
  378. }
  379. else {
  380. intbx = 2;
  381. intby = 2;
  382. }
  383. }
  384. }
  385. );
  386. button22 = new JButton();
  387. button22.setBounds(305,155,90,35);
  388. button22.setBackground(new Color(214,217,223));
  389. button22.setForeground(new Color(0,0,0));
  390. button22.setEnabled(true);
  391. button22.setFont(new Font("sansserif",0,12));
  392. button22.setText("3,2");
  393. button22.setVisible(true);
  394. button22.addMouseListener(new MouseAdapter()
  395. {
  396. public void mouseClicked(MouseEvent evt) {
  397. if(intx == 10) {
  398. intx = 3;
  399. inty = 2;
  400. }
  401. else {
  402. intbx = 3;
  403. intby = 2;
  404. }
  405. }
  406. }
  407. );
  408. button23 = new JButton();
  409. button23.setBounds(405,155,90,35);
  410. button23.setBackground(new Color(214,217,223));
  411. button23.setForeground(new Color(0,0,0));
  412. button23.setEnabled(true);
  413. button23.setFont(new Font("sansserif",0,12));
  414. button23.setText("4,2");
  415. button23.setVisible(true);
  416. button23.addMouseListener(new MouseAdapter()
  417. {
  418. public void mouseClicked(MouseEvent evt) {
  419. if(intx == 10) {
  420. intx = 4;
  421. inty = 2;
  422. }
  423. else {
  424. intbx = 4;
  425. intby = 2;
  426. }
  427. }
  428. }
  429. );
  430. button24 = new JButton();
  431. button24.setBounds(505,155,90,35);
  432. button24.setBackground(new Color(214,217,223));
  433. button24.setForeground(new Color(0,0,0));
  434. button24.setEnabled(true);
  435. button24.setFont(new Font("sansserif",0,12));
  436. button24.setText("5,2");
  437. button24.setVisible(true);
  438. button24.addMouseListener(new MouseAdapter()
  439. {
  440. public void mouseClicked(MouseEvent evt) {
  441. if(intx == 10) {
  442. intx = 5;
  443. inty = 2;
  444. }
  445. else {
  446. intbx = 5;
  447. intby = 2;
  448. }
  449. }
  450. }
  451. );
  452. button25 = new JButton();
  453. button25.setBounds(5,205,90,35);
  454. button25.setBackground(new Color(214,217,223));
  455. button25.setForeground(new Color(0,0,0));
  456. button25.setEnabled(true);
  457. button25.setFont(new Font("sansserif",0,12));
  458. button25.setText("0,1");
  459. button25.setVisible(true);
  460. button25.addMouseListener(new MouseAdapter()
  461. {
  462. public void mouseClicked(MouseEvent evt) {
  463. if(intx == 10) {
  464. intx = 0;
  465. inty = 1;
  466. }
  467. else {
  468. intbx = 0;
  469. intby = 1;
  470. }
  471. }
  472. }
  473. );
  474. button26 = new JButton();
  475. button26.setBounds(105,205,90,35);
  476. button26.setBackground(new Color(214,217,223));
  477. button26.setForeground(new Color(0,0,0));
  478. button26.setEnabled(true);
  479. button26.setFont(new Font("sansserif",0,12));
  480. button26.setText("1,1");
  481. button26.setVisible(true);
  482. button26.addMouseListener(new MouseAdapter()
  483. {
  484. public void mouseClicked(MouseEvent evt) {
  485. if(intx == 10) {
  486. intx = 1;
  487. inty = 1;
  488. }
  489. else {
  490. intbx = 1;
  491. intby = 1;
  492. }
  493. }
  494. }
  495. );
  496. button27 = new JButton();
  497. button27.setBounds(205,205,90,35);
  498. button27.setBackground(new Color(214,217,223));
  499. button27.setForeground(new Color(0,0,0));
  500. button27.setEnabled(true);
  501. button27.setFont(new Font("sansserif",0,12));
  502. button27.setText("2,1");
  503. button27.setVisible(true);
  504. button27.addMouseListener(new MouseAdapter()
  505. {
  506. public void mouseClicked(MouseEvent evt) {
  507. if(intx == 10) {
  508. intx = 2;
  509. inty = 1;
  510. }
  511. else {
  512. intbx = 2;
  513. intby = 1;
  514. }
  515. }
  516. }
  517. );
  518. button28 = new JButton();
  519. button28.setBounds(305,205,90,35);
  520. button28.setBackground(new Color(214,217,223));
  521. button28.setForeground(new Color(0,0,0));
  522. button28.setEnabled(true);
  523. button28.setFont(new Font("sansserif",0,12));
  524. button28.setText("3,1");
  525. button28.setVisible(true);
  526. button28.addMouseListener(new MouseAdapter()
  527. {
  528. public void mouseClicked(MouseEvent evt) {
  529. if(intx == 10) {
  530. intx = 3;
  531. inty = 1;
  532. }
  533. else {
  534. intbx = 3;
  535. intby = 1;
  536. }
  537. }
  538. }
  539. );
  540. button29 = new JButton();
  541. button29.setBounds(405,205,90,35);
  542. button29.setBackground(new Color(214,217,223));
  543. button29.setForeground(new Color(0,0,0));
  544. button29.setEnabled(true);
  545. button29.setFont(new Font("sansserif",0,12));
  546. button29.setText("4,1");
  547. button29.setVisible(true);
  548. button29.addMouseListener(new MouseAdapter()
  549. {
  550. public void mouseClicked(MouseEvent evt) {
  551. if(intx == 10) {
  552. intx = 4;
  553. inty = 1;
  554. }
  555. else {
  556. intbx = 4;
  557. intby = 1;
  558. }
  559. }
  560. }
  561. );
  562. button3 = new JButton();
  563. button3.setBounds(205,5,90,35);
  564. button3.setBackground(new Color(214,217,223));
  565. button3.setForeground(new Color(0,0,0));
  566. button3.setEnabled(true);
  567. button3.setFont(new Font("sansserif",0,12));
  568. button3.setText("2,5");
  569. button3.setVisible(true);
  570. button3.addMouseListener(new MouseAdapter()
  571. {
  572. public void mouseClicked(MouseEvent evt) {
  573. if(intx == 10) {
  574. intx = 2;
  575. inty = 5;
  576. }
  577. else {
  578. intbx = 2;
  579. intby = 5;
  580. }
  581. }
  582. }
  583. );
  584. button30 = new JButton();
  585. button30.setBounds(505,205,90,35);
  586. button30.setBackground(new Color(214,217,223));
  587. button30.setForeground(new Color(0,0,0));
  588. button30.setEnabled(true);
  589. button30.setFont(new Font("sansserif",0,12));
  590. button30.setText("5,1");
  591. button30.setVisible(true);
  592. button30.addMouseListener(new MouseAdapter()
  593. {
  594. public void mouseClicked(MouseEvent evt) {
  595. if(intx == 10) {
  596. intx = 5;
  597. inty = 1;
  598. }
  599. else {
  600. intbx = 5;
  601. intby = 1;
  602. }
  603. }
  604. }
  605. );
  606. button31 = new JButton();
  607. button31.setBounds(5,255,90,35);
  608. button31.setBackground(new Color(214,217,223));
  609. button31.setForeground(new Color(0,0,0));
  610. button31.setEnabled(true);
  611. button31.setFont(new Font("sansserif",0,12));
  612. button31.setText("X = 0 ,Y = 0");
  613. button31.setVisible(true);
  614. button31.addMouseListener(new MouseAdapter()
  615. {
  616. public void mouseClicked(MouseEvent evt) {
  617. if(intx == 10) {
  618. intx = 0;
  619. inty = 0;
  620. }
  621. else {
  622. intbx = 0;
  623. intby = 0;
  624. }
  625. }
  626. }
  627. );
  628. button32 = new JButton();
  629. button32.setBounds(105,255,90,35);
  630. button32.setBackground(new Color(214,217,223));
  631. button32.setForeground(new Color(0,0,0));
  632. button32.setEnabled(true);
  633. button32.setFont(new Font("sansserif",0,12));
  634. button32.setText("1,0");
  635. button32.setVisible(true);
  636. button32.addMouseListener(new MouseAdapter()
  637. {
  638. public void mouseClicked(MouseEvent evt) {
  639. if(intx == 10) {
  640. intx = 1;
  641. inty = 0;
  642. }
  643. else {
  644. intbx = 1;
  645. intby = 0;
  646. }
  647. }
  648. }
  649. );
  650. button33 = new JButton();
  651. button33.setBounds(205,255,90,35);
  652. button33.setBackground(new Color(214,217,223));
  653. button33.setForeground(new Color(0,0,0));
  654. button33.setEnabled(true);
  655. button33.setFont(new Font("sansserif",0,12));
  656. button33.setText("2,0");
  657. button33.setVisible(true);
  658. button33.addMouseListener(new MouseAdapter()
  659. {
  660. public void mouseClicked(MouseEvent evt) {
  661. if(intx == 10) {
  662. intx = 2;
  663. inty = 0;
  664. }
  665. else {
  666. intbx = 2;
  667. intby = 0;
  668. }
  669. }
  670. }
  671. );
  672. button34 = new JButton();
  673. button34.setBounds(305,255,90,35);
  674. button34.setBackground(new Color(214,217,223));
  675. button34.setForeground(new Color(0,0,0));
  676. button34.setEnabled(true);
  677. button34.setFont(new Font("sansserif",0,12));
  678. button34.setText("3,0");
  679. button34.setVisible(true);
  680. button34.addMouseListener(new MouseAdapter()
  681. {
  682. public void mouseClicked(MouseEvent evt) {
  683. if(intx == 10) {
  684. intx = 3;
  685. inty = 0;
  686. }
  687. else {
  688. intbx = 3;
  689. intby = 0;
  690. }
  691. }
  692. }
  693. );
  694. button35 = new JButton();
  695. button35.setBounds(405,255,90,35);
  696. button35.setBackground(new Color(214,217,223));
  697. button35.setForeground(new Color(0,0,0));
  698. button35.setEnabled(true);
  699. button35.setFont(new Font("sansserif",0,12));
  700. button35.setText("4,0");
  701. button35.setVisible(true);
  702. button35.addMouseListener(new MouseAdapter()
  703. {
  704. public void mouseClicked(MouseEvent evt) {
  705. if(intx == 10) {
  706. intx = 4;
  707. inty = 0;
  708. }
  709. else {
  710. intbx = 4;
  711. intby = 0;
  712. }
  713. }
  714. }
  715. );
  716. button36 = new JButton();
  717. button36.setBounds(505,255,90,35);
  718. button36.setBackground(new Color(214,217,223));
  719. button36.setForeground(new Color(0,0,0));
  720. button36.setEnabled(true);
  721. button36.setFont(new Font("sansserif",0,12));
  722. button36.setText("5,0");
  723. button36.setVisible(true);
  724. button36.addMouseListener(new MouseAdapter()
  725. {
  726. public void mouseClicked(MouseEvent evt) {
  727. if(intx == 10) {
  728. intx = 5;
  729. inty = 0;
  730. }
  731. else {
  732. intbx = 5;
  733. intby = 0;
  734. }
  735. }
  736. }
  737. );
  738. button4 = new JButton();
  739. button4.setBounds(305,5,90,35);
  740. button4.setBackground(new Color(214,217,223));
  741. button4.setForeground(new Color(0,0,0));
  742. button4.setEnabled(true);
  743. button4.setFont(new Font("sansserif",0,12));
  744. button4.setText("3,5");
  745. button4.setVisible(true);
  746. button4.addMouseListener(new MouseAdapter()
  747. {
  748. public void mouseClicked(MouseEvent evt) {
  749. if(intx == 10) {
  750. intx = 3;
  751. inty = 5;
  752. }
  753. else {
  754. intbx = 3;
  755. intby = 5;
  756. }
  757. }
  758. }
  759. );
  760. button5 = new JButton();
  761. button5.setBounds(405,5,90,35);
  762. button5.setBackground(new Color(214,217,223));
  763. button5.setForeground(new Color(0,0,0));
  764. button5.setEnabled(true);
  765. button5.setFont(new Font("sansserif",0,12));
  766. button5.setText("4,5");
  767. button5.setVisible(true);
  768. button5.addMouseListener(new MouseAdapter()
  769. {
  770. public void mouseClicked(MouseEvent evt) {
  771. if(intx == 10) {
  772. intx = 4;
  773. inty = 5;
  774. }
  775. else {
  776. intbx = 4;
  777. intby = 5;
  778. }
  779. }
  780. }
  781. );
  782. button6 = new JButton();
  783. button6.setBounds(505,5,90,35);
  784. button6.setBackground(new Color(214,217,223));
  785. button6.setForeground(new Color(0,0,0));
  786. button6.setEnabled(true);
  787. button6.setFont(new Font("sansserif",0,12));
  788. button6.setText("5,5");
  789. button6.setVisible(true);
  790. button6.addMouseListener(new MouseAdapter()
  791. {
  792. public void mouseClicked(MouseEvent evt) {
  793. if(intx == 10) {
  794. intx = 5;
  795. inty = 5;
  796. }
  797. else {
  798. intbx = 5;
  799. intby = 5;
  800. }
  801. }
  802. }
  803. );
  804. button7 = new JButton();
  805. button7.setBounds(5,55,90,35);
  806. button7.setBackground(new Color(214,217,223));
  807. button7.setForeground(new Color(0,0,0));
  808. button7.setEnabled(true);
  809. button7.setFont(new Font("sansserif",0,12));
  810. button7.setText("0,4");
  811. button7.setVisible(true);
  812. button7.addMouseListener(new MouseAdapter()
  813. {
  814. public void mouseClicked(MouseEvent evt) {
  815. if(intx == 10) {
  816. intx = 0;
  817. inty = 4;
  818. }
  819. else {
  820. intbx = 0;
  821. intby = 4;
  822. }
  823. }
  824. }
  825. );
  826. button8 = new JButton();
  827. button8.setBounds(105,55,90,35);
  828. button8.setBackground(new Color(214,217,223));
  829. button8.setForeground(new Color(0,0,0));
  830. button8.setEnabled(true);
  831. button8.setFont(new Font("sansserif",0,12));
  832. button8.setText("1,4");
  833. button8.setVisible(true);
  834. button8.addMouseListener(new MouseAdapter()
  835. {
  836. public void mouseClicked(MouseEvent evt) {
  837. if(intx == 10) {
  838. intx = 1;
  839. inty = 4;
  840. }
  841. else {
  842. intbx = 1;
  843. intby = 4;
  844. }
  845. }
  846. }
  847. );
  848. button9 = new JButton();
  849. button9.setBounds(205,55,90,35);
  850. button9.setBackground(new Color(214,217,223));
  851. button9.setForeground(new Color(0,0,0));
  852. button9.setEnabled(true);
  853. button9.setFont(new Font("sansserif",0,12));
  854. button9.setText("2,4");
  855. button9.setVisible(true);
  856. button9.addMouseListener(new MouseAdapter()
  857. {
  858. public void mouseClicked(MouseEvent evt) {
  859. if(intx == 10) {
  860. intx = 2;
  861. inty = 4;
  862. }
  863. else {
  864. intbx = 2;
  865. intby = 4;
  866. }
  867. }
  868. }
  869. );
  870. button37 = new JButton();
  871. button37.setBounds(255,305,100,40);
  872. button37.setBackground(new Color(214,217,223));
  873. button37.setForeground(new Color(0,0,0));
  874. button37.setEnabled(true);
  875. button37.setFont(new Font("sansserif",0,12));
  876. button37.setText("GeefRoute");
  877. button37.setVisible(true);
  878. button37.addMouseListener(new MouseAdapter()
  879. {
  880. public void mouseClicked(MouseEvent evt) {
  881. routeplanner.berekenRoute(intbx, intby, intx, inty, 0);
  882. }
  883. }
  884. );
  885. button38 = new JButton();
  886. button38.setBounds(190,365,100,40);
  887. button38.setBackground(new Color(214,217,223));
  888. button38.setForeground(new Color(0,0,0));
  889. button38.setEnabled(true);
  890. button38.setFont(new Font("sansserif",0,12));
  891. button38.setText("RESET");
  892. button38.setVisible(true);
  893. button38.addMouseListener(new MouseAdapter()
  894. {
  895. public void mouseClicked(MouseEvent evt) {
  896. intx = 10;
  897. inty = 10;
  898. intbx = 10;
  899. intby = 10;
  900. }
  901. }
  902. );
  903. button39 = new JButton();
  904. button39.setBounds(320,365,100,40);
  905. button39.setBackground(new Color(214,217,223));
  906. button39.setForeground(new Color(0,0,0));
  907. button39.setEnabled(true);
  908. button39.setFont(new Font("sansserif",0,12));
  909. button39.setText("Print");
  910. button39.setVisible(true);
  911. button39.addMouseListener(new MouseAdapter()
  912. {
  913. public void mouseClicked(MouseEvent evt) {
  914. System.out.println("start x = " + intx );
  915. System.out.println("start y = " + inty );
  916. System.out.println("eind x = " + intbx );
  917. System.out.println("eind y = " + intby );
  918. }
  919. }
  920. );
  921. //adding components to contentPane panel
  922. contentPane.add(button1);
  923. contentPane.add(button10);
  924. contentPane.add(button11);
  925. contentPane.add(button12);
  926. contentPane.add(button13);
  927. contentPane.add(button14);
  928. contentPane.add(button15);
  929. contentPane.add(button16);
  930. contentPane.add(button17);
  931. contentPane.add(button18);
  932. contentPane.add(button19);
  933. contentPane.add(button2);
  934. contentPane.add(button20);
  935. contentPane.add(button21);
  936. contentPane.add(button22);
  937. contentPane.add(button23);
  938. contentPane.add(button24);
  939. contentPane.add(button25);
  940. contentPane.add(button26);
  941. contentPane.add(button27);
  942. contentPane.add(button28);
  943. contentPane.add(button29);
  944. contentPane.add(button3);
  945. contentPane.add(button30);
  946. contentPane.add(button31);
  947. contentPane.add(button32);
  948. contentPane.add(button33);
  949. contentPane.add(button34);
  950. contentPane.add(button35);
  951. contentPane.add(button36);
  952. contentPane.add(button4);
  953. contentPane.add(button5);
  954. contentPane.add(button6);
  955. contentPane.add(button7);
  956. contentPane.add(button8);
  957. contentPane.add(button9);
  958. contentPane.add(button37);
  959. contentPane.add(button38);
  960. contentPane.add(button39);
  961. //adding panel to JFrame and seting of window position and close operation
  962. getContentPane().add(contentPane);
  963. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  964. setLocationRelativeTo(null);
  965. pack();
  966. setVisible(true);
  967. }
  968. public static void main(String[] args){
  969. System.setProperty("swing.defaultlaf", "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
  970. javax.swing.SwingUtilities.invokeLater(new Runnable() {
  971. public void run() {
  972. new ManualRoutePlanner();
  973. }
  974. });
  975. }
  976. }