Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

intellij idea - JavaFX source code not showing

I downloaded the JavaFx source code from http://hg.openjdk.java.net/openjfx/2.2/master/rt/summary.

The name of the folder in the zip file is re-e71070b0e0c0.

I unzipped this and added the folder under Project Structure - Global Libraries in Idea, however it doesn't work. When I try to open a class it just shows field names and /* compiled code */. I couldn't find anything in the manual.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Much of the information in this answer is now outdated.

More up-to-date information on using JavaFX with Java 11+ in IntelliJ Idea, is available at:

  • openjfx.io in the section titled: "JavaFX and IntelliJ".

Though, the above-linked article is more focused on using JavaFX in IntelliJ rather than viewing JavaFX library source code in IntelliJ.


These instructions are only necessary for the JavaFX 2.x branch and will be obsoleted once JDK 8 is released.

After you have downloaded the source zip and extracted it, open Idea and follow these instructions:

  1. Modify the source structure for your 1.7 SDK:

    File | Project Structure | SDKs | Sourcepath

For each sub-project in the extracted zip, type Alt+Insert and add the respective source directory. For example rt-e71070b0e0c0javafx-ui-chartssrc, rt-e71070b0e0c0javafx-ui-commonsrc, etc. Not all JavaFX 2.x source code is currently open sourced, so this will only add the open sourced portions.

  1. Set the documentation lookup path:

    File | Project Structure | SDKs | Documentation Paths

Specify a url Alt+S for the documentation: http://docs.oracle.com/javafx/2/api/

  1. In your JavaFX application source, place your cursor over a JavaFX class usage, for instance LineChart:

  2. Press Ctrl+B to open the source code file LineChart.java from your downloaded zip.

  3. Press Shift+F1 to open documentation on the LineChart in a browser.

  4. Press Ctrl+Q to get quick access to documentation from in the IDE.

Update Oct 16 2013

JDK 8 now includes JavaFX source files.

To tell Idea where JavaFX sources are:

  1. Modify the source structure for your 1.8 SDK:

    File | Project Structure | SDKs | Sourcepath

Press Alt+S to add the file javafx-src.zip, which is located in the root directory of the JDK 8 distribution.

  1. Set the documentation lookup path:

    File | Project Structure | SDKs | Documentation Paths

Specify a url Alt+S for the documentation: http://download.java.net/jdk8/jfxdocs.

The JDK 8 JavaFX documentation url will likely change when JDK 8 reaches General Availability release stage.

Step 3 above provides keyboard shortcuts to quickly access the JavaFX sources and documentation from your project.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...