RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
java修改的代码大全,java修改密码代码

Java代码修改

import java.awt.Canvas;

成都创新互联公司主营文登网站建设的网络公司,主营网站建设方案,成都app软件开发公司,文登h5小程序开发搭建,文登网站营销推广欢迎文登等地区企业咨询

import java.awt.Color;

import java.awt.Font;

import java.awt.Graphics;

import java.awt.Image;

import java.util.Random;

import javax.swing.JFrame;

class RainCanvas extends Canvas implements Runnable{

private int width, height;

private Image offScreen; // 缓冲图片

private char[][] charset; // 随机字符集合

private int[] pos; // 列的起始位置

private Color[] colors = new Color[25]; // 列的渐变颜色

public RainCanvas(int width, int height) {

this.width = width;

this.height = height;

// 生成ASCII可见字符集合

//创建一个新的随机器

Random rand = new Random();

 //width/10为字符雨屏幕的宽度  height/10为字符雨屏幕的长度

//随机字符数组

charset = new char[width / 10][height / 10];

for (int i = 0; i  charset.length; i++) {

for (int j = 0; j  charset[i].length; j++) {

//nextInt(int n) 返回一个伪随机数,它是从此随机数生成器的序列中取出的、在 0(包括)和指定值(不包括)之间均匀分布的 int值。

//48--144代表键盘上的字母 符号 数字

//为charset数组的每个元素取值

charset[i][j] = (char) (rand.nextInt(96) + 48); }

}

// 随机化列起始位置

pos = new int[charset.length];

for (int i = 0; i  pos.length; i++) {

pos[i] = rand.nextInt(pos.length);

}

// 生成从黑色到绿色的渐变颜色,最后一个保持为白色

for (int i = 0; i  colors.length - 1; i++) {

//颜色渐变

colors[i] = new Color(0, 255 / colors.length * (i + 1), 0); }

//设置最底下一个的字符的颜色    0 0 255 蓝色  255 0 0 红色  255 255 255 白色  0 255 0 绿色

colors[colors.length - 1] = new Color(0, 0, 255); 

setBackground(Color.black);

setSize(width, height);

setVisible(true);

}

public void startRain() {

new Thread(this).start();

}

public void drawRain() {

if (offScreen == null) {

return;

}

// Random rand = new Random();

//getGraphice()创建供绘制闭屏图像使用的图形上下文

Graphics g = offScreen.getGraphics();

//通过使用当前绘图表面的背景色进行填充来清除指定的矩形。

g.clearRect(0, 0, width, height);

//将此图形上下文的字体设置为指定字体。使用此图形上下文的所有后续文本操作均使用此字体。

g.setFont(new Font("Arial", Font.PLAIN, 14));

//

for (int i = 0; i  charset.length; i++) {

//int speed = rand.nextInt(3);

for (int j = 0; j  colors.length; j++) {

//去掉j只显示蓝色的一个字符  去掉charset[i].length显示黑屏

int index = (pos[i] + j) % charset[i].length;

// 将此图形上下文的当前颜色设置为指定颜色。

g.setColor(colors[j]);

//使用此图形上下文的当前字体和颜色绘制由指定字符数组给定的文本

g.drawChars(charset[i], index, 1, i * 10, index * 10);

}

pos[i] = (pos[i]+2 ) % charset[i].length;

}

}

@Override

public void update(Graphics g) {

paint(g);

}

public void run() {

while (true) {

drawRain();

repaint();

try {

Thread.sleep(50); // 可改变睡眠时间以调节速度

}

catch (InterruptedException e) {

System.out.println(e);

}

}

}

@Override

public void paint(Graphics g) {

// 当组件显示时检测是否要创建缓冲图片,在组件还不可见时调用createImage将返回null

if (offScreen == null) {

offScreen = createImage(width, height);

}

g.drawImage(offScreen, 0, 0, this);

}

}

