[go: up one dir, main page]

0% found this document useful (0 votes)
164 views25 pages

Advance Java PDF

The document provides information about the online exam pattern for the subject AJP with code 22517 in the 5th semester. It includes details like the total number of questions (42), time duration (90 minutes), distribution of questions across different chapters and difficulty levels, and marks distribution. The questions are divided into three difficulty levels: Remember level (14 questions of 1 mark each), Understand level (10 questions of 2 marks each), and Apply level (18 questions of 2 marks each). The document also lists the different swing components like JApplet, labels, text fields, combo boxes, buttons, advanced components, and the MVC architecture.

Uploaded by

Atharva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
164 views25 pages

Advance Java PDF

The document provides information about the online exam pattern for the subject AJP with code 22517 in the 5th semester. It includes details like the total number of questions (42), time duration (90 minutes), distribution of questions across different chapters and difficulty levels, and marks distribution. The questions are divided into three difficulty levels: Remember level (14 questions of 1 mark each), Understand level (10 questions of 2 marks each), and Apply level (18 questions of 2 marks each). The document also lists the different swing components like JApplet, labels, text fields, combo boxes, buttons, advanced components, and the MVC architecture.

Uploaded by

Atharva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Subject:- AJP Code:- 22517

Course Code:- CO/CM/CW/IF-5I Semester:- Fifth

Prof. Gunwant Mankar


BE, MTech(CSE), AMIE, MIAEng, MCSI

https://www.gunwantmankar.com
/ 1
https://www.gunwantmankar.com
/ 2
Online Exam pattern are as follows:
Total questions are: 42 Time:- 90 Minutes
Detail online exam pattern are as follows with chapter wise questions
Distribution of Marks
Unit
Unit Title R U A Total
No
Level Level Level Marks
Abstract Windowing Tool
1 2 4 6 12
Kit (AWT)
2 Swing 2 2 6 10
3 Event Handling 2 2 8 12
4 Networking Basics 2 4 4 10
Interacting with
5 2 4 6 12
Database
6 Servlets 4 4 6 14
Total 14 20 36 70

• (R) Remember Level (Basic Level):-Total Question:-14 (1 mark each)


These are very simple questions and it will not take more than 15 to 20 minutes to solve.

• (U) Understand Level:- Total Question:-10 (2 marks each).


These are understand level questions, difficulty level little increases.

• (A) Apply Level:- Total Question:-18 (2 marks each).


These are apply level questions means you have to apply your knowledge to solve these
questions and again difficulty level is increases.
https://www.gunwantmankar.com
/ 3
Distribution of Marks
Unit
Unit Title R U A
No
Level Level Level Total Marks

Abstract Windowing Tool Kit


1 2 4 6 12
(AWT)

2 Swing 2 2 6 10

3 Event Handling 2 2 8 12

4 Networking Basics 2 4 4 10

5 Interacting with Database 2 4 6 12

6 Servlets 4 4 6 14

Total 14 20 36 70

https://www.gunwantmankar.com
/ 4
2.1. Introduction to Swings: Swing Features, Difference
between AWT & Swings.

2.2. Swing Components: JApplet, Icons and Labels,


Text Fields, Combo Boxes.

2.3. Buttons: The Jbutton, CheckBoxes, Radio Buttons,

2.4.Advanced Swing Components:TabbedPanes, Scroll


Panes, Trees, Tables, Progress bar, tool tips.
2.5. MVC Architeture.

https://www.gunwantmankar.com
/ 5
 Package : javax.swing.*
 Swing is set of classes which provides more powerful and flexible
components as compare to AWT.
 Build on top of AWT API and acts as replacement of AWTAPI.
 Swing component follows a Model-View-Controller
 Swing Components are implemented using Java and so they are
platform independent.
 Called lightweight components
 100 % Java implementations of components.
 Use MVC architecture.
 Model represents the data
 View as a visual representation of the data
 Controller takes input and translates it to changes in data

