Java Project Tutorial - How to Create a Custom Table and Scrollbars Using Graphics In Java NetBeans

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Custom Table with Scrollable Rows Design In Java NetBeans
    ▶ Get The Source Code: 1bestcsharp.blogspot.com/2024...
    ▶ Get All Java Projects Source Code: bit.ly/JavaProjectsBundle
    [[[[[[[[[[[[[[[[[[[[ Check out my Java Projects! ]]]]]]]]]]]]]]]]]]]]
    ▶ Inventory Management System - 1bestcsharp.blogspot.com/2018...
    ▶ Java Project For Beginners - • Java Project For Begin...
    ▶ Students Information System - 1bestcsharp.blogspot.com/2017...
    ▶ Contacts Management System - 1bestcsharp.blogspot.com/2017...
    ▶ Hotel Management System - 1bestcsharp.blogspot.com/2019...
    ▶ Real Estate Management System - 1bestcsharp.blogspot.com/2020...
    ▶ Library Management System - 1bestcsharp.blogspot.com/2020...
    ▶ Car Rental Management System - 1bestcsharp.blogspot.com/2023...
    ▶ Download All My Java Projects Source Code: bit.ly/JavaProjectsBundle
    ▶ All My Programming Projects Here - bit.ly/2HrU8hK
    ▶ My Source Code Store Here - bit.ly/2OsC0TU
    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ JAVA Products ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
    ▶ Download All Java Projects Source Code - bit.ly/JavaProjectsBundle
    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ Project Description ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
    In this Java Tutorial we will see How To Create a Custom Table With a Modern Design and alternating row colors and Custom Scrollbar Using Graphics and Graphics2D In Netbeans.
    In the second table we will be creating a custom table with data fetched from a MySQL database.
    What We Will Use To Build This Project ? :
    - Java Programming Language.
    - NetBeans Editor.
    Java Swing Components We Will Use In This Java Tutorial:
    - JFrame.
    - JPanel.
    - JButton.
    - JScrollBar.
    - JScrollPane.
    - BasicScrollBarUI.
    What We Will Do In This Project ? :
    - Use Graphics2D object to draw table headers and rows with alternating row colors.
    - Create a custom scrollbar UI (ModernScrollBarUI) for the vertical scrollbar.
    - The application fetches data from a MySQL database table named "product" and displays it in a customized table format.
    - Connects to a MySQL database using JDBC, executes a SELECT query on the "product" table.
    - Retrieve data from a MySQL database table and display it in a customized table.
    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ TABLE OF CONTENT ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
    ▶ 00:00:00 The Project Overview
    ▶ 00:01:00 Create The Project File
    ▶ 00:01:50 Create and Design The Form
    ▶ 00:06:15 Create a TableRow class.
    ▶ 00:10:20 Create a TablePanel class that extends JPanel and is responsible for drawing the table.
    ▶ 00:12:50 Method to draw table.
    ▶ 00:26:25 Create a Custom BasicScrollBarUI to customize the appearance of the scrollbar.
    ▶ 00:53:40 Create another custom table with different colors.
    ▶ 00:56:50 Create another custom table to display data from mysql database.
    ▶ 01:01:05 Create a function to fetch data from mysql database.
    [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ JAVA Tutorials ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
    ▶ Java Login and Register Form - bit.ly/Java_Login
    ▶ Java Calculator In Netbeans - bit.ly/Java_Calculator
    ▶ Java Tic Tac Toe Game - bit.ly/Java_TicTacToe
    ▶ Java JTree Tutorial - bit.ly/Java_JTree_Tutorial
    ▶ Java and MySQL Tutorials Using Netbeans - bit.ly/Java_Mysql
    ▶ Java Gui Tutorial For Beginners - bit.ly/Java_Gui
    ▶ Java JTable Tutorial - bit.ly/JAVA_JTable_Tutorial
    ▶ Create a Project In Java With MySQL - bit.ly/Java_Mysql_Project
    ------------------------- JAVA COURSE ----------------------------
    ▶ master Java core development step-by-step - bit.ly/2HXSuAn
    --------------------------------------------------------------------
    visit our blog 1bestcsharp.blogspot.com/
    facebook: / 1bestcsharp
    twitter: / 1bestcsharp_
    subscribe: goo.gl/nRjPKk
    programming projects with source code:
    1bestcsharp.blogspot.com/p/pro...
    C# And Java Programming Books
    1bestcsharp.blogspot.com/2015/...
    share this video: • Java Project Tutorial ...

Komentáře • 3

  • @1BestCsharpblog
    @1BestCsharpblog  Před 2 měsíci +1

    ▶ ▶ ▶ LEAVE A LIKE FOR MORE PROJECTS 👍👍👍
    ▶ Create a Custom CheckBox: czcams.com/video/alkcVURyIx8/video.html
    ▶ Create a Custom RadioButton: czcams.com/video/5FeG6OhJg10/video.html

  • @sulevanG
    @sulevanG Před 2 měsíci

    Hi i really needed your help. Can you make a video about how to make a jtable with disabled duplicate entry? For example when i put James in the jtable i shouldn't be able to put another one. Only limit it in 1?

    • @1BestCsharpblog
      @1BestCsharpblog  Před 2 měsíci

      import javax.swing.*;
      import javax.swing.table.DefaultTableModel;
      import java.awt.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.util.HashSet;
      public class UniqueEntryJTableDemo extends JFrame {
      private JTable table;
      private DefaultTableModel model;
      private JTextField textField;
      private HashSet uniqueEntries;
      public UniqueEntryJTableDemo() {
      setTitle("Unique Entry JTable");
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setSize(400, 300);
      // Initialize HashSet to store unique entries
      uniqueEntries = new HashSet();
      // Create table model
      model = new DefaultTableModel();
      model.addColumn("Name");
      // Create JTable with the model
      table = new JTable(model);
      // Create JTextField for input
      textField = new JTextField(20);
      // Create JButton to add entry
      JButton addButton = new JButton("Add");
      addButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      addEntry();
      }
      });
      // Create JPanel for input components
      JPanel inputPanel = new JPanel();
      inputPanel.add(textField);
      inputPanel.add(addButton);
      // Add components to JFrame
      add(new JScrollPane(table), BorderLayout.CENTER);
      add(inputPanel, BorderLayout.SOUTH);
      }
      private void addEntry() {
      String entry = textField.getText().trim();
      if (!entry.isEmpty() && !uniqueEntries.contains(entry)) {
      uniqueEntries.add(entry); // Add to HashSet
      model.addRow(new Object[]{entry}); // Add to JTable
      textField.setText(""); // Clear text field
      } else {
      JOptionPane.showMessageDialog(this, "Duplicate entry or empty string!", "Error", JOptionPane.ERROR_MESSAGE);
      }
      }
      public static void main(String[] args) {
      new UniqueEntryJTableDemo().setVisible(true);
      }
      }