Hello All,
I have a JFrame that contains a JSplitPane. In that JSplitPane I have a new class that extends JPanel ("SortedPortfolioPanel" in the leftComponent and a new class that extends JPanel ("FilterMarketPanel" in the rightComponent. In JPanel "FilterMarketPanel" I have a button that needs to send an updated ArrayList to JPanel "SortedPortfolioPanel" where that JPanel will be redrawn based on the new Info. This doesn't seem to work. The classes are initially correct, but they don't have the ability to update each other. The JTree is not being redrawn. If someone could point me in the right direction I would appreciate it. All of my bussiness logic is isolated so I can completely change my UI around if need be. In order to keep this short, only the code of the "SortedPortfolioPanel " JPanel is as follows:
Thanks,
bnye
I have a JFrame that contains a JSplitPane. In that JSplitPane I have a new class that extends JPanel ("SortedPortfolioPanel" in the leftComponent and a new class that extends JPanel ("FilterMarketPanel" in the rightComponent. In JPanel "FilterMarketPanel" I have a button that needs to send an updated ArrayList to JPanel "SortedPortfolioPanel" where that JPanel will be redrawn based on the new Info. This doesn't seem to work. The classes are initially correct, but they don't have the ability to update each other. The JTree is not being redrawn. If someone could point me in the right direction I would appreciate it. All of my bussiness logic is isolated so I can completely change my UI around if need be. In order to keep this short, only the code of the "SortedPortfolioPanel " JPanel is as follows:
Code:
public class SortedPortfolioPanel extends JPanel{
private static Portfolio tempPortfolioToSort;
private static Portfolio portfolioToSort;
public SortedPortfolioPanel(Portfolio newPortfolioToSort) {
tempPortfolioToSort = newPortfolioToSort;
createSortedPortfolioPanel(tempPortfolioToSort);
}
public void createSortedPortfolioPanel(Portfolio newPortfolioToSort) {
portfolioToSort = newPortfolioToSort;
this.setBackground(SystemColor.window);
System.out.println(portfolioToSort.getPortfolioName());
DefaultMutableTreeNode portfolioTreeRoot = new DefaultMutableTreeNode(newPortfolioToSort.getPortfolioName());
for(int x = 0; x < 19; x++) {
Stock stockForTree = new Stock();
ArrayList arrayListForTree = new ArrayList();
arrayListForTree = portfolioToSort.getStockPortfolio();
stockForTree = (Stock)arrayListForTree.get(x);
portfolioTreeRoot.add(new DefaultMutableTreeNode(stockForTree.getTicker()));
}
DefaultTreeModel portfolioTreeModel = new DefaultTreeModel(portfolioTreeRoot);
JTree portfolioTree = new JTree(portfolioTreeModel);
this.add(portfolioTree);
this.repaint();
}
}
Thanks,
bnye