JB_APP_KJV application, Book_Frame.java
 
 
 

       

Create Frame, Cook_Frame.java ...

    

  • From File menu,  click New,  the Object Galleray dialog box appears,  from General page select Frame Icon

     
    Object Galleray dialog box

    click  Ok  (Frame Wizard dialog  box appears ...)

     Frame Wizard  dialog box

    Type in the Class name Box : Book_frame
    Type in the Package Box : jb_kjv_app
    Choose and select from Base class conbobox: javax swing JFrame
    Check the Generate header method
    Check the Generate header comments
    and then click Ok

    The Book_Frame.java created ...

     

  • Design  and Structure created  by this wizard...

     
    Design   Structure
     


     

  • The Source (codes) created  by this wizard...
     
     The source (codes)  corresponding ...
     



 Modify the  Book_Frame.java

 

 




 
 Classes or Libraries used ...

import javax.swing.*;
import java.awt.*;
import com.borland.jbcl.layout.*;
import javax.swing.border.*;
import com.borland.dx.sql.dataset.*;

import java.awt.event.*;
import java.beans.*;

import com.borland.dbswing.*;


Event of Book_Frame,java :    windowOpened


 
Components used ...
  

From Compenet  palette,  add the followig components ...
1.  Design  and Structure
 
 
A.
Design   Structure
 
 
 
B.
Design   Structure
 
 
 