https://www.gunwantmankar.com
/ 6
https://www.gunwantmankar.com
/ 7
No Java AWT Java Swing
1) AWT components are platform-dependent. Java swing components are platform-
independent.
2) AWT components are heavyweight. Swing components are lightweight.

3) AWT doesn't support pluggable look and feel. Swing supports pluggable look and feel.

4) AWT provides less components than Swing. Swing provides more powerful
components such as tables, lists, scrollpanes,
colorchooser, tabbedpane etc.
5) AWT doesn't follows MVC(Model View Controller) Swing follows MVC.

 AWT uses Applet and Frame while Swing uses JApplet and JFrame
for GUI.
 Swing has bigger collection of classes and interfaces as compare to AWT.
 In Swing extra feature to Button: Provide Image.

https://www.gunwantmankar.com
/ 8
 Abstract Button
 ButtonGroup
 ImageIcon
 JApplet
 JButton
 JCheckBox
 JComboBox
 JLabel
 JRadioButton
 JScrollPane
 JTabbedPane
 JTable
 JTextField
 JTree

https://www.gunwantmankar.com
/ 9
 Extends JApplet/JFrame class.
 Design UI in init() or Constructor method.
 Add all components on Container instead on
JApplet/JFrame.
 getContentPane() method returns the container object.
 Call container add() method to add components.
 For JFrame close operation: setDefaultCloseOperation()
 Parameters:
 DISPOSE_ON_CLOSE
 EXIT_ON_CLOSE
 DO_NOTHING_ON_CLOSE

https://www.gunwantmankar.com
/ 10
 Small display area for text, image or both.
 Extends Jcomponent.
 Constructors:
 JLabel(Icon i)
 JLabel(String s)
 JLabel(String s, Icon i, int align)
align argument is either LEFT, RIGHT, CENTER,
 ImageIcon:
 ImageIcon(String filename)
 ImageIcon(URL url)
 The ImageIcon class implements the Icon interface that declares the methods
 int getIconHeight( )
 int getIconWidth( )
 Other methods:
 Icon getIcon( ) 1
 String getText( ) 1
 void setIcon(Icon i) https://www.gunwantmankar.com
/ 1
 void setText(String s)
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField

Constructor
JTextField( )
JTextField(int cols)
JTextField(String s, int cols)
JTextField(String s)

https://www.gunwantmankar.com
/ 12
 Combination of text field and drop down list.
 Subclass of JComponet
 Only one entry can view at a time.
 Constructor:
 JComboBox( )
 JComboBox(Vector v)
 void addItem(Object obj): Used to add object in Combobox

 ItemEvent is generated.
 Implements ItemListener interface
 Override: itemStateChnaged(ItemEvent ie) method defined by
ItemListener.

https://www.gunwantmankar.com
/ 13
 Swing provide Icon with Button text.
 Swing buttons are subclasses of the AbstractButton class, which extends
Jcomponent.
 AbstractButton contains many methods that allow you to
control the behavior of buttons, check boxes, and radio buttons.
 Setter and Getter:
 String getText( )
 void setText(String s)

 Constructors:
 JButton(Icon i)
 JButton(String s)
 JButton(String s, Icon i)

https://www.gunwantmankar.com
/ 14
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JToggleButton
javax.swing.JCheckBox
Constructor
JCheckBox(Icon i)
JCheckBox(Icon i, boolean state)
JCheckBox(String s)
JCheckBox(String s, boolean state)
JCheckBox(String s, Icon i)
JCheckBox(String s, Icon i, boolean state)
 void setSelected(boolean state)
 ItemEvent is generated.
 ItemListener interface is needed to handle ItemEvent.
 Public itemStateChanged() used to override.

https://www.gunwantmankar.com
/ 15
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JToggleButton
javax.swing.JRadioButton
JRadioButton(Icon i)
JRadioButton(Icon i, boolean state)
JRadioButton(String s)
JRadioButton(String s, boolean state)
JRadioButton(String s, Icon i)
JRadioButton(String s, Icon i, boolean state)
 ButtonGroup class is used to add radio button in group.
 ActionEvent is generated.
 ActionListener Listener interface is needed to handle ActionEvent.
 public void actionPerofrmed() used to override.

