/** * Change the size of this image. This alters the HEIGHT and WIDTH attributes of the Element and * causes a re-layout. */ protected void resize(int width, int height) { if (width == fWidth && height == fHeight) return; fWidth = width; fHeight = height; // Replace attributes in document: MutableAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(HTML.Attribute.WIDTH, Integer.toString(width)); attr.addAttribute(HTML.Attribute.HEIGHT, Integer.toString(height)); ((StyledDocument) getDocument()) .setCharacterAttributes(fElement.getStartOffset(), fElement.getEndOffset(), attr, false); }
@Override public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, int pos) { // <B>が出たら次の地の文はカテゴリ名。なのでフラグを立てる。 if (tag.equals(HTML.Tag.B)) { start_bold = true; start_category_flag = true; } // <A>タグが出たらurlを保持。あとで板名とペアにする。 if (tag.equals(HTML.Tag.A)) { // 頭についてる広告タグは無視。 if (parse_2ch_start_flag) { String href = (String) attr.getAttribute(HTML.Attribute.HREF); next_board_url = href; } } }