@Override public void setEditorFont(Font font) { se_response.getEditorComponent().setFont(font); }
@Override public void setEditorFont(Font font) { se_req_body.getEditorComponent().setFont(font); }
@Override protected void installDefaults() { super.installDefaults(); JTextComponent editor = getComponent(); editor.setFont(RTextAreaBase.getDefaultFont()); // Nimbus (and possibly other Synth lafs) doesn't play by BasicLaf // rules and doesn't set properties needed by custom BasicTextAreaUI's. correctNimbusDefaultProblems(editor); editor.setTransferHandler(DEFAULT_TRANSFER_HANDLER); }
public void fillByTextAndFont(@Nonnull final JTextComponent compo) { compo.setFont(this.font); compo.setText(this.text); }
/** * Sets the font used by this Display. This determines the font used * by this Display's text editor and in any debugging text. * @param f the Font to use */ public void setFont(Font f) { super.setFont(f); m_editor.setFont(f); }
@Override public void init(String type, InputStream data, boolean viewOnly) throws IOException { if (type.endsWith("xml")) { m_xml = true; } m_editor = new JTextArea(); m_editor.setFont(new Font("monospaced", Font.PLAIN, 12)); setContent(data); m_editor.setEditable(!viewOnly); m_component = new JScrollPane(m_editor); }
public static void makeMultilineLabel(JTextComponent area) { area.setFont(UIManager.getFont("Label.font")); area.setEditable(false); area.setOpaque(false); if (area instanceof JTextArea) { ((JTextArea)area).setWrapStyleWord(true); ((JTextArea)area).setLineWrap(true); } }
textComponent.setFont(new JLabel().getFont()); textComponent.setEditable(false); textComponent.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
public BannerPanel() { setBorder( new CompoundBorder(new EtchedBorder(), LookAndFeelTweaks.PANEL_BORDER)); setOpaque(true); setBackground(UIManager.getColor("Table.background")); titleLabel = new JLabel(); titleLabel.setOpaque(false); subtitleLabel = new JEditorPane("text/html", "<html>"); subtitleLabel.setFont(titleLabel.getFont()); LookAndFeelTweaks.makeBold(titleLabel); LookAndFeelTweaks.makeMultilineLabel(subtitleLabel); LookAndFeelTweaks.htmlize(subtitleLabel); iconLabel = new JLabel(); iconLabel.setPreferredSize(new Dimension(50, 50)); setLayout(new BorderLayout()); JPanel nestedPane = new JPanel(new BorderLayout()); nestedPane.setOpaque(false); nestedPane.add("North", titleLabel); nestedPane.add("Center", subtitleLabel); add("Center", nestedPane); add("East", iconLabel); }
/** * Edit text for the given VisualItem and attribute. Presents a text * editing widget spanning the item's bounding box. Use stopEditing() * to hide the text widget. When stopEditing() is called, the data field * will automatically be updated with the VisualItem. * @param item the VisualItem to edit * @param attribute the attribute to edit */ public void editText(VisualItem item, String attribute) { if ( m_editing ) { stopEditing(); } Rectangle2D b = item.getBounds(); Rectangle r = m_transform.createTransformedShape(b).getBounds(); // hacky placement code that attempts to keep text in same place // configured under Windows XP and Java 1.4.2b if ( m_editor instanceof JTextArea ) { r.y -= 2; r.width += 22; r.height += 2; } else { r.x += 3; r.y += 1; r.width -= 5; r.height -= 2; } Font f = getFont(); int size = (int)Math.round(f.getSize()*m_transform.getScaleX()); Font nf = new Font(f.getFontName(), f.getStyle(), size); m_editor.setFont(nf); editText(item, attribute, r); }
/** * Build the interface. */ private void buildUI() { if (colorEnabled) { JTextPane text = new JTextPane(); this.textComponent = text; } else { JTextArea text = new JTextArea(); this.textComponent = text; text.setLineWrap(true); } textComponent.addMouseListener(this); textComponent.setFont(getMonospaceFont()); textComponent.setEditable(false); DefaultCaret caret = (DefaultCaret) textComponent.getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); document = textComponent.getDocument(); document.addDocumentListener(new LimitLinesDocumentListener(numLines, true)); JScrollPane scrollText = new JScrollPane(textComponent); scrollText.setBorder(null); scrollText.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); add(scrollText, BorderLayout.CENTER); }
logView.setFont(new JLabel().getFont().deriveFont(12f)); logView.setEditable(false);
textComponent.setFont(new JLabel().getFont()); textComponent.setEditable(false); textComponent.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
private void init(Window parent, String str, boolean html) { setDefaultCloseOperation(DISPOSE_ON_CLOSE); JTextComponent textComp; if (html) { textComp = new JEditorPane("text/html", str); textComp.setCaretPosition(0); textComp.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true); textComp.setPreferredSize(Screen.getInstance().scale(new Dimension(600, 800))); } else { textComp = new JTextArea(str); textComp.setFont(new JLabel().getFont()); } textComp.setEditable(false); textComp.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); getContentPane().add(new JScrollPane(textComp)); pack(); setLocationRelativeTo(parent); } }
@Override protected void installDefaults() { super.installDefaults(); JTextComponent editor = getComponent(); editor.setFont(RTextAreaBase.getDefaultFont()); // Nimbus (and possibly other Synth lafs) doesn't play by BasicLaf // rules and doesn't set properties needed by custom BasicTextAreaUI's. correctNimbusDefaultProblems(editor); editor.setTransferHandler(DEFAULT_TRANSFER_HANDLER); }
protected void installDefaults() { super.installDefaults(); JTextComponent editor = getComponent(); editor.setFont(RTextAreaBase.getDefaultFont()); // Nimbus (and possibly other Synth lafs) doesn't play by BasicLaf // rules and doesn't set properties needed by custom BasicTextAreaUI's. correctNimbusDefaultProblems(editor); editor.setTransferHandler(defaultTransferHandler); }
final TextLineNumber textLineNumber = new TextLineNumber(text, 3); scrollPane.setRowHeaderView(textLineNumber); text.setFont(new Font(Font.MONOSPACED, Font.PLAIN, Screen.getInstance().getFontSize()));
private void updateTitle() { editor.setFont(editorFont); editor.setForeground(editorColor); setTitleFont(titleFont); setTitleForeground(titleColor); setTitle(titleText); setRightDecoration(model.isGlobalModified() ? rightDecoration : null); }
private void installMyDefaults() { this.activeBackground = UIManager.getColor("TextField.selectionBackground"); this.activeForeground = UIManager.getColor("TextField.selectionForeground"); this.inactiveBackground = UIManager.getColor("TextField.inactiveBackground"); this.inactiveForeground = UIManager.getColor("TextField.inactiveForeground"); getComponent().setFont(MaterialFonts.REGULAR); getComponent().setSelectionColor(getComponent().hasFocus() && getComponent().isEnabled() ? activeBackground : inactiveBackground); getComponent().setSelectedTextColor(getComponent().hasFocus() && getComponent().isEnabled() ? activeForeground : inactiveForeground); getComponent().setForeground(getComponent().hasFocus() && getComponent().isEnabled() ? activeForeground : inactiveForeground); getComponent().setBorder(BorderFactory.createEmptyBorder(3, 5, 2,5)); } @Override
/** Re-applies the current Field styles to the text component. */ public void validateStyles () { Font font = _element.resolveStyle(Style.FONT); _textComp.setFont(new java.awt.Font(font.name, awtFontStyle(font.style), FloatMath.round(font.size))); Color col = new Color(_element.resolveStyle(Style.COLOR)); _textComp.setForeground(col); _textComp.setCaretColor(col); if (isField()) { switch (_element.resolveStyle(Style.HALIGN)) { case CENTER: asField().setHorizontalAlignment(JTextField.CENTER); break; case LEFT: asField().setHorizontalAlignment(JTextField.LEFT); break; case RIGHT: asField().setHorizontalAlignment(JTextField.RIGHT); break; } } // TODO: Keyboard.TextType textType = resolveStyle(Field.TEXT_TYPE); }