column width

hi all,

i want to adjust the columns width regard the frame size.

i create the following event:

jContentPane.addComponentListener(new java.awt.event.ComponentAdapter(){

publicvoid componentResized(java.awt.event.ComponentEvent e){

System.out.println("componentResized()");// TODO Auto-generated Event stub componentResized()

Component GetComp=e.getComponent();

ExtendTableColumns(GetComp);

int getwidth=GetComp.getWidth();

System.out.println("Resize Width="+getwidth);

}

});

and also implement

the folowing ExtendTableColumns(GetComp) method:

privatevoid ExtendTableColumns(Component GetComp)

{

int getComponentWidth;

int DiagTreeColumnWidth;

getComponentWidth=GetComp.getWidth();

if(prevWidth!=0 && (prevWidth!=getComponentWidth))

{

getComponentWidth=GetComp.getWidth();

DiagTreeColumnWidth=DiagTreeColumn.getWidth();

DiagTreeColumn.setWidth(DiagTreeColumnWidth+(getComponentWidth-prevWidth));

}

prevWidth=getComponentWidth;

}

in this method i was intend to update my column size.

i saw in my debugger that the values in DiagTreeColumn.setWidth are correct but the column not change its size.

if any one can suggest ill appriciate it.

Gabi

[1926 byte] By [Gabia] at [2007-11-27 8:58:23]
# 1
i've got the solution i should set it as :DiagTreeColumn.setPreferredWidth(DiagTreeColumnWidth+(getComponentWidth-prevWidth));and notDiagTreeColumn.setWidth
Gabia at 2007-7-12 21:24:22 > top of Java-index,Desktop,Core GUI APIs...