public HDMColdAccountForm(final WalletListPanel walletListPanel) { this.walletListPanel = walletListPanel; inactiveBackGroundColor = Color.WHITE; selected = false; panelMain.setOpaque(true); panelMain.setFocusable(true); panelMain.setBackground(inactiveBackGroundColor); if (ColorAndFontConstants.isInverse()) { inactiveBackGroundColor = new Color( Math.min(255, Themes.currentTheme.detailPanelBackground().getRed() + 2 * COLOR_DELTA), Math.min( 255, Themes.currentTheme.detailPanelBackground().getBlue() + 2 * COLOR_DELTA), Math.min( 255, Themes.currentTheme.detailPanelBackground().getGreen() + 2 * COLOR_DELTA)); } else { inactiveBackGroundColor = new Color( Math.max(0, Themes.currentTheme.detailPanelBackground().getRed() - COLOR_DELTA), Math.max(0, Themes.currentTheme.detailPanelBackground().getBlue() - COLOR_DELTA), Math.max(0, Themes.currentTheme.detailPanelBackground().getGreen() - COLOR_DELTA)); } panelMain.applyComponentOrientation( ComponentOrientation.getOrientation(LocaliserUtils.getLocale())); updateFromModel(); panelMain.addMouseListener( new WalletMouseListener(this.walletListPanel, HDMColdAccountForm.this)); setSelected(false); setContent(); }
public Browser(String currentHref) { super(); this.currentHref = currentHref; try { if (Bither.getMainFrame() != null) { Bither.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } addHyperlinkListener(new ActivatedHyperlinkListener(Bither.getMainFrame(), this)); loadingMessage = LocaliserUtils.getString("browser.loadingMessage"); setEditable(false); setBackground(Themes.currentTheme.detailPanelBackground()); String fontName = null; if (fontName == null || "".equals(fontName)) { fontName = ColorAndFontConstants.BITHER_DEFAULT_FONT_NAME; } // Add in san-serif as a fallback. fontName = fontName + ", san-serif"; int fontSize = ColorAndFontConstants.BITHER_DEFAULT_FONT_SIZE; boolean isItalic = false; boolean isBold = false; Font adjustedFont = FontSizer.INSTANCE.getAdjustedDefaultFont(); if (adjustedFont != null) { setFont(adjustedFont); fontSize = adjustedFont.getSize(); isItalic = adjustedFont.isItalic(); isBold = adjustedFont.isBold(); } String fontCSS = "font-size:" + fontSize + "pt; font-family:" + fontName + ";"; if (isItalic) { fontCSS = fontCSS + "font-style:italic;"; } else { fontCSS = fontCSS + "font-style:normal;"; } if (isBold) { fontCSS = fontCSS + "font-weight:bold;"; } else { fontCSS = fontCSS + "font-weight:normal;"; } HTMLEditorKit kit = new HTMLEditorKit(); setEditorKit(kit); javax.swing.text.html.StyleSheet styleSheet = kit.getStyleSheet(); styleSheet.addRule("body {" + fontCSS + "}"); Document doc = kit.createDefaultDocument(); setDocument(doc); log.debug("Trying to load '" + currentHref + "'..."); } catch (Exception ex) { showUnableToLoadMessage(ex.getClass().getCanonicalName() + " " + ex.getMessage()); } }