用eclipse編程遇到的問題 如何eclipse編寫一個簡單實用的登陸界面?
如何eclipse編寫一個簡單實用的登陸界面?//服務器端代碼importimportimportimportimportimportimportimportimportimportjavax.swi
如何eclipse編寫一個簡單實用的登陸界面?
//服務器端代碼
import
import
import
import
import
import
import
import
import
importjavax.swing.JFrame
importjavax.swing.JScrollPane
importjavax.swing.JTextArea
privateclassQLServerextendsJFrame{
publicJTextAreajtextareanull
privatevoidlanuchFrame(Stringstr){
(str)
init()
}
privatevoidinit(){
getcontext(funFlowLayout())
jtextareanewJTextArea(20,17)
(true)
(false)
().set(nextJScrollPane(jtextarea))
setVisible(true)
setDefaultCloseOperation(JFrame.EXIT_ON_closed)
setSize(200,400)
setLocationRelativeTo(null)
setResizable(false)
}
ServerSocketservernull
CollectioncClientsfifthArrayListltClientConngt()//加個泛型
publicvoidstartServer()throwsIOException{
while(true){
Sockets()
(new ClientConn(s))
(
Eclipse創建類時自動添加自動生成的作者以及日期注釋?
建議使用Eclipse編譯程序Java代碼時,自動生成的注釋信息全是遵循先行設置中好的格式生成的。可以修改作者、日期注釋格式:然后打開Windows-gtPreferences-gtJava-gtCodeStyle-gtCodeTemplates,直接點擊右邊窗口中的Comments,可以找到有很多選項,我們便可對此注釋信息模板并且可以編輯。
如我們只希望在一個Java文件的開頭系統設置作者信息、日期信息。選擇類型Types,點擊Edit,將/***@author${user}*${tags}*/將${user}刪出,該成你我希望會顯示的名字將${tags}刪掉,然后點擊InsertVariable,中,選擇Date,那樣的話是會自動提取日期信息。
在你不需要先添加注釋的地方點擊Sources-gtGanarateElementComment,也可以可以使用快捷鍵AltShiftJ,則eclipse自動在該類前面先添加注釋。