public class ZFYTest extends JFrame{

private RainCanvas canvas = new RainCanvas(1366, 768);

public ZFYTest() {

super("ZFY");

setUndecorated(true);

setExtendedState(JFrame.MAXIMIZED_BOTH);

setVisible(true);

canvas = new RainCanvas(this.getWidth(), this.getHeight()); //canvas = new RainCanvas(800,600);

getContentPane().add(canvas);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public static void main(String[] args) {

ZFYTest test = new ZFYTest();

test.canvas.startRain();

}

}

JAVA代码修改

你的代码有很多问题,最主要的一个吧就是你的inverse函数的参数没传进去,你自己定义一个空矩阵num[][],计算秩,怎么算都是零,然后就返回 null,自然就报空指针异常了。我改好了程序,供你参考:

import java.util.Scanner;

public class Project2 {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.println("请依次输入:a11、a12、a13、a21、a22、a23、a31、a32、a33\n");

int i, j;

double[][] number = new double[3][3];

double[][] number0 = new double[3][3];

for (i = 0; i  3; i++)

for (j = 0; j  3; j++)

number[i][j] = input.nextDouble();

System.out.println("Input Matrix is :");

System.out.println(number[0][0] + " " + number[0][1] + " "

+ number[0][2]);

System.out.println(number[1][0] + " " + number[1][1] + " "

+ number[1][2]);

System.out.println(number[2][0] + " " + number[2][1] + " "

+ number[2][2]);

number0 = inverse(number);

if (number0 != null) {

System.out.println("Inverse Matrix is :");

System.out.println(number0[0][0] + " " + number0[0][1] + " "

+ number0[0][2]);

System.out.println(number0[1][0] + " " + number0[1][1] + " "

+ number0[1][2]);

System.out.println(number0[2][0] + " " + number0[2][1] + " "

+ number0[2][2]);

} else

System.out.println("矩阵的秩为零");

}

public static double[][] inverse(double[][] A) {

double z;

double A1, B, C, D, E, F, G, H, I;

// double [][] num = new double [3][3];

double[][] num0 = new double[3][3];

System.out.println("Inverse Matrix A is :");

System.out.println(A[0][0] + " " + A[0][1] + " " + A[0][2]);

System.out.println(A[1][0] + " " + A[1][1] + " " + A[1][2]);

System.out.println(A[2][0] + " " + A[2][1] + " " + A[2][2]);

z = A[0][0] * A[1][1] * A[2][2] + A[2][0] * A[0][1] * A[1][2] + A[0][2]

* A[1][0] * A[2][1] - A[0][2] * A[1][1] * A[2][0] - A[0][0]

* A[1][2] * A[2][1] - A[2][2] * A[1][0] * A[0][1];

if (z == 0)

return null;

else {

A1 = A[0][0];

B = A[0][1];

C = A[0][2];

D = A[1][0];

E = A[1][1];

F = A[1][2];

G = A[2][0];

H = A[2][1];

I = A[2][2];

num0[0][0] = 1 / z * (E * I - F * H);

num0[0][1] = 1 / z * (C * H - B * I);

num0[0][2] = 1 / z * (B * F - C * E);

num0[1][0] = 1 / z * (F * G - D * I);

num0[1][1] = 1 / z * (A1 * I - C * G);

num0[1][2] = 1 / z * (C * D - A1 * F);

num0[2][0] = 1 / z * (D * H - E * G);

num0[2][1] = 1 / z * (B * H - A1 * H);

num0[2][2] = 1 / z * (A1 * E - B * D);

return num0;

}

}

}

java代码修改

Button b1=new Button("加速");

b1.addActionListener(new aw());

animationPanel.add(b1,BorderLayout.WEST);

Button b2=new Button("减慢");

b2.addActionListener(new ax());

animationPanel.add(b2,BorderLayout.EAST);

Button b3=new Button("停止");

b3.addActionListener(new ay());

animationPanel.add(b3,BorderLayout.SOUTH);

Button b4=new Button("开始");

b4.addActionListener(new az());

animationPanel.add(b4,BorderLayout.NORTH);

这个改成

Button b1=new Button("加速");

b1.addActionListener(new aw());

add(b1,BorderLayout.WEST);

Button b2=new Button("减慢");

b2.addActionListener(new ax());

add(b2,BorderLayout.EAST);

Button b3=new Button("停止");

b3.addActionListener(new ay());

add(b3,BorderLayout.SOUTH);

Button b4=new Button("开始");

b4.addActionListener(new az());

add(b4,BorderLayout.NORTH);

因为看不到你的其他代码,这一行要去掉

animationPanel.setLayout(new BorderLayout());

求java的增删改查代码

ResultSet rs=s.executeQuery("select * from teacher"); //查询语句

s.executeUpdate("update into teacher set ....."); //插入,更新 ,删除语句

/**

*插入,更新 ,删除

*主要就是SQL语句不同

*/


本文名称:java修改的代码大全,java修改密码代码
当前网址:http://scyingshan.cn/article/phejso.html