Help for Connect4 game java.

Hello, I am attending Java in the university, previously worked in C++, for my first work on java to me to make the Game of Connect 4 with GUI, navigating the forums i found a code for this game, well this code has a few problems, first the methods checkDiagonalFromTopLeft or checkDiagonalFromBottomLeft dosnt work, especial checkDiagonalFromBottomLeft, second when the 1st game is played and second game is coming the circle is yellow , taht to be RED NOT YELLOW well I NEED YOUR help guys please help mee
the code please see heckDiagonalFromTopLeft checkDiagonalFromTopLeft
especially heckDiagonalFromTopLeft
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Tallers1
     static class Connect4
          extends JPanel
          private static final int SIZE= 30;
          private static final int GAP= 10;
          private static final int ROWS= 6;
          private static final int COLS= 7;
          private Color mColor;
          private Color[][] mCounters;
          public Connect4()
               reset();
               addMouseListener(new MouseAdapter() {
                    public void mousePressed(MouseEvent e) {
                         hitTest(e.getPoint());
          private void hitTest(Point point) {
int row = Math.min((point.y / (SIZE+GAP)*ROWS) / ROWS, ROWS-1);
int col = Math.min((point.x / (SIZE+GAP)*COLS) / COLS, COLS-1);
               if (mCounters[col][row] == null) {
                    for (row= ROWS-1; row >= 0; row--) {
                         if (mCounters[col][row] == null) {
                              mCounters[col][row]= mColor;
                              repaint();
                              check(col, row);
                              mColor= mColor == Color.RED ?
                                   Color.YELLOW : Color.RED;
                              return;
          private void check(int col, int row)
               if (checkVertical(col) ||
                    checkHorizontal(row) ||
                    checkDiagonalFromTopLeft(col, row) ||
                    checkDiagonalFromBottomLeft(col, row))
                    alert();
          private boolean checkDiagonalFromTopLeft(int col, int row)
               if (col >= row) {
                    col= col-row;
                    row= 0;
               else {
                    row= row-col;
                    col= 0;
               for (int cnt= 0; row < ROWS && col < COLS; row++, col++) {
                    if (mCounters[col][row] == mColor) {
                         if (++cnt >= 4)
                              return true;
                    else
                         cnt= 0;
               return false;
          private boolean checkDiagonalFromBottomLeft(int col, int row) {
if(row >= ROWS-1) {
// do nowt and move on to the checking.
else {
int delta= Math.min(3, col);
col= Math.max(0, col-delta);
row= Math.min(ROWS-1, row+delta);
for (int tally= 0; row >= 0 && col < COLS; row--, col++) {
if (mCounters[col][row] == mColor) {
if (++tally >= 4)
return true;
} else
tally= 0;
return false;
          private boolean checkVertical(int col)
               for (int cnt= 0, row= 0; row < ROWS; row++) {
                    if (mCounters[col][row] == mColor) {
                         if (++cnt >= 4)
                              return true;
                    else
                         cnt= 0;
               return false;
          private boolean checkHorizontal(int row)
               for (int cnt= 0, col= 0; col < COLS; col++) {
                    if (mCounters[col][row] == mColor) {
                         if (++cnt >= 4)
                              return true;
                    else
                         cnt= 0;
               return false;
          private void alert()
               int option= JOptionPane.showConfirmDialog(this,
                    (mColor == Color.RED ? "Red" : "Yellow") +
                         " wins! Want to go again?",
                    "Game Over",
                    JOptionPane.YES_NO_OPTION);
               if (option == JOptionPane.YES_OPTION)
                    reset();
               else
                    System.exit(0);
          private void reset()
               mCounters= new Color[COLS][ROWS];
               mColor= Color.RED;
               repaint();
          public void paint(Graphics g)
               g.setColor(Color.BLUE);
               g.fillRect(0, 0, getSize().width, getSize().height);
               for (int col= 0; col< COLS; col++) {
                    for (int row= 0; row< ROWS; row++) {
                         g.setColor(mCounters[col][row] == null ?
                              Color.WHITE : mCounters[col][row]);
                         g.fillOval(
                              GAP+((GAP+SIZE)*col),
                              GAP+((GAP+SIZE)*row),
                              SIZE, SIZE);
          public Dimension getPreferredSize()
               return new Dimension(
                    ((SIZE+GAP)*COLS) +GAP,
                    ((SIZE+GAP)*ROWS) +GAP);
     public static void main(String[] argv)
          JFrame frame= new JFrame();
          frame.getContentPane().add(new Connect4());
          frame.pack();
          frame.setResizable(false);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
}

hi, 2) the GUI is from the forums the algorhytm is made by me, so i need to now wy the diagonal dostn Work ON GUI please, sorry my bad english i m from argentina
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Tallers1
static class Connect4
extends JPanel
private static final int SIZE= 30;
private static final int GAP= 10;
private static final int ROWS= 6;
private static final int COLS= 7;
private Color mColor;
private Color[][] mCounters;
public Connect4()
reset();
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
hitTest(e.getPoint());
private void hitTest(Point point) {
int row = Math.min((point.y / (SIZE+GAP)*ROWS) / ROWS, ROWS-1);
int col = Math.min((point.x / (SIZE+GAP)*COLS) / COLS, COLS-1);
if (mCounters[col][row] == null) {
for (row= ROWS-1; row >= 0; row--) {
if (mCounters[col][row] == null) {
mCounters[col][row]= mColor;
repaint();
check(col, row);
mColor= mColor == Color.RED ?
Color.YELLOW : Color.RED;
return;
private void check(int col, int row)
if (checkVertical(col) ||
checkHorizontal(row) ||
checkDiagonalFromTopLeft(col, row) ||
checkDiagonalFromBottomLeft(col, row))
alert();
private boolean checkDiagonalFromTopLeft(int col, int row)
if (col >= row) {
col= col-row;
row= 0;
else {
row= row-col;
col= 0;
for (int cnt= 0; row < ROWS && col < COLS; row++, col++) {
if (mCounters[col][row] == mColor) {
if (++cnt >= 4)
return true;
else
cnt= 0;
return false;
private boolean checkDiagonalFromBottomLeft(int col, int row) {
if(row >= ROWS-1) {
// do nowt and move on to the checking.
else {
int delta= Math.min(3, col);
col= Math.max(0, col-delta);
row= Math.min(ROWS-1, row+delta);
for (int tally= 0; row >= 0 && col < COLS; row--, col++) {
if (mCounters[col][row] == mColor) {
if (++tally >= 4)
return true;
} else
tally= 0;
return false;
private boolean checkVertical(int col)
for (int cnt= 0, row= 0; row < ROWS; row++) {
if (mCounters[col][row] == mColor) {
if (++cnt >= 4)
return true;
else
cnt= 0;
return false;
private boolean checkHorizontal(int row)
for (int cnt= 0, col= 0; col < COLS; col++) {
if (mCounters[col][row] == mColor) {
if (++cnt >= 4)
return true;
else
cnt= 0;
return false;
private void alert()
int option= JOptionPane.showConfirmDialog(this,
(mColor == Color.RED ? "Red" : "Yellow") +
" wins! Want to go again?",
"Game Over",
JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION)
reset();
else
System.exit(0);
private void reset()
mCounters= new Color[COLS][ROWS];
mColor= Color.RED;
repaint();
public void paint(Graphics g)
g.setColor(Color.BLUE);
g.fillRect(0, 0, getSize().width, getSize().height);
for (int col= 0; col< COLS; col++) {
for (int row= 0; row< ROWS; row++) {
g.setColor(mCounters[col][row] == null ?
Color.WHITE : mCounters[col][row]);
g.fillOval(
GAP+((GAP+SIZE)*col),
GAP+((GAP+SIZE)*row),
SIZE, SIZE);
public Dimension getPreferredSize()
return new Dimension(
((SIZE+GAP)*COLS) +GAP,
((SIZE+GAP)*ROWS) +GAP);
public static void main(String[] argv)
JFrame frame= new JFrame();
frame.getContentPane().add(new Connect4());
frame.pack();
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}

Similar Messages

  • Challange for you, help for me! java program

    I am a beginning java student and desparately (again) in help of someone who will check my java program. See below what they want from me, and try to make a program of it that works in all the ways that are asked. Thank you for helping me, i am running out of time.
    Prem Pradeep
    [email protected]
    Catalogue Manager II
    Specification:
    1.     Develop an object to represent to encapsulate an item in a catalogue. Each CatalogueItem has three pieces of information: an alphanumeric catalogue code, a name, and a price (in dollars and cents), that excludes sales tax. The object should also be able to report the price, inclusive of a 15% sales tax, and the taxed component of the price.
    2.     Data input will come from a text file, whose name is passed in as the first command-line argument to the program. This data file may include up to 30 data items (the program will need to be able to support a variable number of actual items in the array without any errors).
    3.     The data lines will be in the format: CatNo:Description:Price Use a StringTokenizer object to separate these data lines into their components.
    4.     A menu should appear, prompting the user for an action:
    a.     Display all goods: this will display a summary (in tabulated form) of all goods currently stored in the catalogue: per item the category, description, price excluding tax, payable tax and price including tax.
    b.     Dispfay cheapest/dearest goods: this will display a summary of all the cheapest and most expensive item(s) in the catalogue. In the case of more than one item being the cheapest (or most expensive), they should all be listed.
    c.     Sort the list: this will use a selection sort algorithm to sort the list in ascending order, using the catalogue number as the key.
    d.     Search the list: this will prompt the user for a catalogue number, and use a binary search to find the data. If the data has not yet been sorted, this menu option should not operate, and instead display a message to the user to sort the data before attempting a search
    5.     Work out a way to be able to support the inc tax/ex tax price accessors, and the tax component accessor, without needing to store any additional information in the object.
    6.     Use modifiers where appropriate to:
    a.     Ensure that data is properly protected;
    b.     Ensure that the accessors and mutators are most visible;
    c.     The accessors and mutators for the catalogue number and description cannot be overridden.
    d.     The constant for the tax rate is publicly accessible, and does not need an instance of the class present in order to be accessible.
    7.     The program should handle all exceptions wherever they may occur (i.e. file 1/0 problems, number formatting issues, etc.) A correct and comprehensive exception handling strategy (leading to a completely robust program) will be necessary and not an incomplete strategy (i.e. handling incorrect data formats, but not critical errors),
    Sample Execution
    C:\> java AssignmentSix mydata.txt
    Loading file data from mydata.txt ...17 item(s) OK
    CATALOGUE MANAGER: MAIN MENU
    ============================
    a) display all goods b) display cheapest/dearest goods
    c) sort the goods list d) search the goods list
    e) quit
    Option: d
    The goods cannot be searched, as the list is not yet sorted.
    CATALOGUE MANAGER: MAIN MENU
    ============================
    a) display all goods b) display cheapest/dearest goods
    c) sort the goods list d) search the goods list
    e) quit
    Option: b
    CHEAPEST GOODS IN CATALOGUE
    Cat      Description      ExTax      Tax      IncTax
    BA023      Headphones      23.00      3.45      26.45
    JW289      Tape Recorder     23.00      3.45      26.45
    MOST EXPENSIVE GOODS IN CATALOGUE
    Cat      Description      ExTax      Tax      IncTax
    ZZ338      Wristwatch      295.00 44.25      339.25
    CATALOGUE MANAGER: MAIN MENU
    ============================
    a) display all goods b) display cheapest/dearest goods
    c) sort the goods list d) search the goods list
    e) quit
    Option: c
    The data is now sorted.
    CATALOGUE MANAGER: MAIN MENU
    ============================
    a) display all goods b) display cheapest/dearest goods
    c) sort the goods list d) search the goods list
    e) quit
    Option: d
    Enter the catalogue number to find: ZJ282
    Cat Description ExTax Tax IncTax
    ZJ282 Pine Table 98.00 14.70 112.70
    CATALOGUE MANAGER: MAIN MENU
    ============================
    a) display all goods b) display cheapest/dearest goods
    c) sort the goods list d) search the goods list
    e) quit
    Option: e
    Here you have the program as far as I could get. Please try to help me make it compact and implement a sorting method.
    Prem.
    By the way: you can get 8 Duke dollars (I have this topic also in the beginnersforum)
    //CatalogueManager.java
    import java.io.*;
    import java.text.DecimalFormat;
    import java.util.StringTokenizer;
    public class CatalogueManager {
    // private static final double TAXABLE_PERCENTAGE = 0.15;
    // Require it to be publicly accessible
    // static means it is class variable, not an object instance variable.
    public static final double TAXABLE_PERCENTAGE = 0.15;
    private String catalogNumber;
    private String description;
    private double price;
    /** Creates a new instance of CatalogueManager */
    public CatalogueManager() {
    catalogNumber = null;
    description = null;
    price = 0;
    public CatalogueManager(String pCatalogNumber, String pDescription, double pPrice) {
    catalogNumber = pCatalogNumber;
    description = pDescription;
    price = pPrice;
    // the mutators must be most visible
    // the final keyword prevents overridden
    public final void setCatalogNumnber(String pCatalogNumber) {
    catalogNumber = pCatalogNumber;
    // the mutators must be most visible
    // the final keyword prevents overridden
    public final String getCatalogNumber() {
    String str = catalogNumber;
    return str;
    // the mutators must be most visible
    // the final keyword prevents overridden
    public final void setDescription(String pDescription) {
    description = pDescription;
    // the accessors must be most visible
    // the final keyword prevents overridden
    public final String getDescription() {
    String str = description;
    return str;
    // If the parameter is not a double type, set the price = 0;
    // the mutators must be most visible
    public boolean setPrice(String pPrice) {
    try {
    price = Double.parseDouble(pPrice);
    return true;
    catch (NumberFormatException nfe) {
    price = 0;
    return false;
    // the accessors must be most visible
    public double getPrice() {
    double rprice = price;
    return formatDouble(rprice);
    double getTaxAmount(){
    double rTaxAmount = price * TAXABLE_PERCENTAGE;
    return formatDouble(rTaxAmount);
    double getIncTaxAmount() {
    double rTaxAmount = price * (1 + TAXABLE_PERCENTAGE);
    return formatDouble(rTaxAmount);
    double formatDouble(double value) {
    DecimalFormat myFormatter = new DecimalFormat("###.##");
    String str1 = myFormatter.format(value);
    return Double.parseDouble(str1);
    public static void main(String[] args) throws IOException {
    final int MAX_INPUT_ALLOW = 30;
    int MAX_CURRENT_INPUT = 0;
    FileReader fr;
    BufferedReader br;
    CatalogueManager[] catalogList = new CatalogueManager[MAX_INPUT_ALLOW];
    String str;
    char chr;
    boolean bolSort = false;
    double cheapest = 0;
    double mostExpensive = 0;
    String header = "Cat\tDescription\tExTax\tTax\tInc Tax";
    String lines = "---\t-----------\t------\t---\t-------";
    if (args.length != 1) {
    System.out.println("The application expects one parameter only.");
    System.exit(0);
    try {
    fr = new FileReader(args[0]);
    br = new BufferedReader(fr);
    int i = 0;
    while ((str = br.readLine()) != null) {
    catalogList[i] = new CatalogueManager();
    StringTokenizer tokenizer = new StringTokenizer(str, ":" );
    catalogList.setCatalogNumnber(tokenizer.nextToken().trim());
    catalogList[i].setDescription(tokenizer.nextToken().trim());
    if (! catalogList[i].setPrice(tokenizer.nextToken())){
    System.out.println("The price column cannot be formatted as dobule type");
    System.out.println("Application will convert the price to 0.00 and continue with the rest of the line");
    System.out.println("Please check line " + i);
    if (catalogList[i].getPrice() < cheapest) {
    cheapest = catalogList[i].getPrice();
    if (catalogList[i].getPrice() > mostExpensive) {
    mostExpensive = catalogList[i].getPrice();
    i++;
    fr.close();
    MAX_CURRENT_INPUT = i;
    catch (FileNotFoundException fnfe) {
    System.out.println("Input file cannot be located, please make sure the file exists!");
    System.exit(0);
    catch (IOException ioe) {
    System.out.println(ioe.getMessage());
    System.out.println("Application cannot read the data from the file!");
    System.exit(0);
    boolean bolLoop = true;
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    do {
    System.out.println("");
    System.out.println("CATALOGUE MANAGER: MAIN MENU");
    System.out.println("============================");
    System.out.println("a) display all goods b) display cheapest/dearest goods");
    System.out.println("c) sort the goods list d) search the good list");
    System.out.println("e) quit");
    System.out.print("Option:");
    try {
    str = stdin.readLine();
    if (str.length() == 1){
    str.toLowerCase();
    chr = str.charAt(0);
    switch (chr){
    case 'a':
    System.out.println(header);
    System.out.println(lines);
    for (int i = 0; i < MAX_CURRENT_INPUT; i++){
    System.out.println(catalogList[i].getCatalogNumber() + "\t" +
    catalogList[i].getDescription() + "\t" +
    catalogList[i].getPrice() + "\t" +
    catalogList[i].getTaxAmount() + "\t" +
    catalogList[i].getIncTaxAmount());
    System.out.println("");
    break;
    case 'b':
    System.out.println("");
    System.out.println("CHEAPEST GOODS IN CATALOGUE");
    System.out.println(header);
    System.out.println(lines);
    for (int i = 0; i < MAX_CURRENT_INPUT; i++){
    if (catalogList[i].getPrice() == cheapest){
    System.out.println(catalogList[i].getCatalogNumber() + "\t" +
    catalogList[i].getDescription() + "\t" +
    catalogList[i].getPrice() + "\t" +
    catalogList[i].getTaxAmount() + "\t" +
    catalogList[i].getIncTaxAmount());
    System.out.println("");
    System.out.println("MOST EXPENSIVE GODS IN CATALOGUE");
    System.out.println(header);
    System.out.println(lines);
    for (int i = 0; i < MAX_CURRENT_INPUT; i++){
    if (catalogList[i].getPrice() == mostExpensive) {
    System.out.println(catalogList[i].getCatalogNumber() + "\t" +
    catalogList[i].getDescription() + "\t" +
    catalogList[i].getPrice() + "\t" +
    catalogList[i].getTaxAmount() + "\t" +
    catalogList[i].getIncTaxAmount());
    System.out.println("");
    break;
    case 'c':
    if (bolSort == true){
    System.out.println("The data has already been sorted");
    else {
    System.out.println("The data is not sorted");
    break;
    case 'd':
    break;
    case 'e':
    bolLoop = false;
    break;
    default:
    System.out.println("Invalid choice, please re-enter");
    break;
    catch (IOException ioe) {
    System.out.println("ERROR:" + ioe.getMessage());
    System.out.println("Application exits now");
    System.exit(0);
    } while (bolLoop);

    One thing you're missing totally is CatalogueItem!! A CatalogueManager manages the CatalogueItem's, and is not an CatalogueItem itself. So at least you have to have this one more class CatalogueItem.
    public class CatalogueItem {
    private String catalogNumber;
    private String description;
    private double price;
    //with all proper getters, setters.
    Then CatalogueManager has a member variable:
    CatalogueItem[] items;
    Get this straight and other things are pretty obvious...

  • Need Concept Help for a game

    OK, I'm wanting to make one of those games where you have a big matrix of circles, and if you click on one that'd adjacent to 2 or more of it's same color, you can remove it. I'm wondering what object I should use for those circles. I'm thinking I could use a JButton with a gif icon, or maybe use an Ellipse somehow. What I don't know is what objects I can use so that I can monitor whether my mouse is over it or whether I'm clicking it or something else. Advice from the more experienced would be appreciated. Thanks!

    it's never a good idea to use swing components in a game. It's much faster to draw the circles yourself. Here's an example of using an Ellipse for your circles:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    // <applet code="Circles.class" width="400" height="400"></applet>
    public class Circles extends Applet implements MouseMotionListener {
         Ellipse2D.Float e[];
         Image buffer;
         int w,h,x,y;
         public void init() {
              circles(20,20,20);
              w = getSize().width;
              h = getSize().height;
              buffer = createImage(w,h);
              x = -1;
              y = -1;
              addMouseMotionListener(this);
         protected void circles(int col,int row,int size) {
              e = new Ellipse2D.Float[row*col];
              int j,n,x = 0;
              for (j = 0;j < col;j++) {
                   for (n = 0;n < row;n++) {
                        e[x++] = new Ellipse2D.Float(j*size,n*size,size,size);
         public void mouseMoved(MouseEvent e) {
              x = e.getX();
              y = e.getY();
              repaint();
         public void mouseDragged(MouseEvent e) {
              mouseMoved(e);
         public void paint(Graphics g) {
              Graphics2D gfx = (Graphics2D)buffer.getGraphics();
              gfx.setColor(Color.white);
              gfx.fillRect(0,0,w,h);
              gfx.setColor(Color.black);
              for (int j = 0;j < e.length;j++) {
                   if (e[j].contains(x,y)) gfx.fill(e[j]);
                   else gfx.draw(e[j]);
              g.drawImage(buffer,0,0,null);
         public void update(Graphics g) {
              paint(g);
    }

  • Help for compiling first Java script

    Friends,
    I am a begginer java programmer. Iam trying to compile a java script using .bat file which contains
    c:\j2sdk\bin\javac -classpath <c:\j2sdk\lib\dt.jar> . ReadOnlyMaker.java
    But it comes back with error as below
    >c:\j2sdk\bin\javac -classpath ReadOnlyMaker.java 0<c:\j2sdk\lib\dt.jar 1>.
    Access is denied.
    I have admin rights on this machine but the directory j2sdk , where java is installed, is always staying readonly even after changing permissions in properties tab.
    Not sure what is going wrong , Any one can Pl. help ?
    Thanks,

    First of all you don't need to be in the ..\..\bin directory to execute the javac.exe, java.exe, etc pgms as commands. If not already set up correctly, you can just add this to your System PATH.
    Next, start by executing from the directory your .java PGM is in.
    Then, what is that <...> stuff?
    Lastly, if it's a .java file, it's a pgm file and not a javascript. Javascript goes is only for web work, embedded in html.
    ~Bill

  • Flash Player 17 Any help for Yahoo games?

    I have Flash Player 17
    It is the newest version. I checked other Yahoo games and they work fine on my Win7 OS. However, on Omaha Poker, a straight beats a flush, 3 of a kind beats a straight, and a flush beats a full house! I've even had a King beat 2 pair. The funny part is, one day the flush wins, the next day the straight beats the flush!
    I do, not have this problem with Texas Hold,'me poker. I checked my plug-ins, and only 1 Adobe FP is running (I know Google Chrome had problems with this, but not on my PC)
    What else could cause this to happen? I usually have only 1 or 2 devices running,and no more than 1 browser window open on each, I have the same problem with just 1 device on. I have a couple add-ons running, but their speed is less than 1/2 second total. Any help?
    TY
    Jackie

    I uninstalled by using Uninstall programs. Yes, activex for IE. By fails, I was using it to listen to wgnam.com (radio station). After installing V17 yesterday, & restarted the radio station this morning, the radio station wouldn't work, thus flash failed. After posting, I went back & installed V17 a couple more times & all of a sudden it started working!

  • !!!-Need help for terminating a Java thread in real time

    Hi everyone!
    I use J2SDK1.4.1 on a Unix platform.
    I want to terminate (or stop) a running java thread, which is dealing with time consuming tasks, in real-time (for example: the delay before the thread is terminated can't beyond one second), However, I don't know which techniques I can use to make sure the previous (or old) running java threads have been terminated?
    Could you please give me any help if you can?
    Any suggestion or reply will be kindly appreciated!
    Thanks!

    Thanks very much, jverd !
    I do set a flag that the thread should periodically check !
    Well, the scenario is like this:
    1. the thread read line by line (using BufferedReader) string from a probably huge-size file
    2. analyse each string read from the file if required (some strings may be omitted based on the user's operations), the analyzing process is a time-consuming task, and the analysing process may be terminated at any time the user want.
    3. record only the strings that have been analyzed by the previous process into a recording file
    The problem I meet is as follows: (Here, I suppose that it should take at least 30 seconds to finish analyse all the strings in a given huge file )
    1. the user start the analysing process, and run it for only 5 seconds,then stop the analyzing.
    2. the user start the analysing process again from the begining of the file(analyse the strings within the same file as previous step), and then stop the analysing process at 10 second. (it means, this time the analysing process is running for 10 seconds, still haven't finish analyse all the strings in the file).
    Once I open the record file, I saw some of the strings in the recording file have been repetitively record for 2 times, and the repetitive strings are just the strings the analysing time from at 5 second to at 10 second.
    And the repetitive times are depend on how many time the user start and stop the analysing process using the same file. for example, based on the above two steps, the user do the third step as follow:
    3. the user start the analysing process once again, analyse the same file,too. And run it for 15 seconds
    This time open the recording file, this time I saw some of the strings have been repetitively record for 3 times, and the repetitive strings are just the strings the analysing time from at 10 second to at 15 second.
    So, I guess the problem is probably because the previous analysing threads haven't been terminated completely, or say they just are blocked or set as inactive etc., then when the next time start the analysing process, the old threads will be reactive,and rerun ffrom the last time they are blocked.
    I hope you had catched what I mean, if you not, please ust let me know, I'll try to explain it again.
    Thanks once again!

  • Need help for traping imported java bean exception

    hi everyone
    i have imported a java bean into my forms 9i using java importer utility which tries to rename a file on a give path(bean works fine when executed through sql client).
    i have problem when called from when button pressed trigger, it throws me an ("FRM-40735 and ORA-105101 NON ORACLE EXCEPTION") error.
    i have imported java.lang.exception class and constructed an exception handler to trap java exception in the trigger
    as
    EXCEPTION
         WHEN ORA_JAVA.JAVA_ERROR then
              message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
              --check for ORA-105101
         WHEN ORA_JAVA.EXCEPTION_THROWN THEN
              ex:= ORA_JAVA.LAST_EXCEPTION;
              message('Java Exception --: '||BIException.toString(ex));
              ORA_JAVA.CLEAR_EXCEPTION;
         WHEN OTHERS THEN
              message('error :'||SQLERRM);
    when i imported java.lang.exception i did not find any wrapper pl/sql function or procedure declared to read or get the error messages except for the functions named "new" ,my exception handler failed.
    so i tried with BIException which also fails to trap the error i have no idea about BIException and its usage with in forms ,Please do help me out with this issue ASAP.
    thanks in advance
    Rgds
    yash

    Hi,
    don't understand what the BIException is supposed to do in your code, can you try
         WHEN ORA_JAVA.EXCEPTION_THROWN then
         ex := ORA_JAVA.LAST_EXCEPTION;
         message('Exception: '||Exception_.toString(ex));
    where Exception_ is the imported java.lang.Exception package.
    Frank

  • Value Help for Model in java webdynpro

    I have created an OVS in web dynpro. I would like to query the database(ABAP Table in SAP R/3).
    How do I do it in webdynpro.
    Thanks and Regards,
    Narayani

    Hi Valery ,
    I tried using the ICMIQuery but there seems to be a problem. I am getting the following exception:
    "java.lang.UnsupportedOperationException: Not supported for generic queries"
    This is the code that I tried for query.
    Selectquery is the query model class that I have created.
    I have even tried without the wdcontext also.
    SelectQuery query = new SelectQuery();
    wdContext.nodeSelectQuery().bind(query);
    WDValueServices.addOVSExtension("OVSTEST",attributes,query,listener);
    Thanks.
    Narayani

  • Help Connect4 game in j2me

    hello everyone. i am new to j2me. does anyone has codes for connect4 game in j2me? thx in advance

    tilom, timine and utmstudent,
    It really would help everyone if you'd stop talking in Creole (Kreol) and stick to English. Besides, my Creole is very rusty.
    And tilom: timine and utmstudent are right --- you wouldn't have learnt anything and you could get into trouble.
    Thanks,
    Hasman

  • I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please

    I have problem with buying in games , I got the massage that the purchased can not be completed , please contact iTunes support.. I need help for my case please

    http://www.apple.com/support/itunes/contact/

  • I have not been able to update my fairy farm game for the last 5days as it quit at launch. I am afraid to delete and reinstall the game as i might lose all. Anyone knows if there is an update for this game? Please help. Thanks

    I have not been able to update my fairy farm game for the last 5days as it quit at launch. I am afraid to delete and reinstall the game as i might lose all. Anyone knows if there is an update for this game? Please help. Thanks

    Erdygirl please be aware you are posting to a public forum.  I have removed your personal information from your previous post.
    Please check your account at http://www.adobe.com/ to locate your serial number.  You can find more information on how to locate your serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

  • Need some help building a game for a school project

    I have to build a game called quads.
    My java knowledge is not the best there is, so i'm looking for some existing code i could use for my game.
    Here are some game details.
    - The game is played by 2 players (on the same computer).
    - both players have 18 square stones.
    - the stones are divided in 4 sides,
    - each side can be shaped, with horizontal- or vertical lines, gray, or black
    - http://213.73.158.54/plaatjes/stones.htm for some preview images
    - player1 has only gray stones, player2 only black.
    - both players have 1 white stone, wich they have to use first.
    - the game is over when one of the players can no longer place one of his stones on the board.
    What i'm looking for,
    I'm looking for a source of a similar game, with:
    - a mouse listener, with te option te rotate the selected stone (0, 90, 180, 270), and to move the selected stone.
    - enable/disable stone collections. (take turns)
    PS. if you don't know where i can find a source similar to this game, sites with game souces are also welcome.
    Thanks alot :D

    Ok, here's what i already have.
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class quadsapplet extends Applet
    //declaraties voor stenen
    private Steen Steen1;
         private Steen[] steentjesSpeler1;
    private Steen[] steentjesSpeler2;
    private Steen[] speelBord;
         private static Image achtergrond;
         private String plaatje;
         private int vak1, vak2, vak3, vak4, x, y, xBord, yBord;
    public TextField tekstvak1;
    public TextField tekstvak2;
    public TextField tekstvak3;
    public Button knop;
    public Button knop1;
    //declaraties voor bord
    private Bord bord;
         public void init()
    tekstvak1 = new TextField();
    tekstvak1.setBounds(10, 550, 70,30);
    add (tekstvak1);
    tekstvak2 = new TextField();
    tekstvak2.setBounds(300, 550, 70,30);
    add (tekstvak2);
    tekstvak3 = new TextField();
    tekstvak3.setBounds(700, 550, 70,30);
    add (tekstvak3);
    knop = new Button("Verplaats grijs");
    knop.setBounds(150, 550, 100,30);
    knop.addActionListener(new KnopHandler() );
    add (knop);
    knop1 = new Button("Verplaats zwart");
    knop1.setBounds(450, 550, 100,30);
    knop1.addActionListener(new Knop1Handler() );
    add (knop1);
    setBackground(new Color(150, 156, 223 ));
              steentjesSpeler1 = new Steen[18];
    steentjesSpeler2 = new Steen[18];
    speelBord = new Steen[36];
              vak1 = 1;
              vak2 = 1;
              vak3 = 1;
              vak4 = 1;
              xBord = 200;
    yBord =10;
    x = 20;
    // bord
    //stenen speler 1
              for(int i=0 ; i<18 ; i++)
                   steentjesSpeler1[i] = new Steen(Color.black, x, y, vak1, vak2, vak3, vak4, false, "3");
    steentjesSpeler1.setArrX(i);
                   add(steentjesSpeler1[i]);
                   System.out.println("Steen "+(i+1)+" created!" );
                   plaatje = "./images/g"+(i+1)+".jpg";
                   achtergrond = getImage( getDocumentBase(), plaatje );
                   System.out.println(plaatje );
                   steentjesSpeler1[i].setafbeelding( achtergrond );
                   x += 70;
                   if(x>99)
                        x = 20;
                        y += 60;
    //stenen speler 2
    for(int i=0 ; i<18 ; i++)
                   steentjesSpeler2[i] = new Steen(Color.black, x + 630 , y - 540, vak1, vak2, vak3, vak4, false, "3");
                   add(steentjesSpeler2[i]);
                   System.out.println("Steen "+(i+1)+" created!" );
                   plaatje = "./images/z"+(i+1)+".jpg";
                   achtergrond = getImage( getDocumentBase(), plaatje );
    System.out.println(plaatje );
    steentjesSpeler2[i].setafbeelding( achtergrond );
                   x += 70;
                   if(x>99)
                        x = 20;
                        y += 60;
    for(int i=0 ; i<36 ; i++)
                   speelBord[i] = new Steen(Color.black, xBord, yBord, vak1, vak2, vak3, vak4, false, "3");
    speelBord[i].setArrX(i);
    //speelBord[1] = new Steen(Color.black, xBord, yBord, 1,1,1,1, false, "3");
    add(speelBord[i]);
    System.out.println("Steen "+(i+1)+" created!" );
                   plaatje = "./images/"+(i+1)+".jpg";
                   achtergrond = getImage( getDocumentBase(), plaatje );
                   System.out.println(plaatje );
                   speelBord[i].setafbeelding( achtergrond );
                   xBord += 70;
                   if(xBord>550)
                        xBord = 200;
                        yBord += 70;
              setLayout( null );
    } // eind init()
    class KnopHandler implements ActionListener
    public void actionPerformed ( ActionEvent e)
    String invoer1 = tekstvak1.getText();
    int getal1 = -1;
    getal1 = Integer.parseInt( invoer1 );
    String invoerstring2 = tekstvak2.getText();
    int getal2 = -1;
    getal2 = Integer.parseInt( invoerstring2 ) ;
    speelBord[getal2].afbeelding = steentjesSpeler1[getal1].afbeelding;
    tekstvak2.setText("");
    tekstvak1.setText("");
    for (int teller = 0; teller<36; teller++){
    speelBord[teller].repaint();
    getal1 = -1;
    getal2 = -1;
    class Knop1Handler implements ActionListener
    public void actionPerformed ( ActionEvent e)
    String invoer3 = tekstvak3.getText();
    int getal11 = -1;
    getal11 = Integer.parseInt( invoer3 );
    String invoerstring22 = tekstvak2.getText();
    int getal22 = -1;
    getal22 = Integer.parseInt( invoerstring22 ) ;
    speelBord[getal11].afbeelding = steentjesSpeler2[getal22].afbeelding;
    tekstvak2.setText("");
    tekstvak3.setText("");
    for (int teller = 0; teller<36; teller++){
    speelBord[teller].repaint();
    getal11 = -1;
    getal22 = -1;
    //tekenen van het bord
    /*public void paint( Graphics g )
    //bord.tekenBord( g, 172, 20);
    //g.drawString(Bord.bord[0][0]);
    My problems right now are,
    - i can't select more than 1 stone
    - i can't rotate 1 stone (i did rotate them all, but that's a bit useless)
    - i can't make players to take turns.
    - i can't move stones, i can only copy them...
    So if i can't use source codes, does anyone know a tutorial for all this?
    PS. sorry about the dutch code.

  • Call Oracle Help for Java in Oracle forms running in the web

    Hi, everyone,
    We are developing a web-enabled Oracle database application
    system. Oracle suggested us to use Oracle Help for Java(OHJ) to
    create an online help system for the web environment. We
    successfully created a OHJ program which can be independently.
    But we still have no idea how to call this OHJ program from the
    forms running in the web environment.
    Could anyone help us out?
    Thanks.
    null

    I would like to know if anyone has been able to do this too. Could someone respond if they have successfully gotten this to work?
    Thanks!!

  • Oracle Help for Java 4.2.0 and 4.1.17

    Attention to all: Oracle Help for Java 4.2.0 and 4.1.17 are now available for download at
    http://otn.oracle.com/software/tech/java/help/content.html
    OHJ 4.2.0 features a new Ice Browser and enhancements related to the known modal dialog problem. It requires JDK 1.3 and is a recommended upgrade for all clients using JDK 1.3 or higher.

    4.1.17 appears to work correctly with RoboHelp.
    4.2 gives an error when attempting to generate fts.idx via RoboHelp.

  • I am trying to buy gems for my games and it says purchase can't be completed. Already I redeem iTunes card. Pls help

    I am trying to buy gems for my games ant it says purchase can't be completed. Already I redeem iTunes card.. Pls help

    If you are also getting a message to contact iTunes Support then you can do so via this link and ask them for help (we are fellow users here on these forums, we won't know why the message is appearing) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for