当前位置: 首页>>代码示例>>Java>>正文


Java EditorStyleConstants类代码示例

本文整理汇总了Java中org.netbeans.api.editor.settings.EditorStyleConstants的典型用法代码示例。如果您正苦于以下问题:Java EditorStyleConstants类的具体用法?Java EditorStyleConstants怎么用?Java EditorStyleConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EditorStyleConstants类属于org.netbeans.api.editor.settings包,在下文中一共展示了EditorStyleConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AnnotationBar

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
/**
 * Creates new instance initializing final fields.
 */
public AnnotationBar(JTextComponent target) {
    this.textComponent = target;
    this.editorUI = Utilities.getEditorUI(target);
    this.foldHierarchy = FoldHierarchy.get(editorUI.getComponent());
    this.doc = editorUI.getDocument();
    setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    elementAnnotationsSubstitute = "";                              //NOI18N
    if (textComponent instanceof JEditorPane) {
        String mimeType = org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(textComponent);
        FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
        renderingHints = (Map) fcs.getFontColors(FontColorNames.DEFAULT_COLORING).getAttribute(EditorStyleConstants.RenderingHints);
    } else {
        renderingHints = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AnnotationBar.java

示例2: AnnotationBar

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
/**
 * Creates new instance initializing final fields.
 */
public AnnotationBar(JTextComponent target) {
    this.textComponent = target;
    this.editorUI = Utilities.getEditorUI(target);
    this.foldHierarchy = FoldHierarchy.get(editorUI.getComponent());
    this.doc = editorUI.getDocument();
    if (textComponent instanceof JEditorPane) {
        String mimeType = org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(textComponent);
        FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
        renderingHints = (Map) fcs.getFontColors(FontColorNames.DEFAULT_COLORING).getAttribute(EditorStyleConstants.RenderingHints);
    } else {
        renderingHints = null;
    }
    setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    elementAnnotationsSubstitute = "";                              //NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AnnotationBar.java

示例3: VersioningSystemColors

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
public VersioningSystemColors(OptionsPanelColorProvider provider) {
    this.colors = provider.getColors();
    if (colors == null) {
        throw new NullPointerException("Null colors for " + provider); // NOI18N
    }
    this.provider = provider;
    // initialize saved colors list
    savedColorAttributes = new ArrayList<AttributeSet>(colors.size());
    for (Map.Entry<String, Color[]> e : colors.entrySet()) {
        SimpleAttributeSet sas = new SimpleAttributeSet();
        StyleConstants.setBackground(sas, e.getValue()[0]);
        sas.addAttribute(StyleConstants.NameAttribute, e.getKey());
        sas.addAttribute(EditorStyleConstants.DisplayName, e.getKey());
        savedColorAttributes.add(sas);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AnnotationColorsPanel.java

示例4: getListCellRendererComponent

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    setComponentOrientation(list.getComponentOrientation());
    if (isSelected) {
        setBackground(list.getSelectionBackground ());
        setForeground(list.getSelectionForeground ());
    } else {
        setBackground(list.getBackground ());
        setForeground(list.getForeground ());
    }
    setIcon((Icon) ((AttributeSet) value).getAttribute ("icon"));
    setText((String) ((AttributeSet) value).getAttribute (EditorStyleConstants.DisplayName));

    setEnabled(list.isEnabled());
    setFont(list.getFont());
    setBorder(cellHasFocus ? UIManager.getBorder ("List.focusCellHighlightBorder") : noFocusBorder);
    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CategoryRenderer.java

示例5: testAllColors

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
public void testAllColors() {
    MimePath mimePath = MimePath.parse("text/x-type-A");
    Lookup lookup = MimeLookup.getLookup(mimePath);
    
    FontColorSettings fcs = lookup.lookup(FontColorSettings.class);
    assertNotNull("Can't find FontColorSettings", fcs);
    
    AttributeSet attribs = fcs.getTokenFontColors("test-all");
    assertNotNull("Can't find test-all coloring", attribs);
    assertEquals("Wrong background color", 
        new Color(0x0A0B0C), attribs.getAttribute(StyleConstants.Background));
    assertEquals("Wrong foreground color", 
        new Color(0x0D0E0F), attribs.getAttribute(StyleConstants.Foreground));
    assertEquals("Wrong underline color", 
        new Color(0x010203), attribs.getAttribute(StyleConstants.Underline));
    assertEquals("Wrong strikeThrough color", 
        new Color(0x040506), attribs.getAttribute(StyleConstants.StrikeThrough));
    assertEquals("Wrong waveUnderline color", 
        new Color(0x070809), attribs.getAttribute(EditorStyleConstants.WaveUnderlineColor));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:EditorSettingsStorageTest.java

示例6: getListCellRendererComponent

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    setComponentOrientation(list.getComponentOrientation());
    if (isSelected) {
        setBackground(list.getSelectionBackground ());
        setForeground(list.getSelectionForeground ());
    } else {
        setBackground(list.getBackground ());
        setForeground(list.getForeground ());
    }
    setIcon((Icon) ((AttributeSet) value).getAttribute ("icon"));
    setText((String) ((AttributeSet) value).getAttribute (EditorStyleConstants.DisplayName));

    setEnabled(list.isEnabled());
    setFont(list.getFont());
    setBorder(cellHasFocus ? UIManager.getBorder ("List.focusCellHighlightBorder") : noFocusBorder);
    return this;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:CategoryRenderer.java

示例7: testAllLanguagesTheCrapWay

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
public void testAllLanguagesTheCrapWay() {
    Collection<AttributeSet> colorings = EditorSettings.getDefault().getFontColorSettings(new String[0]).getAllFontColors(EditorSettingsImpl.DEFAULT_PROFILE);
    assertNotNull("Can't get colorings for all languages", colorings);
    
    AttributeSet attribs = null;
    for(AttributeSet coloring : colorings) {
        String name = (String) coloring.getAttribute(StyleConstants.NameAttribute);
        if (name != null && name.equals("test-all-languages-set-all")) {
            attribs = coloring;
            break;
        }
    }
    
    assertNotNull("Can't find test-all-languages-set-all coloring", attribs);
    assertEquals("Wrong color", new Color(0x0A0B0C), attribs.getAttribute(StyleConstants.Background));
    assertEquals("Wrong color", new Color(0x0D0E0F), attribs.getAttribute(StyleConstants.Foreground));
    assertEquals("Wrong color", new Color(0x010203), attribs.getAttribute(StyleConstants.Underline));
    assertEquals("Wrong color", new Color(0x040506), attribs.getAttribute(StyleConstants.StrikeThrough));
    assertEquals("Wrong color", new Color(0x070809), attribs.getAttribute(EditorStyleConstants.WaveUnderlineColor));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:FontColorSettingsImplTest.java

示例8: getTooltipFromHighlightingLayers

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
private CharSequence getTooltipFromHighlightingLayers() {
    // Read tooltip from highlighting layers attribute
    CharSequence tooltipFromHighlightingLayers = null;
    {
        if (tooltipAttributeValue != null) {
            if (tooltipAttributeValue instanceof String) {
                tooltipFromHighlightingLayers = (String) tooltipAttributeValue;
            } else if (tooltipAttributeValue instanceof HighlightAttributeValue) {
                @SuppressWarnings("unchecked") //NOI18N
                CharSequence value = ((HighlightAttributeValue<CharSequence>) tooltipAttributeValue).getValue(
                    component, doc, EditorStyleConstants.Tooltip, offset, offset + 1);
                tooltipFromHighlightingLayers = value;
            } else {
                LOG.fine("Invalid '" + EditorStyleConstants.Tooltip + "' attribute value " + tooltipAttributeValue); //NOI18N
            }
        }
    }

    return tooltipFromHighlightingLayers;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:NbToolTip.java

示例9: checkMaps

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
private boolean checkMaps(String languageName, Map<String, AttributeSet> savedMap, Map<String, AttributeSet> currentMap) {
    boolean isChanged = false;
    for (String name : savedMap.keySet()) {
        if (currentMap.containsKey(name)) {
            AttributeSet currentAS = currentMap.get(name);
            AttributeSet savedAS = savedMap.get(name);
            isChanged |= isFontChanged(languageName, currentAS, savedAS)
                    || (Color) currentAS.getAttribute(StyleConstants.Foreground) != (Color) savedAS.getAttribute(StyleConstants.Foreground)
                    || (Color) currentAS.getAttribute(StyleConstants.Background) != (Color) savedAS.getAttribute(StyleConstants.Background)
                    || (Color) currentAS.getAttribute(StyleConstants.Underline) != (Color) savedAS.getAttribute(StyleConstants.Underline)
                    || (Color) currentAS.getAttribute(StyleConstants.StrikeThrough) != (Color) savedAS.getAttribute(StyleConstants.StrikeThrough)
                    || (Color) currentAS.getAttribute(EditorStyleConstants.WaveUnderlineColor) != (Color) savedAS.getAttribute(EditorStyleConstants.WaveUnderlineColor);
            if(isChanged) { // no need to iterate further
                return true;
            }
        }
    }
    return isChanged;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SyntaxColoringPanel.java

示例10: checkMaps

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
private boolean checkMaps(Map<String, AttributeSet> savedMap, Map<String, AttributeSet> currentMap) {
    boolean isChanged = false;
    for (String name : savedMap.keySet()) {
        if (currentMap.containsKey(name)) {
            AttributeSet currentAS = currentMap.get(name);
            AttributeSet savedAS = savedMap.get(name);
            Color currentForeground = (Color) currentAS.getAttribute(StyleConstants.Foreground);
            Color savedForeground = (Color) savedAS.getAttribute(StyleConstants.Foreground);
            Color currentBackground = (Color) currentAS.getAttribute(StyleConstants.Background);
            Color savedBackground = (Color) savedAS.getAttribute(StyleConstants.Background);
            Color currentWave = (Color) currentAS.getAttribute(EditorStyleConstants.WaveUnderlineColor);
            Color savedWave = (Color) savedAS.getAttribute(EditorStyleConstants.WaveUnderlineColor);
            isChanged |= (currentForeground == null ? savedForeground != null : !currentForeground.equals(savedForeground))
                    || (currentBackground == null ? savedBackground != null : !currentBackground.equals(savedBackground))
                    || (currentWave == null ? savedWave != null : !currentWave.equals(savedWave));
            if(isChanged) { // no need to iterate further
                return true;
            }
        }
    }
    return isChanged;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:AnnotationsPanel.java

示例11: checkMaps

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
private boolean checkMaps(Map<String, AttributeSet> savedMap, Map<String, AttributeSet> currentMap) {
    boolean isChanged = false;
    for (String name : savedMap.keySet()) {
        if (currentMap.containsKey(name)) {
            AttributeSet currentAS = currentMap.get(name);
            AttributeSet savedAS = savedMap.get(name);
            isChanged |= (Color) currentAS.getAttribute(StyleConstants.Foreground) != (Color) savedAS.getAttribute(StyleConstants.Foreground)
                    || (Color) currentAS.getAttribute(StyleConstants.Background) != (Color) savedAS.getAttribute(StyleConstants.Background)
                    || (Color) currentAS.getAttribute(StyleConstants.Underline) != (Color) savedAS.getAttribute(StyleConstants.Underline)
                    || (Color) currentAS.getAttribute(StyleConstants.StrikeThrough) != (Color) savedAS.getAttribute(StyleConstants.StrikeThrough)
                    || (Color) currentAS.getAttribute(EditorStyleConstants.WaveUnderlineColor) != (Color) savedAS.getAttribute(EditorStyleConstants.WaveUnderlineColor);
            
        }
    }
    return isChanged;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:HighlightingPanel.java

示例12: makeHyperlink

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
private synchronized void makeHyperlink(HyperlinkType type, HyperlinkProviderExt provider, final int start, final int end, final int offset) {
    boolean makeCursorSnapshot = true;
    
    if (hyperlinkUp) {
        unHyperlink(false);
        makeCursorSnapshot = false;
    }
    
    OffsetsBag prepare = new OffsetsBag(component.getDocument());

    FontColorSettings fcs = MimeLookup.getLookup(MimePath.EMPTY).lookup(FontColorSettings.class);
    AttributeSet hyperlinksHighlight = fcs.getFontColors("hyperlinks"); //NOI18N
    prepare.addHighlight(start, end, AttributesUtilities.createComposite(
        hyperlinksHighlight != null ? hyperlinksHighlight : defaultHyperlinksHighlight,
        AttributesUtilities.createImmutable(EditorStyleConstants.Tooltip, new TooltipResolver(provider, offset, type))));

    getBag(currentDocument).setHighlights(prepare);

    hyperlinkUp = true;

    if (makeCursorSnapshot) {
        if (component.isCursorSet()) {
            oldComponentsMouseCursor = component.getCursor();
        } else {
            oldComponentsMouseCursor = null;
        }
        component.setCursor(getMouseCursor(type));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:HyperlinkOperation.java

示例13: updateComponentProperties

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
/**
 * Update various properties of the component in AWT thread.
 */
void updateComponentProperties() {

    // Refresh rendering hints
    String mimeType = org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component);
    FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
    renderingHints = (Map<?, ?>) fcs.getFontColors(FontColorNames.DEFAULT_COLORING).getAttribute(EditorStyleConstants.RenderingHints);
    
    // Set the margin
    String value = prefs.get(SimpleValueNames.MARGIN, null);
    Insets margin = value != null ? SettingsConversions.parseInsets(value) : null;
    component.setMargin(margin != null ? margin : NULL_INSETS);

    lineNumberDigitWidth = computeLineNumberDigitWidth();

    // Update line height
    updateLineHeight(getComponent());

    // Update space width of the default coloring's font
    FontMetricsCache.Info fmcInfo = FontMetricsCache.getInfo(getDefaultColoring().getFont());
    defaultSpaceWidth = fmcInfo.getSpaceWidth(component);

    updateLineNumberWidth(0);

    // update glyph gutter colors and fonts
    if (isGlyphGutterVisible()) {
        glyphGutter.update();
        updateScrollPaneCornerColor();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:EditorUI.java

示例14: updateRenderingHints

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
private void updateRenderingHints(Graphics g){
    JTextComponent comp = editorUI.getComponent();
    if (comp != null) {
        String mimeType = org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(comp);
        FontColorSettings fcs = MimeLookup.getLookup(mimeType).lookup(FontColorSettings.class);
        Map renderingHints = (Map) fcs.getFontColors(FontColorNames.DEFAULT_COLORING).getAttribute(EditorStyleConstants.RenderingHints);

        // Possibly apply the rendering hints
        if (renderingHints != null) {
            ((java.awt.Graphics2D)g).addRenderingHints(renderingHints);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:FoldingToolTip.java

示例15: fromAttributeSet

import org.netbeans.api.editor.settings.EditorStyleConstants; //导入依赖的package包/类
/**
 * Converts <code>AttributeSet</code> to a <code>Coloring</code>. This method
 * will extract any font related information as well as the 'well-known' colors
 * from the <code>AttributeSet</code> passed in and will use them for creating
 * a <code>Coloring</code> instance that will be returned.
 * 
 * <p>The list of supported colors:
 * <ul>
 * <li><code>StyleConstants.Foreground</code>
 * <li><code>StyleConstants.Background</code>
 * <li><code>StyleConstants.Underline</code>
 * <li><code>StyleConstants.StrikeThrough</code>
 * <li><code>EditorStyleConstants.WaveUnderlineColor</code>
 * </ul>
 * 
 * @param as The <code>AttributeSet</code> to convert.
 * 
 * @return <code>Coloring</code> that will contain font and color information
 * from the supplied <code>AttributeSet</code>.
 * @since 1.11
 */
public static Coloring fromAttributeSet(AttributeSet as) {
    synchronized (colorings) {
        Coloring coloring = colorings.get(as);

        if (coloring == null) {
            Object [] fontObj = toFont(as);
            Color foreColor = (Color) as.getAttribute(StyleConstants.Foreground);
            // Deal StrikeThrough to be either Boolean or Color
            Object strikeThrough = as.getAttribute(StyleConstants.StrikeThrough);
            if (strikeThrough instanceof Boolean) {
                strikeThrough = Boolean.TRUE.equals(strikeThrough)
                        ? foreColor
                        : null;
            }

            coloring = new Coloring(
                (Font) fontObj[0],
                ((Integer) fontObj[1]).intValue(),
                foreColor,
                (Color) as.getAttribute(StyleConstants.Background),
                (Color) as.getAttribute(StyleConstants.Underline),
                (Color) strikeThrough,
                (Color) as.getAttribute(EditorStyleConstants.WaveUnderlineColor),
                (Color) as.getAttribute(EditorStyleConstants.TopBorderLineColor),
                (Color) as.getAttribute(EditorStyleConstants.RightBorderLineColor),
                (Color) as.getAttribute(EditorStyleConstants.BottomBorderLineColor),
                (Color) as.getAttribute(EditorStyleConstants.LeftBorderLineColor)
            );

            colorings.put(as, coloring);
        }

        return coloring;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:Coloring.java


注:本文中的org.netbeans.api.editor.settings.EditorStyleConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。