Resize « JTable « Java Swing Q&A





1. Resizing Jtable column widths wont work    stackoverflow.com

//can set column widths using percentages   
private void setPreferredTableColumnWidths(JTable table, double[] percentages) 
{
 Dimension tableDim = table.getSize(); 

 double total = 0; 
    for(int i = ...

2. JTable Column resize isn't working    stackoverflow.com

table.getTableHeader().setResizingAllowed(false);
column = table.getColumn(columns[0]);
column.setWidth(25);
column = table.getColumn(columns[1]);
column.setWidth(225);
column = table.getColumn(columns[2]);
column.setWidth(50);
table.doLayout()
This refuses to set the columns to their specified widths. Any reason why?

3. swing: saving dialog box resize dimensions    stackoverflow.com

I have a dialog box with a bunch of dimensions that a user can change by moving/dragging, including a JTable with resizable/draggable columns. What I would like to do is to make ...

4. Adjust size and colour of JTable-grid and make cells resizable    stackoverflow.com

How to adjust the size and colour of grid in JTable and how to set JTable so that length of column or row can be increased and decreased by dragging it? ...

5. Can't drag to resize JTable columns    stackoverflow.com

Long story short, I'm making a custom Swing component that's basically a JTable with a panel on its side. The table should of course be scrollable and have a table header, ...

6. How to specify behavior of Java BufferedImage resize: need min for pixel rows instead of averaging    stackoverflow.com

I would like to resize a Java BufferedImage, making it smaller vertically but without using any type of averaging, so that if a pixel-row is "blank" (white) in the source image, ...

7. Issue with resizing columns in a double JTable    stackoverflow.com

I am creating a custom component containing 2 JTables, one as the main data grid and other as the always visible summary bar and I have come up this solution, but ...

8. Allowing users to resize columns of JTable    stackoverflow.com

Im creating a table which is dynamically changing its width. And I add columns by time as well. And I have bounded this table to a scrollpane. Here I have set ...

9. Resize JTable in JScrollPane by dragging    stackoverflow.com

How can I implement the functionality of being able to resize a JTable by dragging a corner by mouse (to see more rows during a single view) which is embedded in ...





10. SWT table: auto resize all columns    stackoverflow.com

Qt solution is a single call to resizeColumnsToContent(), in .NET one can use TextRenderer.MeasureText(), JTable could use AUTO_RESIZE_ALL_COLUMNS. In SWT, is there a way to programmaticaly resize columns after populating them? ...

11. SWT tree: auto resize all columns    stackoverflow.com

In a tree with multiple columns, how do I resize columns to contents upon expand/collapse and data updates? The solution to the similar question for tables doesn't work. Same as

 ...

12. How can I keep columns of a JTable from resizing when I resize the JFrame?    stackoverflow.com

This code puts a JTable into a JFrame (sole component of the whole UI):

    JFrame frame = new JFrame( "Title");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JTable ...

13. Wrong JTableHeader component orientation with RIGHT_TO_LEFT + AUTO_RESIZE_OFF in JScrollPane    stackoverflow.com

Using Swing on Java 6u16, WinXP SP3
Hello to all. I need some help, please, with the following case. Basically I use a JTable inside a JScrollPane, that on the scrollPane I ...

14. Automatically vertically resize JTable by contents    stackoverflow.com

Do you know any way of making a JTable resize itself up to a maximum predefined height and then provide scroll bars?

15. Java JTable Resize Row    stackoverflow.com

Is it possible by default to resize a JTable row in the same way you can resize a column by dragging the mouse at the header? If so, how ...

16. How do I resize table columns individually using Netbean's GUI Builder?    stackoverflow.com

In making a quick mockup of a project's end design using Netbeans' GUI Builder, I've run into a problem with the options given to me for the Table object. It seems ...





17. How to exclude columns from auto-resizing in a JTable    stackoverflow.com

I have a JTable with 5 Columns specified in a TableColumnModel. I want the table to use all available horizontal space in the panel (which can vary), but I want to ...

18. resize the first column of table i.e number showing column in java    stackoverflow.com

I include sample code of my application 1st class

import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import org.jdesktop.swingx.JXTable;
import javax.swing.table.TableColumn;

public class setcolwidth {

    public static void main(String args[]) {

      ...

19. JTable will not auto resize last column    stackoverflow.com

I have a JTable that is placed inside a JPanel which is then placed in a JFrame that has another JPanel that has a ScrollPane. The general idea can be seen ...

20. How to resize JTable column to string length?    stackoverflow.com

I have a JTable that will have the last column data field change to different string values. I want to resize the column to the string length. What is the formula ...

21. How does one make a component in the .CENTER of a Borderlayout occupy all center space and resize with the app?    stackoverflow.com

My app/JFrame, using Borderlayout, has a toolbar at the top or north, a statusbar at the bottom or south and a JPanel.JTabbedPane.JScrollPane.JTable in the center. The JPanel is always a fixed ...

22. How to adjust the grid size after resizing the frame?    stackoverflow.com

I was wondering the following: I have a MainWindow component (which contains a frame (JFrame)) and several other JPanels. Where one JPanel, let's say gridPanel uses the gridLayout as LayoutManager. Now ...

23. JTable last column resize only    stackoverflow.com

Is it possible by default means (no subclassing etc) to get the following columns resize behavior:

  1. initially all columns except the last one have predefined size;
  2. user can resize any column except the ...

24. jtable - autoresizable and manually resizable at the same time?    stackoverflow.com

If I'm using table.setAutoResizeMode method to make table autoresizable, then it is not possible to resize it by hand (make wider than window for example). But it should be possible to adjust ...

25. Resizing JTable columns    stackoverflow.com

I have a JTable with some fields with long text and some with little text. By default, this is how it looks: enter image description here Notice how the "Name" and "Title" ...

26. Prevent a JTable with a DragGestureListener from hijacking row resize mouse drag    stackoverflow.com

I'm working with a JTable that can have variable row heights. I also recently added Drag-and-drop support for my JTable by using a DragGestureListener to listen for drag events and call ...

27. TableColumn setPreferredWidth not working    stackoverflow.com

I have a JTable with a number of columns. I want a particular column to resize. What I was hoping was by using setPreferredWidth, the column would resize to that size, ...

28. Resizing a JTable inside BorderLayout    coderanch.com

29. JTable column resizing    coderanch.com

Hi, When I do a resizing of columns on the JTable the subsequent columns seem to disappear when the resized column is being dragged alon until the end of the table.I would like all columns to be seen at anypoint of time when there is a resizing done to a column.It does'nt matter if the size of the other columns shrink. ...

30. scrollbar problem resizing jtable in gridbag    coderanch.com

Hi, I've got a table with a jscrollpane in a gridbag layout. I've set the gridbag constraints for the table to: gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.BOTH; so that when the frame is resized the table expands. This all works fine. The problem arises when the frame is expanded to a width greater than the table. When this ...

31. JTable resize?    coderanch.com

32. jtable column resize issue    coderanch.com

33. Resizing Jtable column    coderanch.com

34. Resize JFrame = needs JTable columns to be resized    coderanch.com

Hi George, Here is some code from an application in which I resize columns on resize of a window. The first part is from the main frame class which is derived from JFrame. // Create and register a listener for the Window's Events this.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { OTG.getInstance().exit(); } public void windowResized(WindowEvent evt) { if (omgFileEditor ...

35. resize columns at jtable    coderanch.com

36. Resize column width for JTable with headers?    coderanch.com

Hi, I find that for me to resize columns of a JTable by using mouse dragging, I MUST have column headers and then drag column headers to resize them. Is my understanding correct? Actually, I need to have a table without header columns. How can I use mouse to resize column width by dragging? The background for this request is that ...

37. can you resize a JTable from UI?    coderanch.com

38. table columns not resizable    coderanch.com

Because you set the min and max sizes to the same value. Before you hide your column, save the initial min and max, then when you restore your column reset the min and max to what you save. If you don't want to save the values, try setting min to 0 and max to Integer.MAX_VALUE. I have a bunch of code ...

40. Resizing JTable    coderanch.com

41. Automatic resizing of table cells    coderanch.com

42. Linking column resizing in two JTables    coderanch.com

43. JTable enhanced resizing    coderanch.com

44. problem resizing JTable column    coderanch.com

45. Resizing columns in Tree table    coderanch.com

Hi All! Iam using Tree Table in my application. Which is already written by somebody else. But when i try to resize the column width it is not increasing. Iam not getting where the thing is went wrong. I checked almost in all the area, but I didn't fixed it. Can any body having idea about this. Please help me if ...

46. How to resize columns in Tree table    coderanch.com

47. Resizing columns in Tree table    coderanch.com

48. Annoing problem JTABLE AUTO_RESIZE_OFF    coderanch.com

49. JFace 3.3 Column Resize Oroblem    coderanch.com

51. JTable : Setting Column Resize Off On MarginChanged Event    coderanch.com

Hello Everyone, I am trying to set column resizing off on a table when someone drags a column in a Jtable. I made a small modification to the SimpleTableDemo that turns the column resizing on the table off when a column is physically dragged. I added a column model listener and turn the column resizing off on the columnMarginChanged event (Lines ...

52. How to make JTable resize when app window is resized?    coderanch.com

At the lower part of an swing app I have placed a JTable. I need help in making the table size along with the window when a user maxamized or resized the window. I have tried Here is the code private JScrollPane getJScrollPane0() { if (jScrollPane0 == null) { jScrollPane0 = new JScrollPane(); jScrollPane0.setPreferredSize(new Dimension(2000, 1500)); jScrollPane0.setMaximumSize(new Dimension(2000, 1500)); jScrollPane0.setViewportView(getJTable0()); } ...

53. JTable AUTO_RESIZE_OFF and extra column    coderanch.com

Hi, had problem to fill the extra space of JTable when there are too few columns to fill the preferredScrollableViewportSize, when JTable's autoResizeMode is AUTO_RESIZE_OFF. This example overrides configureEnclosingScrollPane() in JTable to rebuild whole new view. JTableViewFiller listens LinkTable when it resizes to get new width for extra JTableHeader. JTableViewFiller delegates LinkTable's Scrollable interface methods. RendererPanel has a preferred size set ...

57. Help with resizing Buttons in a grid    java-forums.org

Ok so this is code that I used in a previous question. Now my goal is to resize the buttons in the grid (effectively zooming in and zooming out) but I am running into three issues. The first issue is that the buttons dont actually resize until I maximize the JFrame (either by double clicking the title bar or by clicking ...

58. Question about resizing / packing JTable in JDialog.    java-forums.org

Dear, I programmed a JDialog with the BorderLayout. In the CENTER, I placed a JTable, and in the SOUTH, I placed a panel with buttons. When the JDialog is being made, the JTable is being filled by files of a specific directory. So, when the JDialog is showing up, you can see a list of files, but the problem is that ...

59. Problem in resizing JTable in netbeans    java-forums.org

Dear all, Initially i've designed a table using netbeans.According to database program it has to resize at any time. Suppose initially the table contains only two data.But when it is more than two, the table size should be large or when it is less the table should be less.But i cannot do it in netbeans. How can do that? Plz give ...

60. resize java gui table row length    forums.oracle.com

61. JTable rows self resize    forums.oracle.com