JPanel作为容器,显示不同的视图

 

private JPanel m_topInputContainer = null;


private void changeOrderPanelVisibility(String v) {
  // remove both top and bottom input container
  // create both top and bottom input panel according to visibility
  m_topInputContainer.removeAll();
  m_topInputContainer.add(createPartOrderPanel(v, "top"));
  m_topInputContainer.validate();
  m_topInputContainer.repaint();

  if (hasBottomPanel()) {
   m_bottomInputContainer.removeAll();
   m_bottomInputContainer.add(createPartOrderPanel(v, "bottom"));
   m_bottomInputContainer.validate();
   m_bottomInputContainer.repaint();
  }

 }

你可能感兴趣的:(SWING)