How can we add JTable in JPanel with null layout?

0 votes

We want to add JTable into JPanel whose layout is nullJPanel contains other components. We have to add JTable at proper positions

Jun 1, 2018 in Java by sharth
• 3,370 points
327 views

1 answer to this question.

0 votes
The JPanel should have some layout manager.

JTable should be added into the JScrollPane which actually should be added into the JPanel.

If we don't care about the precision of components size you can use pure BorderLayout and combine it with FlowLayout and GridLayout. if you need precision - use jgoodies FormLayout.

The FormLayout is really tricky one, but you can play a little with WindowBuilder (which is embedded into Eclipse) and a look at the code it generates. It may look complicated but it is just an ignorance
answered Jun 1, 2018 by Parth
• 4,640 points

Related Questions In Java

0 votes
2 answers

How can we add leading zeros to the number in Java?

From Java 1.5 you can use the String.format method. ...READ MORE

answered Aug 26, 2019 in Java by Sirajul
• 48,960 points
645 views
0 votes
2 answers

How can we add the local JAR files to the Maven Project in Java?

Firstly I would like to give credit ...READ MORE

answered Nov 5, 2018 in Java by Sushmita
• 6,890 points
776 views
0 votes
2 answers

How can we display an output of float data with 2 decimal places in java? Please help

Use String.format()  if you need the value as ...READ MORE

answered Aug 26, 2019 in Java by Sirajul
• 48,960 points
105 views
0 votes
3 answers

How can I add new elements to an Array in Java

String[] source = new String[] { "a", ...READ MORE

answered Sep 19, 2018 in Java by Sushmita
• 6,890 points
219 views
0 votes
1 answer

Uipath string null

There are many different approaches and idea ...READ MORE

answered Jun 1, 2018 in RPA by wrecker
• 3,110 points
1,737 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,400 points

edited Nov 6, 2018 by Omkar 14,990 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,510 points
2,931 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,510 points
7,261 views
0 votes
2 answers

How can we add an image to a JPanel?

If you are using JPanels, then are ...READ MORE

answered Sep 20, 2018 in Java by Daisy
• 8,090 points
911 views
0 votes
4 answers

How can we define global variables in java?

class G { static String globalVar ...READ MORE

answered Jan 29, 2019 in Java by zemiak
10,200 views