Unlock Your Java Superpowers with 9 Mind-Blowing Mini Projects in One Ultimate Application!
9 Mind-Blowing Mini Projects in Java
In the world of Java programming, learning through practical application is often the most effective way to grasp the intricacies of the language. What if I told you that you can enhance your Java skills by working on not just one but nine mini projects, all within a single application? Yes, you heard it right! In this post, we will explore a multi-functional Java application that includes nine mini projects, each designed to sharpen your coding skills and give you hands-on experience in Java development.
Demo Video
Table of Contents
1. Calculator 🧮:
- Start with a simple calculator that can perform basic arithmetic operations like addition, subtraction, multiplication, and division.
2. Notepad+ 📝:
- Create a text editor with additional features like opening, editing, saving, and searching for text files. This project will help you work with file I/O in Java.
3. Puzzle Game 🧩:
- Build a puzzle game where users can solve jigsaw puzzles by rearranging pieces. This project will test your skills in GUI development and event handling.
4. Picture Puzzle Game 🖼️:
- Take the puzzle game to the next level by allowing users to solve puzzles with images instead of just numbers. This will require additional image handling capabilities.
9 Mind-Blowing Mini Projects in Java
5. Tic Tac Toe Game ❌⭕:
- Develop a classic Tic Tac Toe game that can be played between two players or against an AI opponent. This project will delve into algorithms and logic.
6. IP Finder 🌐:
- Create a tool that can retrieve and display the IP address of a given website or domain. This project will involve network programming.
7. Word Count Tool 📊:
- Build a program that analyzes a text file and counts the occurrences of each word. You’ll gain experience in working with strings and collections.
8. Source Code Generator 💻:
- Design a source code generator that can create Java code for simple programs based on user input. This project will involve string manipulation and code generation techniques.
9. Exam System 📚:
- Develop a basic exam system where users can take quizzes with multiple-choice questions. This project will require you to manage questions, answers, and user scores.
Combining these nine mini projects into a single application not only provides you with a holistic learning experience but also demonstrates the power of modular programming. You can create separate classes or packages for each project, making your code well-organized and maintainable.
9 Mind-Blowing Mini Projects in Java | Source Code:-
Java Main File:-
package com.javatpoint;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Font;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class JApps extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
JApps frame = new JApps();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public JApps() {
setTitle("Java Nine Projects");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 700, 771);
contentPane = new JPanel();
contentPane.setBackground(new Color(204, 255, 204));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
JButton btnNewButton = new JButton("");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Notepad.main(new String[]{});
}
});
btnNewButton.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/notepad.jpg")));
JLabel lblJavaApplicationWorld = new JLabel("Java Application World");
lblJavaApplicationWorld.setFont(new Font("Tahoma", Font.PLAIN, 21));
lblJavaApplicationWorld.setForeground(new Color(204, 51, 51));
JButton button = new JButton("");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MyCalculator.main(new String[]{});
}
});
button.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/calculator.jpg")));
JButton button_1 = new JButton("");
button_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
IPFinder.main(new String[]{});
}
});
button_1.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/ip.jpg")));
JButton button_2 = new JButton("");
button_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
TTT1.main(new String[]{});
}
});
button_2.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/tictactoe.jpg")));
JButton button_3 = new JButton("");
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
picpuzzle2.main(new String[]{});
}
});
button_3.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/picturepuzzle.jpg")));
JButton button_4 = new JButton("");
button_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
CharCount.main(new String[]{});
}
});
button_4.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/wct.jpg")));
JButton button_5 = new JButton("");
button_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Puzzle.main(new String[]{});
}
});
button_5.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/Puzzle Game.jpg")));
JButton button_6 = new JButton("");
button_6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
OnlineTest.main(new String[]{});
}
});
button_6.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/Exam System.jpg")));
JButton button_7 = new JButton("");
button_7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SourceGetter.main(new String[]{});
}
});
button_7.setIcon(new ImageIcon(JApps.class.getResource("/com/javatpoint/Source Code Generator.jpg")));
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap()
.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(186)
.addComponent(lblJavaApplicationWorld))
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap()
.addComponent(button_2, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(button_3, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(button_4, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap()
.addComponent(button_5, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(button_6, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(button_7, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)))
.addContainerGap(17, Short.MAX_VALUE))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(12)
.addComponent(lblJavaApplicationWorld)
.addGap(18)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addComponent(btnNewButton)
.addComponent(button, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(button_2, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addComponent(button_3, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addComponent(button_4, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.UNRELATED)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(button_5, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addComponent(button_6, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE)
.addComponent(button_7, GroupLayout.PREFERRED_SIZE, 209, GroupLayout.PREFERRED_SIZE))
.addContainerGap(17, Short.MAX_VALUE))
);
contentPane.setLayout(gl_contentPane);
}
}
package com.javatpoint;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class TTT1 extends JFrame implements ItemListener, ActionListener{
int i,j,ii,jj,x,y,yesnull;
int a[][]={{10,1,2,3,11},{10,1,4,7,11},{10,1,5,9,11},{10,2,5,8,11},
{10,3,5,7,11},{10,3,6,9,11},{10,4,5,6,11},{10,7,8,9,11} };
int a1[][]={{10,1,2,3,11},{10,1,4,7,11},{10,1,5,9,11},{10,2,5,8,11},
{10,3,5,7,11},{10,3,6,9,11},{10,4,5,6,11},{10,7,8,9,11} };
boolean state,type,set;
Icon ic1,ic2,icon,ic11,ic22;
Checkbox c1,c2;
JLabel l1,l2;
JButton b[]=new JButton[9];
JButton reset;
public void showButton(){
x=10; y=10;j=0;
for(i=0;i<=8;i++,x+=100,j++){
b[i]=new JButton();
if(j==3)
{j=0; y+=100; x=10;}
b[i].setBounds(x,y,100,100);
add(b[i]);
b[i].addActionListener(this);
}//eof for
reset=new JButton("RESET");
reset.setBounds(100,350,100,50);
add(reset);
reset.addActionListener(this);
}//eof showButton
/*********************************************************/
public void check(int num1){
for(ii=0;ii<=7;ii++){
for(jj=1;jj<=3;jj++){
if(a[ii][jj]==num1){ a[ii][4]=11; }
}//eof for jj
}//eof for ii
}//eof check
/**********************************************************/
/*********************************************************/
public void complogic(int num){
for(i=0;i<=7;i++){
for(j=1;j<=3;j++){
if(a[i][j]==num){ a[i][0]=11; a[i][4]=10; }
}
}
for(i=0;i<=7;i++){ // for 1
set=true;
if(a[i][4]==10){ //if 1
int count=0;
for(j=1;j<=3;j++){ //for 2
if(b[(a[i][j]-1)].getIcon()!=null){ //if 2
count++;
} //eof if 2
else{ yesnull=a[i][j]; }
} //eof for 2
if(count==2){ //if 2
b[yesnull-1].setIcon(ic2);
this.check(yesnull); set=false;break;
} //eof if 2
} //eof if 1
else
if(a[i][0]==10){
for(j=1;j<=3;j++){ //for2
if(b[(a[i][j]-1)].getIcon()==null){ //if 1
b[(a[i][j]-1)].setIcon(ic2);
this.check(a[i][j]);
set=false;
break;
} //eof if1
} //eof for 2
if(set==false)
break;
}//eof elseif
if(set==false)
break;
}//eof for 1
}//eof complogic
/*********************************************************/
TTT1(){
super("Tic tac toe");
CheckboxGroup cbg=new CheckboxGroup();
c1=new Checkbox("vs computer",cbg,false);
c2=new Checkbox("vs friend",cbg,false);
c1.setBounds(120,80,100,40);
c2.setBounds(120,150,100,40);
add(c1); add(c2);
c1.addItemListener(this);
c2.addItemListener(this);
state=true;type=true;set=true;
ic1=new ImageIcon(JApps.class.getResource("/com/javatpoint/ic1.jpg"));
ic2=new ImageIcon(JApps.class.getResource("/com/javatpoint/ic2.jpg"));
ic11=new ImageIcon(JApps.class.getResource("/com/javatpoint/ic11.JPG"));
ic22=new ImageIcon(JApps.class.getResource("/com/javatpoint/ic22.JPG"));
setLayout(null);
setSize(330,450);
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}//eof constructor
/*************************************************************/
public void itemStateChanged(ItemEvent e){
if(c1.getState())
{
type=false;
}
else if(c2.getState())
{ type=true;
}
remove(c1);remove(c2);
repaint(0,0,330,450);
showButton();
}//eof itemstate
/************************************************************/
public void actionPerformed(ActionEvent e){
/********************************/
if(type==true)//logicfriend
{
if(e.getSource()==reset){
for(i=0;i<=8;i++){
b[i].setIcon(null);
}//eof for
}
else{
for(i=0;i<=8;i++){
if(e.getSource()==b[i]){
if(b[i].getIcon()==null){
if(state==true){ icon=ic2;
state=false;} else{ icon=ic1; state=true; }
b[i].setIcon(icon);
}
}
}//eof for
}//eof else
}//eof logicfriend
else if(type==false){ // complogic
if(e.getSource()==reset){
for(i=0;i<=8;i++){
b[i].setIcon(null);
}//eof for
for(i=0;i<=7;i++)
for(j=0;j<=4;j++)
a[i][j]=a1[i][j]; //again initialsing array
}
else{ //complogic
for(i=0;i<=8;i++){
if(e.getSource()==b[i]){
if(b[i].getIcon()==null){
b[i].setIcon(ic1);
if(b[4].getIcon()==null){
b[4].setIcon(ic2);
this.check(5);
} else{
this.complogic(i);
}
}
}
}//eof for
}
}//eof complogic
for(i=0;i<=7;i++){
Icon icon1=b[(a[i][1]-1)].getIcon();
Icon icon2=b[(a[i][2]-1)].getIcon();
Icon icon3=b[(a[i][3]-1)].getIcon();
if((icon1==icon2)&&(icon2==icon3)&&(icon1!=null)){
if(icon1==ic1){
b[(a[i][1]-1)].setIcon(ic11);
b[(a[i][2]-1)].setIcon(ic11);
b[(a[i][3]-1)].setIcon(ic11);
JOptionPane.showMessageDialog(TTT1.this,"You won! Click reset"); break;
}
else if(icon1==ic2){
b[(a[i][1]-1)].setIcon(ic22);
b[(a[i][2]-1)].setIcon(ic22);
b[(a[i][3]-1)].setIcon(ic22);
JOptionPane.showMessageDialog(TTT1.this,"Computer won! Click reset");
break;
}
}
}
}//eof actionperformed
/************************************************************/
public static void main(String []args){
new TTT1();
}//eof main
}//eof class
YouTube :- https://www.youtube.com/@Decodeit./playlists
Download Complete GitHub Link :- https://github.com/Rishabhsaini0204/Java_Nine_Project/archive/refs/heads/main.zip
Download Java Projects :-https://updategadh.com/tag/advance-java/
Download C++ Projects :-https://updategadh.com/category/projects/c-projects/
- How to Use AI in Marketing
- Python Program for n-th Fibonacci number
- Mobile Shop Management System in PHP With Source Code
- Blood Donor Management System in PHP with Source Code
- Top Large Language Models in 2025
- Exploring the nsetools Library in Python: A Guide to Real-Time Stock Data
Thank You ! 9 Mind-Blowing Mini Projects in Java Reading this blog
2 comments