JscrollPane Inside Jscrollpane
Hi all,
my project include a few panels and a few jscrollpanes.
one of the issues is to make an outer jscrollpane that will include another panel and this panel will include another jscrollpane that will conatin a jtree.
the problem that i deal with :
im not getting the inner jscrollpane only the outer scrollbar.
i was thinking that it might be depend on setPreferredSize().
if you have any suggestion ill be glad to try.
my code:
work with eclipse3.2
package test;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultMutableTreeNode;
publicclass BaseFrameextends JFrame{
//Specify the look and feel to use. Valid values:
//null (use the default), "Metal", "System", "Motif", "GTK+"
finalstatic String LOOKANDFEEL ="System";
privatestaticfinallong serialVersionUID = 1;
private JPanel jContentPane =null;
privateboolean Maximized=false;
private JToolBar jToolBar =null;
private JButton jButton =null;
private JPanel jPanel =null;
private JPanel jPanelProgressBar =null;//instead of jPanel1
private JLabel jLabel =null;
private JTextArea jTextArea =null;
private JLabel jLabel1 =null;
private JProgressBar jProgressBar =null;
private JLabel jLabel2 =null;
private JProgressBar jProgressBar1 =null;
private JPanel jTableTreeResultPanel =null;
private JPanel jTablePanel =null;
private JScrollPane jTableScrollPane =null;
private JTable jTable =null;
/**
* This is the default constructor
*/
public BaseFrame(){
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
privatevoid initialize(){
initLookAndFeel();
//CATCH MAXIMIZE WINDOW EVENT
addWindowStateListener(new WindowAdapter()
{
publicvoid windowStateChanged(WindowEvent e)
{
if(e.getNewState() == Frame.NORMAL)
{
System.out.println("Window is Normal");
Maximized=false;
}
elseif(e.getNewState() == Frame.MAXIMIZED_BOTH)
{
System.out.println("Window is Maximized");
Maximized=true;
}
}
publicvoid windowClosing(WindowEvent e)
{}
});
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setPreferredSize(new Dimension(680, 530));
//this.setSize(300, 200);
this.setSize(680, 560);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}
privatevoid initLookAndFeel(){
String lookAndFeel =null;
if (LOOKANDFEEL !=null){
if (LOOKANDFEEL.equals("Metal")){
lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
}elseif (LOOKANDFEEL.equals("System")){
lookAndFeel = UIManager.getSystemLookAndFeelClassName();
}elseif (LOOKANDFEEL.equals("Motif")){
lookAndFeel ="com.sun.java.swing.plaf.motif.MotifLookAndFeel";
}elseif (LOOKANDFEEL.equals("GTK+")){//new in 1.4.2
lookAndFeel ="com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
}else{
System.err.println("Unexpected value of LOOKANDFEEL specified: "
+ LOOKANDFEEL);
lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
}
try{
UIManager.setLookAndFeel(lookAndFeel);
}catch (ClassNotFoundException e){
System.err.println("Couldn't find class for specified look and feel:"
+ lookAndFeel);
System.err.println("Did you include the L&F library in the class path?");
System.err.println("Using the default look and feel.");
}catch (UnsupportedLookAndFeelException e){
System.err.println("Can't use the specified look and feel ("
+ lookAndFeel
+") on this platform.");
System.err.println("Using the default look and feel.");
}catch (Exception e){
System.err.println("Couldn't get specified look and feel ("
+ lookAndFeel
+"), for some reason.");
System.err.println("Using the default look and feel.");
e.printStackTrace();
}
}
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane(){
if (jContentPane ==null){
jContentPane =new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJToolBar(), BorderLayout.NORTH);
jContentPane.add(getJPanel(), BorderLayout.CENTER);
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);
}
});
}
return jContentPane;
}
/**
* This method initializes jToolBar
*
* @return javax.swing.JToolBar
*/
private JToolBar getJToolBar(){
if (jToolBar ==null){
jToolBar =new JToolBar();
//jToolBar.setMinimumSize(new Dimension(405, 40));
jToolBar.add(getJButton());
}
return jToolBar;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton(){
if (jButton ==null){
jButton =new JButton();
jButton.setIcon(new ImageIcon(getClass().getResource("/test/button_help.gif")));
}
return jButton;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel(){
if (jPanel ==null){
jPanel =new JPanel();
jPanel.setLayout(new BorderLayout());
jPanel.add(getJPanelProgressBar(), BorderLayout.NORTH);
jPanel.add(getJTableTreeResultPanel(), BorderLayout.CENTER);
}
return jPanel;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanelProgressBar(){
if (jPanelProgressBar ==null){
GridBagConstraints gridBagConstraints5 =new GridBagConstraints();
gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints5.gridy = 2;
gridBagConstraints5.insets =new Insets(3, 3, 3, 3);
gridBagConstraints5.gridx = 1;
GridBagConstraints gridBagConstraints4 =new GridBagConstraints();
gridBagConstraints4.gridx = 0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints4.gridy = 2;
jLabel2 =new JLabel();
jLabel2.setText("Batch Progress:");
GridBagConstraints gridBagConstraints3 =new GridBagConstraints();
gridBagConstraints3.gridx = 1;
gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints3.anchor = GridBagConstraints.EAST;
gridBagConstraints3.insets =new Insets(3, 3, 3, 3);
gridBagConstraints3.gridy = 1;
GridBagConstraints gridBagConstraints2 =new GridBagConstraints();
gridBagConstraints2.gridy = 1;
gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints2.insets =new Insets(1, 1, 0, 0);
jLabel1 =new JLabel();
jLabel1.setText("Test Progress:");
GridBagConstraints gridBagConstraints1 =new GridBagConstraints();
gridBagConstraints1.insets =new Insets(1, 1, 0, 0);
gridBagConstraints1.weightx = 0.0D;
gridBagConstraints1.weighty = 0.0D;
gridBagConstraints1.anchor = GridBagConstraints.WEST;
gridBagConstraints1.fill = GridBagConstraints.NONE;
GridBagConstraints gridBagConstraints =new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.weighty = 1.0D;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints.insets =new Insets(3, 3, 3, 3);
gridBagConstraints.weightx = 1.0D;
jLabel =new JLabel();
jLabel.setText("Current Test:");
jPanelProgressBar =new JPanel();
jPanelProgressBar.setLayout(new GridBagLayout());
jPanelProgressBar.setName("PanelMainNorth");
//jPanelProgressBar.setMinimumSize(new Dimension(405, 66));
jPanelProgressBar.add(jLabel, gridBagConstraints1);
jPanelProgressBar.add(getJTextArea(), gridBagConstraints);
jPanelProgressBar.add(jLabel1, gridBagConstraints2);
jPanelProgressBar.add(getJProgressBar(), gridBagConstraints3);
jPanelProgressBar.add(jLabel2, gridBagConstraints4);
jPanelProgressBar.add(getJProgressBar1(), gridBagConstraints5);
}
return jPanelProgressBar;
}
/**
* This method initializes jTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextArea(){
if (jTextArea ==null){
jTextArea =new JTextArea();
jTextArea.setBorder(BorderFactory.createLineBorder(Color.gray, 2));
}
return jTextArea;
}
/**
* This method initializes jProgressBar
*
* @return javax.swing.JProgressBar
*/
private JProgressBar getJProgressBar(){
if (jProgressBar ==null){
jProgressBar =new JProgressBar();
}
return jProgressBar;
}
/**
* This method initializes jProgressBar1
*
* @return javax.swing.JProgressBar
*/
private JProgressBar getJProgressBar1(){
if (jProgressBar1 ==null){
jProgressBar1 =new JProgressBar();
}
return jProgressBar1;
}
/**
* This method initializes jTreeResultPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJTableTreeResultPanel(){
if (jTableTreeResultPanel ==null){
jTableTreeResultPanel =new JPanel();
jTableTreeResultPanel.setLayout(new BorderLayout());
jTableTreeResultPanel.setName("Tree Display Panel");
jTableTreeResultPanel.setForeground(new Color(51, 51, 51));
jTableTreeResultPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jTableTreeResultPanel.setPreferredSize(new Dimension(687, 417));
jTableTreeResultPanel.setPreferredSize(new Dimension(669, 31));
jTableTreeResultPanel.add(getJTablePanel(), BorderLayout.NORTH);
jTableTreeResultPanel.add(getJTreeResultScrollPane(), BorderLayout.CENTER);
}
return jTableTreeResultPanel;
}
/**
* This method initializes jTablePanel
*
* @return javax.swing.JPanel
*/
private JPanel getJTablePanel(){
if (jTablePanel ==null){
GridBagConstraints gridBagConstraints12 =new GridBagConstraints();
gridBagConstraints12.anchor = GridBagConstraints.WEST;
gridBagConstraints12.gridheight = 1;
gridBagConstraints12.gridwidth = 4;
gridBagConstraints12.gridx = -1;
gridBagConstraints12.gridy = -1;
gridBagConstraints12.weightx = 1.0D;
gridBagConstraints12.weighty = 1.0D;
gridBagConstraints12.insets =new Insets(0, 0, -10, 0);
gridBagConstraints12.fill = GridBagConstraints.BOTH;
jTablePanel =new JPanel();
jTablePanel.setLayout(new GridBagLayout());
//jTablePanel.setPreferredSize(new Dimension(660, 20));
jTablePanel.add(getJTableScrollPane(), gridBagConstraints12);
}
return jTablePanel;
}
/**
* This method initializes getJTableScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJTableScrollPane(){
if (jTableScrollPane ==null){
jTableScrollPane =new JScrollPane();
jTableScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jTableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
//jTableScrollPane.setPreferredSize(new Dimension(660, 40));
jTableScrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
//jTableScrollPane.setMinimumSize(new Dimension(405, 4));
jTableScrollPane.setViewportView(getJTable());
}
return jTableScrollPane;
}
/**
* This method initializes jTable
*
* @return javax.swing.JTable
*/
TableColumn DiagTreeColumn =null;// @jve:decl-index=0:
TableColumn LastResultcolumn =null;// @jve:decl-index=0:
TableColumn Passcolumn =null;// @jve:decl-index=0:
TableColumn Failcolumn =null;// @jve:decl-index=0:
private JTable getJTable(){
String[] columnNames ={"Diagnostics Tree",
"Last Result",
"# Pass",
"# Fail"
};
Object[][] data ={};
if (jTable ==null){
jTable =new JTable(data,columnNames);
jTable.setPreferredScrollableViewportSize(new Dimension(10,10));
jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jTable.getTableHeader().setReorderingAllowed(false );
//ALLIGN ALL THE TITLES TO CENTER
DefaultTableCellRenderer TableRenderer=(DefaultTableCellRenderer)jTable.getTableHeader().getDefaultRenderer();
TableRenderer.setHorizontalAlignment(JLabel.CENTER);
//resize the first column (Diagnostics Tree)
DiagTreeColumn = jTable.getColumnModel().getColumn(0);
DiagTreeColumn.setMinWidth(30);
DiagTreeColumn.setPreferredWidth(285);
DiagTreeColumn.setResizable(true);
//resize the second column (Last Result)
LastResultcolumn = jTable.getColumnModel().getColumn(1);
LastResultcolumn.setPreferredWidth(125);
LastResultcolumn.setResizable(true);
//resize the second column (#Pass)
Passcolumn = jTable.getColumnModel().getColumn(2);
Passcolumn.setPreferredWidth(125);
Passcolumn.setResizable(true);
//resize the second column (#Fail)
Failcolumn = jTable.getColumnModel().getColumn(3);
Failcolumn.setPreferredWidth(125);
Failcolumn.setResizable(true);
jTable.getColumnModel().addColumnModelListener(new TableColumnModelListener(){
publicvoid columnMarginChanged(ChangeEvent e)
{
//int getColumnWidth;
//for Diagnostics Tree
//int getTreeScrollHight;//, getTreeScrollWidth;
//for Last result
//int getResultScrollHight, getResultScrollWidth;
//for #Pass
//int getPassScrollHight, getPassScrollWidth;
//for #Fail
//int getFailScrollHight;//, getFailScrollWidth;
System.out.println("im columnMarginChanged");
//TableColumn resizingColumn = jTable.getTableHeader().getResizingColumn();
/*
if(resizingColumn!=null)
{
int modelindx=resizingColumn.getModelIndex();
//FOR THE FIRST COLUMN("Diagnostics Tree")
if(modelindx==0)
{
System.out.println("we are in Diagnostics Tree Column0");
getColumnWidth=resizingColumn.getWidth();
//int getTreeScrollWidth=jTreeScrollPane.getWidth();
getTreeScrollHight=jTreeScrollPane.getHeight();
jTreePanel.setSize(getColumnWidth, getTreeScrollHight);
jTreePanel.setPreferredSize(new Dimension(getColumnWidth, getTreeScrollHight));
jTreePanel.validate();
jTreePanel.repaint();
//move the all panel jResultPanel
Point ResultPanelLocation=jResultPanel.getLocation();
jResultPanel.setLocation(jTreeScrollPane.getWidth(), ResultPanelLocation.y);
jResultPanel.setSize(jResultPanel.getWidth(),jResultPanel.getHeight());
jResultPanel.setPreferredSize(new Dimension(jResultPanel.getWidth(),jResultPanel.getHeight()));
}
//FOR THE SeCOND COLUMN("Last Result")
if(modelindx==1)
{
System.out.println("we are in Last Result Column");
getColumnWidth=resizingColumn.getWidth();
getResultScrollHight=jResultListScrollPane.getHeight();
getResultScrollWidth=jResultListScrollPane.getWidth();
jResultListScrollPane.setSize(new Dimension(getColumnWidth,getResultScrollHight));
jResultListScrollPane.setPreferredSize(new Dimension(getColumnWidth,getResultScrollHight));
jResultListScrollPane.validate();
//ALSO MOVE THE PASS LIST
Point ResultListScrollPaneLocation=jResultListScrollPane.getLocation();
getPassScrollWidth=jPassListScrollPane.getWidth();
Point PassListScrollPaneLocation=jPassListScrollPane.getLocation();
jPassListScrollPane.setLocation(ResultListScrollPaneLocation.x+getResultScrollWidth, PassListScrollPaneLocation.y);
jPassListScrollPane.validate();
//ALSO MOVE THE FAIL LIST
Point FailListScrollPaneLocation=jFailListScrollPane.getLocation();
jFailListScrollPane.setLocation(PassListScrollPaneLocation.x+getPassScrollWidth, FailListScrollPaneLocation.y);
jFailListScrollPane.validate();
}
//FOR THE THIRD COLUMN("#Pass")
if(modelindx==2)
{
System.out.println("we are in #Pass Column");
getColumnWidth=resizingColumn.getWidth();
getPassScrollHight=jPassListScrollPane.getHeight();
getPassScrollWidth=jPassListScrollPane.getWidth();
jPassListScrollPane.setSize(new Dimension(getColumnWidth,getPassScrollHight));
jPassListScrollPane.setPreferredSize(new Dimension(getColumnWidth,getPassScrollHight));
Point PassListScrollPaneLocation=jPassListScrollPane.getLocation();
jPassListScrollPane.validate();
Point FailListScrollPaneLocation=jFailListScrollPane.getLocation();
jFailListScrollPane.setLocation(PassListScrollPaneLocation.x+getPassScrollWidth, FailListScrollPaneLocation.y);
jFailListScrollPane.validate();
}
//FOR THE FOURTH COLUMN("#Fail")
if(modelindx==3)
{
System.out.println("we are in #Fail Column");
getColumnWidth=resizingColumn.getWidth();
getFailScrollHight=jFailListScrollPane.getHeight();
//int getFailScrollWidth=jFailListScrollPane.getWidth();
jFailListScrollPane.setSize(new Dimension(getColumnWidth,getFailScrollHight));
jFailListScrollPane.setPreferredSize(new Dimension(getColumnWidth,getFailScrollHight));
jFailListScrollPane.validate();
}
}
*/
}
publicvoid columnSelectionChanged(ListSelectionEvent e)
{
System.out.println("in columnSelectionChanged");
}
publicvoid columnAdded(TableColumnModelEvent e)
{
System.out.println("in columnAdded");
}
publicvoid columnMoved(TableColumnModelEvent e)
{
System.out.println("in columnMoved");
}
publicvoid columnRemoved(TableColumnModelEvent e)
{
System.out.println("in columnRemoved");
}
});
}
return jTable;
}
String[] columnNames ={"Diagnostics Tree","Last Result",
"# Pass","# Fail"};
Object[][] data ={};
privatevoid createNodes(DefaultMutableTreeNode top){
DefaultMutableTreeNode category =null;
DefaultMutableTreeNode SubCategory =null;
DefaultMutableTreeNode SubSubCategoryBasee =null;
DefaultMutableTreeNode SubCategory2 =null;
category =new DefaultMutableTreeNode("Dfe");
top.add(category);
//Sub test visible
SubCategory =new DefaultMutableTreeNode("Test Visible");
category.add(SubCategory);
SubCategory.add(new DefaultMutableTreeNode("Son 1"));
SubCategory.add(new DefaultMutableTreeNode("Son 2"));
SubSubCategoryBasee =new DefaultMutableTreeNode("Test Base");
SubSubCategoryBasee.add(new DefaultMutableTreeNode("Grandson 1"));
SubSubCategoryBasee.add(new DefaultMutableTreeNode("Grandson 2"));
SubCategory.add(SubSubCategoryBasee);
//Sub test visible
SubCategory2 =new DefaultMutableTreeNode("Test Visible2");
category.add(SubCategory2);
SubCategory2.add(new DefaultMutableTreeNode("Son 1"));
SubCategory2.add(new DefaultMutableTreeNode("Son 2"));
SubSubCategoryBasee =new DefaultMutableTreeNode("Test Base");
SubSubCategoryBasee.add(new DefaultMutableTreeNode("Grandson 1"));
SubSubCategoryBasee.add(new DefaultMutableTreeNode("Grandson 2345678910111213141516171920212223242526"));
SubCategory2.add(SubSubCategoryBasee);
}
private DefaultMutableTreeNode top;// @jve:decl-index=0:
//privateDefaultListModel listModel=null;
privateint prevWidth=0;
private JScrollPane jTreeResultScrollPane =null;
private JPanel jTreeResultPanel =null;
private JScrollPane jTreeScrollPanel =null;
private JTree jTree =null;
/********WHEN WE MAKE THE RESIZE AND SHRINK
* WE MAKE IT FOR THREE COMPONENTS:
* 1)FOR THE TREECOLUMN
* 2)FOR THE TREEPANEL
* 3)IF during the maximize process we resize some columns
* we have to keep it when we back to original state
* for example:
* if we maximize the window and resize the last result column
* when we back the previous state we shell keep the same size
* AS THE COULMN SIZE
* WE HAVE TO DO THAT FOR ALL THE THREE LIST COMPONENT
* @param GetComp
*/
privatevoid ExtendTableColumns(Component GetComp)
{
int getComponentWidth;
int getComponentHeight;
int DiagTreeColumnWidth;
getComponentWidth=GetComp.getWidth();
getComponentHeight=GetComp.getHeight();
/*
if(getComponentHeight!=0)
{
System.out.println("jTreeResultsScrollPane height="+jTreeResultsScrollPane.getHeight());
System.out.println("jTreePanel height="+jTreePanel.getHeight());
System.out.println("jTreeScrollPane height="+jTreeScrollPane.getHeight());
}
*/
if(prevWidth!=0 && (prevWidth!=getComponentWidth) )
{
/* System.out.println("GetTreescrollwidthfrom resize="+jTreeScrollPane.getWidth());
System.out.println("DiagTreeColumn1 ="+DiagTreeColumn.getWidth());
System.out.println("jTreeScrollPane width ="+jTreeScrollPane.getWidth());
// System.out.println("ResultList width ="+jResultList.getWidth());
System.out.println("Last Result column width ="+LastResultcolumn.getWidth());
DiagTreeColumnWidth= DiagTreeColumn.getWidth();
DiagTreeColumn.setWidth(DiagTreeColumnWidth+(getComponentWidth-prevWidth));
DiagTreeColumn.setPreferredWidth(DiagTreeColumnWidth+(getComponentWidth-prevWidth));
GetComp.invalidate();
GetComp.validate();
GetComp.repaint();
System.out.println("DiagTreeColumn2 ="+DiagTreeColumn.getWidth());
jTreePanel.setSize(DiagTreeColumnWidth+(getComponentWidth-prevWidth), jTreeScrollPane.getHeight());
jTreePanel.setPreferredSize(new Dimension(DiagTreeColumnWidth+(getComponentWidth-prevWidth), jTreeScrollPane.getHeight()));
jTreePanel.invalidate();
jTreePanel.validate();
jTreePanel.repaint();
//IN ORDER TO KEEP CONSTARINT 3
//WE MAKE THE LIST WIDTH THE SAME AS THE COLUMN SIZE
jResultListScrollPane.setSize(LastResultcolumn.getWidth(), jResultList.getHeight());
jResultListScrollPane.setPreferredSize(new Dimension(LastResultcolumn.getWidth(),jResultList.getHeight()));
jResultListScrollPane.invalidate();
jResultListScrollPane.validate();
jResultListScrollPane.repaint();
jPassListScrollPane.setSize(Passcolumn.getWidth(), jPassList.getHeight());
jPassListScrollPane.setPreferredSize(new Dimension(Passcolumn.getWidth(),jPassList.getHeight()));
jPassListScrollPane.invalidate();
jPassListScrollPane.validate();
jPassListScrollPane.repaint();
jFailListScrollPane.setSize(Failcolumn.getWidth(), jFailList.getHeight());
jFailListScrollPane.setPreferredSize(new Dimension(Failcolumn.getWidth(),jFailList.getHeight()));
jFailListScrollPane.invalidate();
jFailListScrollPane.validate();
jFailListScrollPane.repaint();
*/
/*if(DiagTreeColumn.getWidth()==DiagTreeColumn.getMinWidth())
{
jTreePanel.setSize(jTreePanel.getMinimumSize().width, jTreePanel.getHeight());
jTreePanel.setPreferredSize(new Dimension(jTreePanel.getMinimumSize().width, jTreePanel.getHeight()));
jTreePanel.invalidate();
jTreePanel.validate();
jTreePanel.repaint();
}*/
}
/*jContentPane.invalidate();
jContentPane.validate();
jContentPane.repaint();*/
prevWidth=getComponentWidth;
}
private JScrollPane getJTreeResultScrollPane(){
if (jTreeResultScrollPane ==null){
jTreeResultScrollPane =new JScrollPane();
//jTreeResultScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
//jTreeResultScrollPane.setPreferredSize(new Dimension(160, 415));
//jTreeResultScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
//jTreeResultScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
jTreeResultScrollPane.setViewportView(getJTreeResultPanel());
}
return jTreeResultScrollPane;
}
/**
* This method initializes jTreeResultPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJTreeResultPanel(){
if (jTreeResultPanel ==null){
GridBagConstraints gridBagConstraints6 =new GridBagConstraints();
gridBagConstraints6.fill = GridBagConstraints.BOTH;
gridBagConstraints6.weighty = 1.0;
gridBagConstraints6.weightx = 1.0;
jTreeResultPanel =new JPanel();
jTreeResultPanel.setLayout(new GridBagLayout());
jTreeResultPanel.add(getJTreeScrollPanel(), gridBagConstraints6);
}
return jTreeResultPanel;
}
/**
* This method initializes jTreeScrollPanel
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJTreeScrollPanel(){
if (jTreeScrollPanel ==null){
jTreeScrollPanel =new JScrollPane();
//jTreeScrollPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jTreeScrollPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jTreeScrollPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
jTreeScrollPanel.setPreferredSize(new Dimension(280, 403));
//jTreeScrollPanel.setPreferredSize(new Dimension(142, 387));
//jTreeScrollPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
//jTreeScrollPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jTreeScrollPanel.setViewportView(getJTree());
}
return jTreeScrollPanel;
}
/**
* This method initializes jTree
*
* @return javax.swing.JTree
*/
private JTree getJTree(){
if (jTree ==null){
top =new DefaultMutableTreeNode("DIAGNOSTICS TREE");
createNodes(top);
jTree =new JTree(top);
jTree.setPreferredSize(new Dimension(250, 20));
//expand all nodes
int row=0;
while (row<jTree.getRowCount()){
jTree.expandRow(row);
row++;
}
}
return jTree;
}
/*
private JTree getJTree() {
if (jTree == null) {
top = new DefaultMutableTreeNode("DIAGNOSTICS TREE");
createNodes(top);
jTree = new JTree(top);
//expand all nodes
int row=0;
while (row><jTree.getRowCount()) {
jTree.expandRow(row);
row++;
}
}
return jTree;
}*/
}
>

