SlideShare a Scribd company logo
Presentation on JTable
MD. Nazmul Hasan Sharif
ID:120025
Session:2012-13
Dep’t Of ICT
Comilla University
What is JTable
JTable is a component that displays rows and columns of data.
We can drag the cursor on column
boundaries to resize columns. We can also
drag a column to a new position. It can also
be possible to select a row,column, or cell
within the table and to change the data
Within a cell.
Class, interfaces and constructors
 JTable has many classes and interfaces associated with it. These are packaged in
javax.swing.table
 JTable does not provide any scrolling capabilities of its own. Instead, we will
normally wrap a JTable inside a JScrollPane.
 JTable supplies several constructors. The one used here is JTable(Object data[ ][ ],
Object colHeads[ ])
Here, data is a two-dimensional array of the information to be presented,
and colHeads is a one-dimensional array with the column headings.
Events Of JTable
A JTable can generate several different events.
The two most fundamental to a table’s operation are ListSelectionEvent and
TableModelEvent
ListSelectionEvent is generated when the user selects something in the table
TableModelEvent is fired when that table’s data changes in some way.
However, if we simply want to use JTable to display data (as the following example
does), then we don’t need to handle any events.
Steps for creating a simple table
Here are the steps required to set up a simple JTable that can be used to display data:
 1. Create an instance of JTable.
 2. Create a JScrollPane object, specifying the table as the object to scroll.
 3. Add the table to the scroll pane.
 4. Add the scroll pane to the content pane.
Models Of JTable
JTable relies on three models
1. TableModel : It is defined by the TableModel interface.
This model defines those things related to displaying data in a two-dimensional
format.
2. TableColumnModel
TableColumnModel that specifies the characteristics of a
column.
These two models are packaged in javax.swing.table
3. ListSelectionModel
The third model determines how items are selected.
Source Code
Output:
Thanks to all

More Related Content

What's hot

Pivot Table & Chart_Parakramesh Jaroli_Pacific University
Pivot Table & Chart_Parakramesh Jaroli_Pacific UniversityPivot Table & Chart_Parakramesh Jaroli_Pacific University
Pivot Table & Chart_Parakramesh Jaroli_Pacific University
Parakramesh Jaroli
 
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDERCREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
SagarDuttPhuloria
 
Pivot table
Pivot tablePivot table
Pivot table
Vijay Perepa
 
Tech Tip: Output Management System (OMS) in IBM SPSS Statistics
Tech Tip: Output Management System (OMS) in IBM SPSS StatisticsTech Tip: Output Management System (OMS) in IBM SPSS Statistics
Tech Tip: Output Management System (OMS) in IBM SPSS Statistics
Version 1 Analytics
 
MS Excel Pivot Table Reports & Charts
MS Excel Pivot Table Reports & ChartsMS Excel Pivot Table Reports & Charts
MS Excel Pivot Table Reports & Charts
dnbakhan
 
Charts and pivot tables
Charts and pivot tablesCharts and pivot tables
Charts and pivot tables
UttaraChattopadhyay
 
Ppt on pivot table
Ppt on pivot tablePpt on pivot table
Ppt on pivot table
Hemendra Vyas
 
Pivot Table | Statistics
Pivot Table | StatisticsPivot Table | Statistics
Pivot Table | Statistics
Transweb Global Inc
 
Excel Pivot Tables
Excel Pivot TablesExcel Pivot Tables
Excel Pivot Tables
Matt Saragusa
 
SAP BO Web Intelligence Basics
SAP BO Web Intelligence BasicsSAP BO Web Intelligence Basics
SAP BO Web Intelligence Basics
Kiran Joy
 
Creating visual representations of time period data
Creating visual representations of time period dataCreating visual representations of time period data
Creating visual representations of time period data
QHRClinicalOps
 
Exercise 6
Exercise 6Exercise 6
Exercise 6
Wansoo Im
 

What's hot (12)

Pivot Table & Chart_Parakramesh Jaroli_Pacific University
Pivot Table & Chart_Parakramesh Jaroli_Pacific UniversityPivot Table & Chart_Parakramesh Jaroli_Pacific University
Pivot Table & Chart_Parakramesh Jaroli_Pacific University
 
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDERCREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
 
