Category: Swings

Java JTable Alternate Row Color Background in Swings Netbeans

Add the following code to your JTable as shown in the code, at the place Color.yellow add your custom color. Cheers enjoy output of the code JTable table = new javax.swing.JTable(){ public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); // Alternate row color if (!isRowSelected(row)) c.setBackground(row % 2 == 0 ? getBackground() :...

Custom Column width in JTable in Java Swings Netbeans

Each column is having specific width in my visualization case, just add the line of code and set your width enjoy cheers table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(200); table.getColumnModel().getColumn(3).setPreferredWidth(50); table.getColumnModel().getColumn(4).setPreferredWidth(80); table.getColumnModel().getColumn(5).setPreferredWidth(80); table.getColumnModel().getColumn(6).setPreferredWidth(100); table.getColumnModel().getColumn(7).setPreferredWidth(100); table.getColumnModel().getColumn(8).setPreferredWidth(50); table.getColumnModel().getColumn(9).setPreferredWidth(100); table.getColumnModel().getColumn(10).setPreferredWidth(100);  

Java with SQL – How to Insert Update Delete in SQL Database Using Java NetBeans

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package youtubenetbeanproject; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; /** * * @author Saili */ public class RegisterForm extends javax.swing.JFrame { /** *...