/** * Creates a UI for an RTextArea. * * @param textArea A text area. * @return The UI. */ public static ComponentUI createUI(JComponent textArea) { return new RTextAreaUI(textArea); }
@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); }
/** * {@inheritDoc} */ @Override protected void installKeyboardActions() { // NOTE: Don't call super.installKeyboardActions(), as that causes // JTextAreas to stop responding to certain keystrokes if an RTextArea // is the first-instantiated text area. This is because of the code // path installKeyboardActions() -> getActionMap() -> createActionMap(). // In BasicTextUI#createActionMap(), "editor.getActions()" is called, // and the current editor's returned Actions are used to create the // ActionMap, which is then cached and used in all future J/RTextAreas. // Unfortunately, RTextArea actions don't worn in JTextAreas. //super.installKeyboardActions(); RTextArea textArea = getRTextArea(); // backward compatibility support... keymaps for the UI // are now installed in the more friendly input map. textArea.setKeymap(createKeymap()); // Since BasicTextUI.getInputMap() is package-private, instead use // our own version here. InputMap map = getRTextAreaInputMap(); SwingUtilities.replaceUIInputMap(textArea,JComponent.WHEN_FOCUSED,map); // Same thing here with action map. ActionMap am = getRTextAreaActionMap(); if (am!=null) { SwingUtilities.replaceUIActionMap(textArea, am); } }
/** * Returns an action map to use by a text area.<p> * * This method is not named <code>getActionMap()</code> because there is * a package-private method in <code>BasicTextAreaUI</code> with that name. * Thus, creating a new method with that name causes certain compilers to * issue warnings that you are not actually overriding the original method * (since it is package-private). * * @return The action map. * @see #createRTextAreaActionMap() */ private ActionMap getRTextAreaActionMap() { // Get the UIManager-cached action map; if this is the first // RTextArea created, create the action map and cache it. ActionMap map = (ActionMap)UIManager.get(getActionMapName()); if (map==null) { map = createRTextAreaActionMap(); UIManager.put(getActionMapName(), map); } ActionMap componentMap = new ActionMapUIResource(); componentMap.put("requestFocus", new FocusAction()); if (map != null) { componentMap.setParent(map); } return componentMap; }
View v = ui.getRootView(textArea).getView(0); Document doc = textArea.getDocument(); Element root = doc.getDefaultRootElement(); Rectangle visibleEditorRect = ui.getVisibleEditorRect(); Rectangle r = LineNumberList.getChildViewBounds(v, topLine, visibleEditorRect);
View v = ui.getRootView(textArea).getView(0); Rectangle visibleEditorRect = ui.getVisibleEditorRect(); Rectangle r = IconRowHeader.getChildViewBounds(v, topLine, visibleEditorRect);
/** * Returns an action map to use by a text area.<p> * * This method is not named <code>getActionMap()</code> because there is * a package-private method in <code>BasicTextAreaUI</code> with that name. * Thus, creating a new method with that name causes certain compilers to * issue warnings that you are not actually overriding the original method * (since it is package-private). * * @return The action map. * @see #createRTextAreaActionMap() */ private ActionMap getRTextAreaActionMap() { // Get the UIManager-cached action map; if this is the first // RTextArea created, create the action map and cache it. ActionMap map = (ActionMap)UIManager.get(getActionMapName()); if (map==null) { map = createRTextAreaActionMap(); UIManager.put(getActionMapName(), map); } ActionMap componentMap = new ActionMapUIResource(); componentMap.put("requestFocus", new FocusAction()); if (map != null) componentMap.setParent(map); return componentMap; }
/** * {@inheritDoc} */ protected void installKeyboardActions() { // NOTE: Don't call super.installKeyboardActions(), as that causes // JTextAreas to stop responding to certain keystrokes if an RTextArea // is the first-instantiated text area. This is because of the code // path installKeyboardActions() -> getActionMap() -> createActionMap(). // In BasicTextUI#createActionMap(), "editor.getActions()" is called, // and the current editor's returned Actions are used to create the // ActionMap, which is then cached and used in all future J/RTextAreas. // Unfortunately, RTextArea actions don't worn in JTextAreas. //super.installKeyboardActions(); RTextArea textArea = getRTextArea(); // backward compatibility support... keymaps for the UI // are now installed in the more friendly input map. textArea.setKeymap(createKeymap()); // Since BasicTextUI.getInputMap() is package-private, instead use // our own version here. InputMap map = getRTextAreaInputMap(); SwingUtilities.replaceUIInputMap(textArea,JComponent.WHEN_FOCUSED,map); // Same thing here with action map. ActionMap am = getRTextAreaActionMap(); if (am!=null) { SwingUtilities.replaceUIActionMap(textArea, am); } }
View v = ui.getRootView(textArea).getView(0); Rectangle visibleEditorRect = ui.getVisibleEditorRect(); Rectangle r = LineNumberList.getChildViewBounds(v, topLine, visibleEditorRect);
protected void installDefaults() { super.installDefaults(); JTextComponent editor = getComponent(); // 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); }
/** * Returns an action map to use by a text area.<p> * * This method is not named <code>getActionMap()</code> because there is * a package-private method in <code>BasicTextAreaUI</code> with that name. * Thus, creating a new method with that name causes certain compilers to * issue warnings that you are not actually overriding the original method * (since it is package-private). * * @return The action map. * @see #createRTextAreaActionMap() */ private ActionMap getRTextAreaActionMap() { // Get the UIManager-cached action map; if this is the first // RTextArea created, create the action map and cache it. ActionMap map = (ActionMap)UIManager.get(getActionMapName()); if (map==null) { map = createRTextAreaActionMap(); UIManager.put(getActionMapName(), map); } ActionMap componentMap = new ActionMapUIResource(); componentMap.put("requestFocus", new FocusAction()); if (map != null) componentMap.setParent(map); return componentMap; }
/** * Returns the a real UI to install on this text area. * * @return The UI. */ @Override protected RTextAreaUI createRTextAreaUI() { return new RTextAreaUI(this); }
/** * {@inheritDoc} */ @Override protected void installKeyboardActions() { // NOTE: Don't call super.installKeyboardActions(), as that causes // JTextAreas to stop responding to certain keystrokes if an RTextArea // is the first-instantiated text area. This is because of the code // path installKeyboardActions() -> getActionMap() -> createActionMap(). // In BasicTextUI#createActionMap(), "editor.getActions()" is called, // and the current editor's returned Actions are used to create the // ActionMap, which is then cached and used in all future J/RTextAreas. // Unfortunately, RTextArea actions don't worn in JTextAreas. //super.installKeyboardActions(); RTextArea textArea = getRTextArea(); // backward compatibility support... keymaps for the UI // are now installed in the more friendly input map. textArea.setKeymap(createKeymap()); // Since BasicTextUI.getInputMap() is package-private, instead use // our own version here. InputMap map = getRTextAreaInputMap(); SwingUtilities.replaceUIInputMap(textArea,JComponent.WHEN_FOCUSED,map); // Same thing here with action map. ActionMap am = getRTextAreaActionMap(); if (am!=null) { SwingUtilities.replaceUIActionMap(textArea, am); } }
View v = ui.getRootView(textArea).getView(0); boolean currentLineHighlighted = textArea.getHighlightCurrentLine(); Document doc = textArea.getDocument(); Rectangle visibleEditorRect = ui.getVisibleEditorRect(); Rectangle r = LineNumberList.getChildViewBounds(v, topLine, visibleEditorRect);
@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); }
/** * Returns an action map to use by a text area.<p> * * This method is not named <code>getActionMap()</code> because there is * a package-private method in <code>BasicTextAreaUI</code> with that name. * Thus, creating a new method with that name causes certain compilers to * issue warnings that you are not actually overriding the original method * (since it is package-private). * * @return The action map. * @see #createRTextAreaActionMap() */ private ActionMap getRTextAreaActionMap() { // Get the UIManager-cached action map; if this is the first // RTextArea created, create the action map and cache it. ActionMap map = (ActionMap)UIManager.get(getActionMapName()); if (map==null) { map = createRTextAreaActionMap(); UIManager.put(getActionMapName(), map); } ActionMap componentMap = new ActionMapUIResource(); componentMap.put("requestFocus", new FocusAction()); if (map != null) { componentMap.setParent(map); } return componentMap; }
/** * Creates a UI for an RTextArea. * * @param textArea A text area. * @return The UI. */ public static ComponentUI createUI(JComponent textArea) { return new RTextAreaUI(textArea); }
/** * {@inheritDoc} */ protected void installKeyboardActions() { // NOTE: Don't call super.installKeyboardActions(), as that causes // JTextAreas to stop responding to certain keystrokes if an RTextArea // is the first-instantiated text area. This is because of the code // path installKeyboardActions() -> getActionMap() -> createActionMap(). // In BasicTextUI#createActionMap(), "editor.getActions()" is called, // and the current editor's returned Actions are used to create the // ActionMap, which is then cached and used in all future J/RTextAreas. // Unfortunately, RTextArea actions don't worn in JTextAreas. //super.installKeyboardActions(); RTextArea textArea = getRTextArea(); // backward compatibility support... keymaps for the UI // are now installed in the more friendly input map. textArea.setKeymap(createKeymap()); // Since BasicTextUI.getInputMap() is package-private, instead use // our own version here. InputMap map = getRTextAreaInputMap(); SwingUtilities.replaceUIInputMap(textArea,JComponent.WHEN_FOCUSED,map); // Same thing here with action map. ActionMap am = getRTextAreaActionMap(); if (am!=null) { SwingUtilities.replaceUIActionMap(textArea, am); } }
View v = ui.getRootView(textArea).getView(0); boolean currentLineHighlighted = textArea.getHighlightCurrentLine(); Document doc = textArea.getDocument(); Rectangle visibleEditorRect = ui.getVisibleEditorRect(); Rectangle r = LineNumberList.getChildViewBounds(v, topLine, visibleEditorRect);
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); }