主题:有没有强人帮忙做个java题呀 紧急
有人会做吗 谢谢了
import java.io.*;
import java.awt.image.*;
import javax.imageio.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class A1 extends JFrame implements ActionListener {
private final int RED=0,GREEN=1,BLUE=2; // the rgb component
private BufferedImage bi = null; // the image buffer
private int[][][] pixels2D = null; // Array storing RGB values of pixels
private int[] pixels = null;
private int w,h; //Width and height of image
private JTextField xTextField, yTextField; //x-coordinate and y-coordiate
private int offset = 3;
/*
* Initializes components
*/
public A1(String fileName) {
setTitle(fileName);
Container visibleArea = getContentPane();
JPanel mousePanel = new JPanel();
// complete this ...
// Stage 1) Create two textbox controls
// complete this ...
// Stage 2) Read the bmp image file
ImageCanvas imageCanvas = new ImageCanvas(this,bi);
visibleArea.add(imageCanvas, BorderLayout.CENTER);
// Complete this...
// Stage 2: Read the width and height of the image file
setSize(w+50, h+100);
// get the RGB values and store into a single-dimensional array
//Stage 3:
//Stage 4:
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
/*
* Writes the RGB values of the selected position
*/
public void actionPerformed(ActionEvent e) {
try {
// Complete this ...
// Stage 1: Display the mouse coordinate position
// Stage 4: Display the RGB component values
} catch (Exception ex) {
System.out.println("ERROR");
}
}
/*
* Main method
*/
public static void main(String[] args) {
if (args.length>0){
new A1(args[0]);
}
else new A1("731.bmp");
}
/*
* Converts the one-dimensional array to 2-d array of RGB values
*/
private int[][][] convertOneDimTwoDim(int[] pixels,int w, int h){
int[][][] pixels2D=new int[w][h][3];
// complete this ...
// Stage 3: Converting array
return pixels2D;
}
/*
* Writes the RGB values of the selected position
*/
private void writeArrays( int xPos, int yPos) {
int redAverage, greenAverage, blueAverage;
try {
// complete this ...
// Stage 4: Display the RGB component values
} catch(Exception e) {
System.out.println("Error");
}
}
}
import java.io.*;
import java.awt.image.*;
import javax.imageio.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class A1 extends JFrame implements ActionListener {
private final int RED=0,GREEN=1,BLUE=2; // the rgb component
private BufferedImage bi = null; // the image buffer
private int[][][] pixels2D = null; // Array storing RGB values of pixels
private int[] pixels = null;
private int w,h; //Width and height of image
private JTextField xTextField, yTextField; //x-coordinate and y-coordiate
private int offset = 3;
/*
* Initializes components
*/
public A1(String fileName) {
setTitle(fileName);
Container visibleArea = getContentPane();
JPanel mousePanel = new JPanel();
// complete this ...
// Stage 1) Create two textbox controls
// complete this ...
// Stage 2) Read the bmp image file
ImageCanvas imageCanvas = new ImageCanvas(this,bi);
visibleArea.add(imageCanvas, BorderLayout.CENTER);
// Complete this...
// Stage 2: Read the width and height of the image file
setSize(w+50, h+100);
// get the RGB values and store into a single-dimensional array
//Stage 3:
//Stage 4:
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
/*
* Writes the RGB values of the selected position
*/
public void actionPerformed(ActionEvent e) {
try {
// Complete this ...
// Stage 1: Display the mouse coordinate position
// Stage 4: Display the RGB component values
} catch (Exception ex) {
System.out.println("ERROR");
}
}
/*
* Main method
*/
public static void main(String[] args) {
if (args.length>0){
new A1(args[0]);
}
else new A1("731.bmp");
}
/*
* Converts the one-dimensional array to 2-d array of RGB values
*/
private int[][][] convertOneDimTwoDim(int[] pixels,int w, int h){
int[][][] pixels2D=new int[w][h][3];
// complete this ...
// Stage 3: Converting array
return pixels2D;
}
/*
* Writes the RGB values of the selected position
*/
private void writeArrays( int xPos, int yPos) {
int redAverage, greenAverage, blueAverage;
try {
// complete this ...
// Stage 4: Display the RGB component values
} catch(Exception e) {
System.out.println("Error");
}
}
}