效果图如下

java.jpg

代码实现

\documentclass[11pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{listings}
\usepackage{color}
\definecolor{keywordcolor}{rgb}{0.8,0.1,0.5}
\definecolor{webgreen}{rgb}{0,.5,0}
\title{Progress Report 8}
\author{author}
\date{July 28th, 2008}
\begin{document}
\maketitle
\lstset{language=[AspectJ]Java,
basicstyle=\footnotesize,
keywordstyle=\color{keywordcolor}\bfseries, %\underbar,
identifierstyle=,
commentstyle=\color{blue} \textit,
stringstyle=\ttfamily,
showstringspaces=false,
captionpos=b
}
\section*{Prototype}
Advertiser class.
\begin{lstlisting}
public void addAdvertisement(String company, String ad_Category,
String ad_Type, String ad_Price)
{
int price = Integer.parseInt(ad_Price);
ad = new Advertisement(company, ad_Category, ad_Type, price);
adList.add(index, ad);
index++;
anDM = getDefaultDirectoryManager();
ActorTuple tuple = new ActorTuple(getActorName(), "advertiser",
company, ad_Category, ad_Type, price, index-1);
send(anDM, "register", tuple);
}
\end{lstlisting}
\end{document}

选自:http://hi.baidu.com/canada_2007/blog/item/8f6e32c2afa4003de4dd3b69.html

点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部