Travel Agency. Khateeb Engineering Classes. Mini Project. Khateeb Engineering Classes: / Technology to be used

Size: px
Start display at page:

Download "Travel Agency. Khateeb Engineering Classes. Mini Project. Khateeb Engineering Classes: / Technology to be used"

Transcription

1 Khateeb Engineering Classes Mini Project Travel Agency Technology to be used Front end :Java Swings Back End: PHP Myadmin Requirements : 1) Jdk ( version 1.6 or upwards) 2) Netbeans (Version 6.0 or upwards) 3) WAMP server 4) Jcalendar.jar (version 1.4) 5) Rs2xml (Jar file) 6) Lots of common sense and patience Junaid Sir : Page 1

2 Screen 1 : package com.travel; import java.awt.color; import java.util.logging.level; import java.util.logging.logger; public class splash extends javax.swing.jframe { static Thread t = new Thread(); // we need this for implementing timer public splash() throws InterruptedException { //the sleep method which we use for thread throws this exception initcomponents(); Color backgroundcolor = new Color(200,204,255); this.getcontentpane().setbackground(backgroundcolor); setvisible(true); Junaid Sir : Page 2

3 for (int i = 1;i<=5;i++) // we want the splash screen to go away automatically after 5 seconds { /** t.sleep(1000); MainMenuScreen mms = new MainMenuScreen(); dispose();//this will delete the splash screen * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. // <editor-fold defaultstate="collapsed" desc="generated Code"> private void initcomponents() { jlabel1 = new javax.swing.jlabel(); jlabel2 = new javax.swing.jlabel(); jlabel3 = new javax.swing.jlabel(); jlabel4 = new javax.swing.jlabel(); filler1 = new javax.swing.box.filler(new java.awt.dimension(600, 0), new java.awt.dimension(600, 0), new java.awt.dimension(600, 32767)); filler2 = new javax.swing.box.filler(new java.awt.dimension(400, 0), new java.awt.dimension(400, 0), new java.awt.dimension(400, 32767)); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); setbackground(new java.awt.color(255, 204, 204)); setforeground(java.awt.color.red); setundecorated(true); Junaid Sir : Page 3

4 setresizable(false); jlabel1.setfont(new java.awt.font("century Gothic", 1, 70)); // NOI18N jlabel1.setforeground(new java.awt.color(0, 0, 51)); jlabel1.settext("welcome to "); jlabel2.setfont(new java.awt.font("kristen ITC", 1, 80)); // NOI18N jlabel2.setforeground(new java.awt.color(0, 0, 51)); jlabel2.settext("globe Trotters"); jlabel4.seticon(new javax.swing.imageicon("c:\\users\\java\\desktop\\globetrotters\\globe-splash.jpg")); // NOI18N javax.swing.grouplayout layout = new javax.swing.grouplayout(getcontentpane()); getcontentpane().setlayout(layout); layout.sethorizontalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(javax.swing.grouplayout.alignment.trailing, layout.createsequentialgroup().addcontainergap(682, Short.MAX_VALUE).addComponent(jLabel3).addGap(18, 18, 18)).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(136, Short.MAX_VALUE).addComponent(jLabel1).addContainerGap(132, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) Junaid Sir : Page 4

5 .addcomponent(jlabel2).addgap(0, 0, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(333, Short.MAX_VALUE).addComponent(jLabel4).addContainerGap(87, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(50, Short.MAX_VALUE).addComponent(filler1, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size).addcontainergap(50, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(150, Short.MAX_VALUE).addComponent(filler2, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size).addcontainergap(150, Short.MAX_VALUE))) ); layout.setverticalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(javax.swing.grouplayout.alignment.trailing, layout.createsequentialgroup().addcontainergap(295, Short.MAX_VALUE).addComponent(jLabel3, javax.swing.grouplayout.preferred_size, 168, javax.swing.grouplayout.preferred_size) Junaid Sir : Page 5

6 .addgap(28, 28, 28)).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(89, Short.MAX_VALUE).addComponent(jLabel1).addContainerGap(315, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(jLabel2).addGap(0, 0, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(319, Short.MAX_VALUE).addComponent(jLabel4, javax.swing.grouplayout.preferred_size, 138, javax.swing.grouplayout.preferred_size).addcontainergap(34, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(32, Short.MAX_VALUE) Junaid Sir : Page 6

7 .addcomponent(filler1, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size).addcontainergap(459, Short.MAX_VALUE))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcontainergap(35, Short.MAX_VALUE).addComponent(filler2, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size) ); pack();.addcontainergap(456, Short.MAX_VALUE))) setlocationrelativeto(null); // </editor-fold> public static void main(string args[]) { /* Set the Nimbus look and feel */ "> //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see */ try { for (javax.swing.uimanager.lookandfeelinfo info : javax.swing.uimanager.getinstalledlookandfeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.uimanager.setlookandfeel(info.getclassname()); Junaid Sir : Page 7

8 break; catch (ClassNotFoundException ex) { java.util.logging.logger.getlogger(splash.class.getname()).log(java.util.logging.level.s EVERE, null, ex); catch (InstantiationException ex) { java.util.logging.logger.getlogger(splash.class.getname()).log(java.util.logging.level.s EVERE, null, ex); catch (IllegalAccessException ex) { java.util.logging.logger.getlogger(splash.class.getname()).log(java.util.logging.level.s EVERE, null, ex); catch (javax.swing.unsupportedlookandfeelexception ex) { java.util.logging.logger.getlogger(splash.class.getname()).log(java.util.logging.level.s EVERE, null, ex); //</editor-fold> /* Create and display the form */ java.awt.eventqueue.invokelater(new Runnable() { public void run() { try {//this has been added as if we dont do it,the constructor reporting exception will create a problem ); new splash().setvisible(true); catch (InterruptedException ex) { Logger.getLogger(splash.class.getName()).log(Level.SEVERE, null, ex); Junaid Sir : Page 8

9 // Variables declaration - do not modify private javax.swing.box.filler filler1; private javax.swing.box.filler filler2; private javax.swing.jlabel jlabel1; private javax.swing.jlabel jlabel2; private javax.swing.jlabel jlabel3; private javax.swing.jlabel jlabel4; // End of variables declaration Screen 2 : Junaid Sir : Page 9

10 package com.travel; import java.awt.color; import java.sql.sqlexception; import java.util.calendar; import java.util.gregoriancalendar; import java.util.logging.level; import java.util.logging.logger; public class MainMenuScreen extends javax.swing.jframe { public MainMenuScreen() { initcomponents(); Color backgroundcolor = new Color(200,204,255); this.getcontentpane().setbackground(backgroundcolor); setvisible(true); setresizable(false); clockdisplay(); void clockdisplay() { Calendar cal = new GregorianCalendar(); int month = cal.get(calendar.month); int date = cal.get(calendar.date); int year = cal.get(calendar.year); Junaid Sir : Page 10

11 lbldate.settext("date :"+ date + "-" + (month+1) + "-" + year); /*we are creating a thread as we want the time to refresh after every second. if refreshing is not needed then this thread is not required*/ Thread clocktime = new Thread() { public void run() { try { while (true) { Calendar c = new GregorianCalendar(); int hour = c.get(calendar.hour); int min = c.get(calendar.minute); int sec = c.get(calendar.second); lbltime.settext("time :"+ hour + ":" + min + ":" + sec); sleep(1000); catch (InterruptedException ex) { Logger.getLogger(MainMenuScreen.class.getName()).log(Level.SEVERE, null, ex); ; //end of thread Junaid Sir : Page 11

12 clocktime.start(); // <editor-fold defaultstate="collapsed" desc="generated Code"> private void initcomponents() { jlabel1 = new javax.swing.jlabel(); jlabel2 = new javax.swing.jlabel(); lblflightbooking = new javax.swing.jlabel(); lblhotelbooking = new javax.swing.jlabel(); lbldate = new javax.swing.jlabel(); jlabel5 = new javax.swing.jlabel(); lbltime = new javax.swing.jlabel(); jmenubar1 = new javax.swing.jmenubar(); jmenu1 = new javax.swing.jmenu(); jmenuitem1 = new javax.swing.jmenuitem(); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); seticonimages(null); setpreferredsize(new java.awt.dimension(700, 600)); setresizable(false); jlabel1.seticon(new javax.swing.imageicon("c:\\users\\java\\desktop\\globetrotters\\hotel.jpg")); // NOI18N jlabel2.seticon(new javax.swing.imageicon("c:\\users\\java\\desktop\\globetrotters\\flight.jpg")); // NOI18N lblflightbooking.setfont(new java.awt.font("tahoma", 1, 18)); // NOI18N lblflightbooking.setforeground(new java.awt.color(102, 0, 0)); lblflightbooking.settext("click here for flight booking"); lblflightbooking.setname("lblflightbooking"); // NOI18N lblflightbooking.addmouselistener(new java.awt.event.mouseadapter() { Junaid Sir : Page 12

13 public void mouseclicked(java.awt.event.mouseevent evt) { lblflightbookingmouseclicked(evt); ); lblhotelbooking.setfont(new java.awt.font("tahoma", 1, 18)); // NOI18N lblhotelbooking.setforeground(new java.awt.color(102, 0, 0)); lblhotelbooking.settext("click here for Hotel booking"); lblhotelbooking.setname("lblhotelbooking"); // NOI18N lbldate.setfont(new java.awt.font("tahoma", 1, 14)); // NOI18N lbldate.settext("lbldate"); lbldate.setname("lbldate"); // NOI18N jlabel5.setfont(new java.awt.font("tahoma", 1, 24)); // NOI18N jlabel5.setname("lbltime"); // NOI18N lbltime.setfont(new java.awt.font("tahoma", 1, 14)); // NOI18N lbltime.settext("lbltime"); lbltime.setname("lbltime"); // NOI18N jmenubar1.setmaximumsize(new java.awt.dimension(27, 200)); jmenubar1.setname("adminmenu"); // NOI18N jmenu1.settext("admin Login"); jmenuitem1.settext("login to Admin Account"); jmenuitem1.setname("menulogin"); // NOI18N jmenu1.add(jmenuitem1); jmenubar1.add(jmenu1); Junaid Sir : Page 13

14 setjmenubar(jmenubar1); javax.swing.grouplayout layout = new javax.swing.grouplayout(getcontentpane()); getcontentpane().setlayout(layout); layout.sethorizontalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leadin G).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jLabel2)).addGroup(layout.createSequentialGroup().addGap(68, 68, 68).addComponent(lblflightbooking))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(layout.createSequentialGroup().addComponent(lblhotelbooking).addGap(0, 0, Short.MAX_VALUE)).addComponent(jLabel1, javax.swing.grouplayout.default_size, javax.swing.grouplayout.default_size, Short.MAX_VALUE))).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addgap(0, 0, Short.MAX_VALUE) Junaid Sir : Page 14

15 .addcomponent(jlabel5).addgap(305, 305, 305).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addComponent(lbltime, javax.swing.grouplayout.preferred_size, 140, javax.swing.grouplayout.preferred_size).addcomponent(lbldate, javax.swing.grouplayout.preferred_size, 158, javax.swing.grouplayout.preferred_size)))).addcontainergap()) ); layout.setverticalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addgap(64, 64, 64).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G, false).addcomponent(jlabel1, javax.swing.grouplayout.preferred_size, 0, Short.MAX_VALUE).addComponent(jLabel2, javax.swing.grouplayout.default_size, javax.swing.grouplayout.default_size, Short.MAX_VALUE)).addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELI NE).addComponent(lblflightbooking).addComponent(lblhotelbooking)).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(layout.createSequentialGroup().addGap(192, 192, 192).addComponent(jLabel5).addContainerGap(69, Short.MAX_VALUE)) Junaid Sir : Page 15

