πŸš€ Java Stylish Screenshot Tool | Modern GUI Screenshot App πŸ“Έ

Demo :


Click Video πŸ‘‡πŸ‘‡πŸ‘‡


















πŸ”Ή Features:

✔️ Step-by-step guide on creating a Java Screenshot Tool
✔️ Full Source Code with explanation
✔️ Screenshots & Video Demo included
✔️ SEO Optimized with trending keywords
✔️ Download Link for the project


Code :


File Name : ScreenshotTool.java


import java.awt.*;

import java.awt.event.*;

import java.awt.image.BufferedImage;

import java.io.File;

import javax.imageio.ImageIO;

import javax.swing.*;

import java.text.SimpleDateFormat;

import java.util.Date;


public class ScreenshotTool extends JFrame {

    private JButton captureBtn;


    public ScreenshotTool() {

        setTitle("Screenshot Tool - FuzzuTech");

        setSize(400, 200);

        setDefaultCloseOperation(EXIT_ON_CLOSE);

        setLocationRelativeTo(null);

        setLayout(new FlowLayout());


        captureBtn = new JButton("Capture Screenshot");

        captureBtn.setFont(new Font("Arial", Font.BOLD, 16));

        captureBtn.setBackground(new Color(50, 150, 250));

        captureBtn.setForeground(Color.WHITE);

        captureBtn.setFocusPainted(false);


        captureBtn.addActionListener(e -> captureScreenshot());


        add(captureBtn);

        setVisible(true);

    }


    private void captureScreenshot() {

        try {

            Thread.sleep(500);

            Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());

            BufferedImage capture = new Robot().createScreenCapture(screenRect);


            // Current folder ka path

            String currentDir = new File(".").getCanonicalPath();

            String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());

            String fileName = "screenshot_" + timestamp + ".png";

            File outputFile = new File(currentDir, fileName);


            // User confirmation

            int confirm = JOptionPane.showConfirmDialog(this,

                    "Screenshot yaha save hoga:\n" + outputFile.getAbsolutePath() + "\n\nContinue?",

                    "Confirm Save Location", JOptionPane.YES_NO_OPTION);


            if (confirm == JOptionPane.YES_OPTION) {

                ImageIO.write(capture, "png", outputFile);

                JOptionPane.showMessageDialog(this, "Screenshot Saved Successfully!\n" + outputFile.getAbsolutePath(),

                        "Success", JOptionPane.INFORMATION_MESSAGE);

            } else {

                JOptionPane.showMessageDialog(this, "Screenshot Cancelled!", "Cancelled", JOptionPane.WARNING_MESSAGE);

            }

        } catch (Exception ex) {

            ex.printStackTrace();

        }

    }


    public static void main(String[] args) {

        SwingUtilities.invokeLater(ScreenshotTool::new);

    }

}

Comments

Popular posts from this blog

πŸš€ Simple Login & Registration System in Python Tkinter πŸ“±

πŸš€ Create a Python Screen Recorder with Audio (Complete Code)

πŸ“‘ Fuzzu Packet Sniffer – Python GUI for Real-Time IP Monitoring | Tkinter + Scapy