当前位置 : 首页 » 互动问答 » 正文

How can I change font size in Eclipse for Java text editors?

分类 : 互动问答 | 发布时间 : 2011-02-07 22:18:00 | 评论 : 16 | 浏览 : 496816 | 喜欢 : 390

I have just tried to change my font size in Eclipse 3.6.0 in the following way:

General → Appearance → Colors and Fonts → Java Editor text font

However, the font size only changed in the file I had open. How can I change the font size for all Java files and projects I open in Eclipse?

回答(16)

  • 1楼
  • If you are changing the font size, but it is only working for the currently open file, then I suspect that you are changing the wrong preferences.

    • On the Eclipse toolbar, select WindowPreferences
    • Set the font size, GeneralAppearanceColors and FontsJavaJava Editor Text Font).
    • Save the preferences.

    Check that you do not have per-project preferences. These will override the top-level preferences.

    Eclipse v4.2 (Juno) note

    Per comment below, this has moved to the Eclipse Preferences menu (no longer named the Window menu).

    Eclipse v4.3 (Kepler) note

    The Window menu is live again, that is, menu WindowPreferences.

    Note Be sure to check out the ChandraBhan Singh's answer, it shows the key bindings to change the font size.

  • 2楼
  • On Mac:

    1. Eclipse toolbar Eclipse → Preferences OR Command + , (comma)

    2. GeneralAppearanceColors and FontsBasicText Font

    3. Apply

  • 3楼
  • This worked for me:

    1. On the Eclipse toolbar, select WindowPreferences.

    2. Set the font size (GeneralAppearanceColors and FontsBasicText Font):

      Enter image description here

    3. Save the preferences.

  • 4楼
  • For Eclipse Neon

    To Increase Ctrl +

    To reduce Ctrl -

    shortcut for font eclipse

  • 5楼
  • General → Appearance → Colors and Fonts → Java Editor text font
    

    See the image:

    enter image description here

  • 6楼
  • The Eclipse-Fonts extension will add toolbar buttons and keyboard shortcuts for changing font size. You can then use AutoHotkey to make Ctrl + mousewheel zoom.

    Under menu HelpInstall New Software... in the menu, paste the update URL (http://eclipse-fonts.googlecode.com/svn/trunk/FontsUpdate/) into the Works with: text box and press Enter. Expand the tree and select FontsFeature as in the following image:

    Eclipse extension installation screen capture

    Complete the installation and restart Eclipse. Then you should see the A toolbar buttons (circled in red in the following image) and be able to use the keyboard shortcuts Ctrl + - and Ctrl + = to zoom (although you may have to unbind those keys from Eclipse first).

    Eclipse screen capture with the font size toolbar buttons circled

    To get Ctrl + mouse wheel zooming, you can use AutoHotkey with the following script:

    ; Ctrl + mouse wheel zooming in Eclipse.
    ; Requires Eclipse-Fonts (https://code.google.com/p/eclipse-fonts/).
    ; Thank you for the unique window class, SWT/Eclipse.
    ;
    #IfWinActive ahk_class SWT_Window0
        ^WheelUp:: Send ^{=}
        ^WheelDown:: Send ^-
    #IfWinActive
    
  • 7楼
  • Enter image description here

    Menu WindowPreferences. GeneralAppearanceColors and FontsBasicText Font

  • 8楼
  • You can have a look at Eclipse color theme, also which has a hell of a lot of options for customizing font, background color, etc.

  • 9楼
    1. On the menu bar, select WindowPreferences
    2. Set the font size (GeneralAppearanceColors and FontsStructured Text EditorsStructured Text Editor Text Font (set to default: Text Font)Edit...).
    3. Save the preferences.
  • 10楼
  • If you are using windows then try with CTRL,SHIFT,+ and for decreasing font size you can use CTRL,SHIFT,-

  • 11楼
  • On the Eclipse toolbar, select WindowPreferences, set the font size (GeneralAppearanceColors and FontsBasicText Font).

    Save the preferences.

  • 12楼
  • Running Eclipse v4.3 (Kepler), the steps outlined by AlvaroCachoperro do the trick for the Java text editor and console window text.

    Many of the text font options, including the Java Editor Text Font note, are "set to default: Text Font". The 'default' can be found and configured as follows:

    On the Eclipse toolbar, select WindowPreferences. Drill down to: (GeneralAppearanceColors and FontsBasicText Font) (at the bottom)

    • Click Edit and select the font, style and size
    • Click OK in the Font dialog
    • Click Apply in the Preferences dialog to check it
    • Click OK in the Preferences dialog to save it

    Eclipse will remember your settings for your current workspace.

    I teach programming and use the larger font for the students in the back.

  • 13楼
  • I tend to use menu WindowsPreferencesGeneralAppearancesColors and FontsJava Text EditorsChangeApply.

  • 15楼
  • You can use

    ctrl and + or - key

  • 16楼
  • If you are using STS, then goto STS/Contents/Eclipse directory and open the STS.ini file.

    From the STS.ini file, remove the flooring line:

    -Dorg.eclipse.swt.internal.carbon.smallFonts
    

    And restart the STS.

相关阅读:

How to convert Set<String> to String[]?

Converting a date string to a DateTime object using Joda Time library

Java reading a file into an ArrayList?

How to clear console in Java - Eclipse SDK

How many spaces will Java String.trim() remove?

How to print all key and values from HashMap in Android?

With android studio no jvm found, JAVA_HOME has been set

String isNullOrEmpty in Java?

Cannot run Eclipse; JVM terminated. Exit code=13

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path