Pivot table
Pivot tablePivot table
Pivot table
 
Tech Tip: Output Management System (OMS) in IBM SPSS Statistics
Tech Tip: Output Management System (OMS) in IBM SPSS StatisticsTech Tip: Output Management System (OMS) in IBM SPSS Statistics
Tech Tip: Output Management System (OMS) in IBM SPSS Statistics
 
MS Excel Pivot Table Reports & Charts
MS Excel Pivot Table Reports & ChartsMS Excel Pivot Table Reports & Charts
MS Excel Pivot Table Reports & Charts
 
Charts and pivot tables
Charts and pivot tablesCharts and pivot tables
Charts and pivot tables
 
Ppt on pivot table
Ppt on pivot tablePpt on pivot table
Ppt on pivot table
 
Pivot Table | Statistics
Pivot Table | StatisticsPivot Table | Statistics
Pivot Table | Statistics
 
Excel Pivot Tables
Excel Pivot TablesExcel Pivot Tables
Excel Pivot Tables
 
SAP BO Web Intelligence Basics
SAP BO Web Intelligence BasicsSAP BO Web Intelligence Basics
SAP BO Web Intelligence Basics
 
Creating visual representations of time period data
Creating visual representations of time period dataCreating visual representations of time period data
Creating visual representations of time period data
 
Exercise 6
Exercise 6Exercise 6
Exercise 6
 

Similar to Java presentation

Microsoft Excel Tutorial
Microsoft Excel TutorialMicrosoft Excel Tutorial
Microsoft Excel Tutorial
Kristine Tiongco-Rimpa
 
simio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docx
simio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docxsimio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docx
simio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docx
budabrooks46239
 
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
Nitish Nagar
 
Java swing
Java swingJava swing
Java swing
ssuser3a47cb
 
Tolerance Stackups Using Oracle Crystal Ball
Tolerance Stackups Using Oracle Crystal BallTolerance Stackups Using Oracle Crystal Ball
Tolerance Stackups Using Oracle Crystal Ball
Ramon Balisnomo
 
Advanced Excel ppt
Advanced Excel pptAdvanced Excel ppt
Advanced Excel ppt
Sudipta Mazumder
 
SACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdfSACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdf
PeputraHiring
 
27 Excel Hacks to Make You a Superstar
27 Excel Hacks to Make You a Superstar27 Excel Hacks to Make You a Superstar
27 Excel Hacks to Make You a Superstar
Alan Murray
 
Focusing on specific data by using filterss
Focusing on specific data by using filterssFocusing on specific data by using filterss
Focusing on specific data by using filterss
um5ashm
 
Basics of excel for beginners
Basics of excel for beginnersBasics of excel for beginners
Basics of excel for beginners
Jitesh Khushalani
 
computer applications in business unit 3
computer applications in business unit 3computer applications in business unit 3
computer applications in business unit 3
Dr T.Sivakami
 
MS Excel 2013
MS Excel 2013MS Excel 2013
MS Excel 2013
Jahnavee Parmar
 
Excel booklet
Excel bookletExcel booklet
Excel booklet
pacevedoma Acemaci
 
Itm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers keyItm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers key
Song Love
 
PATTERNS08 - Strong Typing and Data Validation in .NET
PATTERNS08 - Strong Typing and Data Validation in .NETPATTERNS08 - Strong Typing and Data Validation in .NET
PATTERNS08 - Strong Typing and Data Validation in .NET
Michael Heron
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
onlinetrainingplacements
 
Jide grids developer_guide
Jide grids developer_guideJide grids developer_guide
Jide grids developer_guide
Satheesh Somasekharan
 
Introduction to MySQL - Part 2
Introduction to MySQL - Part 2Introduction to MySQL - Part 2
Introduction to MySQL - Part 2
webhostingguy
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
Divyam Pateriya
 
Excel Training
Excel TrainingExcel Training
Excel Training
Joshua Flewelling
 

Similar to Java presentation (20)

Microsoft Excel Tutorial
Microsoft Excel TutorialMicrosoft Excel Tutorial
Microsoft Excel Tutorial
 
