| 1 |
%% LaTeX2e file `tmp-gen-java-program.tex' |
| 2 |
%% generated by the `filecontents' environment |
| 3 |
%% from source `codeanatomy.lstlisting' on 2025/10/19. |
| 4 |
%% |
| 5 |
\lstset{escapeinside={!}{!}} |
| 6 |
\begin{lrbox}{\mycodebox} |
| 7 |
\begin{lstlisting} |
| 8 |
public !\iPart{class}{class}! !\cPart{className}{HelloWorld}! |
| 9 |
{ |
| 10 |
!\mtPoint{mainLeft}!public static void main(String[] argv) |
| 11 |
{ |
| 12 |
!\hmtPoint{left}\iPart{assign}{ |
| 13 |
\bgcode{// Prints "Hello World" in the terminal window}} |
| 14 |
\extremPoint{fnR} \extremPoint{mR}! |
| 15 |
!\iPart{fnCall}{System.out.print("Hello World");}\dmbPoint{mostBottom}! |
| 16 |
}!\mbPoint{mainBottom}! |
| 17 |
} |
| 18 |
\end{lstlisting} |
| 19 |
\end{lrbox} |
| 20 |
|
| 21 |
\begin{tikzpicture}[remember picture] |
| 22 |
\node(code) [anatomy] at (0,0){\usebox\mycodebox}; |
| 23 |
|
| 24 |
\fitExtrem{classBody}{(mainLeft) (mR) (mainBottom)} |
| 25 |
\fitExtrem{functionBody}{(left) (fnR) (mostBottom)} |
| 26 |
|
| 27 |
\codeAnnotation{fileNameText} (1.5,5) {text file named \texttt{HelloWorld.java}} |
| 28 |
\codeAnnotation{classNameText} (3.5,4.25) {name} |
| 29 |
\codeAnnotation{classBodyText} (6.5,3.6) {\texttt{main()} method} |
| 30 |
\codeAnnotation{functionBodyText} (2.5,-0.5) {body} |
| 31 |
\codeAnnotation{statement} (8,0) {statements} |
| 32 |
|
| 33 |
{[on background layer] |
| 34 |
\draw[->,annotation] (fileNameText) -- (class); |
| 35 |
\draw[->,annotation] (classNameText) -- (className); |
| 36 |
\draw[->,annotation] (classBodyText.south west) -- (classBody); |
| 37 |
\draw[->,annotation] (functionBodyText) -- (functionBody); |
| 38 |
\draw[->,annotation] (statement) -- (assign.353); |
| 39 |
\draw[->,annotation] (statement) -- (fnCall.350); |
| 40 |
} |
| 41 |
\end{tikzpicture} |