Lost two closing brackets:

  • after line 55 and 91

A little help
put the 57 line in place of 54 line
Look at results.

Use plain text editor.

I recommend examples from the book:[URL="http://filthyrichclients.org/"]http://filthyrichclients.org/[/URL]
download Examples
Chapter 8, Image Processing
go to
CustomImageOp and GraphicsUtilities - very useful methods
[CODE]
public final float[] FILTER_3x3 = {
0.1f, 0.1f, 0.1f,
0.1f, 0.4f, 0.1f,
0.1f, 0.1f, 0.1f
};[/CODE]

implement stack URGENT

jon.kiparsky commented: Good answer. +2

Your code should like this:
[CODE]package macey;

/**

  • @author Mike
    /
    import java.awt.
    ;
    import java.awt.event.;
    import javax.swing.
    ;

public class NormCalcDev implements ActionListener {

private JTextField calcDisplayF;

public NormCalcDev() {
    // Content Pane
    ...
    calcDisplayF = new JTextField();
    // calcDisplayF.setEnabled(false);
    ...
}

public void actionPerformed(ActionEvent e) {

    if (e.getActionCommand().equals("1") != false) {
        calcDisplayF.setText("1");
    } else {
        calcDisplayF.setText("Other Button");
    }
}

public static void main(String[] args) {
    // Creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            new NormCalcDev();
        }
    });
}

}[/CODE]
Line 36 create new instance of NormCalcDev class
Line 14 constructor of NormCalcDev class
Line 12,17 variable [I]JTextField calcDisplayF[/I] need be declared outside the constructor to be visible
Line 31 need be [I]static[/I]

[CODE]
boolean all() {
//&&
int counter = 0;
for (int j = 0; j < errorList.length; j++) {
if (errorList[j] == 0) {
counter++;
}
}
return counter == errorList.length;
}

boolean oneOf() {
    //||
    for (int j = 0; j < errorList.length; j++) {
        if (errorList[j] != 0) {
            return true;
        }
    }
    return false;
}

...

    if (oneOf()) {
        System.arraycopy(newWeight, 0, initialWeight, 0, row);
    }

...

[/CODE]

useful: [URL="http://en.wikipedia.org/wiki/De_Morgan's_laws"]http://en.wikipedia.org/wiki/De_Morgan's_laws[/URL]

I like posts like this.
It is like checking to Newton's law of the apple falling to head from a tree.
Graph is also needed to compare the results with a certain amount of starts.
First look, very cursory: [B]mutChance[/B] is absence in calculations. Why?

(my English reflects the degree of perfection google translator)

train 2 examples:
[CODE]import java.awt.BorderLayout;
import javax.swing.JApplet;
import javax.swing.JSlider;

public class NewJApplet extends JApplet {

int initValue = 10;
int minimum = 10;
int maximum = 20;
JSlider slider = new JSlider(JSlider.HORIZONTAL, minimum, maximum, initValue);

@Override
public void init() {
    add(slider,BorderLayout.NORTH); //add the slider to the panel
    slider.setLocation(400, 40);
    System.out.println(this.getLayout());
}    

}
//result: java.awt.BorderLayout[hgap=0,vgap=0] <-- default border [/CODE]
[CODE]import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.JApplet;
import javax.swing.JPanel;
import javax.swing.JSlider;

public class NewJApplet1 extends JApplet {

int initValue = 10;
int minimum = 10;
int maximum = 20;
JSlider slider = new JSlider(JSlider.HORIZONTAL, minimum, maximum, initValue);

@Override
public void init() {
    JPanel northPanel = new JPanel();
    northPanel.setPreferredSize(new Dimension(600, 100));
    northPanel.setBackground(Color.red);
    northPanel.setLayout(null);//!!!!!!!!!! all in your hands

    northPanel.add(slider); //add the slider to the panel
    slider.setLocation(400, 40);
    slider.setSize(160, 20);// !!!!!!!!!!!!!!! try comment this line

    add(northPanel, BorderLayout.NORTH);
    System.out.println(northPanel.getLayout());
    System.out.println(slider.getLocation());

     System.out.println(new Point());
}
// TODO overwrite start(), stop() and destroy() methods

}
//result: null
//java.awt.Point[x=400,y=40]
//java.awt.Point[x=0,y=0] <-- default point[/CODE]

shakssage commented: Very good code examples. Shows time spent on answer. Thanks +1

the result of 1.0/2500.0 is worrying!
seanbp, have you patience?

run:
2E10+1
RESULT: 2.0E10
2E2+1
RESULT: 201.0
2E2^2
RESULT: 40000.0
2E2^-2
java.lang.NumberFormatException: For input string: "2.5E"
run:
2^2
RESULT: 4.0
-2^2
RESULT: 4.0
-2^3
RESULT: -8.0
-2^(2)
RESULT: 4.0
-2^(-2)
RESULT: 0.25
-2^-2
RESULT: 0.25
2E2^(-2)
java.lang.NumberFormatException: For input string: "2.5E"
run:
2E2
RESULT: 200.0
200^2
RESULT: 40000.0
200^-2
java.lang.NumberFormatException: For input string: "2.5E"
run:
200^(-2)
java.lang.NumberFormatException: For input string: "2.5E"

  • run:
    20^(-2)
    RESULT: 0.0025
    30^-2
    RESULT: 0.0011111111
    9^9^9
    RESULT: Infinity
    100^-2
    java.lang.NumberFormatException: For input string: "1.0E"
    50^-2
    java.lang.NumberFormatException: For input string: "4.0E"
    1/50^2
    java.lang.NumberFormatException: For input string: "4.0E"
    run:
    50^2
    RESULT: 2500.0
    1/2500.0
    java.lang.NumberFormatException: For input string: "4.0E"
    run:
    1.0/2500.0
    java.lang.NumberFormatException: For input string: "4.0E"
javaAddict commented: For the trouble you went through to write this +7

As usual, page 2 is shown, but I have not noticed this.
[QUOTE]I guess that IF...THEN should be added to GraphicDragController in order to check an image to be moved.[/QUOTE]
So, too quickly I removed this option (usefull)
Line 107 fault

line 2,7 delete them, you have direct access to x, y, w, h, (extends Rectangle!)
Rectangle have a method contains(Point p)
In place of 13 write return super.contains(p)
[CODE]
public void drawImage(Graphics2D g2) {
g2.drawImage(bi, x, y, null);
}[/CODE]
Invoke this method for two images in Drag1 paintComponent(...) method
[CODE]
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
img1.drawImage(g2);
img2.drawImage(g2);
}[/CODE]
//
[CODE]
class GraphicDragController extends MouseInputAdapter {

Drag2 component;

public GraphicDragController(Drag2 gdad) {
    component = gdad;
    component.addMouseListener(this);
    component.addMouseMotionListener(this);
}

public void mousePressed(MouseEvent e) {
    Point p = e.getPoint();
    component.img1.mousePressed(p);
    component.img2.mousePressed(p);
    component.repaint();
}

public void mouseReleased(MouseEvent e) {
    component.img1.mouseReleased();
    component.img2.mouseReleased();
    component.repaint();
}

public void mouseDragged(MouseEvent e) {
    Point p = e.getPoint();
    component.img1.mouseDragged(p);
    component.img2.mouseDragged(p);
    component.repaint();
}

}[/CODE]
Class ImageRectangle should handle mouse events

Loading images put to the constructor
[CODE]
ImageRectangle img1;
ImageRectangle img2;

public Drag1() {
    try {
        Image image1 = ImageIO.read(getClass().getResource("ScanImage30.jpg"));
        BufferedImage bi1 = new BufferedImage(image1.getWidth(this), image1.getHeight(this),
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D big = bi1.createGraphics();
        big.drawImage(image1, 0, 0, this);
        img1 = new ImageRectangle("alfa", 10, 100, bi1.getWidth(), bi1.getHeight(), bi1);

        Image image2 = ImageIO.read(getClass().getResource("y00000001.jpg"));
        BufferedImage bi2 = new BufferedImage(image2.getWidth(this), image2.getHeight(this),
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D big2 = bi2.createGraphics();
        big2.drawImage(image2, 0, 0, this);
        img2 = new ImageRectangle("beta", 100, 100, bi2.getWidth(), bi2.getHeight(), bi2);
    } catch (IOException ex) {
        //
    }
}[/CODE]

This works fine with swing components
[CODE]
public Testing() {
initComponents();
this.remove(jPanel2); // remove no add once more!
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    this.remove(jPanel1);
    this.add(jPanel2);
    this.repaint();
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    this.remove(jPanel2);
    this.add(jPanel1);
    this.repaint();
}[/CODE]

[CODE]
//to view set
//jPanel1.setOpaque(false);
//jPanel2.setOpaque(false);[/CODE]

ajst commented: This Post was really helpful and solved my question +1

catch java.lang.NullPointerException
for example
[CODE]
try
{
data_set = SQL_query.getData();
table.addData(data_set);
}
catch (NullPointerException nullPointer)
{
table.addData(NULL_DATA_SET); // in case of NullPointerException
}
[/CODE]

No, jotTable.setFillsViewportHeight(true) has a different purpose (sometimes solve the specific problems of visibility of jotTable in the GUI ).

Some info about exceptions:Effective Java NullPointerException Handling
[URL="http://www.javaworld.com/community/node/2833"]http://www.javaworld.com/community/node/2833[/URL]

unreported exception java.lang.Exception;
TWO WAYS
must be caught //handling error in place
-->[CODE] else {
try {
throw new Exception();
} catch (Exception ex) {
// here your reaction on error
}
}[/CODE]
or
declared to be thrown.
add throws clause:
[CODE] public void setRectangle(int initialX, int initialY, int initialWidth, int initialHeight) throws Exception {[/CODE]
//propagate error

peter_budo commented: Yay, replied faster then me. Good one +15

this mean: YOU
should first create the array with the initial employees’ salaries
and then update the salaries to show the 30% increase

Read Me: Starting "Java" [Java tutorials / resources / faq] - first thread on the page

in this case is no need to use two for-loops (redundant calculations)
[CODE=java]
for (int row = 0; row < arr.length; row++) {
//for (int col = 0; col < arr[row].length; col++) {
sum = arr[row][0] + arr[row][arr[row].length - 1];
//}
System.out.println("The sum of the first and last elements of Row " + row + " is " + sum + ".");
}[/CODE]
other variant:
[CODE=java]
for (int row = 0; row < arr.length; row++) {
sum = 0;
for (int col = 0; col < arr[row].length; col++) {
if (col == 0 || col == arr[row].length - 1) {
sum += arr[row][col];
}
}
System.out.println("*The sum of the first and last elements of Row " + row + " is " + sum + ".");
}[/CODE]

from my resources
[CODE]
public void deleteData() {
int rows = getRowCount();
if (rows == 0) {
return;
}
cache.clear();
fireTableRowsDeleted(0, rows - 1);
}[/CODE]

follow this example, first
[CODE]
public static void main(String[] args) {
int arr[][] = {{5, 9, 6}, {3, 2, 8}, {7, 0, 1}};
for (int row = 0; row < arr.length; row++) {
for (int col = 0; col < arr[row].length; col++) {
System.out.println("arr[" + row + "][" + col + "] = " + arr[row][col]);
}
System.out.println();
}
}[/CODE]
define the first and last INDEX of elements of row
-first - by default -- zero
-last - calculate last INDEX
make sum if your index is first or last

To finally finish this topic I enclose a short program, which was created as a side effect of working on this theme:
[CODE=java]
package peter_budo;

import java.util.ArrayList;
import java.util.List;

/*

  • @author j3c 17 marca 2009
  • Created on 2010-09-09, 12:01:11
    */
    public class DetectUnicodeBlocks {

    //static final int LAST_UNICODE = 0x10FFFF;//1114112; j++) {//
    private List blockList = new ArrayList();
    private boolean DEBUG;

    public DetectUnicodeBlocks() {
    detectUnicodeBlocks();
    if (DEBUG) {
    for (ItemBlock inner : blockList) {
    System.out.println(inner);
    }
    }
    }

    public String[] getModel() {
    String[] model = new String[blockList.size()];
    int i = 0;
    for (ItemBlock inner : blockList) {
    model[i++] = inner.name;
    }
    return model;
    }

    public String[] getModelDescription() {
    String[] model = new String[blockList.size()];
    int i = 0;
    for (ItemBlock inner : blockList) {
    model[i++] = inner.toString();
    }
    return model;
    }

    int getFrom(String in) {
    for (ItemBlock inner : blockList) {
    if (in.equals(inner.name)) {
    return inner.from;
    }
    }
    return -1;
    }

    int getTo(String in) {
    for (ItemBlock inner : blockList) {
    if (in.equals(inner.name)) {
    return inner.to;
    }
    }
    return -1;
    }

    String getName(String in) {
    for (ItemBlock inner : blockList) {
    if (in.equals(inner.name)) {
    return inner.toString();
    }
    }
    return null;
    }

    class ItemBlock {

    String name;
    int from;
    int to;
    //Character ch;
    
    public ItemBlock(String name, int from, int to) {//, Character ch
        this.name = name;
        this.from = from;
        this.to = to;
        //this.ch = ch;
        if (DEBUG) {
            System.out.println("*" + toString());
        }
    }
    
    @Override
    public String toString() {
        return (name + "[" + Integer.toHexString(from) + "-" + Integer.toHexString(to) + ...
peter_budo commented: Hehe nice +15

OK. Step by step:
[QUOTE]the changePositionX method, which is currently empty[/QUOTE]
My recommendations from "Two dimensions: X&Y":
Line 7:car.changePositionY(sLeftY); // same as your current method car.changePosition
Line 10:car.changePositionX(sLeftX); // write a new one
My recommendations from "AffineTransform, Graphics 2D":
Make your method rotatePosition() same as changePosition method with angle parameter.

[CODE=java]
public void run() {
while (true) {
this.requestFocus();
i++;
/////////
{// the best way is put this code with N,E,S,W,R values into Car class
// in the method car.go();
// here should be invocation of method: car.go();
//REALIZE of STATE
if (N) {
sLeftY -= 1;
car.changePositionY(sLeftY);
} else if (E) {
sLeftX -= 1;
car.changePositionX(sLeftX);
} else if (S) {
//TODO
} else if (W) {
//TODO
} else if (R) {
sRot -= 1;
car.changeRot(sRot);
}
//CHANGE of STATE
//boundary conditions
if (sLeftY == 365) {
// condition for end of car go straight
N = false;
W = false;
S = false;
E = false;
R = true;
}
if (sRot == -90) {
// condition for end of car left rotation
N = false;
W = false;
S = false;
E = true;
R = false;
}
if (sLeftX <= 24) {
// condition for end of car simulation (do nothing-for example)
N = false;
W = false;
S = false;
E = false;
R = false;
}

            // other conditions
        }
        /////////
        repaint();

        try {
            t.sleep(1000 / 100);//30
        } catch (InterruptedException e) {
            //
        }
    }
}[/CODE]

class Car
[CODE=java]
public void paint(Graphics g) ...

Make your method rotatePosition() same as changePosition method with angle parameter.
Use Graphics 2D.
Treat same all transformations.
Reply, where is your center of car? (dimensions of car)
Where is your center of rotation? (turning radius)
Before rotating of car you need somthing translate it. After rotating return to previous values.
Here is car's paint method:
[CODE=java]
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;

        Polygon pgon = new Polygon(iX, iY, 4);

        AffineTransform tx = new AffineTransform();
        int dx = -20;
        int dy = 0;
        tx.translate(posX + dx, posY + dy);
        //tx.translate(posX, posY);
        tx.rotate(angle);
        tx.translate(-dx, -dy);
        Shape pgonT = tx.createTransformedShape(pgon);
        g2.setColor(cColor);
        g2.fill(pgonT);
        g2.setColor(Color.black);
        g2.draw(pgonT);
    }[/CODE]

You have 4 possible directions: N,E,S,W.
Implement them as boolean values.
In your code N=true, E=S=W=false.
Inside method check this N,E,S,W values.
[CODE=java]public void run() {
while (true) {
this.requestFocus();
i++;
if (N) {
sLeftY -= 5;
car.changePositionY(sLeftY); // same as your current method car.changePosition
} else if (E) {
sLeftX -= 5;
car.changePositionX(sLeftX); // write a new one
} else if (S) {
//TODO
} else {//W
//TODO
}

        if (sLeftY == 365) {
            car.rotatePosition();
            N = false;
            W = false;
            S = false;
            E = true;

            sLeftY = 570;
        }
        // other conditions
        repaint();
        ...

[/CODE]

[CODE]
@Override
public void paint(Graphics g) {
super.paint(g); /// <-- lame laughs here
resize(200, 200);
}[/CODE]

mitch9654 commented: Sweet! thanks for the super.paint(g); solution!!! +1

Try of use [I]revalidate(), invalidate(), repaint()[/I] and other similar methods clearly indicate a EDT problem (Event Dispatch Thread)
read and follow the given solutions:
[URL="http://mindprod.com/jgloss/swingthreads.html"]http://mindprod.com/jgloss/swingthreads.html[/URL]

array is two dimensional, adress of any element of array have two components r and c
two loops:
[CODE=java]public static void main(String[] args) {
double[][] array = new double[10][2];
for (int r = 0; r < array.length; r++) {
for (int c = 0; c < array[r].length; c++) {
array[r][c]=2;// example
System.out.println(array[r][c]);
}
}
}[/CODE]
or one loop-for:
[CODE=java]
public static void main(String[] args) {
double number1 = 111;//example
double number2 = 22;//example
double[][] array = new double[10][2];
for (int r = 0; r < array.length; r++) {
array[r][0] = number1;
array[r][1] = number2;
System.out.println(array[r][0]);
System.out.println(array[r][1]);
System.out.println();

    }
}[/CODE]

//
array[r] -- at this adress is the second one-dimensional table: double[]
[URL="http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html"]http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html[/URL]

bibiki use Runnable interface with method run() , an start new Thread
[CODE=java]import javax.swing.;
import java.awt.
;

public class Bully extends JPanel implements Runnable {

private Testi aa;
private Tooopi bb;

public Bully() {
    JFrame korniza = new JFrame();
    korniza.getContentPane().add(this);
    korniza.setSize(500, 500);
    korniza.setTitle("Bull's Eye");
    korniza.setVisible(true);
    korniza.setDefaultCloseOperation(3);
    aa = new Testi();
    bb = new Tooopi();
    //
    Thread th = new Thread(this);
    th.start();
}

public void paintComponent(Graphics g) {
    g.setColor(Color.yellow);
    g.fillRect(0, 0, 500, 500);
    aa.paintsquares(20, 20, 20, 400, g);
    bb.tupi(g);
}

public void run() {
    while (true) {
        repaint();
        try {
            Thread.sleep(100);
        } catch (InterruptedException ex) {
            //
        }
    }
}

public static void main(String[] args) {
    new Bully();
}

}[/CODE]
or use: TimerTask,Timer classes
[URL="http://www.java-tips.org/java-se-tips/java.awt/how-to-create-animation-paint-and-thread.html"]http://www.java-tips.org/java-se-tips/java.awt/how-to-create-animation-paint-and-thread.html[/URL]