16 .addgroup(javax.swing.grouplayout.alignment.trailing, layout.createsequentialgroup().addpreferredgap(javax.swing.layoutstyle.componentplacement.related, javax.swing.grouplayout.default_size, Short.MAX_VALUE).addComponent(lbldate, javax.swing.grouplayout.preferred_size, 39, javax.swing.grouplayout.preferred_size).addpreferredgap(javax.swing.layoutstyle.componentplacement.related).addcomponent(lbltime, javax.swing.grouplayout.preferred_size, 45, javax.swing.grouplayout.preferred_size) );.addgap(21, 21, 21)))) pack(); setlocationrelativeto(null); // </editor-fold> private void lblflightbookingmouseclicked(java.awt.event.mouseevent evt) { try { // TODO add your handling code here: flightbooking fb = new flightbooking(); //try-catch is needed here as,flight booking class is reporting exception catch (ClassNotFoundException ex) { ex); Logger.getLogger(MainMenuScreen.class.getName()).log(Level.SEVERE, null, catch (SQLException ex) { ex); Logger.getLogger(MainMenuScreen.class.getName()).log(Level.SEVERE, null, Junaid Sir : Page 16

17 this.setvisible(false); public static void main(string args[]) { /* Set the Nimbus look and feel */ "> //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see */ try { for (javax.swing.uimanager.lookandfeelinfo info : javax.swing.uimanager.getinstalledlookandfeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.uimanager.setlookandfeel(info.getclassname()); break; catch (ClassNotFoundException ex) { java.util.logging.logger.getlogger(mainmenuscreen.class.getname()).log(java.util.logg ing.level.severe, null, ex); catch (InstantiationException ex) { java.util.logging.logger.getlogger(mainmenuscreen.class.getname()).log(java.util.logg ing.level.severe, null, ex); catch (IllegalAccessException ex) { java.util.logging.logger.getlogger(mainmenuscreen.class.getname()).log(java.util.logg ing.level.severe, null, ex); Junaid Sir : Page 17

18 catch (javax.swing.unsupportedlookandfeelexception ex) { java.util.logging.logger.getlogger(mainmenuscreen.class.getname()).log(java.util.logg ing.level.severe, null, ex); //</editor-fold> /* Create and display the form */ java.awt.eventqueue.invokelater(new Runnable() { public void run() { new MainMenuScreen().setVisible(true); ); // Variables declaration - do not modify private javax.swing.jlabel jlabel1; private javax.swing.jlabel jlabel2; private javax.swing.jlabel jlabel5; private javax.swing.jmenu jmenu1; private javax.swing.jmenubar jmenubar1; private javax.swing.jmenuitem jmenuitem1; private javax.swing.jlabel lbldate; private javax.swing.jlabel lblflightbooking; private javax.swing.jlabel lblhotelbooking; private javax.swing.jlabel lbltime; // End of variables declaration Screen 3 : Junaid Sir : Page 18

19 package com.travel; import com.model.dbaseaccount; import java.awt.color; import java.sql.resultset; import java.sql.sqlexception; import java.util.date; import java.util.vector; import java.util.logging.level; import java.util.logging.logger; import javax.swing.buttongroup; import javax.swing.joptionpane; import javax.swing.table.defaulttablemodel; Junaid Sir : Page 19

20 import javax.swing.table.tablemodel; import net.proteanit.sql.dbutils; public class flightbooking extends javax.swing.jframe { ResultSet rs,rsreturn; int option; //to determine if the operation is one-way or return //NOTE: for adding a date picker we need to first download jcalendar.jar // i have copied jdatechooser (version 1.4) in my netbeans folder //then include this file in your palette manager from tools on top of your netbeans screen. //we have also downloaded rs2xml file and added to libraries, will need that for table operations /** * Creates new form flightbooking */ public flightbooking() throws ClassNotFoundException, SQLException { initcomponents(); Color backgroundcolor = new Color(200,204,255); this.getcontentpane().setbackground(backgroundcolor); departtablejpanel.setvisible(false); //we are placing the tables in side panels returntablejpanel.setvisible(false); buttonconfirm.setvisible(false); fillcombobox(); Junaid Sir : Page 20

21 setvisible(true); setresizable(false); public void fillcombobox() throws ClassNotFoundException, SQLException { //first we will empty all comboboxes cmborigin.removeallitems(); cmbdestination.removeallitems(); //Code for AUto populating the cities Combo boxes //for this we have written a getcities() method in dbaseaccount.java file dbaseaccount dba = new dbaseaccount(); //this is our class in com.model rs = dba.getsourcecity(); while (rs.next()== true) { cmborigin.additem(rs.getstring("source")); rs = dba.getdestinationcity(); while (rs.next()== true) { cmbdestination.additem(rs.getstring("destination")); Junaid Sir : Page 21

22 /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. // <editor-fold defaultstate="collapsed" desc="generated Code"> private void initcomponents() { buttongroup1 = new javax.swing.buttongroup(); buttongroup2 = new javax.swing.buttongroup(); buttongroup3 = new javax.swing.buttongroup(); buttongroup4 = new javax.swing.buttongroup(); buttongroup5 = new javax.swing.buttongroup(); jcalmodel1 = new com.jcalendar.model.jcalmodel(); jcalmodel2 = new com.jcalendar.model.jcalmodel(); jdatepickerutil1 = new org.jdatepicker.util.jdatepickerutil(); jdatepickerutil2 = new org.jdatepicker.util.jdatepickerutil(); jdatepickerutil3 = new org.jdatepicker.util.jdatepickerutil(); jdatepickerutil4 = new org.jdatepicker.util.jdatepickerutil(); jcalmodel3 = new com.jcalendar.model.jcalmodel(); jcalmodel4 = new com.jcalendar.model.jcalmodel(); jdatepickerutil5 = new org.jdatepicker.util.jdatepickerutil(); jlabel1 = new javax.swing.jlabel(); radiooneway = new javax.swing.jradiobutton(); radioreturn = new javax.swing.jradiobutton(); Junaid Sir : Page 22

23 lblorigin = new javax.swing.jlabel(); cmborigin = new javax.swing.jcombobox<>(); lbldestination = new javax.swing.jlabel(); cmbdestination = new javax.swing.jcombobox<>(); lbldeparture = new javax.swing.jlabel(); lblreturn = new javax.swing.jlabel(); buttonsearch = new javax.swing.jbutton(); buttoncancel = new javax.swing.jbutton(); departurejdatechooser = new com.toedter.calendar.jdatechooser(); returnjdatechooser = new com.toedter.calendar.jdatechooser(); departtablejpanel = new javax.swing.jpanel(); jscrollpane2 = new javax.swing.jscrollpane(); departuretable = new javax.swing.jtable(); jlabel2 = new javax.swing.jlabel(); jlabel3 = new javax.swing.jlabel(); cmbselectdepartflight = new javax.swing.jcombobox<>(); returntablejpanel = new javax.swing.jpanel(); jlabel4 = new javax.swing.jlabel(); jscrollpane1 = new javax.swing.jscrollpane(); returntable = new javax.swing.jtable(); jlabel5 = new javax.swing.jlabel(); cmbreturnflight = new javax.swing.jcombobox<>(); buttonconfirm = new javax.swing.jbutton(); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); jlabel1.setfont(new java.awt.font("times New Roman", 1, 14)); // NOI18N jlabel1.setforeground(new java.awt.color(153, 0, 0)); Junaid Sir : Page 23

24 jlabel1.settext("help us choose the best flight for you..."); radiooneway.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N radiooneway.setforeground(new java.awt.color(0, 0, 102)); radiooneway.settext("one Way"); radiooneway.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { radioonewaymouseclicked(evt); ); radiooneway.addactionlistener(new java.awt.event.actionlistener() { public void actionperformed(java.awt.event.actionevent evt) { radioonewayactionperformed(evt); ); radioreturn.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N radioreturn.setforeground(new java.awt.color(0, 0, 102)); radioreturn.settext("return"); radioreturn.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { radioreturnmouseclicked(evt); ); radioreturn.addactionlistener(new java.awt.event.actionlistener() { public void actionperformed(java.awt.event.actionevent evt) { radioreturnactionperformed(evt); Junaid Sir : Page 24

25 ); lblorigin.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N lblorigin.setforeground(new java.awt.color(0, 0, 102)); lblorigin.settext("city of Origin"); cmborigin.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N cmborigin.setmodel(new javax.swing.defaultcomboboxmodel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" )); cmborigin.setenabled(false); cmborigin.addactionlistener(new java.awt.event.actionlistener() { ); public void actionperformed(java.awt.event.actionevent evt) { cmboriginactionperformed(evt); lbldestination.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N lbldestination.setforeground(new java.awt.color(0, 0, 102)); lbldestination.settext("destination"); cmbdestination.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N cmbdestination.setmodel(new javax.swing.defaultcomboboxmodel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" )); cmbdestination.setenabled(false); cmbdestination.additemlistener(new java.awt.event.itemlistener() { public void itemstatechanged(java.awt.event.itemevent evt) { cmbdestinationitemstatechanged(evt); Junaid Sir : Page 25

26 ); cmbdestination.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { cmbdestinationmouseclicked(evt); ); lbldeparture.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N lbldeparture.setforeground(new java.awt.color(0, 0, 102)); lbldeparture.settext("depature Date"); lblreturn.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N lblreturn.setforeground(new java.awt.color(0, 0, 102)); lblreturn.settext("return Date"); buttonsearch.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N buttonsearch.settext("search"); buttonsearch.setenabled(false); buttonsearch.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { buttonsearchmouseclicked(evt); ); buttonsearch.addkeylistener(new java.awt.event.keyadapter() { public void keypressed(java.awt.event.keyevent evt) { buttonsearchkeypressed(evt); ); Junaid Sir : Page 26

27 buttoncancel.setfont(new java.awt.font("times New Roman", 1, 12)); // NOI18N buttoncancel.settext("cancel"); buttoncancel.setenabled(false); buttoncancel.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { buttoncancelmouseclicked(evt); ); departurejdatechooser.setenabled(false); returnjdatechooser.setenabled(false); departtablejpanel.setborder(javax.swing.borderfactory.creatematteborder(1, 1, 1, 1, new java.awt.color(0, 102, 102))); departuretable.setfont(new java.awt.font("tahoma", 1, 12)); // NOI18N departuretable.setforeground(new java.awt.color(51, 0, 153)); departuretable.setmodel(new javax.swing.table.defaulttablemodel( new Object [][] { {null, null, null, null, {null, null, null, null, {null, null, null, null, {null, null, null, null, new String [] { Junaid Sir : Page 27

28 "Title 1", "Title 2", "Title 3", "Title 4" )); jscrollpane2.setviewportview(departuretable); jlabel2.setfont(new java.awt.font("tahoma", 1, 14)); // NOI18N jlabel2.setforeground(new java.awt.color(0, 0, 102)); jlabel2.settext("departure Flight"); jlabel3.setfont(new java.awt.font("tahoma", 1, 11)); // NOI18N jlabel3.setforeground(new java.awt.color(51, 0, 102)); jlabel3.settext("select your flight"); cmbselectdepartflight.setfont(new java.awt.font("tahoma", 1, 11)); // NOI18N cmbselectdepartflight.setforeground(new java.awt.color(51, 0, 102)); cmbselectdepartflight.addactionlistener(new java.awt.event.actionlistener() { public void actionperformed(java.awt.event.actionevent evt) { cmbselectdepartflightactionperformed(evt); ); javax.swing.grouplayout departtablejpanellayout = new javax.swing.grouplayout(departtablejpanel); departtablejpanel.setlayout(departtablejpanellayout); departtablejpanellayout.sethorizontalgroup( departtablejpanellayout.createparallelgroup(javax.swing.grouplayout.alignment.le ADING) Junaid Sir : Page 28

29 .addgroup(departtablejpanellayout.createsequentialgroup().addcontainergap().addgroup(departtablejpanellayout.createparallelgroup(javax.swing.grouplayout.al ignment.leading).addcomponent(jscrollpane2, javax.swing.grouplayout.default_size, 525, Short.MAX_VALUE).addGroup(departtablejPanelLayout.createSequentialGroup().addComponent(jLabel2).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, departtablejpanellayout.createsequentialgroup().addcontainergap(javax.swing.grouplayout.default_size, Short.MAX_VALUE).addComponent(jLabel3, javax.swing.grouplayout.preferred_size, 127, javax.swing.grouplayout.preferred_size).addpreferredgap(javax.swing.layoutstyle.componentplacement.related).addcomponent(cmbselectdepartflight, javax.swing.grouplayout.preferred_size, 126, javax.swing.grouplayout.preferred_size) );.addgap(24, 24, 24)) departtablejpanellayout.setverticalgroup( departtablejpanellayout.createparallelgroup(javax.swing.grouplayout.alignment.le ADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, departtablejpanellayout.createsequentialgroup().addcontainergap() Junaid Sir : Page 29

30 .addgroup(departtablejpanellayout.createparallelgroup(javax.swing.grouplayout.al ignment.trailing).addgroup(departtablejpanellayout.createsequentialgroup().addgap(0, 0, Short.MAX_VALUE).addGroup(departtablejPanelLayout.createParallelGroup(javax.swing.GroupLayout.Al ignment.baseline).addcomponent(cmbselectdepartflight, javax.swing.grouplayout.preferred_size, 32, javax.swing.grouplayout.preferred_size).addcomponent(jlabel3))).addgroup(departtablejpanellayout.createsequentialgroup().addcomponent(jlabel2).addpreferredgap(javax.swing.layoutstyle.componentplacement.unrelated).addcomponent(jscrollpane2, javax.swing.grouplayout.preferred_size, 157, javax.swing.grouplayout.preferred_size) );.addgap(0, 62, Short.MAX_VALUE))).addGap(21, 21, 21)) returntablejpanel.setborder(javax.swing.borderfactory.creatematteborder(1, 1, 1, 1, new java.awt.color(102, 0, 102))); jlabel4.setfont(new java.awt.font("tahoma", 1, 14)); // NOI18N jlabel4.setforeground(new java.awt.color(0, 0, 102)); jlabel4.settext("return Flight"); returntable.setfont(new java.awt.font("tahoma", 1, 11)); // NOI18N Junaid Sir : Page 30

31 returntable.setforeground(new java.awt.color(51, 0, 102)); returntable.setmodel(new javax.swing.table.defaulttablemodel( new Object [][] { {null, null, null, null, {null, null, null, null, {null, null, null, null, {null, null, null, null, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" )); jscrollpane1.setviewportview(returntable); jlabel5.setfont(new java.awt.font("tahoma", 1, 11)); // NOI18N jlabel5.setforeground(new java.awt.color(0, 0, 102)); jlabel5.settext("select your return flight"); cmbreturnflight.setfont(new java.awt.font("tahoma", 1, 12)); // NOI18N cmbreturnflight.setforeground(new java.awt.color(51, 0, 153)); javax.swing.grouplayout returntablejpanellayout = new javax.swing.grouplayout(returntablejpanel); returntablejpanel.setlayout(returntablejpanellayout); returntablejpanellayout.sethorizontalgroup( returntablejpanellayout.createparallelgroup(javax.swing.grouplayout.alignment.le ADING) Junaid Sir : Page 31

32 .addgroup(returntablejpanellayout.createsequentialgroup().addcontainergap().addgroup(returntablejpanellayout.createparallelgroup(javax.swing.grouplayout.al ignment.trailing).addgroup(returntablejpanellayout.createparallelgroup(javax.swing.grouplayout.al ignment.leading).addcomponent(jscrollpane1, javax.swing.grouplayout.preferred_size, 516, javax.swing.grouplayout.preferred_size).addcomponent(jlabel4)).addgroup(returntablejpanellayout.createsequentialgroup().addcomponent(jlabel5).addpreferredgap(javax.swing.layoutstyle.componentplacement.related).addcomponent(cmbreturnflight, javax.swing.grouplayout.preferred_size, 107, javax.swing.grouplayout.preferred_size).addgap(14, 14, 14))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); returntablejpanellayout.setverticalgroup( returntablejpanellayout.createparallelgroup(javax.swing.grouplayout.alignment.le ADING).addGroup(returntablejpanelLayout.createSequentialGroup().addGap(26, 26, 26).addComponent(jLabel4).addGap(27, 27, 27) Junaid Sir : Page 32

33 .addcomponent(jscrollpane1, javax.swing.grouplayout.preferred_size, 157, javax.swing.grouplayout.preferred_size).addgap(36, 36, 36).addGroup(returntablejpanelLayout.createParallelGroup(javax.swing.GroupLayout.Al ignment.baseline).addcomponent(jlabel5).addcomponent(cmbreturnflight, javax.swing.grouplayout.preferred_size, 31, javax.swing.grouplayout.preferred_size)) );.addcontainergap(21, Short.MAX_VALUE)) buttonconfirm.setfont(new java.awt.font("tahoma", 1, 12)); // NOI18N buttonconfirm.settext("confirm Booking"); buttonconfirm.addmouselistener(new java.awt.event.mouseadapter() { public void mouseclicked(java.awt.event.mouseevent evt) { buttonconfirmmouseclicked(evt); ); javax.swing.grouplayout layout = new javax.swing.grouplayout(getcontentpane()); getcontentpane().setlayout(layout); layout.sethorizontalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addcontainergap() Junaid Sir : Page 33

34 .addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leadin G).addComponent(jLabel1).addGroup(layout.createSequentialGroup().addComponent(radiooneway, javax.swing.grouplayout.preferred_size, 84, javax.swing.grouplayout.preferred_size).addpreferredgap(javax.swing.layoutstyle.componentplacement.related).addcomponent(radioreturn, javax.swing.grouplayout.preferred_size, 84, javax.swing.grouplayout.preferred_size)).addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.trailin G, false).addgroup(javax.swing.grouplayout.alignment.leading, layout.createsequentialgroup().addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leadin G).addComponent(lblorigin).addComponent(lbldestination)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G, false).addcomponent(cmbdestination, 0, 135, Short.MAX_VALUE).addComponent(cmborigin, 0, javax.swing.grouplayout.default_size, Short.MAX_VALUE))).addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createsequentialgroup() Junaid Sir : Page 34

35 .addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leadin G).addComponent(lbldeparture).addComponent(lblreturn)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addComponent(departurejDateChooser, javax.swing.grouplayout.default_size, 133, Short.MAX_VALUE).addComponent(returnjDateChooser, javax.swing.grouplayout.default_size, javax.swing.grouplayout.default_size, Short.MAX_VALUE)))).addGroup(layout.createSequentialGroup().addGap(8, 8, 8).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILIN G, false).addcomponent(buttonsearch, javax.swing.grouplayout.default_size, 220, Short.MAX_VALUE).addComponent(buttoncancel, javax.swing.grouplayout.default_size, 220, Short.MAX_VALUE).addComponent(buttonconfirm, javax.swing.grouplayout.alignment.leading, javax.swing.grouplayout.default_size, javax.swing.grouplayout.default_size, Short.MAX_VALUE)))).addGap(27, 27, 27).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G, false) Junaid Sir : Page 35

36 .addcomponent(departtablejpanel, javax.swing.grouplayout.default_size, javax.swing.grouplayout.default_size, Short.MAX_VALUE).addComponent(returntablejpanel, javax.swing.grouplayout.default_size, javax.swing.grouplayout.default_size, Short.MAX_VALUE)) );.addcontainergap(78, Short.MAX_VALUE)) layout.setverticalgroup( layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addcontainergap().addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leadin G).addGroup(layout.createSequentialGroup().addComponent(jLabel1, javax.swing.grouplayout.preferred_size, 24, javax.swing.grouplayout.preferred_size).addgap(27, 27, 27).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELI NE).addComponent(radiooneway).addComponent(radioreturn)).addGap(18, 18, 18).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addGroup(layout.createSequentialGroup().addComponent(lblorigin).addGap(18, 18, 18) Junaid Sir : Page 36

37 .addcomponent(lbldestination)).addgroup(layout.createsequentialgroup().addcomponent(cmborigin, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size).addgap(18, 18, 18).addComponent(cmbdestination, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size))).addgap(17, 17, 17).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addComponent(lbldeparture).addComponent(departurejDateChooser, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size)).addgap(37, 37, 37).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G).addComponent(lblreturn).addComponent(returnjDateChooser, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size)).addgap(69, 69, 69)).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createsequentialgroup().addcomponent(departtablejpanel, javax.swing.grouplayout.preferred_size, Junaid Sir : Page 37

38 javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size).addgap(18, 18, 18))).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G, false).addgroup(layout.createsequentialgroup().addcomponent(buttonsearch).addgap(18, 18, 18).addComponent(buttoncancel).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.grouplayout.default_size, Short.MAX_VALUE).addComponent(buttonconfirm)).addComponent(returntablejpanel, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size)).addcontainergap(javax.swing.grouplayout.default_size, Short.MAX_VALUE)) ); pack(); setlocationrelativeto(null); // </editor-fold> private void radioonewayactionperformed(java.awt.event.actionevent evt) { // TODO add your handling code here: Junaid Sir : Page 38

