eclipse的导代码配置、快捷键、出项出源项目导入导出、目源码常见的导代码插件或代码生成器工具
欢迎来到一乐乐的博客园,本文将详细介绍eclipse的出项出源配置、快捷键、目源码项目导入导出以及常用的导代码xwalk 源码插件和代码生成器工具。一、出项出源常规配置
1. 配置环境变量
2. 调整字体大小
3. 设置工作空间默认编码为UTF-8
4. 显示代码行号:便于代码阅读
5. 代码提示增强:如快捷键 'Alt+/' 用于代码提示
二、目源码常用快捷键
代码提示:'Alt+/'
打印:'sout' + 回车键
注释:'/**' + 回车键
自动导入包:'Ctrl+Shift+O'
错误修复:'Ctrl+1'
代码格式化:'Ctrl+Shift+F'
查看源码:'Alt+Left' 和 'Alt+Right' 移动光标
竖直选择代码:'Alt+Shift+A'
代码跳转:'Ctrl+T'
三、项目操作
1. 导入项目:按照eclipse的主题源码导入功能进行
2. 导出项目:同样利用eclipse内置的导出功能
四、插件与工具
1. Tomcat热部署插件:在线安装,搜索Eclipse Marketplace
2. Web开发插件:同样在Marketplace搜索
3. Mybatis框架:mybatipse插件,通过Java代码或Maven插件运行Generator
4. Spring框架:sts插件
5. 自动代码生成器:Lombok,非通过Marketplace,easyops源码需通过cmd安装
以上内容来自一乐乐的博客园,如需使用,请务必注明出处。myeclipseå¦ä½è®¾ç½®utf-8
myeclipseä¸UTF-8设置
myeclipseä¸UTF-8设置
å¦æè¦ä½¿æ件å¼ååºç¨è½ææ´å¥½çå½é åæ¯æï¼è½å¤æ大ç¨åº¦çæ¯æä¸æè¾åºï¼åæ好使 Javaæ件使ç¨UTF-8ç¼ç ãç¶èï¼Eclipseå·¥ä½ç©ºé´(workspace)ç缺çå符ç¼ç æ¯æä½ç³»ç»ç¼ºççç¼ç ï¼ç®ä½ä¸ææä½ç³»ç» (Windows XPãWindows ç®ä½ä¸æ)ç缺çç¼ç æ¯GBï¼å¨æ¤å·¥ä½ç©ºé´ä¸å»ºç«çå·¥ç¨ç¼ç æ¯GBï¼å·¥ç¨ä¸å»ºç«çjavaæ件ä¹æ¯GBãå¦æè¦ä½¿ æ°å»ºç«å·¥ç¨ãjavaæ件ç´æ¥ä½¿UTF-8åéè¦å以ä¸å·¥ä½ï¼
1ãwindows->Preferences...æå¼"é¦é项"对è¯æ¡ï¼å·¦ä¾§å¯¼èªæ ï¼å¯¼èªå°general->Workspaceï¼å³ 侧Text file encodingï¼éæ©Otherï¼æ¹å为UTF-8ï¼ä»¥åæ°å»ºç«å·¥ç¨å ¶å±æ§å¯¹è¯æ¡ä¸çText file encodingå³ä¸ºUTF-8ã
2ãwindows->Preferences...æå¼"é¦é项"对è¯æ¡ï¼å·¦ä¾§å¯¼èªæ ï¼å¯¼èªå°general->Content Typesï¼å³ä¾§Context Typesæ ï¼ç¹å¼Textï¼éæ©Java Source Fileï¼å¨ä¸é¢çDefault encodingè¾å ¥æ¡ä¸è¾å ¥UTF-8ï¼ç¹Updateï¼å设置Javaæ件ç¼ç 为UTF-8ãå ¶ä»javaåºç¨å¼åç¸å ³çæ件 å¦ï¼propertiesãXMLçå·²ç»ç±Eclipse缺çæå®ï¼åå«ä¸ºISO-1ï¼UTF-8ï¼å¦å¼åä¸ç¡®éæ¹åç¼ç æ ¼å¼åå¯ä»¥å¨æ¤æå®ã
3ãç»è¿ä¸è¿°ä¸¤æ¥ï¼æ°å»ºjavaæ件å³ä¸ºUTF-8ç¼ç ï¼Eclipseç¼è¯ãè¿è¡ãè°è¯é½æ²¡é®é¢ï¼ä½æ¯åRCPåºç¨çProductè¾åºæ¶ãæè æ件 è¾åºæ¶ï¼åæ»æ¯åºéï¼è¦ä¹ä¸è½ç¼è¯éè¿(è¾åºæ¶è¦éæ°compile)ãè¦ä¹è¾åºçæ件è¿è¡æ¶ä¸ææ¾ç¤ºä¹±ç ãæ¤æ¶éè¦åRCPåºç¨ãææ件Pluginå·¥ ç¨çbuild.propertiesä¸å¢å ä¸è¡ï¼javacDefaultEncoding.. = UTF-8ã让è¾åºæ¶ç¼è¯ç¥éjavaæºæ件æ¶UTF-8ç¼ç ãè¿ä¸ªè®¾ç½®éè¦ä¿è¯ææçjavaæºæ件æ¶UTF-8ç¼ç æ ¼å¼ï¼å¦æä¸å ¨æ¯ï¼å¯ä»¥åè Eclipse帮ä¸(Plug-in Development Environment Guide > Reference > Feature and Plug-in Build configuration)ï¼å»ºè®®å ¨é¨javaæºæ件æ¯UTF-8ç¼ç ã
å¦ææ件å¼åãRCPåºç¨å¼ååæ¥åºäºå ¶ä»ç¼ç ï¼å¦GBï¼æ³è½¬æ¢ä¸ºUTF-8ï¼åé¦å ï¼å以ä¸å·¥ä½ï¼ç¶åéè¿æ¥æ¾ç¼ç 转æ¢å·¥å ·ï¼å¦åºäº iconvçæ¹é转æ¢å·¥å ·ï¼å°åç¼ç 转æ¢ä¸ºUTF-8ç¼ç ï¼æ³¨æåªè½¬æ¢javaæºæ件ï¼å ¶ä»ç±»åæ件å¯è½å·²ç»æ¯æ¯è¾åéçç¼ç äºï¼å°åå·¥ç¨å±æ§ä¸ç Text file encodingï¼ä»åç¼ç æ¹ä¸ºUTF-8å³å¯ã
急需基于eclipse的JAVA小游戏源代码!!!
单人版五子棋,不用导入,直接新建一个mywindow类就行,然后把一下代码粘贴就Ok了。或者,直接用dos就可以了。。
---------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class mypanel extends Panel implements MouseListener
{
int chess[][] = new int[][];
boolean Is_Black_True;
mypanel()
{
Is_Black_True = true;
for(int i = 0;i < ;i++)
{
for(int j = 0;j < ;j++)
{
chess[i][j] = 0;
}
}
addMouseListener(this);
setBackground(Color.BLUE);
setBounds(0, 0, , );
setVisible(true);
}
public void mousePressed(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
if(x < || x > + ||y < || y > +)
{
return;
}
if(chess[x/-1][y/-1] != 0)
{
return;
}
if(Is_Black_True == true)
{
chess[x/-1][y/-1] = 1;
Is_Black_True = false;
repaint();
Justisewiner();
return;
}
if(Is_Black_True == false)
{
chess[x/-1][y/-1] = 2;
Is_Black_True = true;
repaint();
Justisewiner();
return;
}
}
void Drawline(Graphics g)
{
for(int i = ;i <= ;i += )
{
for(int j = ;j <= ; j+= )
{
g.setColor(Color.WHITE);
g.drawLine(i, j, i, );
}
}
for(int j = ;j <= ;j += )
{
g.setColor(Color.WHITE);
g.drawLine(, j, , j);
}
}
void Drawchess(Graphics g)
{
for(int i = 0;i < ;i++)
{
for(int j = 0;j < ;j++)
{
if(chess[i][j] == 1)
{
g.setColor(Color.BLACK);
g.fillOval((i + 1) * - 8, (j + 1) * - 8, , );
}
if(chess[i][j] == 2)
{
g.setColor(Color.WHITE);
g.fillOval((i + 1) * - 8, (j + 1) * - 8, , );
}
}
}
}
void Justisewiner()
{
int black_count = 0;
int white_count = 0;
int i = 0;
for(i = 0;i < ;i++)//横向判断
{
for(int j = 0;j < ;j++)
{
if(chess[i][j] == 1)
{
black_count++;
if(black_count == 5)
{
JOptionPane.showMessageDialog(this, "黑棋胜利");
Clear_Chess();
return;
}
}
else
{
black_count = 0;
}
if(chess[i][j] == 2)
{
white_count++;
if(white_count == 5)
{
JOptionPane.showMessageDialog(this, "白棋胜利");
Clear_Chess();
return;
}
}
else
{
white_count = 0;
}
}
}
for(i = 0;i < ;i++)//竖向判断
{
for(int j = 0;j < ;j++)
{
if(chess[j][i] == 1)
{
black_count++;
if(black_count == 5)
{
JOptionPane.showMessageDialog(this, "黑棋胜利");
Clear_Chess();
return;
}
}
else
{
black_count = 0;
}
if(chess[j][i] == 2)
{
white_count++;
if(white_count == 5)
{
JOptionPane.showMessageDialog(this, "白棋胜利");
Clear_Chess();
return;
}
}
else
{
white_count = 0;
}
}
}
for(i = 0;i < 7;i++)//左向右斜判断
{
for(int j = 0;j < 7;j++)
{
for(int k = 0;k < 5;k++)
{
if(chess[i + k][j + k] == 1)
{
black_count++;
if(black_count == 5)
{
JOptionPane.showMessageDialog(this, "黑棋胜利");
Clear_Chess();
return;
}
}
else
{
black_count = 0;
}
if(chess[i + k][j + k] == 2)
{
white_count++;
if(white_count == 5)
{
JOptionPane.showMessageDialog(this, "白棋胜利");
Clear_Chess();
return;
}
}
else
{
white_count = 0;
}
}
}
}
for(i = 4;i < ;i++)//右向左斜判断
{
for(int j = 6;j >= 0;j--)
{
for(int k = 0;k < 5;k++)
{
if(chess[i - k][j + k] == 1)
{
black_count++;
if(black_count == 5)
{
JOptionPane.showMessageDialog(this, "黑棋胜利");
Clear_Chess();
return;
}
}
else
{
black_count = 0;
}
if(chess[i - k][j + k] == 2)
{
white_count++;
if(white_count == 5)
{
JOptionPane.showMessageDialog(this, "白棋胜利");
Clear_Chess();
return;
}
}
else
{
white_count = 0;
}
}
}
}
}
void Clear_Chess()
{
for(int i=0;i<;i++)
{
for(int j=0;j<;j++)
{
chess[i][j]=0;
}
}
repaint();
}
public void paint(Graphics g)
{
Drawline(g);
Drawchess(g);
}
public void mouseExited(MouseEvent e){ }
public void mouseEntered(MouseEvent e){ }
public void mouseReleased(MouseEvent e){ }
public void mouseClicked(MouseEvent e){ }
}
class myframe extends Frame implements WindowListener
{
mypanel panel;
myframe()
{
setLayout(null);
panel = new mypanel();
add(panel);
panel.setBounds(0,, , );
setTitle("单人版五子棋");
setBounds(, , , );
setVisible(true);
addWindowListener(this);
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowDeactivated(WindowEvent e){ }
public void windowActivated(WindowEvent e){ }
public void windowOpened(WindowEvent e){ }
public void windowClosed(WindowEvent e){ }
public void windowIconified(WindowEvent e){ }
public void windowDeiconified(WindowEvent e){ }
}
public class mywindow
{
public static void main(String argc [])
{
myframe f = new myframe();
}
}
My eclipse
Eclipse æ¯ä¸ä¸ªIDEï¼Integrated Developing Environmentï¼ï¼èè¿ä¸ªIDEæ¯å 许å®è£ 第ä¸æ¹å¼åçæ件æ¥ä½¿èªèº«çåè½å¾å°æ©å±åå¢å¼ºçï¼èMyeclipseå°±æ¯å ¶ä¸çä¸ç§æåçæ件éä¹ä¸ï¼MyEclipseå°å¼åè 常ç¨å°çä¸äºæç¨çæ件é½éåèµ·æ¥ï¼ä½å®æ¯æ¶è´¹çã
Eclipseæ¯ä¸ä¸ªå¼æ¾æºä»£ç ,åºäºJavaçå¯æ©å¼ çå¼åå¹³å°ï¼å¤æ°äººé½æ¯å°Eclipseä½ä¸ºJavaçéæå¼åç¯å¢ä½¿ç¨ï¼è½ç¶Eclipse使ç¨Javaå¼åï¼ä½Eclipseä¸ä» ä» å±éäºJavaå¼åï¼è¿å¯ç¨äºå ¶å®è¯è¨çå¼åï¼å¦C/C++;
Eclipseæ¯ä¸ä¸ªæ¡æ¶åä¸ç»æå¡ï¼å®éè¿åç§æ件æ¥æ建å¼åç¯å¢ï¼å æ¤åªè¦æä¾æ¯æC/C++ æ件便è½è¿è¡ç¸åºè¯è¨çå¼åï¼</DIV>
Eclipseææ©æ¯ç±IBMå¼åçï¼åæ¥IBMå°Eclipseä½ä¸ºä¸ä¸ªå¼åæºä»£ç ç项ç®ï¼ç®ç»äºå¼æºç»ç»Eclipse.orgä½ä»ç±IBMçåå ¬å¸OTIï¼ä¸»è¦ä»äºEclipseå¼åç人åï¼ç»§ç»Eclipseçå¼å.
MyEclipse为Eclipseæä¾äºä¸ä¸ªå¤§éç§æåå¼æºçJavaå·¥å ·çéåï¼è¿è§£å³äºåç§å¼æºå·¥å ·çä¸ä¸è´å缺ç¹ãNitroXæ¯ä¸ä¸ªç¹æè强大çå éJava Webåºç¨å¼åçå·¥å ·ï¼è¿å å«äºä¸ä¸ªå¼ºå¤§ä¸è½å¤ç¼è¯ææJSPåStruts Webåºç¨çå·¥å ·AppXRayãè¿äºå·¥å ·è§£æJavaåXMLé ç½®æ件.
MyEclipseçå®é ä»·å¼æ¥èªå å«çåå¸å ä¸ç大éçå·¥å ·ãå¦CCS/JS/HTML/XMLçç¼è¾å¨ï¼å¸®å©å建EJBåStruts项ç®çå导并产ç项ç®çææ主è¦çç»ä»¶å¦action/session bean/formçãè¿å å«ç¼è¾Hibernateé ç½®æ件åæ§è¡SQLè¯å¥çå·¥å ·ã
2024-12-24 01:06
2024-12-24 00:57
2024-12-23 23:41
2024-12-23 23:40
2024-12-23 23:29