private MainPanel() { super(new GridLayout(3, 1)); add(makePanel("Default", HREF)); // [Customize detault html link color in java swing - Stack Overflow] // http://stackoverflow.com/questions/26749495/customize-detault-html-link-color-in-java-swing HTMLEditorKit kit = new HTMLEditorKit(); StyleSheet styleSheet = kit.getStyleSheet(); styleSheet.addRule("a{color:#FF0000;}"); add(makePanel("styleSheet.addRule(\"a{color:#FF0000;}\")", HREF)); add( makePanel( "<a style='color:#00FF00'...", "<html><a style='color:#00FF00' href='" + MYSITE + "'>" + MYSITE + "</a>")); setPreferredSize(new Dimension(320, 240)); }
/** * Creates a new view that represents an IMG element. * * @param elem the element to create a view for */ public MyImageView(Element elem) { super(elem); initialize(elem); StyleSheet sheet = getStyleSheet(); attr = sheet.getViewAttributes(this); }