2. Components ...
 
 
  1. Add JPanel  component  - jPanel2  Proprietes
     
    name:
    layout:
     jPanel2
    XYLayout


    This component includes the following components:    ImageLabel1  jLabelbook, jLabeltitle, jLabelchapter,  jLabelverse, jlabelrecord, txtbook, txttitle, txtchapter, txtverse, txtrec, txttextdata, btnfirst , btnprev, btnnext, btnlast, btnclose
     

    1. Add  JLabel component  - ImageLabel1 , Proprietes
       
      name:
      Icon:
      imageLabel1
      Image1

             Image1= "forum.gif"
       

    2. Add  JLabel component  - jLabelbook, Proprietes
       
      name:
      text:
       jLabelbook
      Book

       

    3. Add  JLabel component  - jLabeltitle, Proprietes
       
      name:
      text:
      jLabeltitle
      Title

       

    4. Add  JLabel component  - jLabelchapter, Proprietes
       
      name:
      text:
       jLabelchapter
      Chapter

       

    5. Add  JLabel component  - jLabelverse, Proprietes
       
      name:
      text:
      jLabelverse
      Verse

       

    6. Add  JLabel component  - jlabelrecord, Proprietes
       
      name:
      text:
       jlabelrecord
      Record

       

    7. Add  JTextField component  - txtbook, Proprietes
       
      name:
      border:
      txtbook
      Empty border

       

    8. Add  JTextField component  - txttitle, Proprietes
       
      name:
      border:
      txttitle
      Empty border

       

    9. Add  JTextField component  - txtchapter, Proprietes
       
      name:
      border:
      txtchapter
      Empty border

       

    10. Add  JTextField component  - txtverse , Proprietes
       
      name:
      border:
      txtverse
      Empty border

       

    11. Add  JTextField component  - txtrec, Proprietes
       
      name:
      border:
      txtrec
      Line

       

    12. Add  JTextPane component  - txttextdata, Proprietes    
       JTextPane component is used to edit multi-line strings of text data
       
      name:
      border:
      txttextdata
      Custom

       

    13. Add   JToggleButton component  - btnfirst , Proprietes 
       
      name:
      actioncommand:
       btnfirst
      |<

      Event :  actionPerformed
       

    14. Add   JToggleButton component  - btnprev, Proprietes 
       
      name:
      actioncommand:
      btnprev
      <

      Event :  actionPerformed
       

    15. Add   JToggleButton component  - btnnext, Proprietes 
       
      name:
      actioncommand:
      btnnext
      >
       

      Event :  actionPerformed
       

    16. Add   JToggleButton component  - btnlast, Proprietes 
       
      name:
      actioncommand:
      btnlast
      >|

      Event :  actionPerformed
       

    17. Add   JToggleButton component  - btnclose, Proprietes 
       
      name:
      actioncommand:
      btnclose
      Close

      Event :  actionPerformed
       



     

  2. Add JPanel  component  - jPanel1  Proprietes
     
    name:
    layout:
    jPanel1
    XYLayout


    This component includes the following components :   
    ImageLabel2,  jTabbedPane1

     

    1. Add  JLabel  component  - ImageLabel2 , Proprietes
       
      name:
      Icon:
      imageLabel2
      Image2

                   Image2= "christus-th.gif"
       

    1. Add  JTabbedPane component  - JTabbedPane1, Proprietes  

      JTabbedPane component that lets the user switch between a group of components by clicking on a tab with a given title and/or icon.
      Tabs/components are added to a TabbedPane object by using the addTab and insertTab methods. A tab is represented by an index corresponding to the position it was added in, where the first tab has an index equal to 0 and the last tab has an index equal to the tab count minus 1


       

      name:
      SelectedCompenent:
      JTabbedPane1
      Searchbyword_panel

      Note:
      How to add tab or page to
      JTabbedPane component.
      1- select 
      JTabbedPane component
      2-
      From Compenet  palette (from Swing Containers tab) add JPanel  component to JTabbedPane.
           New tab appears, rename the  title...
      3- repeat previous operation to be add new tab

      Add to
       JTabbedPane1       2 tabs
      Title of 1st tab :   Searchbyword_panel
      Title of 2nd tab :  
      Searchbyaddress_panel

      This component includes the following components :
      Searchbyword_panel,  Searchbyaddress_panel
       

      1. Add  JPanel component  - Searchbyword_panel  , Proprietes
         
        name:
        layout:
        Searchbyword_panel
        XYLayout

        This component includes the following components :  jLabel1,  txtword ,  btnsearch,  jLabel2, list1, txtinfo
         

        1. Add  JLabel component  - jLabel1, Proprietes
           
          name:
          text:
          jLabel1
          "Type in the word to search for:"

           

        2. Add  JTextField component  - txtword , Proprietes
           
          name:
          border:
          txtword
          Empty border

          Event :  keyPressed
           

        3. Add   JToggleButton component  -  btnsearch, Proprietes 
           
          name:
          actioncommand:
           btnsearch
          Search

          Event :  actionPerformed
           

        4. Add  JLabel component  - jLabel2, Proprietes
           
          name:
          text:
          jLabel2
          " Book        Booktitle               Chapter        Verse "

           

        5. Add  List  component  -  list1, Proprietes  

          The List component presents the user with a scrolling list of text items. The list can be set up so that the user can choose either one item or multiple items.
           

          name:
          multipleMode:
          list1
          False

          Event :  actionPerformed
           

        6. Add  JTextPane component  - txtinfo, Proprietes
           
          name:
          border:
          txtinfo
          Empty border

           

         


         

      1. Add  JPanel  component  - Searchbyaddress_panel , Proprietes
         
        name:
        layout:
        Searchbyaddress_panel
        XYLayout


        This component includes the following components : 
        lbbook1, lbtitle1,lbchapter1, lbverse1, cmbbook, cmbtitle, cmbchapter, cmbverse, cmbbookval, cmbtitleval, cmbchapterval, cmbverseval
         

        1. Add  JLabel  component  - lbbook1, Proprietes
           
          name:
          text:
          lbbook1
          Book

           

        2. Add  JLabel  component  - lbtitle1, Proprietes
           
          name:
          text:
          lbtitle1
          Title

           

        3. Add  JLabel  component  - lbchapter1, Proprietes
           
          name:
          text:
          lbchapter1
           Chapter

           

        4. Add  JLabel  component  - lbverse1, Proprietes
           
          name:
          text:
          lbverse1
           Verse

           

        5. Add  JComboBox  component  - cmbbook, Proprietes
           
          name:
          border:
          cmbbook
          line

          Event :  itemStateChanged
           

        6. Add  JComboBox  component  - cmbtitle, Proprietes
           
          name:
          border:
          cmbtitle
          line

          Event :  itemStateChanged
           

        7. Add  JComboBox  component  - cmbchapter, Proprietes
           
          name:
          border:
          cmbchapter
          line

          Event :  itemStateChanged
           

        8. Add  JComboBox  component  - cmbverse, Proprietes
           
          name:
          border:
          cmbverse
          line

          Event :  itemStateChanged
           

        9. Add  JComboBox  component  - cmbbookval, Proprietes
           
          name:
          border:
          enabled
          :
          cmbbookval
          Empty border
          False

           

        10. Add  JComboBox  component  - cmbtitleval, Proprietes
           
          name:
          border:
          enabled
          :
          cmbtitleval
          Empty border
          False

           

        11. Add  JComboBox  component  - cmbchapterval, Proprietes
           
          name:
          border:
          enabled
          :
          cmbchapterval
          Empty border
          False

           

        12. Add  JComboBox  component  - cmbverseval , Proprietes
           
          name:
          border:
          enabled
          :
          cmbverseval
          Empty border
          False

         



     

  3. Add database  components ...  
     

    1. Add the Data Module bookDataModule1 to this project - ( How to use it)
      1- Compile this
      Data module or project ( From Project menu select and click Rebuild Project
          "JB_APP_KJV"
      2. From Wizards menu select and click
      Use DataModule ..
      . The Use DataModule Wizard dialog
      box appears

      Use DataModule Wizard dialog box

      In DataModule class box type  BookDataModule
      In DataModule class combobox  choose and select  BookDataModule
      In Field name box type  bookDataModule1
      and then click Ok.      (
      bookDataModule1 compenent to be added to the Data Access of the Structure of the Book_Frame.java )
       

    2. Add queryDataSet   component - QueryDataSet 1, Proprietes
      The QueryDataSet class is an extension of its superclass (StorageDataSet StorageDataSet) and provides functionality to run a query statement (with or without parameters) against a table in a SQL database
       

      Name:
      query:

      TableName
      QueryDataSet 1
      database1, "SELECT BibleTable.ID,BibleTable ...
      Bibletable


      How create query ? ...

      From the Proprietes, click query, the Query dialog  box appears ..
        Query
      dialog  box

      In the database combobox, choose or type  database1
      Click Sql  Builder to create the Sql statement using the  Sql  Builder  dialog  box  ...  Sql statement stores  " bookDataModule1.getMdatabase1(), SELECT BibleTable.ID,BibleTable.Book,BibleTable.BookTitle,BibleTable.Chapter,BibleTable.Verse,
      BibleTable.TextData FROM \C:\\JB_APP_KJV\\PIC\\KJV2002\.BibleTable WHERE BibleTable.Chapter<>\'000\'ORDER BY BibleTable.ID",


       
      And then click Ok 

 

 

 The source (codes)  corresponding ...


 

 

Previous
  Home
4