<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    三分自留地

    Follow your heart

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      4 Posts :: 2 Stories :: 1 Comments :: 0 Trackbacks

    2013年1月22日 #


    一、清晰型

    <%@ page contentType="image/jpeg" import="java.awt.*, 
    java.awt.image.*,java.util.*,javax.imageio.*" %> 
    <%! 
    Color getRandColor(int fc,int bc) 

    Random random = new Random(); 
    if(fc>255) fc=255; 
    if(bc>255) bc=255; 
    int r=fc+random.nextInt(bc-fc); 
    int g=fc+random.nextInt(bc-fc); 
    int b=fc+random.nextInt(bc-fc); 
    return new Color(r,g,b); 

    %> 
    <% 
    out.clear();
    response.setHeader("Pragma","No-cache"); 
    response.setHeader("Cache-Control","no-cache"); 
    response.setDateHeader("Expires", 0); 
    int width=60, height=20; 
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 
    Graphics g = image.getGraphics(); 
    Random random = new Random(); 
    g.setColor(getRandColor(200,250)); 
    g.fillRect(0, 0, width, height); 
    g.setFont(new Font("Times New Roman",Font.PLAIN,18)); 
    g.setColor(getRandColor(160,200)); 
    for (int i=0;i<155;i++) 

    int x = random.nextInt(width); 
    int y = random.nextInt(height); 
    int xl = random.nextInt(12); 
    int yl = random.nextInt(12); 
    g.drawLine(x,y,x+xl,y+yl); 

    String sRand=""; 
    for (int i=0;i<4;i++){ 
    String rand=String.valueOf(random.nextInt(10)); 
    sRand+=rand; 
    g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110))); 
    g.drawString(rand,13*i+6,16); 

    session.setAttribute("SRA",sRand);
    g.dispose(); 
    ImageIO.write(image, "JPEG", response.getOutputStream()); 
    %>


    二、凌亂型

    <%@ page contentType="image/jpeg"
        import="java.awt.*, 
    java.awt.image.*,java.util.*,javax.imageio.*"%>
    <%! 
    Color getRandColor(int fc,int bc) 

    Random random = new Random(); 
    if(fc>255) fc=255; 
    if(bc>255) bc=255; 
    int r=fc+random.nextInt(bc-fc); 
    int g=fc+random.nextInt(bc-fc); 
    int b=fc+random.nextInt(bc-fc); 
    return new Color(r,g,b); 

    %>
    <% 
    char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
            'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
            'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

    response.setHeader("Pragma","No-cache"); 
    response.setHeader("Cache-Control","no-cache"); 
    response.setDateHeader("Expires", 0); 
    int width=60, height=20; 
    BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 
    Graphics g = image.getGraphics(); 
    Random random = new Random(); 
    g.setColor(getRandColor(200,250)); 
    g.fillRect(0, 0, width, height); 
    g.setFont(new Font("Fixedsys",Font.PLAIN,18)); 
    g.drawRect(0, 0, width - 1, height - 1); // 隨機(jī)產(chǎn)生160條干擾線,使圖象中的認(rèn)證碼不易被其它程序探測到。
    g.setColor(Color.BLACK);
    for (int i = 0; i < 30; i++) {
        int x = random.nextInt(width);
        int y = random.nextInt(height);
        int xl = random.nextInt(12);
        int yl = random.nextInt(12);
        g.drawLine(x, y, x + xl, y + yl);
    }
    String sRand=""; 
    for (int i=0;i<4;i++){     
    String rand=String.valueOf(codeSequence[random.nextInt(36)]);
    sRand+=rand; 
    g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110))); 
    g.drawString(rand,13*i+6,16); 

    session.setAttribute("SRA",sRand);
    g.dispose(); 
    ImageIO.write(image, "JPEG", response.getOutputStream()); 
    out.clear();
    out = pageContext.pushBody();
    %>


    posted @ 2013-11-01 13:43 大山 閱讀(113) | 評論 (0)編輯 收藏



        1、題目是編寫java程序打印出一下數(shù)字形狀:

            1  
            7   2  
            12 8   3   
            16 13 9   4  
            19 17 14 10 5  
            21 20 18 15 11 6  
        
        當(dāng)初做題的時(shí)候比較著急沒用做出來,其實(shí)思路也都想出來了,就是沒具體編碼出來,關(guān)鍵是控制數(shù)組的坐標(biāo)變換而已:
        下來做了一下,與大家共享下,請多指正。

         
       
     public class Test {

        public static void main(String[] args) {
            
            int count=1;
            int [][]  a=new int [12][12];
            
            //賦值
            for(int i=0;i<12;i++){
                for(int j=0;j<12-j;j++){
                    if(j>=i){
                        a[j][j-i]=count++;
                    }
                }
            }
            
            //打印
            for(int i=0;i<12;i++){
                for(int j=0;j<12;j++){
                    if(a[i][j]!=0){
                        System.out.print(a[i][j]+" ");
                    }
                    
                }
                System.out.println(" ");
            }
            
        }

    }
    posted @ 2013-05-02 17:09 大山 閱讀(213) | 評論 (0)編輯 收藏


    1、先發(fā)效果圖  





























    2、上頁面
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
    <title>Back to To TEST</title>
    <LINK rel=stylesheet type=text/css href="css/lrtk.css">
    <script src="js/jquery.js"></script>
    <script type="text/javascript">
    $(function() 
    {
        $(window).scroll(function() 
    {
            
    if($(this).scrollTop() != 0{
                $(
    '#toTop').fadeIn();    
            }
     else {
                $(
    '#toTop').fadeOut();
            }

        }
    );
     
        $(
    '#toTop').click(function() {
            $(
    'body,html').animate({scrollTop:0},2000);
            
    return false;//返回false可以避免在原鏈接后加上# 
        }
    );    
    }
    );
    </script>
    </head>
    <body>
    <div style="DISPLAY: none" id="toTop"><IMG border=0 src="images/top.gif"></div>


    <div id="main" style="width:1000px;padding-top:200px;height:2000px;background:#eee; margin:0 auto;text-align:center">
      
    <h1>請滾動(dòng)右側(cè)滾動(dòng)條查看效果</h1>
    </div>

    </body>
    </html>



    3、CSS 代碼
    #toTop {
    POSITION: fixed;
    TEXT
    -ALIGN: center;
    LINE
    -HEIGHT: 30px;
    WIDTH: 60px;
    BOTTOM: 65px;
    HEIGHT: 63px;
    FONT
    -SIZE: 12px;
    CURSOR: pointer;
    RIGHT: 30px;
    _position: absolute;
    _right: auto
    }


    示例地址:/Files/ityouknow/back_top.zip





    posted @ 2013-01-22 21:44 大山 閱讀(192) | 評論 (1)編輯 收藏

    主站蜘蛛池模板: 亚洲免费在线视频| 亚洲人成在线免费观看| 99re6免费视频| 亚洲人AV永久一区二区三区久久| 亚洲成AV人片在线播放无码| 亚洲色丰满少妇高潮18p| 久久精品国产免费| 免费a级黄色毛片| 一本色道久久88—综合亚洲精品 | 日韩成人免费视频| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 四虎影视久久久免费观看| 亚洲欧洲免费无码| 亚洲理论片中文字幕电影| 久久99热精品免费观看牛牛| 亚洲天堂免费在线| 99在线精品视频观看免费| 亚洲国产日韩在线成人蜜芽 | 国产精品成人免费福利| 特色特黄a毛片高清免费观看| 91亚洲一区二区在线观看不卡| 国内精品免费在线观看| 亚洲精品无码中文久久字幕| 女人被免费视频网站| 2020久久精品亚洲热综合一本| 亚洲日韩在线中文字幕第一页| 青青青国产在线观看免费| 亚洲一区在线免费观看| 女人18毛片免费观看| 香蕉成人免费看片视频app下载| 黄网站色成年片大免费高清| 亚洲无码黄色网址| 女人18毛片免费观看| 免费能直接在线观看黄的视频| 二区久久国产乱子伦免费精品| 2048亚洲精品国产| 免费无码又爽又刺激高潮| 美女被吸屁股免费网站| 在线综合亚洲中文精品| 久久久久亚洲AV片无码下载蜜桃 | 亚洲伊人成无码综合网 |