Hi,

I have 1 jframe containing 1 panel. This panel shows data using JTable. I want to put button at the bottom of the panel to print that data in PDF. Can I reduce the size of the JTable? Currently it takes the size as that of the panel.

Thanks

Can I reduce the size of the JTable? Currently it takes the size as that of the panel.

no idea about numbers of records. but

1) myJTable.setPreferredScrollableViewportSize(myJTable.getPreferredSize()), for a few row, this should to reduce the size of JScrollPane

2) have to get height from row (Assume that every rows have got the same size) and multiply with desired number of row, this Dimmension put to the code line in 1st. point, instead of myJTable.getPreferredSize()

use layout to restrict objects to place and area you want.
As i can see, your JTable need a size set also.

  • use layout to restrict objects to place and area you want.

simply not

  • As i can see, your JTable need a size set also.

never ever to set for JComponents Size that are inside JScrollPane, any reason for, everything is implemented in the API and correctly, simply not

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.