AJP - Microproject
AJP - Microproject
Micro project
On
Submitted By
Guided By
Ms. A. D. Mate
Scheme, MSBTE)
SOU.VENUTAI CHAVAN
Program Code: CM
SR NO CONTENTS PAGE NO
2 Rationale 3
4 Literature Review 3
7 Skills Developed 12
8 Conclusion 13
Advance Java Programming - Online Quiz Application
22517
Annexure - I
Micro-Project Proposal
Quiz Application
The aim of the Micro-project is to develop a application which can generate a online quiz.
IV. Study to create packages and developing a java file in it and importing it.
6 18-10-2023 23-10-2023
Prepare the final report. Vedant Mawale
Annexure - II
Micro-Project
Report
1.0 Rationale:
Java, the very popular language for desktop as well as mobile application development,
has some unique features, also it’s an object-oriented programming language.
In this course of microproject I am going to learn about one of Java’s unique feature i.e.,
Package creation and importing it in a program to use its function.
By default, in Java the main class runs in a default java package, but one can create our
own package and can implement classes in and methods, so that I can import that package
to use its functions.
1.AWT Components:
AWT, Java's original GUI toolkit, provides a set of platform-dependent components for
building graphical user interfaces. These components include buttons, text fields, labels,
and panels, which were used in the project to create the expense entry form.
1. Swing Components:
Swing, an extension of AWT, offers a more versatile and customizable set of GUI
components. Swing components, such as JFrame, JPanel, JTextField, JButton, JLabel, and
2. JFrame:
The JFrame class serves as the main window for the application. It encapsulates the entire
GUI and provides essential features such as window management and event handling.
3. JPanel:
JPanel is a versatile container used to group and organize other components. In the project,
it was employed to create distinct sections of the GUI, such as the form panel and the
button panel.
4. JTextField and JLabel:
JTextField components are used for text input, allowing users to enter expense details.
Corresponding JLabel components provide labels for these input fields.
5. JButton:
JButton components represent interactive buttons that trigger actions. In the project, they
were used for the "Submit" and "View Division" buttons.
6. JScrollPane:
JScrollPane enables scrolling of components that may exceed the visible area. It was
applied to the JTextArea component in the expense division screen to accommodate
potentially lengthy reports.
7. Event Handling:
Both AWT and Swing components support event handling. The project utilized event
listeners and action listeners to capture user interactions, such as button clicks and form
submissions.
8. Layout Managers:
Java provides various layout managers, including FlowLayout and BorderLayout, to
control the arrangement and positioning of components within containers. These layout
managers were utilized to design the GUI layout efficiently.
9. User Experience (UX):
A focus on UX design was evident in the project, ensuring that the GUI is intuitive and
user- friendly. This involved organizing components logically, providing clear labels, and
offering real-time feedback through status messages.
7.0 Algorithm:
Step 1: Start
Step 2: Select the right answers of the questions
Step 3: Click on the next button
Step 4: Complete all the questions
Step 5: Check the results by clicking on RESULT button
Step 6: Message Dialog appears which shows the number of correct answers.
Step7: Enter OK
Step8: Stop
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
for(int i=0;i<5;i++)
{
jb[i]=new JRadioButton();
f.add(jb[i]);
bg.add(jb[i]);
}
b1=new JButton("Next");
b2=new JButton("Bookmark");
Sou.Venuati Chavan Polytechnic Pune 2023-24
Advance Java Programming - Online Quiz Application
22517
b1.setBackground(Color.green);
b1.setBorder(border);
b1.setForeground(Color.black);
b2.setBackground(Color.blue);
b2.setBorder(border);
b2.setForeground(Color.white);
b1.addActionListener(this);
b2.addActionListener(this);
f.add(b1);
f.add(b2);
set();
l.setBounds(30,40,700,20);
jb[0].setBounds(50,80,150,20);
jb[1].setBounds(50,110,150,20);
jb[2].setBounds(50,140,150,20);
jb[3].setBounds(50,170,150,20);
b1.setBounds(100,240,150,30);
b2.setBounds(270,240,150,30);
f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
f.setLayout(null);
f.setLocation(550,450);
f.setVisible(true);
f.getRootPane().setBorder(BorderFactory.createMatteBorder(7, 7,7,
7, Color.red));
f.setSize(700,400);
}
if(e.getSource()==b1)
{
if(check()) count=count+1;
current++;
Sou.Venuati Chavan Polytechnic Pune 2023-24
Advance Java Programming - Online Quiz Application
22517
set();
if(current==9)
{
b1.setEnabled(false);
b2.setText("Result");
}
}
if(e.getActionCommand().equals ("Bookmark"))
{
JButton bk = new JButton("Bookmark"+x);
bk.setBounds(480,20+30*x,100, 30);
add(bk);
bk.addActionListener(this);
m[x]=current;
x++;
current++;
set();
if(current==9)
b2.setText("Result");
setVisible(false);
setVisible(true);
}
for(int i=0,y=1;i<x;i++,y++)
{
if(e.getActionCommand().equals ("Bookmark"+y))
{
if(check())
count=count+1;
now=current;
current=m[y];
set();
((JButton)e.getSource()).setEnabled(false);
current=now;
}
}
{ 22517
if(check()) count=count+1;
current++;
JOptionPane.showMessageDialog(this,"correct ans="+count);
System.exit(0);
}
}
void set()
{
jb[4].setSelected(true);
if(current==0)
{
l.setText("Que1: Which class provides many methods for graphics
programming?");
jb[0].setText("java.awt");
jb[1].setText("java.Graphics");
jb[2].setText("java.awt.graphics");
jb[3].setText("None of the above");
}
if(current==1)
{
l.setText("Que2: By Which methods you can set or change the text
in a label?");
jb[0].setText("setText()");
jb[1].setText("getText()");
jb[2].setText(" Both A & B");
jb[3].setText("None of the above");
}
if(current==2)
{
l.setText("Que3: Public class MenuBar extends?");
jb[0].setText("MenuComponent");
jb[1].setText("MenuContainer");
jb[2].setText("ComponentMenu");
jb[3].setText("MenuBar");
}
if(current==3)
{
l.setText("Que4:The getContentPane() method is of which class?");
jb[0].setText("JApplet");
Sou.Venuati Chavan Polytechnic Pune 2023-24
Advance Java Programming - Online Quiz Application
22517
jb[1].setText("JFrame");
jb[2].setText("JB utton");
jb[3].setText("None of these");
}
if(current==4)
{
l.setText("Que5: MVC architecture is ?");
jb[0].setText("Modeling-visual-
controller"); jb[1].setText("Model-view-
controll"); jb[2].setText("Many- View-
controller"); jb[3].setText("Model-viewable-
controller");
}
if(current==5)
{
l.setText("Que6:Select full form of DNS?");
jb[0].setText("Data Network system");
jb[1].setText("Domain Name System");
jb[2].setText("Domain Name Server");
jb[3].setText("Domain Naming Service");
}
if(current==6)
{
l.setText("Que7: Which event is genrated when the position of
scrollbar is changed? ");
jb[0].setText("AdjustmentEvent");
jb[1].setText("MouseEvent");
jb[2].setText("keyEvent");
jb[3].setText("ItemEVent");
}
if(current==7)
{
l.setText("Que8: UDP Stands For ?");
jb[0].setText("User Data Port");
jb[1].setText("User data provider");
jb[2].setText("User data protocol");
jb[3].setText("User Datagram Protocol");
}
if(current==8)
{
Sou.Venuati Chavan Polytechnic Pune 2023-24
Advance Java Programming - Online Quiz Application
22517
l.setText("Que9: Port Number of FTP is ?");
jb[j].setBounds(50,80+i,200,20);
}
boolean check()
{
if(current==0) return(jb[0].isSelected());
if(current==1) return(jb[0].isSelected());
if(current==2) return(jb[3].isSelected());
if(current==3) return(jb[1].isSelected());
if(current==4) return(jb[1].isSelected());
if(current==5) return(jb[2].isSelected());
if(current==6) return(jb[0].isSelected());
if(current==7) return(jb[3].isSelected());
if(current==8) return(jb[0].isSelected());
if(current==9) return(jb[0].isSelected());
return false;
}
public static void main(String s[])
{
new OnlineExam("Online Exams");
}
}
9.0 0utput:
11.0 Conclusion:
It was a great experience to design and implement the Swing using Advanced Java
programming and also to work on its documentation. This project helped me in getting the
better understanding of Swings and AWT Components of Advanced Java Programming.
After doing this project, I am in position to explain concepts of Advanced Java
Programming and apply them to the modelling of real-world systems by utilizing its
offered facilities. I am now able to handle events of AWT and swing components and also
develop programs using networking concepts