是否可以将java源代码导入Jlst?请告诉我如何,如果可能的话,我会欣赏一个例子。感谢
答案 0 :(得分:1)
我不是我明白你要做什么,但是你不能逐行将你的源文件加载到一个集合中(在BufferedReader.readLine()周围使用FileReader),然后创建适当的ListModel?
我怀疑TextArea可能更适合代码。
答案 1 :(得分:1)
我认为您不想将其导入JList。在JTextArea或JEditorPane中更好地呈现文本。您可以在这里阅读更多相关信息 http://java.sun.com/docs/books/tutorial/uiswing/components/textarea.html http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html