java问题,处理文件关于java注释模板的问题,大神帮帮忙,急!!!

您现在正在浏览:
java网站,有关jdbc连接池的问题报错,紧急,请大神指点!!!解决不了又要被老板骂了.
发布时间:
04:45:02 &
浏览次数:
java网站,关于jdbc连接池的问题报错,紧急,请大神指点!!!解决不了又要被老板骂了。
[align=center]项目启动后按F5一直刷新网站主页,
1.刚开始刷新后异常的信息为:java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
2.刷新一段时候后异常的信息为:java.sql.SQLException: Couldn&t get connection because we are at maximum connection count (200/200) and there are none
3.最后报内存溢出异常。[/align]
代码我检查了没问题,pst,rs,conn该关闭的都关闭了,访问主页的19个查询方法也是平级的概念。
@RequestMapping(value = { &indexInfo& }, method = { RequestMethod.GET,
RequestMethod.POST })
public ModelAndView indexInfo(HttpServletRequest request,
HttpServletResponse response, HttpSession session, ModelMap modelMap)
throws Exception {
List&Map&String, Object&& maps = browseByPicNewsType(7);
StringBuffer sb = new StringBuffer();
StringBuffer sb1 = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
for (Map&String, Object& map : maps) {
sb.append(&../&);
sb.append(map.get(&IMAGEPATH&));
sb.append(&|&);
sb1.append(&../news_pic/picInfo.doid=&);
sb1.append(map.get(&ID&));
sb1.append(&|&);
sb2.append(map.get(&TITLE&));
sb2.append(&|&);
}
modelMap.put(&news_pic_imgpath&, sb.substring(0, sb.length() - 1));
modelMap.put(&news_pic_url&, sb1.substring(0, sb1.length() - 1));
modelMap.put(&news_pic_title&, sb2.substring(0, sb2.length() - 1));
objList = new ArrayList();
HashMap optionMap = new HashMap();
optionMap.put(&value&, &content&);
optionMap.put(&text&, &文章&);
objList.add(optionMap);
optionMap = new HashMap();
optionMap.put(&value&, &pics&);
optionMap.put(&text&, &图片&);
objList.add(optionMap);
// 经信动态
List&Map&String, Object&& jingxindongtai = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=9 order by createdate desc limit 0,9&);
modelMap.put(&jingxindongtai&, jingxindongtai);
// 领导讲话
List&Map&String, Object&& lingdaojianghua = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=4 order by createdate desc limit 0,10&);
modelMap.put(&lingdaojianghua&, lingdaojianghua);
// 政策文件
List&Map&String, Object&& zhengcewenjian = getAdminS&p&[NextPage][/NextPage]&/p&ervice()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=10 order by createdate desc limit 0,10&);
modelMap.put(&zhengcewenjian&, zhengcewenjian);
// 机关党建
List&Map&String, Object&& jiguandangjian = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=37 order by createdate desc limit 0,10&);
modelMap.put(&jiguandangjian&, jiguandangjian);
// 县区工作
List&Map&String, Object&& xianqugongzuo = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=40 order by createdate desc limit 0,10&);
modelMap.put(&xianqugongzuo&, xianqugongzuo);
// 综合信息
List&Map&String, Object&& zonghexinxi = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=2 order by createdate desc limit 0,10&);
modelMap.put(&zonghexinxi&, zonghexinxi);
// 经信知识
List&Map&String, Object&& jingxinzhishi = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=64 order by createdate desc limit 0,10&);
modelMap.put(&jingxinzhishi&, jingxinzhishi);
// 政策法规
List&Map&String, Object&& zhengcefagui = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=3 order by createdate desc limit 0,10&);
modelMap.put(&zhengcefagui&, zhengcefagui);
// 政策法规 国资委
List&Map&String, Object&& zhengcefaguigzw = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=160 order by createdate desc limit 0,15&);
modelMap.put(&zhengcefaguigzw&, zhengcefaguigzw);
// 国资动态
List&Map&String, Object&& guozidongtai = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=22 order by createdate desc limit 0,10&);
modelMap.put(&guozidongtai&, guozidongtai);
// 国资动态 国资委
List&Map&String, Object&& guozidongtaigzw = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=161 order by createdate desc limit 0,15&);
modelMap.put(&guozidongtaigzw&, guozidongt&p&[NextPage][/NextPage]&/p&aigzw);
// 通知公告
List&Map&String, Object&& tongzhigonggao = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=6 order by createdate desc limit 0,10&);
modelMap.put(&tongzhigonggao&, tongzhigonggao);
// 企业资讯
List&Map&String, Object&& qiyezixun = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=16 order by createdate desc limit 0,10&);
modelMap.put(&qiyezixun&, qiyezixun);
// 企业动态
List&Map&String, Object&& qiyedongtai = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=17 order by createdate desc limit 0,10&);
modelMap.put(&qiyedongtai&, qiyedongtai);
// 重点工程
List&Map&String, Object&& zhongdiangongcheng = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=18 order by createdate desc limit 0,10&);
modelMap.put(&zhongdiangongcheng&, zhongdiangongcheng);
List&Map&String, Object&& rows = getAdminService()
.select(
& jxw_renwu&,
&Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront&,
&type=0 order by createdate&);
// 经信人物
modelMap.put(&renwu&, rows);
List&Map&String, Object&& rowss = getAdminService()
.select(
& jxw_renwu&,
&Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront&,
&type=1 order by createdate&);
// 经信企业
modelMap.put(&qiye&, rowss);
List&Map&String, Object&& zhuanti = getAdminService()
.select(
& jxw_renwu&,
&Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront&,
&type=2 order by createdate&);
modelMap.put(&zhuanti&, zhuanti);
List&Map&String, Object&& images = getAdminService()
.select(
& jxw_picnews&,
&ID,title,newType,browseImage,imgurl,sortnum,content,createDate,userName,infoSource&,
&browseImage=1 order by sortnum limit 0,5&);// sortnum
// asc
modelMap.put(&images&, images);
modelMap.put(&selectOption&, objList);
return new ModelAndView(&index2.jsp&, modelMap);
}
连接池配置proxool.xml:
&xml version=&1.0& encoding=&UTF-8&&
&!--
the proxool configuration can be embedded within your own
application&s. Anything outside the &proxool& tag is i&p&[NextPage][/NextPage]&/p&gnored.
--&
&something-else-entirely&
&proxool&
&alias&jxw_db&/alias&
&driver-url&jdbc:mysql://192.168.1.111:3306/jxw&/driver-url&
&driver-class&com.mysql.jdbc.Driver&/driver-class&
&driver-properties&
&property name=&user& value=&root& /&
&property name=&password& value=&rocan2012& /&
&/driver-properties&
&simultaneousBuildThrottle&69&/simultaneousBuildThrottle&
&minimum-connection-count&20&/minimum-connection-count&
&maximum-connection-count&200&/maximum-connection-count&
&house-keeping-test-sql&select 0&/house-keeping-test-sql&
&trace&true&/trace&
&/proxool&
&/something-else-entirely&
javajdbc内存溢出异常exception回答1:[align=center]项目启动后按F5一直刷新网站主页,
1.刚开始刷新后异常的信息为:java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
2.刷新一段时候后异常的信息为:java.sql.SQLException: Couldn&t get connection because we are at maximum connection count (200/200) and there are none
3.最后报内存溢出异常。[/align]
代码我检查了没问题,pst,rs,conn该关闭的都关闭了,访问主页的19个查询方法也是平级的概念。
@RequestMapping(value = { &indexInfo& }, method = { RequestMethod.GET,
RequestMethod.POST })
public ModelAndView indexInfo(HttpServletRequest request,
HttpServletResponse response, HttpSession session, ModelMap modelMap)
throws Exception {
List&Map&String, Object&& maps = browseByPicNewsType(7);
StringBuffer sb = new StringBuffer();
StringBuffer sb1 = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
for (Map&String, Object& map : maps) {
sb.append(&../&);
sb.append(map.get(&IMAGEPATH&));
sb.append(&|&);
sb1.append(&../news_pic/picInfo.doid=&);
sb1.append(map.get(&ID&));
sb1.append(&|&);
sb2.append(map.get(&TITLE&));
sb2.append(&|&);
}
modelMap.put(&news_pic_imgpath&, sb.substring(0, sb.length() - 1));
modelMap.put(&news_pic_url&, sb1.substring(0, sb1.length() - 1));
modelMap.put(&news_pic_title&, sb2.substring(0, sb2.length() - 1));
objList = new ArrayList();
HashMap optionMap = new HashMap();
optionMap.put(&value&, &content&);
optionMap.put(&text&, &文章&);
objList.add(optionMap);
optionMap = new HashMap();
optionMap.put(&value&, &pics&);
optionMap.put(&text&, &图片&);
objList.add(optionMap);
// 经信动态
List&Map&String, Object&& jingxindongtai = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=9 order by createdate desc limit 0,9&);
modelMap.put(&jingxindongtai&, jingxindongtai);
// 领导讲话
List&Map&String, Object&& lingdaojianghua = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=4 order by createdate desc limit 0,10&);
modelMap.put(&lingdaojianghua&, lingdaojianghua);
// 政策文件
List&Map&String, Object&& zhengcewenjian = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=10 order by createdate desc limit 0,10&);
modelMap.put(&zhengcewenjian&, zhengcewenjian);
// 机关党建
List&Map&String, Object&& jiguandangjian = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=37 order by createdate desc limit 0,10&);
modelMap.put(&jiguandangjian&, jiguandangjian);
// 县区工作
List&Map&String, Object&& xianqugongzuo = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=40 order by createdate desc limit 0,10&);
modelMap.put(&xianqugongzuo&, xianqugongzuo);
// 综合信息
List&Map&String, Object&& zonghexinxi = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=2 order by createdate desc limit 0,10&);
modelMap.put(&zonghexinxi&, zonghexinxi);
// 经信知识
List&Map&String, Object&& jingxinzhishi = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=64 order by createdate desc limit 0,10&);
modelMap.put(&jingxinzhishi&, jingxinzhishi);
// 政策法规
List&Map&String, Object&& zhengcefagui = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=3 order by createdate desc limit 0,10&);
modelMap.put(&zhengcefagui&, zhengcefagui);
// 政策法规 国资委
List&Map&String, Object&& zhengcefaguigzw = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=160 order by createdate desc limit 0,15&);
modelMap.put(&zhengcefaguigzw&, zhengcefaguigzw);
// 国资动态
List&Map&String, Object&& guozidongtai = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=22 order by createdate desc limit 0,10&);
modelMap.put(&guozidongtai&, guozidongtai);
// 国资动态 国资委
List&Map&String, Object&& guozidongtaigzw = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=161 order by createdate desc limit 0,15&);
modelMap.put(&guozidongtaigzw&, guozidongtaigzw);
// 通知公告
List&Map&String, Object&& tongzhigonggao = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=6 order by createdate desc limit 0,10&);
modelMap.put(&tongzhigonggao&, tongzhigonggao);
// 企业资讯
List&Map&String, Object&& qiyezixun = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=16 order by createdate desc limit 0,10&);
modelMap.put(&qiyezixun&, qiyezixun);
// 企业动态
List&Map&String, Object&& qiyedongtai = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=17 order by createdate desc limit 0,10&);
modelMap.put(&qiyedongtai&, qiyedongtai);
// 重点工程
List&Map&String, Object&& zhongdiangongcheng = getAdminService()
.select(
& jxw_news&,
&Id, title, content,newType,userName,hints, issueDate,createdate&,
&newType=18 order by createdate desc limit 0,10&);
modelMap.put(&zhongdiangongcheng&, zhongdiangongcheng);
List&Map&String, Object&& rows = getAdminService()
.select(
& jxw_renwu&,
&Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront&,
&type=0 order by createdate&);
// 经信人物
modelMap.put(&renwu&, rows);
List&Map&String, Object&& rowss = getAdminService()
.select(
& jxw_renwu&,
&Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront&,
&type=1 order by createdate&);
// 经信企业
modelMap.put(&qiye&, rowss);
List&Map&String, Object&& zhuanti = getAdminService()
.select(
& jxw_renwu&,
&Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront&,
&type=2 order by createdate&);
modelMap.put(&zhuanti&, zhuanti);
List&Map&String, Object&& images = getAdminService()
.select(
& jxw_picnews&,
&ID,title,newType,browseImage,imgurl,sortnum,content,createDate,userName,infoSource&,
&browseImage=1 order by sortnum limit 0,5&);// sortnum
// asc
modelMap.put(&images&, images);
modelMap.put(&selectOption&, objList);
return new ModelAndView(&index2.jsp&, modelMap);
}
连接池配置proxool.xml:
&xml version=&1.0& encoding=&UTF-8&&
&!--
the proxool configuration can be embedded within your own
application&s. Anything outside the &proxool& tag is ignored.
--&
&something-else-entirely&
&proxool&
&alias&jxw_db&/alias&
&driver-url&jdbc:mysql://192.168.1.111:3306/jxw&/driver-url&
&driver-class&com.mysql.jdbc.Driver&/driver-class&
&driver-properties&
&property name=&user& value=&root& /&
&property name=&password& value=&rocan2012& /&
&/driver-properties&
&simultaneousBuildThrottle&69&/simultaneousBuildThrottle&
&minimum-connection-count&20&/minimum-connection-count&
&maximum-connection-count&200&/maximum-connection-count&
&house-keeping-test-sql&select 0&/house-keeping-test-sql&
&trace&true&/trace&
&/proxool&
&/something-else-entirely&
javajdbc内存溢出异常exception
分享到:回答2:请大神们指点指点,小弟不胜感激!!!定会请客吃饭。回答3:我觉得是连接池的问题,java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
大神们来帮帮我!!!回答4:楼主用的是oracle吗?
是不是驱动版本的问题啊回答5:&simultaneousBuildThrottle&69&/simultaneousBuildThrottle&
&minimum-connection-count&20&/minimum-connection-count&
&maximum-connection-count&200&/maximum-connection-count&
这个设置的不合理,改为
&simultaneousBuildThrottle&20&/simultaneousBuildThrottle&
&minimum-connection-count&5&/minimum-connection-count&
&maximum-connection-count&50&/maximum-connection-count&回答6:看看你写的数据库连接
释放自动释放回答7:引用 4 楼 fangmingshijie 的回复:&simultaneousBuildThrottle&69&/simultaneousBuildThrottle&
&minimum-connection-count&20&/minimum-connection-count&
&maximum-connection-count&200&/maximum-connection-count&
这个设置的不合理,改为
&simultaneousBuildThrottle&20&/simultaneousBuildThrottle&
&minimum-connection-count&5&/minimum-connection-count&
&maximum-connection-count&50&/maximum-connection-count&
改为这个就合理了吗?4楼的朋友?异常还报吗?回答8:引用 3 楼 huzhihui429 的回复:楼主用的是oracle吗?
是不是驱动版本的问题啊
我用的mysql,谢谢,没看到proxool.xml里的驱动吧?
转载请保留出处:/Java_question/907.html
本周热门问答排行紧急,求java大神们帮帮忙_java吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:246,989贴子:
紧急,求java大神们帮帮忙收藏
import javax.swing.*; import java.awt.*;import java.awt.event.*;import java.io.Fimport java.io.FilenameFimport java.awt.*; import java.awt.event.*; public class kkt implements ActionListener { JFrame mainF //主面板 Container thisC JPanel centerPanel,southPanel,northP //子面板 JButton diamondsButton[][] = new JButton[6][5];//游戏按钮数组 JButton exitButton,resetButton,newlyB //游戏退出,重新排列,重新开始按钮 JLabel fractionLable=new JLabel("0"); //分数标签 JButton firstButton,secondB //分别记录两次被选中的按钮 int grid[][] = new int[8][7];//储存游戏按钮位置 static boolean pressInformation= //判断是否有按钮被选中 int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标 int i,j,k,n;//消除方法控制 //=====================================////=============调用图片================//private static Icon[] icons = new ImageIcon[6*5];private static final String imgDir="E:/xzh/bbb.jpg";//这里填上图片目录全名就行了static{try{File dir = new File(imgDir);File[] imgFiles = dir.listFiles(new FilenameFilter(){public boolean accept(File dir, String name) {return name.toLowerCase().endsWith(".jpg");}});for(int i=0; i&7*5; i++){icons[i]=new ImageIcon(imgFiles[i].getAbsolutePath());}}catch(Exception e){e.printStackTrace();}}public void init(){ mainFrame=new JFrame("JKJ连连看");mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);thisContainer = mainFrame.getContentPane(); thisContainer.setLayout(new BorderLayout()); centerPanel=new JPanel(); southPanel=new JPanel(); northPanel=new JPanel(); thisContainer.add(centerPanel,"Center"); thisContainer.add(southPanel,"South"); thisContainer.add(northPanel,"North"); centerPanel.setLayout(new GridLayout(5,7)); for(int cols = 0;cols & 6;cols++){ for(int rows = 0;rows & 5;rows++ ){ // diamondsButton[cols][rows] = new JButton(String// .valueOf(grid[cols + 1][rows + 1]));//========设置图片========//diamondsButton[cols][rows] = new JButton(icons[grid[cols + 1][rows + 1]-1]);diamondsButton[cols][rows].addActionListener(this);centerPanel.add(diamondsButton[cols][rows]);}}exitButton=new JButton("游戏退出"); exitButton.addActionListener(this); resetButton=new JButton("重新排列"); resetButton.addActionListener(this); newlyButton=new JButton("再来一局"); newlyButton.addActionListener(this); southPanel.add(exitButton); southPanel.add(resetButton); southPanel.add(newlyButton); fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText()))); northPanel.add(fractionLable); mainFrame.setBounds(280,100,500,450); mainFrame.setVisible(true); } public void randomBuild() { int randoms,cols, for(int twins=1;twins&=15;twins++) { randoms=(int)(Math.random()*25+1); for(int alike=1;alike&=2;alike++) { cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); while(grid[cols][rows]!=0) { cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); } this.grid[cols][rows]= } } } public void fraction(){ fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100)); } public void reload() { int save[] = new int[30]; int n=0,cols, int grid[][]= new int[8][7]; for(int i=0;i&=6;i++) { for(int j=0;j&=5;j++) { if(this.grid[i][j]!=0) { save[n]=this.grid[i][j]; n++; } } } n=n-1; this.grid= while(n&=0) { cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); while(grid[cols][rows]!=0) { cols=(int)(Math.random()*6+1); rows=(int)(Math.random()*5+1); } this.grid[cols][rows]=save[n]; n--; } mainFrame.setVisible(false); pressInformation= //这里一定要将按钮点击信息归为初始 init(); for(int i = 0;i & 6;i++){ for(int j = 0;j & 5;j++ ){ if(grid[i+1][j+1]==0) diamondsButton[i][j].setVisible(false); } } } public void estimateEven(int placeX,int placeY,JButton bz) { if(pressInformation==false) { x=placeX; y=placeY; secondMsg=grid[x][y]; secondButton= pressInformation= } else { x0=x; y0=y; fristMsg=secondM firstButton=secondB x=placeX; y=placeY; secondMsg=grid[x][y]; secondButton= if(fristMsg==secondMsg && secondButton!=firstButton){ xiao(); } } } public void xiao() { //相同的情况下能不能消去。仔细分析,不一条条注释 if((x0==x &&(y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)&&(y0==y))){ //判断是否相邻 remove(); } else{ for (j=0;j&7;j++ ) { if (grid[x0][j]==0){ //判断第一个按钮同行哪个按钮为空 if (y&j) { //如果第二个按钮的Y坐标大于空按钮的Y坐标说明第一按钮在第二按钮左边 for (i=y-1;i&=j;i-- ){ //判断第二按钮左侧直到第一按钮中间有没有按钮 if (grid[x][i]!=0) { k=0;
} else{ k=1; } //K=1说明通过了第一次验证 } if (k==1) { linePassOne(); } } if (y&j){ //如果第二个按钮的Y坐标小于空按钮的Y坐标说明第一按钮在第二按钮右边 for (i=y+1;i&=i++ ){ //判断第二按钮左侧直到第一按钮中间有没有按钮 if (grid[x][i]!=0){ k=0;
} else { k=1; } } if (k==1){ linePassOne(); } } if (y==j ) { linePassOne(); } } if (k==2) { if (x0==x) { remove(); } if (x0&x) { for (n=x0;n&=x-1;n++ ) { if (grid[n][j]!=0) { k=0;
} if(grid[n][j]==0 && n==x-1) { remove(); } } } if (x0&x) { for (n=x0;n&=x+1 ;n-- ) { if (grid[n][j]!=0) { k=0;
} if(grid[n][j]==0 && n==x+1) { remove(); } } } } } for (i=0;i&8;i++ ) { //列 if (grid[i][y0]==0) { if (x&i) { for (j=x-1;j&=j-- ) { if (grid[j][y]!=0) { k=0;
} else { k=1; } } if (k==1) { rowPassOne(); } } if (x&i) { for (j=x+1;j&=i;j++ ) { if (grid[j][y]!=0) { k=0;
} else { k=1; } } if (k==1) { rowPassOne(); } } if (x==i) { rowPassOne(); } } if (k==2){ if (y0==y) { remove(); } if (y0&y) { for (n=y0;n&=y-1 ;n++ ) { if (grid[i][n]!=0) { k=0;
} if(grid[i][n]==0 && n==y-1) { remove(); } } } if (y0&y) { for (n=y0;n&=y+1 ;n--) { if (grid[i][n]!=0) { k=0;
} if(grid[i][n]==0 && n==y+1) { remove(); } } } } } } } public void linePassOne(){ if (y0&j){ //第一按钮同行空按钮在左边 for (i=y0-1;i&=i-- ){ //判断第一按钮同左侧空按钮之间有没按钮 if (grid[x0][i]!=0) { k=0;
} else { k=2; } //K=2说明通过了第二次验证 } } if (y0&j){ //第一按钮同行空按钮在与第二按钮之间 for (i=y0+1;i&=i++){ if (grid[x0][i]!=0) { k=0;
} else{ k=2; } } } } public void rowPassOne(){ if (x0&i) { for (j=x0-1;j&=j-- ) { if (grid[j][y0]!=0) { k=0;
} else { k=2; } } } if (x0&i) { for (j=x0+1;j&=j++ ) { if (grid[j][y0]!=0) { k=0;
} else { k=2; } } } } public void remove(){ firstButton.setVisible(false); secondButton.setVisible(false); fraction(); pressInformation= k=0; grid[x0][y0]=0; grid[x][y]=0; } public void actionPerformed(ActionEvent e) { if(e.getSource()==newlyButton){ int grid[][] = new int[8][7]; this.grid = randomBuild(); mainFrame.setVisible(false); pressInformation= init(); } if(e.getSource()==exitButton) System.exit(0); if(e.getSource()==resetButton) reload(); for(int cols = 0;cols & 6;cols++){ for(int rows = 0;rows & 5;rows++ ){ if(e.getSource()==diamondsButton[cols][rows]) estimateEven(cols+1,rows+1,diamondsButton[cols][rows]); } } } public static void main(String[] args) { kkt llk = new kkt(); llk.randomBuild(); llk.init(); } }//old 998 lines //new 318 lines
如上面代码,怎么样把连连看的数字换成图片,求大神们帮帮忙改改看看回复
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或}

我要回帖

更多关于 java 注释 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信