simio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docx
simio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docxsimio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docx
simio_HW.DS_Storesimio_HWHW4.JPGsimio_HWModel7.1.pdf.docx
 
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
4b6c1c5c-e913-4bbf-b3a4-41e23cb961ba-161004200047.pdf
 
Java swing
Java swingJava swing
Java swing
 
Tolerance Stackups Using Oracle Crystal Ball
Tolerance Stackups Using Oracle Crystal BallTolerance Stackups Using Oracle Crystal Ball
Tolerance Stackups Using Oracle Crystal Ball
 
Advanced Excel ppt
Advanced Excel pptAdvanced Excel ppt
Advanced Excel ppt
 
SACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdfSACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdf
 
27 Excel Hacks to Make You a Superstar
27 Excel Hacks to Make You a Superstar27 Excel Hacks to Make You a Superstar
27 Excel Hacks to Make You a Superstar
 
Focusing on specific data by using filterss
Focusing on specific data by using filterssFocusing on specific data by using filterss
Focusing on specific data by using filterss
 
Basics of excel for beginners
Basics of excel for beginnersBasics of excel for beginners
Basics of excel for beginners
 
computer applications in business unit 3
computer applications in business unit 3computer applications in business unit 3
computer applications in business unit 3
 
MS Excel 2013
MS Excel 2013MS Excel 2013
MS Excel 2013
 
Excel booklet
Excel bookletExcel booklet
Excel booklet
 
Itm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers keyItm310 problem solving #7 complete solutions correct answers key
Itm310 problem solving #7 complete solutions correct answers key
 
PATTERNS08 - Strong Typing and Data Validation in .NET
PATTERNS08 - Strong Typing and Data Validation in .NETPATTERNS08 - Strong Typing and Data Validation in .NET
PATTERNS08 - Strong Typing and Data Validation in .NET
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
 
Jide grids developer_guide
Jide grids developer_guideJide grids developer_guide
Jide grids developer_guide
 
Introduction to MySQL - Part 2
Introduction to MySQL - Part 2Introduction to MySQL - Part 2
Introduction to MySQL - Part 2
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
Excel Training
Excel TrainingExcel Training
Excel Training
 

Recently uploaded

Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
HODECEDSIET
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 

Recently uploaded (20)

Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 

Java presentation

  • 1. Presentation on JTable MD. Nazmul Hasan Sharif ID:120025 Session:2012-13 Dep’t Of ICT Comilla University
  • 2. What is JTable JTable is a component that displays rows and columns of data. We can drag the cursor on column boundaries to resize columns. We can also drag a column to a new position. It can also be possible to select a row,column, or cell within the table and to change the data Within a cell.
  • 3. Class, interfaces and constructors  JTable has many classes and interfaces associated with it. These are packaged in javax.swing.table  JTable does not provide any scrolling capabilities of its own. Instead, we will normally wrap a JTable inside a JScrollPane.  JTable supplies several constructors. The one used here is JTable(Object data[ ][ ], Object colHeads[ ]) Here, data is a two-dimensional array of the information to be presented, and colHeads is a one-dimensional array with the column headings.
  • 4. Events Of JTable A JTable can generate several different events. The two most fundamental to a table’s operation are ListSelectionEvent and TableModelEvent ListSelectionEvent is generated when the user selects something in the table TableModelEvent is fired when that table’s data changes in some way. However, if we simply want to use JTable to display data (as the following example does), then we don’t need to handle any events.
  • 5. Steps for creating a simple table Here are the steps required to set up a simple JTable that can be used to display data:  1. Create an instance of JTable.  2. Create a JScrollPane object, specifying the table as the object to scroll.  3. Add the table to the scroll pane.  4. Add the scroll pane to the content pane.
  • 6. Models Of JTable JTable relies on three models 1. TableModel : It is defined by the TableModel interface. This model defines those things related to displaying data in a two-dimensional format. 2. TableColumnModel TableColumnModel that specifies the characteristics of a column. These two models are packaged in javax.swing.table 3. ListSelectionModel The third model determines how items are selected.
  • 8.