java - JTable columns doesnt resize probably when JFrame resize -



I have got a jettison, on which I had applied to AUTOISISISISUSLSTCLOMN. When I pull the columns right or right, it automatically changes the size of the previous column.
However, Jettbabel is connected to JPNL with a border layout manager. When I change the shape of the JFrame, then the size of JPNL is changed, and when JetTable fills the JPLLL, the jetty label also changes, but when I change the size of the JFRAM, AUTO_RESIZE_LAST_COLUMN works, but instead it The size of all the columns varies.

I want it to be only autometris in the last column, when JFrame resizes, instead of resizing the size of all columns -

code :

  Import java.awt. *; Import javax.swing. *; Import javax.swing.table. *; Public Category JTableResize JFrame {Private JTable Table; Private Jepynel Panel; Private JScrollPane Panel; DefaultTel Model Model = New DefaultTableModel (); Public JTableResize () {Super ("JTable - Resize Problem"); Set layout (new border layout ()); Panel = new zpn (); Panel.setLayout (new border layout ()); Panel.setBackground (Color.red); Add (Panel, Border Layout. CA); Table = new JTable (model); //panel.add(table); Model.addColumn ("Resize"); Model.addColumn ("problem"); Model.addColumn ("........"); Model.addColumn ("It should resize"); Pane = new JScrollPane (table); Panel.add (panel); // This is considered to change the shape of the last column. When you drag it into the column, but when the frame is converted into a table, it works. SetOuto Resume Mode (JetTable. ATOOSISISSSSeclm); . Table.getTableHeader () setReorderingAllowed (incorrect); Table.setShowVerticalLines (wrong); (Ii, i, i});}} public static zero main (string [] args ) {JTableResize jtr = New JTableResize (); Jtr.setSize (500, 500); jtr.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); jtr.setVisible (true);}}    < p> 

The API documentation should be used in the doLayout () method JTable .

The method is resized before the layout starts when the title of the heading is the header when the method is called as the result of the size of an attached window , Then the resizing column is zero. This means that the resizing jetty is "out" and the change - or "delta" - should be distributed to all columns, regardless of the self-resizing mode of this jetty Without.

Behavior does not support by default.

Setting the "Resizing column" in the last column by overriding the JTable doLayout () method It seems that:

  @ override public Hoid Delaut () {if (tableHeader! = Null) {table column resizing column = tableHeader.getResizingColumn (); // Increase the viewport size to increase the last column width if (resizing column == blank) {table column model TCM = meet column model (); Int lastColumn = tcm.getColumnCount () - 1; TableHeader.setResizingColumn (tcm.getColumn (last column)); }} Super. Outline (); }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -