public void visit(LinkModel link) { try { // make sure to reload editorPane.getDocument().putProperty(Document.StreamDescriptionProperty, null); // JW: editorPane defaults to asynchronous loading // no need to explicitly start a thread - really? editorPane.setPage(link.getURL()); link.setVisited(true); } catch (IOException e1) { editorPane.setText("<html>Error 404: couldn't show " + link.getURL() + " </html>"); } }
/** * Set the details section to be either visible or invisible. Set the text of the Details button * accordingly. * * @param b if true details section will be visible */ private void setDetailsVisible(boolean b) { if (b) { collapsedHeight = pane.getHeight(); pane.setSize( pane.getWidth(), expandedHeight == 0 ? collapsedHeight + getDetailsHeight() : expandedHeight); detailsPanel.setVisible(true); configureDetailsButton(true); detailsPanel.applyComponentOrientation(detailButton.getComponentOrientation()); // workaround for bidi bug, if the text is not set "again" and the component orientation has // changed // then the text won't be aligned correctly. To reproduce this (in JDK 1.5) show two dialogs // in one // use LTOR orientation and in the second use RTOL orientation and press "details" in both. // Text in the text box should be aligned to right/left respectively, without this line this // doesn't // occure I assume because bidi properties are tested when the text is set and are not updated // later // on when setComponentOrientation is invoked. details.setText(details.getText()); details.setCaretPosition(0); } else if (collapsedHeight != 0) { // only collapse if the dialog has been expanded expandedHeight = pane.getHeight(); detailsPanel.setVisible(false); configureDetailsButton(false); // Trick to force errorMessage JTextArea to resize according // to its columns property. errorMessage.setSize(0, 0); errorMessage.setSize(errorMessage.getPreferredSize()); pane.setSize(pane.getWidth(), collapsedHeight); } else { detailsPanel.setVisible(false); } pane.doLayout(); }