1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      java有點(diǎn)用的代碼 java必背代碼

      求java小程序代碼,500行左右。。大作業(yè)用。追加50

      import java.awt.*;

      十多年的涪城網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。營(yíng)銷型網(wǎng)站的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整涪城建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“涪城網(wǎng)站設(shè)計(jì)”,“涪城網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

      import java.awt.event.*;

      import javax.swing.*;

      class mypanel extends Panel implements MouseListener

      {

      int chess[][] = new int[11][11];

      boolean Is_Black_True;

      mypanel()

      {

      Is_Black_True = true;

      for(int i = 0;i 11;i++)

      {

      for(int j = 0;j 11;j++)

      {

      chess[i][j] = 0;

      }

      }

      addMouseListener(this);

      setBackground(Color.BLUE);

      setBounds(0, 0, 360, 360);

      setVisible(true);

      }

      public void mousePressed(MouseEvent e)

      {

      int x = e.getX();

      int y = e.getY();

      if(x 25 || x 330 + 25 ||y 25 || y 330+25)

      {

      return;

      }

      if(chess[x/30-1][y/30-1] != 0)

      {

      return;

      }

      if(Is_Black_True == true)

      {

      chess[x/30-1][y/30-1] = 1;

      Is_Black_True = false;

      repaint();

      Justisewiner();

      return;

      }

      if(Is_Black_True == false)

      {

      chess[x/30-1][y/30-1] = 2;

      Is_Black_True = true;

      repaint();

      Justisewiner();

      return;

      }

      }

      void Drawline(Graphics g)

      {

      for(int i = 30;i = 330;i += 30)

      {

      for(int j = 30;j = 330; j+= 30)

      {

      g.setColor(Color.WHITE);

      g.drawLine(i, j, i, 330);

      }

      }

      for(int j = 30;j = 330;j += 30)

      {

      g.setColor(Color.WHITE);

      g.drawLine(30, j, 330, j);

      }

      }

      void Drawchess(Graphics g)

      {

      for(int i = 0;i 11;i++)

      {

      for(int j = 0;j 11;j++)

      {

      if(chess[i][j] == 1)

      {

      g.setColor(Color.BLACK);

      g.fillOval((i + 1) * 30 - 8, (j + 1) * 30 - 8, 16, 16);

      }

      if(chess[i][j] == 2)

      {

      g.setColor(Color.WHITE);

      g.fillOval((i + 1) * 30 - 8, (j + 1) * 30 - 8, 16, 16);

      }

      }

      }

      }

      void Justisewiner()

      {

      int black_count = 0;

      int white_count = 0;

      int i = 0;

      for(i = 0;i 11;i++)//橫向判斷

      {

      for(int j = 0;j 11;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 11;i++)//豎向判斷

      {

      for(int j = 0;j 11;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 11;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;i11;i++)

      {

      for(int j=0;j11;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,23, 360, 360);

      setTitle("單人版五子棋");

      setBounds(200, 200, 360, 383);

      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();

      }

      }

      跪地求好玩的JAVA 源代碼~

      連連看java源代碼

      import javax.swing.*;

      import java.awt.*;

      import java.awt.event.*;

      public class lianliankan implements ActionListener

      {

      JFrame mainFrame; //主面板

      Container thisContainer;

      JPanel centerPanel,southPanel,northPanel; //子面板

      JButton diamondsButton[][] = new JButton[6][5];//游戲按鈕數(shù)組

      JButton exitButton,resetButton,newlyButton; //退出,重列,重新開始按鈕

      JLabel fractionLable=new JLabel("0"); //分?jǐn)?shù)標(biāo)簽

      JButton firstButton,secondButton; //分別記錄兩次被選中的按鈕

      int grid[][] = new int[8][7];//儲(chǔ)存游戲按鈕位置

      static boolean pressInformation=false; //判斷是否有按鈕被選中

      int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戲按鈕的位置坐標(biāo)

      int i,j,k,n;//消除方法控制

      public void init(){

      mainFrame=new JFrame("JKJ連連看");

      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(6,5));

      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].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,rows;

      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]=randoms;

      }

      }

      }

      public void fraction(){

      fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));

      }

      public void reload() {

      int save[] = new int[30];

      int n=0,cols,rows;

      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=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=false; //這里一定要將按鈕點(diǎn)擊信息歸為初始

      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=bz;

      pressInformation=true;

      }

      else {

      x0=x;

      y0=y;

      fristMsg=secondMsg;

      firstButton=secondButton;

      x=placeX;

      y=placeY;

      secondMsg=grid[x][y];

      secondButton=bz;

      if(fristMsg==secondMsg secondButton!=firstButton){

      xiao();

      }

      }

      }

      public void xiao() { //相同的情況下能不能消去。仔細(xì)分析,不一條條注釋

      if((x0==x (y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)(y0==y))){ //判斷是否相鄰

      remove();

      }

      else{

      for (j=0;j7;j++ ) {

      if (grid[x0][j]==0){ //判斷第一個(gè)按鈕同行哪個(gè)按鈕為空

      if (yj) { //如果第二個(gè)按鈕的Y坐標(biāo)大于空按鈕的Y坐標(biāo)說明第一按鈕在第二按鈕左邊

      for (i=y-1;i=j;i-- ){ //判斷第二按鈕左側(cè)直到第一按鈕中間有沒有按鈕

      if (grid[x][i]!=0) {

      k=0;

      break;

      }

      else{ k=1; } //K=1說明通過了第一次驗(yàn)證

      }

      if (k==1) {

      linePassOne();

      }

      }

      if (yj){ //如果第二個(gè)按鈕的Y坐標(biāo)小于空按鈕的Y坐標(biāo)說明第一按鈕在第二按鈕右邊

      for (i=y+1;i=j ;i++ ){ //判斷第二按鈕左側(cè)直到第一按鈕中間有沒有按鈕

      if (grid[x][i]!=0){

      k=0;

      break;

      }

      else { k=1; }

      }

      if (k==1){

      linePassOne();

      }

      }

      if (y==j ) {

      linePassOne();

      }

      }

      if (k==2) {

      if (x0==x) {

      remove();

      }

      if (x0x) {

      for (n=x0;n=x-1;n++ ) {

      if (grid[n][j]!=0) {

      k=0;

      break;

      }

      if(grid[n][j]==0 n==x-1) {

      remove();

      }

      }

      }

      if (x0x) {

      for (n=x0;n=x+1 ;n-- ) {

      if (grid[n][j]!=0) {

      k=0;

      break;

      }

      if(grid[n][j]==0 n==x+1) {

      remove();

      }

      }

      }

      }

      }

      for (i=0;i8;i++ ) { //列

      if (grid[i][y0]==0) {

      if (xi) {

      for (j=x-1;j=i ;j-- ) {

      if (grid[j][y]!=0) {

      k=0;

      break;

      }

      else { k=1; }

      }

      if (k==1) {

      rowPassOne();

      }

      }

      if (xi) {

      for (j=x+1;j=i;j++ ) {

      if (grid[j][y]!=0) {

      k=0;

      break;

      }

      else { k=1; }

      }

      if (k==1) {

      rowPassOne();

      }

      }

      if (x==i) {

      rowPassOne();

      }

      }

      if (k==2){

      if (y0==y) {

      remove();

      }

      if (y0y) {

      for (n=y0;n=y-1 ;n++ ) {

      if (grid[i][n]!=0) {

      k=0;

      break;

      }

      if(grid[i][n]==0 n==y-1) {

      remove();

      }

      }

      }

      if (y0y) {

      for (n=y0;n=y+1 ;n--) {

      if (grid[i][n]!=0) {

      k=0;

      break;

      }

      if(grid[i][n]==0 n==y+1) {

      remove();

      }

      }

      }

      }

      }

      }

      }

      public void linePassOne(){

      if (y0j){ //第一按鈕同行空按鈕在左邊

      for (i=y0-1;i=j ;i-- ){ //判斷第一按鈕同左側(cè)空按鈕之間有沒按鈕

      if (grid[x0][i]!=0) {

      k=0;

      break;

      }

      else { k=2; } //K=2說明通過了第二次驗(yàn)證

      }

      }

      if (y0j){ //第一按鈕同行空按鈕在與第二按鈕之間

      for (i=y0+1;i=j ;i++){

      if (grid[x0][i]!=0) {

      k=0;

      break;

      }

      else{ k=2; }

      }

      }

      }

      public void rowPassOne(){

      if (x0i) {

      for (j=x0-1;j=i ;j-- ) {

      if (grid[j][y0]!=0) {

      k=0;

      break;

      }

      else { k=2; }

      }

      }

      if (x0i) {

      for (j=x0+1;j=i ;j++ ) {

      if (grid[j][y0]!=0) {

      k=0;

      break;

      }

      else { k=2; }

      }

      }

      }

      public void remove(){

      firstButton.setVisible(false);

      secondButton.setVisible(false);

      fraction();

      pressInformation=false;

      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 = grid;

      randomBuild();

      mainFrame.setVisible(false);

      pressInformation=false;

      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) {

      lianliankan llk = new lianliankan();

      llk.randomBuild();

      llk.init();

      }

      }

      //old 998 lines

      //new 318 lines

      基于JAVA的3D坦克游戲源代碼

      JAVA猜數(shù)字小游戲源代碼

      /*1、編寫一個(gè)猜數(shù)字的游戲,由電腦隨機(jī)產(chǎn)生一個(gè)100以內(nèi)的整數(shù),讓用戶去猜,如果用戶猜的比電腦大,則輸出“大了,再小點(diǎn)!”,反之則輸出“小了,再大點(diǎn)!”,用戶總共只能猜十次,并根據(jù)用戶正確猜出答案所用的次數(shù)輸出相應(yīng)的信息,如:只用一次就猜對(duì),輸出“你是個(gè)天才!”,八次才猜對(duì),輸出“笨死了!”,如果十次還沒有猜對(duì),則游戲結(jié)束!*/

      import java.util.*;

      import java.io.*;

      public class CaiShu{

      public static void main(String[] args) throws IOException{

      Random a=new Random();

      int num=a.nextInt(100);

      System.out.println("請(qǐng)輸入一個(gè)100以內(nèi)的整數(shù):");

      for (int i=0;i=9;i++){

      BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));

      String str=bf.readLine();

      int shu=Integer.parseInt(str);

      if (shunum)

      System.out.println("輸入的數(shù)大了,輸小點(diǎn)的!");

      else if (shunum)

      System.out.println("輸入的數(shù)小了,輸大點(diǎn)的!");

      else {

      System.out.println("恭喜你,猜對(duì)了!");

      if (i=2)

      System.out.println("你真是個(gè)天才!");

      else if (i=6)

      System.out.println("還將就,你過關(guān)了!");

      else if (i=8)

      System.out.println("但是你還……真笨!");

      else

      System.out.println("你和豬沒有兩樣了!");

      break;}

      }

      }

      }

      給段最簡(jiǎn)單的java代碼 讓我新手看一下

      最簡(jiǎn)單的java代碼肯定就是這個(gè)了,如下:

      public class MyFirstApp

      {

      public static void main(String[] args)

      {

      System.out.print("Hello world");

      }

      }

      “hello world”就是應(yīng)該是所有學(xué)java的新手看的第一個(gè)代碼了。如果是零基礎(chǔ)的新手朋友們可以來我們的java實(shí)驗(yàn)班試聽,有免費(fèi)的試聽課程幫助學(xué)習(xí)java必備基礎(chǔ)知識(shí),有助教老師為零基礎(chǔ)的人提供個(gè)人學(xué)習(xí)方案,學(xué)習(xí)完成后有考評(píng)團(tuán)進(jìn)行專業(yè)測(cè)試,幫助測(cè)評(píng)學(xué)員是否適合繼續(xù)學(xué)習(xí)java,15天內(nèi)免費(fèi)幫助來報(bào)名體驗(yàn)實(shí)驗(yàn)班的新手快速入門java,更好的學(xué)習(xí)java!


      當(dāng)前標(biāo)題:java有點(diǎn)用的代碼 java必背代碼
      文章路徑:http://ef60e0e.cn/article/dogsdid.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        景泰县| 瑞金市| 裕民县| 清原| 海林市| 汉沽区| 仙居县| 武穴市| 讷河市| 赫章县| 冀州市| 吉林省| 铁力市| 四子王旗| 孟津县| 筠连县| 元阳县| 博爱县| 文安县| 织金县| 哈巴河县| 舞阳县| 日喀则市| 天水市| 乌鲁木齐县| 泾源县| 三台县| 泉州市| 扎兰屯市| 依安县| 武平县| 嘉黎县| 绥阳县| 安义县| 成武县| 蓬安县| 吉安市| 桂阳县| 岳阳县| 五华县| 南投市|