因此,我今天想出了一个想法,让java程序在我的PC上运行,并定期检查系统时间。当我注意到季节(冬、秋、夏、春)发生了变化时,我会改变IDE的所有颜色(关键字、注释和背景),以适应季节的颜色。不幸的是,我找不到这些信息存储在文件中的位置。有没有人知道它可能在哪里,或者这是否有可能?谢谢!
发布于 2016-02-27 00:50:18
是的,这是可能的!
1.运行时选项
如果您想拥有“MetalLookAndFeel& fontsize 14”,请运行以下命令
netbeans --laf javax.swing.plaf.metal.MetalLookAndFeel --fontsize 14
您可以从这个链接Netbeans主题安装主题列表。您可以根据您的选择以编程方式启动不同的主题。
2.使用配置文件
这可以通过更新位于下面位置的netbeans.conf
文件${nb-install}/etc/netbeans.conf
来实现,以便执行如下操作:
C:\程序文件\NetBeans 8.1\etc\netbeans.conf
以编程方式使用所需的主题和字体大小更新conf文件。前任:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.notter=true-J-Dsun.java2d.dpi华=true-J-Dsun.zip.disableMemorymap=true“
您可以更新多个外观选项。
此外,还可以配置其他参数。这里列出的所有启动参数都是启动参数→
3.使用netbeans库
你可能对此更感兴趣。完整netbeans API netbeans Api对应的Jar文件→jar文件
`org.netbeans.api.editor.settings.FontColorSettings` will be used to change the font settings which include keywords, syntax, background, foreground etc.
一个供你参考的小例子
public void updateColors() {
EditorUI editorUI = Utilities.getEditorUI(textComponent);
if (editorUI == null) {
return;
}
String mimeType = NbEditorUtilities.getMimeType(textComponent);
FontColorSettings fontColorSettings = MimeLookup.getLookup(MimePath.get(mimeType)).lookup(FontColorSettings.class);
Coloring lineColoring = Coloring.fromAttributeSet(fontColorSettings.getFontColors(FontColorNames.LINE_NUMBER_COLORING));
Coloring defaultColoring = Coloring.fromAttributeSet(fontColorSettings.getFontColors(FontColorNames.DEFAULT_COLORING));
if (lineColoring == null) {
return;
}
// use the same color as GlyphGutter
final Color backColor = lineColoring.getBackColor();
// set to white by o.n.swing.plaf/src/org/netbeans/swing/plaf/aqua/AquaLFCustoms
if (org.openide.util.Utilities.isMac()) {
backgroundColor = backColor;
} else {
backgroundColor = UIManager.getColor("NbEditorGlyphGutter.background"); //NOI18N
}
if (null == backgroundColor) {
if (backColor != null) {
backgroundColor = backColor;
} else {
backgroundColor = defaultColoring.getBackColor();
}
}
}
https://stackoverflow.com/questions/35592494
复制相似问题