https://www.gunwantmankar.com
/ 16
 A tabbed pane is a component that appears as a group of folders in
a file cabinet.
 Each folder has a title.
 When a user selects a folder, its contents become visible.
 Only one of the folders may be selected at a time.
 Subclass of Jcomponent
 Tabs are defined via the following method :
 void addTab(String str, Component comp)

 Str: title of pane

 Comp: component, it can be JPanel

https://www.gunwantmankar.com
/ 17
 A scroll pane is a component that presents a rectangular area in
which a component may be viewed.
 Subclass of JComponent
 Constructor:
 JScrollPane(Component comp)
 JScrollPane(int vsb, int hsb)
 JScrollPane(Component comp, int vsb, int hsb)
 Comp: Component, vsb and hsb: Scrollbar constant
 HORIZONTAL_SCROLLBAR_ALWAYS
 HORIZONTAL_SCROLLBAR_AS_NEEDED
 VERTICAL_SCROLLBAR_ALWAYS
 VERTICAL_SCROLLBAR_AS_NEEDED
.

https://www.gunwantmankar.com
/ 18
• Check box is selected or deselected, an item event is
generated.
• For handling implements ItemListener interface
• ItemListener interface is defines itemStateChanged( )
method.
• ItemEvent object is supplied as the argument.
• getState() : Get Status about checkbox.

• Following methods determine and set status:


• Checkbox getSelectedCheckbox( )
• void setSelectedCheckbox(Checkbox which)

https://www.gunwantmankar.com
/ 19
 A tree is a component that presents a hierarchical view of data.
 Trees are implemented in Swing by the JTree class, which extends
JComponent.
 Constructors:
 JTree(Hashtable ht)
 JTree(Object obj[ ])
 JTree(TreeNode tn)
 JTree(Vector v)
 A JTree object generates events when a node is expandedor collapsed.
 The addTreeExpansionListener( ) and removeTreeExpansionListener( ) methods allow
listeners to register and unregister for these notifications.
 Signature for these methods:
 void addTreeExpansionListener(TreeExpansionListener tel)
 void removeTreeExpansionListener(TreeExpansionListener tel)

https://www.gunwantmankar.com
/ 20
 To create a hierarchy of tree nodes, the add( ) method of
DefaultMutableTreeNode can be used.
 void add(MutableTreeNode child)
 Tree Expansion event described by class:
 TreeExpansionEvent (Package: javax.swing.event)
 The getPath( ) method of this class returns a TreePath.
 TreePath getPath( )
 TreeExpansionListener interface provides the following two methods
 void treeCollapsed(TreeExpansionEvent tee)
 void treeExpanded(TreeExpansionEvent tee)

 Steps to create Jtree:

1. Create a JTree object.


2. Create a JScrollPane object.
3. Add the tree to the scroll pane.
4. Add the scroll pane to the content pane of the applet.

https://www.gunwantmankar.com
/ 21
 A table is a component that displays rows and columns of data.
 You can drag the cursor on column boundaries to resize columns.
 You can also drag a column to a new position.
 Subclass of JComponent
 Constructor:
 JTable(Object data[ ][ ], Object colHeads[ ])
 data is a two-dimensional array of the information
 colHeads is a one-dimensional array with the column headings.
 Steps to create Jtable

1. Create a JTable object.


2. Create a JScrollPane object.
3. Add the table to the scroll pane.
4. Add the scroll pane to the content pane of the JApplet or JFrame.

https://www.gunwantmankar.com
/ 22
 Software design pattern for software development.
 Model:
 Major function of this layer to maintain the data.
 Database and logic.
 View:
 Used to display full or partial data.
 User Interface
 Controller:
 Control the interaction and communication between Model and view.
 Communication logic/integration logic

https://www.gunwantmankar.com
/ 23
https://www.gunwantmankar.com
/ 24
https://www.gunwantmankar.com
/ 25

You might also like