本文整理汇总了Java中org.netbeans.api.editor.settings.FontColorNames类的典型用法代码示例。如果您正苦于以下问题:Java FontColorNames类的具体用法?Java FontColorNames怎么用?Java FontColorNames使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FontColorNames类属于org.netbeans.api.editor.settings包,在下文中一共展示了FontColorNames类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColoring
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
private Coloring getColoring() {
if (attribs == null) {
if (fcsLookupResult == null) {
fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component))
.lookupResult(FontColorSettings.class);
fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
}
FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_BAR_COLORING);
specificAttrs = attr;
if (attr == null) {
attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
} else {
attr = AttributesUtilities.createComposite(
attr,
fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
}
attribs = attr;
}
return Coloring.fromAttributeSet(attribs);
}
示例2: getColoring
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
private Coloring getColoring() {
if (attribs == null) {
if (fcsLookupResult == null) {
fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(getComponent()))
.lookupResult(FontColorSettings.class);
fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
}
FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_COLORING);
if (attr == null) {
attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
} else {
attr = AttributesUtilities.createComposite(attr, fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
}
attribs = attr;
}
return Coloring.fromAttributeSet(attribs);
}
示例3: computeLineNumberDigitWidth
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
private int computeLineNumberDigitWidth(){
// Handle line number fonts and widths
Coloring dc = getDefaultColoring();
Coloring lnc = getCMInternal().get(FontColorNames.LINE_NUMBER_COLORING);
if (lnc != null) {
Font lnFont = lnc.getFont();
if (lnFont == null) {
lnFont = dc.getFont();
}
if (component == null) return lineNumberDigitWidth;
FontMetrics lnFM = FontMetricsCache.getFontMetrics(lnFont, component);
if (lnFM == null) return lineNumberDigitWidth;
int maxWidth = 1;
for (int i = 0; i <= 9; i++) {
maxWidth = Math.max(maxWidth, lnFM.charWidth((char)('0' + i)));
}
return maxWidth;
}
return lineNumberDigitWidth;
}
示例4: FoldingToolTip
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
/** Creates a new instance of FoldingToolTip */
public FoldingToolTip(View view, EditorUI editorUI) {
this.view = view;
this.editorUI = editorUI;
FontColorSettings fcs = MimeLookup.getLookup(
org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(
editorUI.getComponent())).lookup(FontColorSettings.class);
AttributeSet attribs = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
Color foreColor = (Color) attribs.getAttribute(StyleConstants.Foreground);
if (foreColor == null) {
foreColor = Color.black;
}
setBorder(new LineBorder(foreColor));
setOpaque(true);
}
示例5: getColoring
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
private Coloring getColoring() {
if (attribs == null) {
if (fcsLookupResult == null) {
fcsLookupResult = MimeLookup.getLookup(org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(component))
.lookupResult(FontColorSettings.class);
fcsLookupResult.addLookupListener(WeakListeners.create(LookupListener.class, fcsTracker, fcsLookupResult));
}
FontColorSettings fcs = fcsLookupResult.allInstances().iterator().next();
AttributeSet attr = fcs.getFontColors(FontColorNames.CODE_FOLDING_BAR_COLORING);
if (attr == null) {
attr = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
} else {
attr = AttributesUtilities.createComposite(attr, fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
}
attribs = attr;
}
return Coloring.fromAttributeSet(attribs);
}
示例6: AnnotationBar
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的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;
}
}
示例7: AnnotationBar
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的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
}
示例8: updateColors
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
private void updateColors(final FontColorSettings fcs) {
if (getParent() == null) {
return;
}
AttributeSet as = fcs.getFontColors(BRACES_COLORING);
if (as == null) {
as = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
this.backColor = (Color)as.getAttribute(StyleConstants.ColorConstants.Background);
} else {
this.backColor = (Color)as.getAttribute(StyleConstants.ColorConstants.Background);
as = AttributesUtilities.createComposite(
as,
fcs.getFontColors(FontColorNames.DEFAULT_COLORING));
}
this.coloring = Coloring.fromAttributeSet(as);
int w = 0;
if (coloring.getFont() != null) {
w = coloring.getFont().getSize();
} else if (baseUI != null) {
w = baseUI.getEditorUI().getLineNumberDigitWidth();
}
this.barWidth = Math.max(4, w / 2);
updatePreferredSize();
}
示例9: ComposedTextHighlighting
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
public ComposedTextHighlighting(JTextComponent component, Document document, String mimeType) {
// Prepare the highlight
FontColorSettings fcs = MimeLookup.getLookup(MimePath.parse(mimeType)).lookup(FontColorSettings.class);
AttributeSet dc = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
Color background = (Color) dc.getAttribute(StyleConstants.Background);
Color foreground = (Color) dc.getAttribute(StyleConstants.Foreground);
highlightInverse = AttributesUtilities.createImmutable(StyleConstants.Background, foreground, StyleConstants.Foreground, background);
highlightUnderlined = AttributesUtilities.createImmutable(StyleConstants.Underline, foreground);
// Create the highlights container
this.bag = new OffsetsBag(document);
this.bag.addHighlightsChangeListener(this);
// Start listening on the document
this.document = document;
this.document.addDocumentListener(WeakListeners.document(this, this.document));
this.component = component;
}
示例10: updateComponentProperties
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的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();
}
}
示例11: updateScrollPaneCornerColor
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
protected void updateScrollPaneCornerColor() {
Coloring lineColoring = getCMInternal().get(FontColorNames.LINE_NUMBER_COLORING);
Coloring defaultColoring = getDefaultColoring();
Color backgroundColor;
if (lineColoring != null && lineColoring.getBackColor() != null) {
backgroundColor = lineColoring.getBackColor();
} else {
backgroundColor = defaultColoring.getBackColor();
}
if (glyphCorner != null){
glyphCorner.setBackground(backgroundColor);
}
}
示例12: getTextLimitLineColor
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
Color getTextLimitLineColor() {
Coloring c = getCMInternal().get(FontColorNames.TEXT_LIMIT_LINE_COLORING);
if (c != null && c.getForeColor() != null) {
return c.getForeColor();
} else {
return new Color(255, 235, 235);
}
}
示例13: updateRenderingHints
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的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);
}
}
}
示例14: setText
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
public void setText(String cellName, String text, Coloring extraColoring, int importance) {
JLabel cell = getCellByName(cellName);
if (cell != null) {
cell.setText(text);
if (visible) {
JTextComponent jtc = editorUI.getComponent();
Coloring c = jtc != null ? getColoring(
org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(jtc),
FontColorNames.STATUS_BAR_COLORING
) : null;
if (c != null && extraColoring != null) {
c = extraColoring.apply(c);
} else if (c == null) {
c = extraColoring;
}
if (CELL_POSITION.equals(cellName)){
cell.setToolTipText(caretPositionLocaleString);
} else if (CELL_TYPING_MODE.equals(cellName)) {
cell.setToolTipText(insText.equals(text)? insertModeLocaleString : overwriteModeLocaleString);
} else {
cell.setToolTipText(text == null || text.length() == 0 ? null : text);
}
if (c != null && cell instanceof Cell) {
applyColoring((Cell) cell, c);
}
} else { // Status bar not visible => use global status bar if possible
JLabel globalCell = cellName2GlobalCell.get(cellName);
if (globalCell != null) {
if (CELL_MAIN.equals(cellName)) {
globalCell.putClientProperty("importance", importance);
}
globalCell.setText(text);
}
}
}
}
示例15: setBlockSearchHighlight
import org.netbeans.api.editor.settings.FontColorNames; //导入依赖的package包/类
public void setBlockSearchHighlight(int startSelection, int endSelection){
JTextComponent comp = getFocusedTextComponent();
BlockHighlighting layer = comp == null ? null : findLayer(comp, Factory.BLOCK_SEARCH_LAYER);
if (layer != null) {
if (startSelection >= 0 && endSelection >= 0 && startSelection < endSelection ) {
layer.highlightBlock(startSelection, endSelection, FontColorNames.BLOCK_SEARCH_COLORING, true, true);
} else {
layer.highlightBlock(-1, -1, FontColorNames.BLOCK_SEARCH_COLORING, true, true);
}
}
}