How can I remove the black lines above and below the code here:
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{orange}{RGB}{255,127,0}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=left, %eller none
numberstyle=\tiny\color{codegray},
keywordstyle=\color{mauve},
commentstyle=\color{gray},
stringstyle=\color{orange},
breaklines=false,
breakatwhitespace=true,
tabsize=3,
backgroundcolor=\color{backcolour},
}
\begin{document}
{\setlength{\parindent}{0cm}
\begin{lstlisting}
// some comment
import javax.swing.JApplet;
import java.awt.Graphics;
public class Hello extends JApplet {
public void paintComponent(Graphics g) {
g.drawString("Hello, world!", 65, 95);
}
}
\end{lstlisting}
}
\end{document}
Best Answer
Answering my own question:
I found the cause of the lines on the bottom and the top of the code. Its
frame=tb
. This should be changed toframe=none
.