@Override public void ancestorResized(HierarchyEvent e) { if (header == e.getComponent()) { View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); // view might get lost on LAF change ... if (v == null) { descriptionPane.putClientProperty(BasicHTML.propertyKey, MultiLineSupport.createView(descriptionPane)); v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); } if (v != null) { Container tla = header.getTopLevelAncestor(); if (tla == null) { tla = header.getParent(); while (tla.getParent() != null) { tla = tla.getParent(); } } int h = Math.max(descriptionPane.getHeight(), tla.getHeight()); int w = Math.min(tla.getWidth(), header.getParent().getWidth()); // 35 = description pane insets, TODO: obtain dynamically w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x; v.setSize(w, h); descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS))); } } }}; header.addPropertyChangeListener(propListener);
@Override public void ancestorResized(HierarchyEvent e) { if (header == e.getComponent()) { View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); // view might get lost on LAF change ... if (v == null) { descriptionPane.putClientProperty(BasicHTML.propertyKey, MultiLineSupport.createView(descriptionPane)); v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); } if (v != null) { Container tla = header.getTopLevelAncestor(); if (tla == null) { tla = header.getParent(); while (tla.getParent() != null) { tla = tla.getParent(); } } int h = Math.max(descriptionPane.getHeight(), tla.getHeight()); int w = Math.min(tla.getWidth(), header.getParent().getWidth()); // 35 = description pane insets, TODO: obtain dynamically w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x; v.setSize(w, h); descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS))); } } }}; header.addPropertyChangeListener(propListener);
@Override public void ancestorResized(HierarchyEvent e) { if (header == e.getComponent()) { View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); // view might get lost on LAF change ... if (v == null) { descriptionPane.putClientProperty(BasicHTML.propertyKey, MultiLineSupport.createView(descriptionPane)); v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); } if (v != null) { Container tla = header.getTopLevelAncestor(); if (tla == null) { tla = header.getParent(); while (tla.getParent() != null) { tla = tla.getParent(); } } int h = Math.max(descriptionPane.getHeight(), tla.getHeight()); int w = Math.min(tla.getWidth(), header.getParent().getWidth()); // 35 = description pane insets, TODO: obtain dynamically w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x; v.setSize(w, h); descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS))); } } }}; header.addPropertyChangeListener(propListener);
@Override public void ancestorResized(HierarchyEvent e) { if (header == e.getComponent()) { View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); // view might get lost on LAF change ... if (v == null) { descriptionPane.putClientProperty(BasicHTML.propertyKey, MultiLineSupport.createView(descriptionPane)); v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); } if (v != null) { Container tla = header.getTopLevelAncestor(); if (tla == null) { tla = header.getParent(); while (tla.getParent() != null) { tla = tla.getParent(); } } int h = Math.max(descriptionPane.getHeight(), tla.getHeight()); int w = Math.min(tla.getWidth(), header.getParent().getWidth()); // 35 = description pane insets, TODO: obtain dynamically w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x; v.setSize(w, h); descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS))); } } }}; header.addPropertyChangeListener(propListener);
@Override public void ancestorResized(HierarchyEvent e) { if (header == e.getComponent()) { View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); // view might get lost on LAF change ... if (v == null) { descriptionPane.putClientProperty(BasicHTML.propertyKey, descriptionPane.getMultiLineSupport().createView(descriptionPane)); v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey); } if (v != null) { Container tla = header.getTopLevelAncestor(); if (tla == null) { tla = header.getParent(); while (tla.getParent() != null) { tla = tla.getParent(); } } int h = Math.max(descriptionPane.getHeight(), tla.getHeight()); int w = Math.min(tla.getWidth(), header.getParent().getWidth()); // 35 = description pane insets, TODO: obtain dynamically w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x; v.setSize(w, h); descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS))); } } }}; header.addPropertyChangeListener(propListener);