Java Basic Problems

Java JButton below the JTable: How to use and place JButton just under or beneath the JTable.

JBUtton below the JTableHere I am sharing with you another simple but important  fact related to  java JTable and JButton. If you are using JButton and JTable in your software, it may need to place your JButton just under or below the JTable. Here I have shown the way how to place JButton just beneath the JTable. Just copy the code below and run in your pc.

Here is the Code:   JButton Just Below or beneath the JTable

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.table.*;

class ButtonBelowTable extends JFrame


private JPanel topPanel;

private JTable table;

public JScrollPane scrollPane;

public JScrollPane scrollPane1;

private String[] columnNames=new String[3];

private String[][] dataValues=new String[3][3];

JTextField textBox=new JTextField();

JTextField textBox1=new JTextField();

JButton button=new JButton(“Click Here”);

public ButtonBelowTable()


setTitle(“Button Below the Table”);


setDefaultCloseOperation (EXIT_ON_CLOSE);


columnNames=new String[] {“Column 1″ ,”Column 2”, “Column 3”};

dataValues=new String[][]






topPanel=new JPanel();



table=new JTable();

TableModel  model=new myTableModel();


scrollPane=new JScrollPane(table);


scrollPane1=new JScrollPane(button);






public class myTableModel extends DefaultTableModel






public boolean isCellEditable(int row,int cols)


return true;



public static void main(String args[])


  ButtonBelowTable x=new ButtonBelowTable();




2 thoughts on “Java JButton below the JTable: How to use and place JButton just under or beneath the JTable.”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s