39 private void radioreturnactionperformed(java.awt.event.actionevent evt) { // TODO add your handling code here: private void cmboriginactionperformed(java.awt.event.actionevent evt) { // TODO add your handling code here: private void radioonewaymouseclicked(java.awt.event.mouseevent evt) { // TODO add your handling code here: radioreturn.setenabled(false); cmborigin.setenabled(true); cmbdestination.setenabled(true); departurejdatechooser.setenabled(true); buttonsearch.setenabled(true); buttoncancel.setenabled(true); option = 1; //indicating that user has selected one way //Once the date chooser becomes active, we will set todays date as default -Junaid Khateeb Date d = new Date(); departurejdatechooser.setdate((d)); private void cmbdestinationitemstatechanged(java.awt.event.itemevent evt) { // THis will check if the origin and the destination cities are the same, if yes,generate error Junaid Sir : Page 39

40 // if ( cmborigin.getselecteditem()== cmbdestination.getselecteditem() ) // JOptionPane.showMessageDialog(null, "Origin and destination cities cant be the same.","inane warning", JOptionPane.WARNING_MESSAGE); private void cmbdestinationmouseclicked(java.awt.event.mouseevent evt) { private void radioreturnmouseclicked(java.awt.event.mouseevent evt) { // TODO add your handling code here: radiooneway.setenabled(false); cmborigin.setenabled(true); cmbdestination.setenabled(true); departurejdatechooser.setenabled(true); returnjdatechooser.setenabled(true); buttonsearch.setenabled(true); buttoncancel.setenabled(true); option = 2; //indicating that user has selected return Date d = new Date(); departurejdatechooser.setdate((d)); returnjdatechooser.setdate((d)); Junaid Sir : Page 40

41 private void buttonsearchkeypressed(java.awt.event.keyevent evt) { private void buttonsearchmouseclicked(java.awt.event.mouseevent evt) { String source,dest; ResultSet rs1 = null,rs2=null; if (option ==1) { source = cmborigin.getselecteditem().tostring(); dest = cmbdestination.getselecteditem().tostring(); dbaseaccount dba = new dbaseaccount(); //this is our class in com.model try { rs = dba.getdepartureflight(source,dest); //calling function from database rs1=rs; catch (ClassNotFoundException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, catch (SQLException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, departtablejpanel.setvisible(true); buttonconfirm.setvisible(true); Junaid Sir : Page 41

42 //Define TableModel TableModel tmodel = new DefaultTableModel(); departuretable.setmodel(dbutils.resultsettotablemodel(rs)); try { //adding selected flight codes to combo box rs1.beforefirst(); while (rs1.next()== true) { cmbselectdepartflight.additem(rs1.getstring("flightid")); catch (SQLException ex) { Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, ex); else { if (option ==2) { source = cmborigin.getselecteditem().tostring(); dest = cmbdestination.getselecteditem().tostring(); dbaseaccount dba = new dbaseaccount(); //this is our class in com.model try { rs = dba.getdepartureflight(source,dest); //calling function from database rsreturn = dba.getreturnflight(source,dest); rs1=rs; rs2=rsreturn; Junaid Sir : Page 42

43 catch (ClassNotFoundException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, catch (SQLException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, departtablejpanel.setvisible(true); returntablejpanel.setvisible(true); buttonconfirm.setvisible(true); //Define TableModel TableModel tmodel = new DefaultTableModel(); departuretable.setmodel(dbutils.resultsettotablemodel(rs)); returntable.setmodel(dbutils.resultsettotablemodel(rsreturn)); try { //adding selected flight codes to combo box rs1.beforefirst(); while (rs1.next()== true) { cmbselectdepartflight.additem(rs1.getstring("flightid")); catch (SQLException ex) { Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, ex); Junaid Sir : Page 43

44 try { //adding selected return flight codes to combo box rs2.beforefirst(); while (rs2.next()== true) { cmbreturnflight.additem(rs2.getstring("flightid")); catch (SQLException ex) { Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, ex); { private void cmbselectdepartflightactionperformed(java.awt.event.actionevent evt) // TODO add your handling code here: Junaid Sir : Page 44

45 private void buttoncancelmouseclicked(java.awt.event.mouseevent evt) { // TODO add your handling code here: MainMenuScreen m = new MainMenuScreen(); this.dispose(); private void buttonconfirmmouseclicked(java.awt.event.mouseevent evt) { // on clicking this button we will collect ll data that user has selected and //send it to the next form in a vector Vector bookingdetails = new Vector (); bookingdetails.addelement(cmborigin.getselecteditem()); //index 0 on vector bookingdetails.addelement(cmbdestination.getselecteditem());//index 1 on vector bookingdetails.addelement(departurejdatechooser.getdate());//index 2 on vector bookingdetails.addelement(cmbselectdepartflight.getselecteditem());//index 3 on vector if (option == 2) { bookingdetails.addelement(returnjdatechooser.getdate());//index 4 on vector bookingdetails.addelement(cmbreturnflight.getselecteditem());//index 5 on vector FinalBooking fb = new FinalBooking(); try { fb.flightdetails(bookingdetails,option); Junaid Sir : Page 45

46 catch (SQLException ex) { Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, ex); /** args the command line arguments */ public static void main(string args[]) { /* Set the Nimbus look and feel */ "> //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see */ try { for (javax.swing.uimanager.lookandfeelinfo info : javax.swing.uimanager.getinstalledlookandfeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.uimanager.setlookandfeel(info.getclassname()); break; catch (ClassNotFoundException ex) { Junaid Sir : Page 46

47 java.util.logging.logger.getlogger(flightbooking.class.getname()).log(java.util.logging. Level.SEVERE, null, ex); catch (InstantiationException ex) { java.util.logging.logger.getlogger(flightbooking.class.getname()).log(java.util.logging. Level.SEVERE, null, ex); catch (IllegalAccessException ex) { java.util.logging.logger.getlogger(flightbooking.class.getname()).log(java.util.logging. Level.SEVERE, null, ex); catch (javax.swing.unsupportedlookandfeelexception ex) { java.util.logging.logger.getlogger(flightbooking.class.getname()).log(java.util.logging. Level.SEVERE, null, ex); //</editor-fold> /* Create and display the form */ java.awt.eventqueue.invokelater(new Runnable() { public void run() { try { new flightbooking().setvisible(true);//type this statemnt first, it will automatically sorrounded by try-catch catch (ClassNotFoundException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, catch (SQLException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, Junaid Sir : Page 47

48 ); // Variables declaration - do not modify private javax.swing.buttongroup buttongroup1; private javax.swing.buttongroup buttongroup2; private javax.swing.buttongroup buttongroup3; private javax.swing.buttongroup buttongroup4; private javax.swing.buttongroup buttongroup5; private javax.swing.jbutton buttoncancel; private javax.swing.jbutton buttonconfirm; private javax.swing.jbutton buttonsearch; private javax.swing.jcombobox<string> cmbdestination; private javax.swing.jcombobox<string> cmborigin; private javax.swing.jcombobox<string> cmbreturnflight; private javax.swing.jcombobox<string> cmbselectdepartflight; private javax.swing.jpanel departtablejpanel; private com.toedter.calendar.jdatechooser departurejdatechooser; private javax.swing.jtable departuretable; private com.jcalendar.model.jcalmodel jcalmodel1; private com.jcalendar.model.jcalmodel jcalmodel2; private com.jcalendar.model.jcalmodel jcalmodel3; private com.jcalendar.model.jcalmodel jcalmodel4; private org.jdatepicker.util.jdatepickerutil jdatepickerutil1; private org.jdatepicker.util.jdatepickerutil jdatepickerutil2; private org.jdatepicker.util.jdatepickerutil jdatepickerutil3; Junaid Sir : Page 48

49 private org.jdatepicker.util.jdatepickerutil jdatepickerutil4; private org.jdatepicker.util.jdatepickerutil jdatepickerutil5; private javax.swing.jlabel jlabel1; private javax.swing.jlabel jlabel2; private javax.swing.jlabel jlabel3; private javax.swing.jlabel jlabel4; private javax.swing.jlabel jlabel5; private javax.swing.jscrollpane jscrollpane1; private javax.swing.jscrollpane jscrollpane2; private javax.swing.jlabel lbldeparture; private javax.swing.jlabel lbldestination; private javax.swing.jlabel lblorigin; private javax.swing.jlabel lblreturn; private javax.swing.jradiobutton radiooneway; private javax.swing.jradiobutton radioreturn; private com.toedter.calendar.jdatechooser returnjdatechooser; private javax.swing.jtable returntable; private javax.swing.jpanel returntablejpanel; // End of variables declaration Screen 4: Junaid Sir : Page 49

50 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. Junaid Sir : Page 50

51 */ package com.travel; import com.model.dbaseaccount; import java.awt.color; import java.sql.resultset; import java.sql.sqlexception; import java.text.dateformat; import java.text.simpledateformat; import java.util.vector; import java.util.logging.level; import java.util.logging.logger; import javax.swing.joptionpane; import javax.swing.table.defaulttablemodel; import javax.swing.table.tablemodel; import net.proteanit.sql.dbutils; /** * JAVA */ public class FinalBooking extends javax.swing.jframe { ResultSet rs; double totalfare; int op;//will use it in insert function Vector v1;//will use it in insert function Junaid Sir : Page 51

52 public FinalBooking() { initcomponents(); Color backgroundcolor = new Color(200,204,255); this.getcontentpane().setbackground(backgroundcolor); returnjpanel.setvisible(false); setvisible(true); setresizable(false); public void flightdetails(vector v,int option) throws SQLException { String code,code1,departtime = null,departfare = null,returntime = null,returnfare = null; op = option; v1 =v; code = String.valueOf(v.get(3));//we have passed flight code in index 3 of vector // now to get deart time and fare for selected flight dbaseaccount dba = new dbaseaccount(); //this is our class in com.model try { rs = dba.finaldepart(code); //calling function from database catch (ClassNotFoundException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, catch (SQLException ex) { Junaid Sir : Page 52

53 ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, rs.beforefirst(); while (rs.next()== true) { departtime = rs.getstring("departtime"); departfare = rs.getstring("fare"); lbldepartureflight.settext(string.valueof(v.get(0)) +" to "+ String.valueOf(v.get(1))); lbldepartflightcode.settext(lbldepartflightcode.gettext() +" " + String.valueOf(v.get(3)) ); DateFormat df = new SimpleDateFormat("dd-MM-yyyy");//if we dont do this, system will display the current time also lbldepartflightdate.settext(lbldepartflightdate.gettext() +" " + String.valueOf(df.format( v.get(2))) ); lbldepartflighttime.settext(lbldepartflighttime.gettext() +" " + departtime ); lbldepartfare.settext(lbldepartfare.gettext() +" " + departfare ); totalfare = 1.18 * (Integer.parseInt(departfare)); Junaid Sir : Page 53

54 lbltotalfare.settext(lbltotalfare.gettext() +" " + totalfare ); if (option ==2) //fetching additional data for return { returnjpanel.setvisible(true); code1 = String.valueOf(v.get(5));//we have passed flight code in index 3 of vector // now to get deart time and fare for selected flight dbaseaccount dba1 = new dbaseaccount(); //this is our class in com.model try { rs = dba1.finalreturn(code1); //calling function from database catch (ClassNotFoundException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, catch (SQLException ex) { ex); Logger.getLogger(flightBooking.class.getName()).log(Level.SEVERE, null, rs.beforefirst(); while (rs.next()== true) { returntime = rs.getstring("departtime"); returnfare = rs.getstring("fare"); Junaid Sir : Page 54

* To change this license header, choose License Headers in Project Properties.

* To change this license header, choose License Headers in Project Properties. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. package tugasumbyjava; /**

More information

Answer on question #61311, Programming & Computer Science / Java

Answer on question #61311, Programming & Computer Science / Java Answer on question #61311, Programming & Computer Science / Java JSP JSF for completion Once the user starts the thread by clicking a button, the program must choose a random image out of an image array,

More information

* To change this license header, choose License Headers in Project Properties.

* To change this license header, choose License Headers in Project Properties. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. */ package calci; /** * *

More information

/** Creates new form NewJFrame */ public NewJFrame() { initcomponents(); initblogsearch(); //initializes Index List box }

/** Creates new form NewJFrame */ public NewJFrame() { initcomponents(); initblogsearch(); //initializes Index List box } /* * To change this template, choose Tools Templates * and open the template in the editor. */ /* * NewJFrame.java * * Created on Apr 17, 2011, 1:13:13 PM */ /** * * @author Kelli */ import java.io.*;

More information

Appendix I: Software Coding

Appendix I: Software Coding References [1] Ceylon Electricity Board, Statistical Digest 2015, pp 2 [2] Roy Billinton and Ronald N. Allan, Reliability Evaluation of Engineering Systems: Concepts and Techniques, Springer (first published

More information

Java Programming Summer 2008 LAB. Thursday 8/21/2008

Java Programming Summer 2008 LAB. Thursday 8/21/2008 LAB Thursday 8/21/2008 Design and implement the program that contains a timer. When the program starts, the timer shows 00:00:00. When we click the Start button, the timer starts. When we click the Stop

More information

JAVA CODE JAVA CODE: BINOMIAL TREES OPTION PRICING BINOMIALTREE CLASS PAGE 1

JAVA CODE JAVA CODE: BINOMIAL TREES OPTION PRICING BINOMIALTREE CLASS PAGE 1 CODE JAVA CODE BINOMIAL TREES OPTION PRICING JAVA CODE: BINOMIAL TREES OPTION PRICING BINOMIALTREE CLASS /** * * @author Ioannis Svigkos 2008 */ // This class corresponds to binomial tree option pricing.

More information

I.1 Introduction Matisse GUI designer I.2 GroupLayout Basics Sequential and Parallel Arrangements sequential horizontal orientation

I.1 Introduction Matisse GUI designer I.2 GroupLayout Basics Sequential and Parallel Arrangements sequential horizontal orientation I GroupLayout I.1 Introduction Java SE 6 includes a powerful layout manager called GroupLayout, which is the default layout manager in the NetBeans IDE (www.netbeans.org). In this appendix, we overview

More information

DAFTAR LAMPIRAN. Source Code Java Aplikasi Keyword to Image Renamer Split

DAFTAR LAMPIRAN. Source Code Java Aplikasi Keyword to Image Renamer Split DAFTAR LAMPIRAN Source Code Java Aplikasi Keyword to Image Renamer Split Source Code Menu Utama package spin_text; import java.awt.color; import java.awt.event.actionevent; import java.awt.event.actionlistener;

More information

jlabel14 = new javax.swing.jlabel(); jlabel15 = new javax.swing.jlabel(); jlabel16 = new javax.swing.jlabel(); jlabel17 = new javax.swing.

jlabel14 = new javax.swing.jlabel(); jlabel15 = new javax.swing.jlabel(); jlabel16 = new javax.swing.jlabel(); jlabel17 = new javax.swing. 188 APPENDIX 1 { jinternalframe1 = new javax.swing.jinternalframe(); jlabel1 = new javax.swing.jlabel(); jlabel2 = new javax.swing.jlabel(); jlabel3 = new javax.swing.jlabel(); jlabel4 = new javax.swing.jlabel();

More information

INSTITUTO POLITÉCNICO NACIONAL ESCUELA SUPERIOR DE CÓMPUTO

INSTITUTO POLITÉCNICO NACIONAL ESCUELA SUPERIOR DE CÓMPUTO INSTITUTO POLITÉCNICO NACIONAL ESCUELA SUPERIOR DE CÓMPUTO Cryptography Practice 1,2,3 By: Raúl Emmanuel Delgado Díaz de León Professor: M. en C. NIDIA ASUNCIÓN CORTEZ DUARTE February2015 Index Contenido

More information

Project Helpine Report BANQUET HALL BOOKING

Project Helpine Report BANQUET HALL BOOKING Project Helpine Report BANQUET HALL BOOKING - 1 - BANQUET HALL BOOKING TABLE OF CONTENT Contents Page No. Acknowledgment 3 Declaration 4 1. Introduction & Objectives of the Project 1.1 Introduction 7 1.2

More information

privateint m, n, smithitemcount, raitaitemcount;

privateint m, n, smithitemcount, raitaitemcount; LISTING PROGRAM /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. */ package

More information

/* * MoraDrill.java * Version last updated 6 April 2010 * Written by John K. Estell * Created on November 30, 2008, 10:22 PM */

/* * MoraDrill.java * Version last updated 6 April 2010 * Written by John K. Estell * Created on November 30, 2008, 10:22 PM */ /* * MoraDrill.java * Version 2.1.0 - last updated 6 April 2010 * Written by John K. Estell * Created on November 30, 2008, 10:22 PM */ package MoraDrill; import java.io.inputstream; import java.awt.*;

More information

CHAPTER 8 INFERENCE. The concept of Inference would be explained in the following chapter, as the CTBN

CHAPTER 8 INFERENCE. The concept of Inference would be explained in the following chapter, as the CTBN CHAPTER 8 INFERENCE The concept of Inference would be explained in the following chapter, as the CTBN framework has already been detailed on. The chapter begins by answering the most asked queries and

More information

Role-Coll Role Based Collaboration Software

Role-Coll Role Based Collaboration Software Department of Computer Science University of Nevada, Reno Role-Coll Role Based Collaboration Software CS 425 12/12/2006 Software Team: Harold De Armas, Erik Hanchett, Raymond Lee, Zack Norcross Business

More information

Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS

Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS Hanley s Survival Guide for Visual Applications with NetBeans 2.0 Last Updated: 5/20/2015 TABLE OF CONTENTS Glossary of Terms 2-4 Step by Step Instructions 4-7 HWApp 8 HWFrame 9 Never trust a computer

More information

1 Using the NetBeans IDE

1 Using the NetBeans IDE Chapter 1: Using the NetBeans IDE 5 1 Using the NetBeans IDE In this chapter we will examine how to set up a new application program using the NetBeans Integrated Development Environment with the language

More information

LAMPIRAN Lampiran Utama. a. Struktur Organisasi

LAMPIRAN Lampiran Utama. a. Struktur Organisasi LAMPIRAN 5.1. Lampiran Utama a. Struktur Organisasi b. Flowchart Prosedur Penggajian PT Timatex c. Coding List Class Koneksi package ta_552012010_aprilia; import java.sql.*; public class koneksi { private

More information

LAMPIRAN PERANGKAT LUNAK

LAMPIRAN PERANGKAT LUNAK LAMPIRAN PERANGKAT LUNAK package com.fr.core; import com.googlecode.javacv.cpp.opencv_core; import com.googlecode.javacv.cpp.opencv_imgproc; import com.googlecode.javacv.cpp.opencv_objdetect; import java.awt.image.bufferedimage;

More information

Our first program is a simple calculator, which will carry out the arithmetic operations of adding, subtracting, multiplying and dividing numbers.

Our first program is a simple calculator, which will carry out the arithmetic operations of adding, subtracting, multiplying and dividing numbers. Chapter 2: Calculations 29 2 Calculations Most computer programs need to carry out calculations, for example: with money, quantities of materials, or dates and times. In this chapter, we will examine how

More information

グラフを表すデータ構造 JAVA での実装

グラフを表すデータ構造 JAVA での実装 グラフを表すデータ構造 JAVA での実装 グラフの構造を記述するクラス パッケージgraphLib graphlib.graph グラフ全体 graphlib.vertex 頂点 頂点を始点とする弧 頂点を2 次元面に表示するための座標 graphlib.arc 弧の始点と終点 クラスの関係 グラフ 弧一覧 弧 弧 頂点 弧 頂点一覧 頂点 頂点 写像 + 頂点 写像 頂点 写像 δ + GRAPH

More information

Lampiran A. SOURCE CODE PROGRAM

Lampiran A. SOURCE CODE PROGRAM A-1 Lampiran A. SOURCE CODE PROGRAM Frame Utama package FrameDesign; import ArithmeticSkripsi.ArithmeticCompress; import ArithmeticSkripsi.ArithmeticDecompress; import Deflate.DeflateContoh; import java.io.file;

More information

LAMPIRAN. 1. Lampiran Utama. a. Struktur Organisasi Perusahaan

LAMPIRAN. 1. Lampiran Utama. a. Struktur Organisasi Perusahaan LAMPIRAN 1. Lampiran Utama a. Struktur Organisasi Perusahaan 1 b. Flowchart Pemasukan dan Pengeluaran Benang PT TIGA MANUNGGAL SYNTHETIC INDUSTRIES PROSEDUR PERMINTAAN PEMBELIAN ANALYTIC FLOWCHART KANTOR

More information

Chapter 8. Java continued. CS Hugh Anderson s notes. Page number: 264 ALERT. MCQ test next week. This time. This place.

Chapter 8. Java continued. CS Hugh Anderson s notes. Page number: 264 ALERT. MCQ test next week. This time. This place. Chapter 8 Java continued CS3283 - Hugh Anderson s notes. Page number: 263 ALERT MCQ test next week This time This place Closed book CS3283 - Hugh Anderson s notes. Page number: 264 ALERT Assignment #2

More information

Java continued. Chapter 8 ALERT ALERT. Last week. MCQ test next week. This time. This place. Closed book. Assignment #2 is for groups of 3

Java continued. Chapter 8 ALERT ALERT. Last week. MCQ test next week. This time. This place. Closed book. Assignment #2 is for groups of 3 Chapter 8 Java continued MCQ test next week This time This place Closed book ALERT CS3283 - Hugh Anderson s notes. Page number: 263 CS3283 - Hugh Anderson s notes. Page number: 264 ALERT Last week Assignment

More information

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords Goals By the end of this lesson, you should: Lecture 7 More GUI programming 1. Be able to write Java s with JTextField, JList, JCheckBox and JRadioButton components 2. Be able to implement a ButtonGroup

More information

TECHNICAL DOCUMENTATION

TECHNICAL DOCUMENTATION TECHNICAL DOCUMENTATION UNDERSTANDING THE JAVA/XML CODE BINDING IN OPENBRAVO POS AND LITTLE EDITING SPONSORED BY: IT-KAMER COMPANY LTD CEO: Dr.-Ing. Stanley Mungwe SONDI Mikael Steve jobs project Cameroon

More information

We have several alternatives now, which we need to address. Here is a list of them: 1. How to get HTML interpreted correctly.

We have several alternatives now, which we need to address. Here is a list of them: 1. How to get HTML interpreted correctly. Applets in Java using NetBeans as an IDE Creating an Interactive Browser using JEditorPane (Part 3) C.W. David Department of Chemistry University of Connecticut Storrs, CT 06269-3060 Carl.David@uconn.edu

More information

CSCI 201L Midterm Written Summer % of course grade

CSCI 201L Midterm Written Summer % of course grade CSCI 201L Summer 2016 10% of course grade 1. Abstract Classes and Interfaces Give two differences between an interface and an abstract class in which all of the methods are abstract. (0.5% + 0.5%) 2. Serialization

More information

PART 23. Java GUI Advanced JList Component. more items.

PART 23. Java GUI Advanced JList Component. more items. PART 23 Java GUI Advanced 23.1 JList Component JList is a component that displays a list of objects. It allows the user to select one or more items. import java.awt.color; import java.awt.eventqueue; import

More information

The class definition is not a program by itself. It can be used by other programs in order to create objects and use them.

The class definition is not a program by itself. It can be used by other programs in order to create objects and use them. Data Classes and Object-Oriented Programming Data classes can be motivated by the need to create data structures that have grouped together a number of variables of simpler type (ints, Strings, arrays)

More information

SampleApp.java. Page 1

SampleApp.java. Page 1 SampleApp.java 1 package msoe.se2030.sequence; 2 3 /** 4 * This app creates a UI and processes data 5 * @author hornick 6 */ 7 public class SampleApp { 8 private UserInterface ui; // the UI for this program

More information

Based on slides by Prof. Burton Ma

Based on slides by Prof. Burton Ma Based on slides by Prof. Burton Ma 1 TV - on : boolean - channel : int - volume : int + power(boolean) : void + channel(int) : void + volume(int) : void Model View Controller RemoteControl + togglepower()

More information

SQream Connector JDBC SQream Technologies Version 2.9.3

SQream Connector JDBC SQream Technologies Version 2.9.3 SQream Connector JDBC 2.9.3 SQream Technologies 2019-03-27 Version 2.9.3 Table of Contents The SQream JDBC Connector - Overview...................................................... 1 1. API Reference............................................................................

More information

AP CS Unit 11: Graphics and Events

AP CS Unit 11: Graphics and Events AP CS Unit 11: Graphics and Events This packet shows how to create programs with a graphical interface in a way that is consistent with the approach used in the Elevens program. Copy the following two

More information

CSCI 201L Midterm Written SOLUTION Summer % of course grade

CSCI 201L Midterm Written SOLUTION Summer % of course grade CSCI 201L SOLUTION Summer 2016 10% of course grade 1. Abstract Classes and Interfaces Give two differences between an interface and an abstract class in which all of the methods are abstract. (0.5% + 0.5%)

More information

Studying software design patterns is an effective way to learn from the experience of others

Studying software design patterns is an effective way to learn from the experience of others Studying software design patterns is an effective way to learn from the experience of others Design Pattern allows the requester of a particular action to be decoupled from the object that performs the

More information

3 Multiple windows. Chapter 3: Multiple windows 57

3 Multiple windows. Chapter 3: Multiple windows 57 Chapter 3: Multiple windows 57 3 Multiple windows Many larger computer applications use more than one form window, perhaps inputting data in one window and outputting results in another. In this chapter

More information

Forte for Java Community Edition 1.0

Forte for Java Community Edition 1.0 Forte for Java Community Edition 1.0 Java Integrated Development Environment Tutorials Tutorials version 0.9.4 Copyright 1997-1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303, U.S.A.

More information

In this chapter we will examine arrays, and the ways that they can be used in combination with loop structures to process data in programs.

In this chapter we will examine arrays, and the ways that they can be used in combination with loop structures to process data in programs. Chapter 5: Loops and arrays 117 5 Loops and arrays In this chapter we will examine arrays, and the ways that they can be used in combination with loop structures to process data in programs. The first

More information

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid

Systems Programming. Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Systems Programming Bachelor in Telecommunication Technology Engineering Bachelor in Communication System Engineering Carlos III University of Madrid Leganés, 21st of March, 2014. Duration: 75 min. Full

More information

PART 22. Java GUI Library SWT GUI Library SWING GUI Library Swing First Program

PART 22. Java GUI Library SWT GUI Library SWING GUI Library Swing First Program PART 22 Java GUI Library 22.1 SWT GUI Library There is also another GUI library for the Java programming language. It is called SWT (The Standard widget toolkit). The SWT library was initially developed

More information

COMP16121 Sample Code Lecture 1

COMP16121 Sample Code Lecture 1 COMP16121 Sample Code Lecture 1 Sean Bechhofer, University of Manchester, Manchester, UK sean.bechhofer@manchester.ac.uk 1 SimpleFrame 1 import javax.swing.jframe; 2 3 public class SimpleFrame { 4 5 /*

More information

CSCI 201L Midterm Written Fall % of course grade

CSCI 201L Midterm Written Fall % of course grade CSCI 201L Midterm Written Fall 2015 10% of course grade 1. Inheritance Answer the following questions about inheritance. a. Does Java allow overloading, overriding, and redefining of methods? (0.5%) b.

More information

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) M257 MTA Spring2010 Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks) 1. If we need various objects that are similar in structure, but

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor: Alan

More information

Tiers (or layers) Separation of concerns

Tiers (or layers) Separation of concerns Tiers (or layers) Separation of concerns Hiding the type of storage from the client class Let s say we have a program that needs to fetch objects from a storage. Should the program have to be concerned

More information

CSCI 201L Midterm Written SOLUTION Fall % of course grade

CSCI 201L Midterm Written SOLUTION Fall % of course grade CSCI 201L Midterm Written SOLUTION Fall 2015 10% of course grade 1. Inheritance Answer the following questions about inheritance. a. Does Java allow overloading, overriding, and redefining of methods?

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2006 FINAL EXAMINATION 7pm to 10pm, 19 DECEMBER 2006, Jeffrey Hall 1 st Floor Instructor:

More information

AnimatedImage.java. Page 1

AnimatedImage.java. Page 1 1 import javax.swing.japplet; 2 import javax.swing.jbutton; 3 import javax.swing.jpanel; 4 import javax.swing.jcombobox; 5 import javax.swing.jlabel; 6 import javax.swing.imageicon; 7 import javax.swing.swingutilities;

More information

Example: Building a Java GUI

Example: Building a Java GUI Steven Zeil October 25, 2013 Contents 1 Develop the Model 2 2 Develop the layout of those elements 3 3 Add listeners to the elements 9 4 Implement custom drawing 12 1 The StringArt Program To illustrate

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC124, WINTER TERM, 2009 FINAL EXAMINATION 7pm to 10pm, 18 APRIL 2009, Dunning Hall Instructor: Alan McLeod If the

More information

Example: Building a Java GUI

Example: Building a Java GUI Steven Zeil October 25, 2013 Contents 1 Develop the Model 3 2 Develop the layout of those elements 4 3 Add listeners to the elements 12 4 Implement custom drawing 15 1 The StringArt Program To illustrate

More information

Chapter 13 Lab Advanced GUI Applications

Chapter 13 Lab Advanced GUI Applications Gaddis_516907_Java 4/10/07 2:10 PM Page 113 Chapter 13 Lab Advanced GUI Applications Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the

More information

Abstract. 1. What is an ABSTRACT METHOD? 2. Why you would want to declare a method as abstract? 3. A non-abstract CLASS is called a concrete class

Abstract. 1. What is an ABSTRACT METHOD? 2. Why you would want to declare a method as abstract? 3. A non-abstract CLASS is called a concrete class ABSTRACT 2 1. What is an ABSTRACT METHOD? 2 2. Why you would want to declare a method as abstract? 2 3. A non-abstract CLASS is called a concrete class 2 4. Abstract Example 2 5. If you are extending ABSTRACT

More information

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION 15 3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION Checklist: The most recent version of Java SE Development

More information

C: THE PROGRAM Devin Kwok: Dossier 2008

C: THE PROGRAM Devin Kwok: Dossier 2008 C: THE PROGRAM Devin Kwok: Dossier 2008 C.I: Using Good Programming Style C.I.i: Package: com.gmai.kwok.devin.gui.frame Class: Main 01 package com.gmail.kwok.devin.gui.frame; 02 03 import javax.swing.jframe;

More information

GUI Components Continued EECS 448

GUI Components Continued EECS 448 GUI Components Continued EECS 448 Lab Assignment In this lab you will create a simple text editor application in order to learn new GUI design concepts This text editor will be able to load and save text

More information

EJB - ACCESS DATABASE

EJB - ACCESS DATABASE EJB - ACCESS DATABASE http://www.tutorialspoint.com/ejb/ejb_access_database.htm Copyright tutorialspoint.com EJB 3.0, persistence mechanism is used to access the database in which container manages the

More information

10 Object oriented programming

10 Object oriented programming 250 Java Programming for A-level Computer Science 10 Object oriented programming Java is an object oriented programming language. The use of objects has a number of important advantages, particularly when

More information

1 (6) Lösningsförslag Objektorienterade applikationer Provdatum Program DAI 2 Läsår 2016/2017, lp 3. Uppgift 1 (1+1+1 p) a)

1 (6) Lösningsförslag Objektorienterade applikationer Provdatum Program DAI 2 Läsår 2016/2017, lp 3. Uppgift 1 (1+1+1 p) a) till dugga P r e l i m i n ä r 1 (6) Kursnamn Objektorienterade applikationer Provdatum 2017-02-09 Program DAI 2 Läsår 2016/2017, lp 3 Examinator Uno Holmer Uppgift 1 (1+1+1 p) a) b) c) public interface

More information

A Simple Text Editor Application

A Simple Text Editor Application CASE STUDY 7 A Simple Text Editor Application To demonstrate the JTextArea component, fonts, menus, and file choosers we present a simple text editor application. This application allows you to create

More information

COSC 123 Computer Creativity. Graphics and Events. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Graphics and Events. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Graphics and Events Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Draw shapes, text in various fonts, and colors. 2) Build

More information

MainWindow.java. Page 1

MainWindow.java. Page 1 / This project is a demo showing a sound card selector and tester. The UI would look nice and work better, but I've decided that's outside the scope of this demo. Code from this demo will eventually be

More information

Graphical User Interface

Graphical User Interface Lecture 10 Graphical User Interface An introduction Sahand Sadjadee sahand.sadjadee@liu.se Programming Fundamentals 725G61 http://www.ida.liu.se/~725g61/ Department of Computer and Information Science

More information

This is the java code for generating coördinates of molecules numerically using the CDNT framework with real-time input and diagramatic output.

This is the java code for generating coördinates of molecules numerically using the CDNT framework with real-time input and diagramatic output. This is the java code for generating coördinates of molecules numerically using the DNT framework with real-time input and diagramatic output. * cdnt.java * * reated on January 25, 2006, 8:38 AM * System

More information

So You Want to Build a Burp Plugin?

So You Want to Build a Burp Plugin? So You Want to Build a Burp Plugin? Monika Morrow, Senior Security Consultant at AppSec Consulting Inc. December 6, 2013 Why Burp Plugins? Eliminate annoyances Status notifications, default settings, auto-scope

More information

Swing - JTextField. Adding a text field to the main window (with tooltips and all)

Swing - JTextField. Adding a text field to the main window (with tooltips and all) Swing - JTextField Adding a text field to the main window (with tooltips and all) Prerequisites - before this lecture You should have seen: The lecture on JFrame The lecture on JButton Including having

More information

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions G51PGP Programming Paradigms Lecture 009 Concurrency, exceptions 1 Reminder subtype polymorphism public class TestAnimals public static void main(string[] args) Animal[] animals = new Animal[6]; animals[0]

More information

Chapter 3: A Larger Example: SocketChat

Chapter 3: A Larger Example: SocketChat page 1 Chapter 3: A Larger Example: SocketChat In this chapter we are going to look at three versions of a larger socket-based example: a simple `chat' application. The application does not have many capabilities,

More information

Chapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus

Chapter 13 Lab Advanced GUI Applications Lab Objectives. Introduction. Task #1 Creating a Menu with Submenus Chapter 13 Lab Advanced GUI Applications Lab Objectives Be able to add a menu to the menu bar Be able to use nested menus Be able to add scroll bars, giving the user the option of when they will be seen.

More information

Prototyping a Swing Interface with the Netbeans IDE GUI Editor

Prototyping a Swing Interface with the Netbeans IDE GUI Editor Prototyping a Swing Interface with the Netbeans IDE GUI Editor Netbeans provides an environment for creating Java applications including a module for GUI design. Here we assume that we have some existing

More information

Building a Java First-Person Shooter

Building a Java First-Person Shooter Building a Java First-Person Shooter Episode 1 Windows [Last update: 5/03/2017] Objectives In this episode you are presented with enough information to: Using the Eclipse IDE Create a window Set it to

More information

CreateServlet.java

CreateServlet.java Classes in OBAAS 1.2: -------------------- The package name is pack_bank. Create this package in java source of your project. Create classes as per the class names provided here. You can then copy the

More information

Accessing databases in Java using JDBC

Accessing databases in Java using JDBC Accessing databases in Java using JDBC Introduction JDBC is an API for Java that allows working with relational databases. JDBC offers the possibility to use SQL statements for DDL and DML statements.

More information

Writing your own Exceptions. How to extend Exception

Writing your own Exceptions. How to extend Exception Writing your own Exceptions How to extend Exception When would you write your own exception class? When to write your own custom exception is a matter for discussion in your project design team. There

More information

Java and OOP. Part 5 More

Java and OOP. Part 5 More Java and OOP Part 5 More 1 More OOP More OOP concepts beyond the introduction: constants this clone and equals inheritance exceptions reflection interfaces 2 Constants final is used for classes which cannot

More information

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige CSC 308 2.0 System Development with Java Database Connection Budditha Hettige Department of Statistics and Computer Science Budditha Hettige 1 From database to Java There are many brands of database: Microsoft

More information

Program #3 - Airport Simulation

Program #3 - Airport Simulation CSCI212 Program #3 - Airport Simulation Write a simulation for a small airport that has one runway. There will be a queue of planes waiting to land and a queue of planes waiting to take off. Only one plane

More information

FirstSwingFrame.java Page 1 of 1

FirstSwingFrame.java Page 1 of 1 FirstSwingFrame.java Page 1 of 1 2: * A first example of using Swing. A JFrame is created with 3: * a label and buttons (which don t yet respond to events). 4: * 5: * @author Andrew Vardy 6: */ 7: import

More information

CS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.

CS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit. Name CS 110 Practice Final Exam originally from Winter, 2003 Instructions: closed books, closed notes, open minds, 3 hour time limit. There are 4 sections for a total of 49 points. Part I: Basic Concepts,

More information

// autor igre Ivan Programerska sekcija package mine;

// autor igre Ivan Programerska sekcija package mine; // autor igre Ivan Bauk @ Programerska sekcija package mine; import java.awt.color; import java.awt.flowlayout; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener;

More information

HL7 FHIR Data Consolidation Tool

HL7 FHIR Data Consolidation Tool WHITE PAPER HL7 FHIR Data Consolidation Tool What is HL7 FHIR? HL7 FHIR or FHIR (Fast Healthcare Interoperability Resources pronounced as "Fire") is a part of the Medical Healthcare information ecosystem

More information

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 {

import java.applet.applet; import java.applet.audioclip; import java.net.url; public class Vjesala2 { import java.awt.color; import java.awt.flowlayout; import java.awt.font; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton;

More information

Pieter van den Hombergh. March 25, 2018

Pieter van den Hombergh. March 25, 2018 ergh Fontys Hogeschool voor Techniek en Logistiek March 25, 2018 ergh/fhtenl March 25, 2018 1/25 JDBC JDBC is a Java database connectivity technology (Java Standard Edition platform) from Oracle Corporation.

More information

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Page 1 of 16. Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. Page 1 of 16 SOLUTION HAND IN Answers Are Recorded on Question Paper QUEEN'S UNIVERSITY SCHOOL OF COMPUTING CISC212, FALL TERM, 2005 FINAL EXAMINATION 9am to 12noon, 19 DECEMBER 2005 Instructor: Alan McLeod

More information

DESIGN AND IMPLEMENTATION OF A PUZZLE GAME USING JAVA SE 1. University Politehnica Timisoara, Faculty Engineering Hunedoara, ROMANIA

DESIGN AND IMPLEMENTATION OF A PUZZLE GAME USING JAVA SE 1. University Politehnica Timisoara, Faculty Engineering Hunedoara, ROMANIA ANNALS of Faculty Engineering Hunedoara International Journal of Engineering Tome XV [2017] Fascicule 3 [August] ISSN: 1584-2665 [print; online] ISSN: 1584-2673 [CD-Rom; online] a free-access multidisciplinary

More information

NetBeans IDE Java Quick Start Tutorial

NetBeans IDE Java Quick Start Tutorial NetBeans IDE Java Quick Start Tutorial Welcome to NetBeans IDE! This tutorial provides a very simple and quick introduction to the NetBeans IDE workflow by walking you through the creation of a simple

More information

This document shows the whole program for the implementation of the Withdraw operation specication.

This document shows the whole program for the implementation of the Withdraw operation specication. This document shows the whole program for the implementation of the Withdraw operation specication. * Account.java * 1 package ATM_BasicClasses; 3 import java.util.date; 4 5 public class Account { 6 public

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A

More information

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written. QUEEN'S UNIVERSITY SCHOOL OF COMPUTING HAND IN Answers Are Recorded on Question Paper CMPE212, FALL TERM, 2012 FINAL EXAMINATION 18 December 2012, 2pm Instructor: Alan McLeod If the instructor is unavailable

More information

search value 94 not found

search value 94 not found 230 Java Programming for A-level Computer Science 9 Searching In the second part of this chapter, we will turn our attention to methods for finding a particular record within a set of data. The method

More information

CS108, Stanford Handout #22. Thread 3 GUI

CS108, Stanford Handout #22. Thread 3 GUI CS108, Stanford Handout #22 Winter, 2006-07 Nick Parlante Thread 3 GUI GUIs and Threading Problem: Swing vs. Threads How to integrate the Swing/GUI/drawing system with threads? Problem: The GUI system

More information

Programming a Bank Database. We ll store the information in two tables: INTEGER DECIMAL(10, 2)

Programming a Bank Database. We ll store the information in two tables: INTEGER DECIMAL(10, 2) WE1 W o r k e d E x a m p l e 2 2.1 Programming a Bank Database In this Worked Example, we will develop a complete database program. We will reimplement the ATM simulation of Chapter 12, storing the customer

More information

17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau

17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau List of Slides 1 Title 2 Chapter 13: Graphical user interfaces 3 Chapter aims 4 Section 2: Example:Hello world with a GUI 5 Aim 6 Hello world with a GUI 7 Hello world with a GUI 8 Package: java.awt and

More information

1. Go to the URL Click on JDK download option

1. Go to the URL   Click on JDK download option Download and installation of java 1. Go to the URL http://www.oracle.com/technetwork/java/javase/downloads/index.html Click on JDK download option 2. Select the java as per your system type (32 bit/ 64

More information

CS 351 Design of Large Programs Threads and Concurrency

CS 351 Design of Large Programs Threads and Concurrency CS 351 Design of Large Programs Threads and Concurrency Brooke Chenoweth University of New Mexico Spring 2018 Concurrency in Java Java has basic concurrency support built into the language. Also has high-level

More information

Widgets. Widgets Widget Toolkits. 2.3 Widgets 1

Widgets. Widgets Widget Toolkits. 2.3 Widgets 1 Widgets Widgets Widget Toolkits 2.3 Widgets 1 User Interface Widget Widget is a generic name for parts of an interface that have their own behavior: buttons, drop-down menus, spinners, file dialog boxes,

More information

Lecture 03: Thread API (continue)

Lecture 03: Thread API (continue) Lecture 03: Thread API (continue) SSC2 Behzad Bordbar School of Computer Science, University of Birmingham, UK Lecture 03 1 Recap Extending Thread or implementing Runnable Thread terminology Stopping Threads

More information