首页 \ 问答 \ 怎么卸载JAVA(TM)?具体步骤是?

怎么卸载JAVA(TM)?具体步骤是?

怎么彻底卸载?
更新时间:2022-11-27 16:11

最满意答案

五子棋

import java.awt.*;
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;i<11;i++)
 {
  for(int j=0;j<11;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();
    }
}

其他回答

已发,请注意查收
我在QQ上传离线文件给你了,传了Java五子棋、贪吃蛇、俄罗斯方块给你。
import java.awt.*; 
  import java.awt.event.*; 
  import javax.swing.*; 
  import java.util.*; 

  public class GreedSnake implements KeyListener{ 
   JFrame mainFrame; 
   Canvas paintCanvas; 
   JLabel labelScore; 
   SnakeModel snakeModel = null; 

   public static final int canvasWidth = 200; 
   public static final int canvasHeight = 300; 

   public static final int nodeWidth = 10; 
   public static final int nodeHeight = 10; 

   public GreedSnake() { 
    mainFrame = new JFrame("GreedSnake"); 

    Container cp = mainFrame.getContentPane(); 

    labelScore = new JLabel("Score:"); 
    cp.add(labelScore, BorderLayout.NORTH); 

    paintCanvas = new Canvas(); 
    paintCanvas.setSize(canvasWidth+1,canvasHeight+1); 
    paintCanvas.addKeyListener(this); 
    cp.add(paintCanvas, BorderLayout.CENTER); 

    JPanel panelButtom = new JPanel(); 
    panelButtom.setLayout(new BorderLayout()); 
    JLabel labelHelp; 
    labelHelp = new JLabel("PageUp, PageDown for speed;", JLabel.CENTER); 
    panelButtom.add(labelHelp, BorderLayout.NORTH); 
    labelHelp = new JLabel("ENTER or R or S for start;", JLabel.CENTER); 
    panelButtom.add(labelHelp, BorderLayout.CENTER); 
    labelHelp = new JLabel("SPACE or P for pause",JLabel.CENTER); 
    panelButtom.add(labelHelp, BorderLayout.SOUTH); 
    cp.add(panelButtom,BorderLayout.SOUTH); 

    mainFrame.addKeyListener(this); 
    mainFrame.pack(); 
    mainFrame.setResizable(false); 
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    mainFrame.setVisible(true); 
    begin(); 
   } 

   public void keyPressed(KeyEvent e){ 
    int keyCode = e.getKeyCode(); 
    if (snakeModel.running) 
     switch(keyCode){ 
      case KeyEvent.VK_UP: 
       snakeModel.changeDirection(SnakeModel.UP); 
       break; 
      case KeyEvent.VK_DOWN: 
       snakeModel.changeDirection(SnakeModel.DOWN); 
       break; 
      case KeyEvent.VK_LEFT: 
       snakeModel.changeDirection(SnakeModel.LEFT); 
       break; 
      case KeyEvent.VK_RIGHT: 
       snakeModel.changeDirection(SnakeModel.RIGHT); 
       break; 
      case KeyEvent.VK_ADD: 
      case KeyEvent.VK_PAGE_UP: 
       snakeModel.speedUp(); 
       break; 
      case KeyEvent.VK_SUBTRACT: 
      case KeyEvent.VK_PAGE_DOWN: 
       snakeModel.speedDown(); 
       break; 
      case KeyEvent.VK_SPACE: 
      case KeyEvent.VK_P: 
       snakeModel.changePauseState(); 
       break; 
      default: 
     } 

    if (keyCode == KeyEvent.VK_R || 
      keyCode == KeyEvent.VK_S || 
      keyCode == KeyEvent.VK_ENTER){ 
     snakeModel.running = false; 
     begin(); 
    } 
   } 

   public void keyReleased(KeyEvent e){ 
   } 

   public void keyTyped(KeyEvent e){ 
   } 

void repaint(){ 
    Graphics g = paintCanvas.getGraphics(); 

    //draw background 
    g.setColor(Color.WHITE); 
    g.fillRect(0,0,canvasWidth,canvasHeight); 

    // draw the snake 
    g.setColor(Color.BLACK); 
    LinkedList na = snakeModel.nodeArray; 
    Iterator it = na.iterator(); 
    while(it.hasNext()){ 
     Node n = (Node)it.next(); 
     drawNode(g,n); 
    } 

    // draw the food 
    g.setColor(Color.RED); 
    Node n = snakeModel.food; 
    drawNode(g,n); 

    updateScore(); 
   } 

   private void drawNode(Graphics g, Node n){ 
    g.fillRect(n.x*nodeWidth, 
          n.y*nodeHeight, 
          nodeWidth-1, 
          nodeHeight-1); 
   } 

   public void updateScore(){ 
    String s = "Score: " + snakeModel.score; 
    labelScore.setText(s); 
   } 

   void begin(){ 
    if (snakeModel == null || !snakeModel.running){ 
     snakeModel = new SnakeModel(this, 
                   canvasWidth/nodeWidth, 
                   canvasHeight/nodeHeight); 
     (new Thread(snakeModel)).start(); 
    } 
   } 

   public static void main(String[] args){ 
    GreedSnake gs = new GreedSnake(); 
   } 
  } 

  /////////////////////////////////////////////////// 
  // 文件2 
  /////////////////////////////////////////////////// 

  import java.util.*; 
  import javax.swing.*; 

  class SnakeModel implements Runnable{ 
   GreedSnake gs; 
   boolean[][] matrix; 
   LinkedList nodeArray = new LinkedList(); 
   Node food; 
   int maxX; 
   int maxY; 
   int direction = 2; 
   boolean running = false; 

   int timeInterval = 200; 
   double speedChangeRate = 0.75; 
   boolean paused = false; 

   int score = 0; 
   int countMove = 0; 

   // UP and DOWN should be even 
   // RIGHT and LEFT should be odd 
   public static final int UP = 2; 
   public static final int DOWN = 4; 
   public static final int LEFT = 1; 
   public static final int RIGHT = 3; 

   public SnakeModel(GreedSnake gs, int maxX, int maxY){ 
    this.gs = gs; 
    this.maxX = maxX; 
    this.maxY = maxY; 

    // initial matirx 
    matrix = new boolean[maxX][]; 
    for(int i=0; i 20 ? 10 : maxX/2; 
    for(int i = 0; i < initArrayLength; ++i){ 
     int x = maxX/2+i; 
     int y = maxY/2; 
     nodeArray.addLast(new Node(x, y)); 
     matrix[x][y] = true; 
    } 

    food = createFood(); 
    matrix[food.x][food.y] = true; 
   } 

   public void changeDirection(int newDirection){ 
    if (direction % 2 != newDirection % 2){ 
     direction = newDirection; 
    } 
   } 

   public boolean moveOn(){ 
    Node n = (Node)nodeArray.getFirst(); 
    int x = n.x; 
    int y = n.y; 

    switch(direction){ 
     case UP: 
      y--; 
      break; 
     case DOWN: 
      y++; 
      break; 
     case LEFT: 
      x--; 
      break; 
     case RIGHT: 
      x++; 
      break; 
    } 

    if ((0 <= x && x < maxX) && (0 <= y && y < maxY)){ 
     if (matrix[x][y]){ 
      if(x == food.x && y == food.y){ 
       nodeArray.addFirst(food); 

       int scoreGet = (10000 - 200 * countMove) / timeInterval; 
       score += scoreGet > 0? scoreGet : 10; 
       countMove = 0; 

       food = createFood(); 
       matrix[food.x][food.y] = true; 
       return true; 
      } 
      else 
       return false; 
     } 
     else{ 
      nodeArray.addFirst(new Node(x,y)); 
      matrix[x][y] = true; 
      n = (Node)nodeArray.removeLast(); 
      matrix[n.x][n.y] = false; 
      countMove++; 
      return true; 
}
}
24YY5

相关问答

更多
  • 前天写的猜数字游戏,yong i控制猜测次数,有详细解析,用黑窗口可以直接运行, 我试验过了,没问题 import javax.swing.Icon; import javax.swing.JOptionPane; public class CaiShuZi4JOptionPane { /** * @param args */ public static void main(String[] args) { Icon icon = null; boolean bl = false; int put = 0; ...
  • java小游戏程序[2021-05-16]

    你要的百度都能搜到... 要不csdn也有.. 有兴趣 加群40871315 一起讨论java 互相学习
  • 五子棋 import java.awt.*; 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 ...
  • 这个很多的,初学建议去这个网学习源码和项目。 http://www.java2s.com/CN/
  • import java.awt.*; import java.applet.*; import java.awt.event.*; import java.awt.image.*; import java.awt.geom.*; import java.util.*; class Car{ Image img; int x, y; Dimension dim; Car(Image img){ this.img=img; } Car(Image img, int x, int y){ this.img=img ...
  • E网手游家园 完全免费的手机游戏! 电脑访问: http://www.ewang5.com/hack.php?H_name=adv&u=15103 电脑访问: http://www.ewang5.com/hack.php?H_name=adv&u=15103 手机访问 http://wap.ewang5.com 游戏不收任何费用。。还可以学破解!!也可以制订手机破解游戏!!请采纳我做最佳答案!~
  • 给你发了一个,你没在,不知道你感觉怎么样,给个答复。
  • 连连看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[][] = ...
  • 比较粗糙的贪吃蛇。由于代码过长,分着贴 import java.awt.*; import java.awt.event.*; public class GreedSnake //主类 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new MyWindow(); } } class MyPanel extends Panel implements KeyLi ...
  • 第一个类,服务器主线程类。 package src;//定义一个包,存放JAVA文件。 import java.io.*;//导入JAVA包,输入输出流包 import java.net.*;//导入JAVA包,网络应用包 public class SocketServer extends Thread {//服务器主线程,负责为每个发出请求连接的客户端分配一个服务线程。 ServerSocket server;//定义一个对象 public SocketServer() { //该类的午餐构 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)