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);
}

Similar Messages

  • What does a new non-DE user need? | Help for a Wiki page

    Hey Archers,
    I'm using Arch with the Compiz Standalone Window Manager and I need some help for a project.
    It turns out (who knew) that computers need a lot more to run smoothly than just a desktop and applications. You need network managers, gtk themes and much much more. Now, Desktop Environments such as GNOME and KDE provide a lot of these programs built-in, good for them, but I'm looking to build my system as dependency-free as I can and the big DE's don't really provide that. Especially GNOME just ropes me in whenever I want to use the tiniest piece of it (darn you gnome-keyring).
    So I come to you fora, with a quest for information. I want to compile an overview of essential and useful applications with minimal dependencies that allow a CompizIndy user to build his system freely. And if I get enough information, I want to turn it into its own page for the Wiki so it becomes easier to get started with a birds-eye view of what you need to flesh out your system (not exclusively for CompizIndy btw). So please help me!
    What applications/daemons/tools should a new system install? I'm not asking which ones are the best or worst or your favorites, just which kinds do you need --that aren't covered in the install guide--?
    For example it's advisable to get:
    Panel/dock
    desktop manager
    network manager
    compositing manager
    a tool for managing removable devices (ntfs-3g etc)
    a packer/unpacker
    a screensaver
    power management
    alt-F2 runcommand
    custom keybindings
    a user switch/logout manager
    a volume manager
    etc.
    So what do you recommend? What do you need to get up and going?
    Hoping to hear from you guys and girls,
    Matthias
    PS: if I'm doubling up on anything, please let me know and save me effort and embarassment ^_^
    Last edited by Matsjo (2011-01-28 20:37:26)

    There are many threads on this, although individual ones asking for "the best app to do XXX". You could try searching those. Also Search for the LnF Awards threads. you might find a few ideas there. We also have wiki pages for light-weight applications which might be useful
    Panel/dock  none
    desktop manager none
    network manager netcfg
    compositing manager none or xcompmgr (for basic compositing)
    a tool for managing removable devices (ntfs-3g etc) udiskie or udev rules or devmon
    a packer/unpacker coreutils eg - tar, bzip etc with an alias called "ex" in .aliases
    a screensaver none
    power management ???
    alt-F2 runcommand gmrun
    custom keybindings xbindkeys
    a user switch/logout manager none
    a volume manager see udiskie....
    BTW, if this is for you, then simply install Arch and use a non DE based WM --- eventually you will figure out what you are missing

  • Why do i need payment informations for free games

    why do I need payment information for free games?

    You can create an iTunes account without payment info on file.
    Once you have a card on file, though, iTunes wants it to be current/valid. Don't think there's any way around it.

  • I need some help for an explanation. Loop for 1 minute.

              int minute=1;
              long currentTime=System.currentTimeMillis();          
              long stoppingTime = currentTime + (minute * 60 * 1000);
              while (currentTime<stoppingTime) {
                   // do x;
                   currentTime=System.currentTimeMillis();
              }I want to have the loop to run for 1 minute. It does not seem to work.
    What did I miss? I need some help for an explanation.

    Ran:
    class PrintTimeAsProcess {
      public static void main(String[] argv)  throws Exception {
        int minute=1;
        long currentTime=System.currentTimeMillis();
        long stoppingTime = currentTime + (minute * 15 * 1000);
        System.out.println("START Time: "+currentTime);
        while (currentTime<stoppingTime) {
          currentTime=System.currentTimeMillis();
        System.out.println("END Time: "+currentTime);
    }Got:
    START Time: 1149278202718
    END Time: 1149278217718
    1149278217718
    -1149278202718
    15000

  • HI ALL SINCE TWO DAYS I AM DOWNLOADING VIBER BUT I AM NOT HAVING MY ACCESS CODE AND EVERY TIME I DELETE THE APPLICATION AND DOWNLOADING IT AGAIN BUT ALWAYS THE SAME RESULT PLEASE I NEED YOUR HELP FOR THE ACCESS CODE.MY PHONE NUMBER IS 0022996969896.THANKS

    HI ALL SINCE TWO DAYS I AM DOWNLOADING VIBER BUT I AM NOT HAVING MY ACCESS CODE AND EVERY TIME I DELETE THE APPLICATION AND DOWNLOADING IT AGAIN BUT ALWAYS THE SAME RESULT PLEASE I NEED YOUR HELP FOR THE ACCESS CODE.MY PHONE NUMBER IS 0022996969896.THANKS IN ADVANCE

    try this website this should help you http://helpme.viber.com/index.php?/Knowledgebase/List/Index/1/iphone

  • Need conceptual help for a simple drag n drop game

    As anyone who saw my previous thread knows, I'm trying to make an educational app prototype (I'm new to Flash, this is for a Masters in education) to help students learn IPA symbols (phonetics). I have successfully made a section where the students click on symbols to hear the corresponding audio and listen to explanations.
    For the final part of the prototype, I have to create some kind of instructional game. My idea is to have 12 circles, each one playing an audio file of a vowel sound (this I know how to do). The students will have to click the circles to listen and then drag and drop them to the correct IPA symbol. Flash would then give feedback on correct/incorrect answers and a score. Maybe all of this is against the clock, needing a timer.
    So, I need to learn drag and drop. What else to I need to learn so that one drop position is considered "correct", the others are considered "incorrect" and a score is given at the end? And maybe a timer?)
    Any conceptual help gratefully received!!
    Darren

    Cheers for the reply.
    Yes, I have heard of this Google you speak of The thing is, sometimes as a beginner you can't see the wood for the trees and I find mountains of info when I search, it's hard to know which direction to do in. As for drag & drop I had already found good tutorials on that, it's more the other concepts that need to be employed that I would like information on.
    I'll look into the getTomer() function, sounds just what I need.
    As for the scoring correct/incorrect answers, i found a wonderful example on flashkit.com, which would basically solve all my problems if I learn how to adapt it. The trouble is it was made in Flash 7, I'm on CS4.
    How many changes would I need to make to the code to turn it into AS3?
    Cheers everyone
    Darren
    (EDIT: I pasted the code and now it looks weird. I used SQL syntax highlighting on this page, maybe somebody could tell me how to past code and get it looking correct?)
    myAnswers = [[1, 1], [2, 2], [3, 5], [4, 4]];
    function doDrop(dragSprite, numTargets) {
         for (i=1; i<numTargets+1; i++) {
              if (_root[dragSprite].hitTest("_root.q"+i)) {
                   if (_root["q"+i]._currentframe<>2) {
                        _root[dragSprite]._x = _root["q"+i]._x+5;
                        _root[dragSprite]._y = _root["q"+i]._y+2;
                        _root["q"+i].gotoAndStop(2);
                   } else {
                        _root[dragSprite]._x = _root[dragSprite].stx;
                        _root[dragSprite]._y = _root[dragSprite].sty;
    function clearDrop(dragSprite, numTargets) {
         for (i=1; i<numTargets+1; i++) {
              if (_root[dragSprite].hitTest("_root.q"+i)) {
                   if (_root["q"+i]._currentframe == 2) {
                        _root["q"+i].gotoAndStop(1);
                        break;

  • 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.

  • 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);
    }

  • How much disk space will I need in bootcamp for PC games

         Hi, I have installed bootcamp and windows but when I went to use steam on it I coudlnt download anything because i have barely any disk space. I believe this has something to do with the partioning thing. So I need to know how much I roughly need for PC games like I will be buying Elder Scrolls Skyrim when it comes out. And games on steam PLEASE HELP. Oh and BTW im using a 21.5 imac with not upgrades or changes since I bought it.

    That depens on a couple of things - how many audio tracks do you have, and what audio quality are you using.
    As a rule of thumb: An audio track at 16 bits takes up around 10 megabytes per minute, at 24 bits you need 15 megabytes per minute. So for 10 minutes that makes 100 and 150 MB, respectively.

  • I need heed help for Handle the JButton

    hi, guys
    I am writing a small program
    It has name and number field.
    It also has the first, privious, next , last and add buttons.
    i want to load the myData.txt file to the name and number field.
    and I want to make the buttons handle the events.
    and when the application is closed, it will save the data into the files.
    I can assign the the add button to save the files, and save the data when it is closed, but I can not make it save more than one record.
    i need ur help to the rest of the buttons, and load the file back to the field.
    andy suggestion would be great!
    Thank !
    here codes
       import javax.swing.*;
       import java.awt.event.*;
       import java.awt.*;
       import javax.swing.event.*;
       import java.io.*;
        public  class buttonAction extends JFrame
          private JLabel nameL;
          private JLabel numberL;               
          private JTextField name;
          private JTextField number;
          private JButton first;
          private JButton prev;
          private JTextField current;
          private JButton next;
          private JButton last;
          private JButton add;
          private JButton exit;
          private final int winw = 410;
          private final int winh = 200;
           private buttonAction()
             super("Wage Calculate");
             setSize(winw, winh);
             setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
             addWindowListener(new Closing());
             setLayout (new BorderLayout());
             loadData();        
             buildPanel();
             buildButtomButtons();
             setVisible(true);
           private void buildPanel()
             nameL = new JLabel("Name:");
             numberL = new JLabel("Number:");
             name = new JTextField(10);
             number = new  JTextField(5);
             JPanel panel =new JPanel();
             panel.setLayout(new GridLayout(2,1));
             panel.add(nameL);
             panel.add(name);
             panel.add(numberL);
             panel.add(number);
             add(panel, BorderLayout.NORTH);
           private void buildButtomButtons()
             first = new JButton("First");
             prev = new JButton("Prev");
             current = new JTextField(5);
             current.setEditable(false);
             next = new JButton("Next");
             last = new JButton("Last");
             add = new JButton("Add");
             exit = new JButton("Exit");
             JPanel button = new JPanel();
             first.addActionListener(new ButtonListener());
             prev.addActionListener(new ButtonListener());
             current.addActionListener(new ButtonListener());
             next.addActionListener(new ButtonListener());
             last.addActionListener(new ButtonListener());
             add.addActionListener(new ButtonListener());
             button.add(first);
             button.add(prev);
             button.add(current);
             button.add(next);
             button.add(last);
             button.add(add);
             add(button, BorderLayout.SOUTH);
            // save the data into the file when the application is close
           public class Closing extends WindowAdapter
              public void windowClosing(WindowEvent e)  
                try {
                   PrintWriter out = new PrintWriter (new FileWriter("myData.txt"));
                   out.println (name.getText());
                   out.println(number.getText());
                   out.close();
                    catch (IOException ee) {
                   // Happens if the file cannot be written to for any reason
                      JOptionPane.showMessageDialog(null, "Could not save the file " + ee.getMessage());
                System.exit(0);
           private void loadData()
             try {
                BufferedReader fileReader = new BufferedReader(new FileReader(new File("myData.txt")));
                String lineRead = fileReader.readLine();
                  // I need help how to load the data
                 catch (FileNotFoundException e)
                   e.printStackTrace();
                 catch (IOException e) {
                   e.printStackTrace();
            //handle the first, previous, next, last, add buttons
           private class ButtonListener implements ActionListener
              public void actionPerformed(ActionEvent e)
                Object button = e.getSource();
                if (button == add)
                   try
                      PrintWriter out = new PrintWriter (new FileWriter("myData.txt"));
                      out.println (name.getText());
                      out.println(number.getText());
                      out.close();
                       catch (IOException ee)
                      // Happens if the file cannot be written to for any reason
                         JOptionPane.showMessageDialog(null, "Could not save the file " + ee.getMessage());
                        //I need help for the first, privious and last buttons
           public static void main(String[] args)
             buttonAction pr = new buttonAction();
       }

    are you trying to load a multi line textfile int a JTextField? If you try to load this in a while loop as you read the file, it will zoom through the file, and you will probably only see the last line of the file (or nothing if the last line is blank) in the jtextfield. Consider using a JTextArea or some other component that can hold multiple lines. Also your file reading method calls look wrong to me. You appear to read a line, then continually check if that one read line is null, and if not do a while loop, that looks to loop forever. Look at the java I/O examples for how to do this right.
    Good luck

  • Need urgently help for OBIEE Installation (11g)

    Hi all,
    I am having problems trying to install Oracle Business Intelligence 11g on Windows 7.
    The Installation Wizard hangs on the step: Domain Configuration (0%). The Creating Domain shows In progress.
    The log under the Inventory directory shows me only following:
    INFO: Ending the inventory Session
    INFO: Using an existing InstallAreaControl for this Inventory Session with existing access level 1
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    INFO: The ORACLE_CONFIG_HOME env var is set to
    I really don't know what to do. I am searching for a solution on Internet, but I don't find it.
    I need urgently help. I would appreciate someone could help me.
    We can do together via Webex or something similar. It doesnt worth it for me to type here and wait till someone give me an answer (if any), trying to find out how I did.
    I hope to find the help I need. I am desperated :-(

    Can I install the OBIEE 10g version?I am not sure but i think OBIEE is not certified with windows 7. i could not find any MOS doc confirming same. Please log a call with oracle to confirm this.
    would it work fine with the Oracle Database 11g and the RCUs?. Yes OBIEE 10g will work with oracle database 11g.
    Thanks,
    JD

  • In serious need of help for huge Premiere Pro Picture glitch. Confounded beyond belief.

    Gents and ladies, I have been at this for two days and am in desperate need of help. Right now my editing in Premiere Pro is completely stalled due to a bizzare picture glitch. I am 100% stuck and unable to edit.
    When I add a picture to my bin, it's ok. Then I add a second and it seems fine. But any and all pictures I add after that show up as the first picture. Never mind that the name of the file appears correct.
    The picture itself, both the thumbnail and the picture in the timeline, etc. are just the first picture.
    I have rebooted,restarted, started new projects with new settings, cleared the Premiere Pro cache... NOTHING works.
    Video is not a problem. Only pictures. And I am now dead in the water as a result.
    Look at this screenshot. See how the other than the second picture they are all the same? Well, they shouldn't be. But they are. And I am stuck and unable to edit at all as a result.
    WTH is happening here?
    I have Premiere Pro 5 on a PC from Adobe Production Premium.
    One issue I have had recently is in the middle of editing Premiere Pro will start conforming video that has already been conformed prior.
    Begging for help here.

    I guess I should expect a snarky answer from someone named "Snarky McSnarkster." You are being quite rude. It is not helpful to tell someone to fix a glitch by buying new software. That is not a solution. I could just uninstall and re-install, but I am not going to risk losing all of my current projects if something goes wrong. That is like a thermonuclear option. And spending a grand on new software is insane when I don't need it. The software has been fantastic since I bought it. But glitches happen and so I have been in this forum before and always found a solution via some helpful experts.
    It is also absurd to call me disinterested when I have engaged with everyone here and answered all of their questions. Just because I have tried most of what has been suggested and explained as such does not make me the bad guy.
    As for Ann Bens' question: We have seen this issue in the past and re-save was the solution. Are these images RGB?
    Yes, most are RGB. Some I have tried are CMYK. I have tried jpegs, tiffs, bitmaps, png. I am completely clueless as to how this is happening.
    I am about to try opening Photoshop, opening a bunch of pictures and savings them to a new HD, then starting a brand new project.
    For those who have made suggestions, thank you.

  • Need search help for Profit centre

    Hi all,
    I am struggling to facilitate profit centres in SRM. I am quite close to it. I have done some config changes and could get the profit centre option in web browser under cost assignment. The POs are going through in R/3.
    BUT the searchhelp is not available in the web browser in the next field "Assigned to". There are different search helps available in the program LBBP_PDH_ACCF32 for different account assignment categories but not for profit centre.
    Let me know if there is some search help available somewhere in SRM for profit centre.
    Regards,
    Ravi

    Ravi,
    Hi. Profit centres, like cost centres, doen't exist on SRM as an entity. What the system does for cost centres is it holds a key to which system this exists on (eg the logical system name for R3). When you search for cost centres on the account assignement screen the system runs a search help on the R3 backend.
    My guess is that you would need to configure the system to act the same as with cost centres and run the search help for profit centres on teh R3 backend.
    Cheers
    Rob

  • Need someone helps for several Problems on my 9630 Tour

    Hello,
    Well, these are list of problems with my 9630 Tour, and I need some helps to solve these :
    1. My 1st problem is, everytime my 9630 started its also a message appears : "uncaught exception index 8 >= 8"
    2. And I also realized that some missing application happened. My m-Banking application (already re-installed well) but it also lost of SMS icon. So the result is, everytime I sent an outgoing SMS  I couldn't save it. And I have made a test to sent SMS from my other number to this 9630 device, but 9630 couldn't show that any incoming message, even my other device has given me notification that message has been delivered.
    3. Its also often shutdown suddenly by itself, or its shutdown upon charging
    4. Charging tasks sometime couldn't be well charged. And finally I realized that my device has off in the middle of charging task, it may caused of charging wasn't recharge the device very well 
    Hopefully I can read your kindly solution on those problems happened. Thank you for your prompt response. 
    Anwar Hussein

    Hi and Welcome to the Community!
    I actually think that all of your issues are related, and rooted in the same problem...OS corruption or hardware failure. But, before you begin, please be sure you have a good backup...see the link in my auto-sig on this post for instructions for that process.
    Then, at the top of each device forum, there should be some "sticky" threads that discuss the OS levels available for many models. If they include your model, then please use those as reference as you proceed. Otherwise, you will have to dig through the official download portal for OS packages for your model:
    http://us.blackberry.com/support/downloads/download_sites.jsp
    From a PC, you can install any compatible (e.g., for your exact BB Model Number) OS package to a BB via this procedure:
    http://supportforums.blackberry.com/t5/BlackBerry-Device-Software/How-To-Reload-Your-Operating-Syste...
    Note that while written for "reload" and the Storm, it can be used to upgrade, downgrade, or reload any BB device model -- it all depends on the OS package you download and install to your PC. If that OS package is from a carrier other than the carrier for which your BB was originally manufactured, then delete, on your PC, all copies of VENDOR.XML...there will be at least one, and perhaps 2, and they will be located in or similarly to (it changes based on your Windows version) these folders:
    C:\Program Files (x86)\Common Files\Research In Motion\AppLoader
    C:\Users\(your Windows UserName)\AppData\Roaming\Research In Motion\BlackBerry\Loader XML
    Be sure that you remove, from your PC, any other BB device OS packages as having more than one installed to the PC can cause conflicts with this procedure.
    You may also want to investigate the use of BBSAK (bbsak.org) to perform the wipe it is capable of.
    You may also want to try this procedure to perhaps narrow down the precise causal item:
    Load your OS "bare bones"...if anything is optional, do not install it.
    If the behavior presents immediately, then try a different OS with step 1
    If the behavior does not immediately present, then run for as long as it takes for you to be sure that the behavior will not present.
    Add one thing -- no matter how tempting, just one.
    If the behavior does not present immediately, then again run for long enough to be sure it will not have the same problem
    Repeat steps 4 and 5 until all things are loaded or the behavior presents
    When the behavior presents, you know the culprit...the last thing you loaded.
    If the behavior does not re-present, then you know that either step 1 or 2 cured it.
    If the behavior presents no matter what, then you likely have a hardware level issue for which no amount of OS or software can cure.
    If you are on MAC, you are limited to only your carriers sanctioned OS packages...but can still use any levels that they currently sanction. See this procedure:
    KB19915How to perform a clean reload of BlackBerry smartphone application software using BlackBerry Desktop Software
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I need some help , for create some paper on air

    Hi everyone
    I need some help , i work in a static sequence from Tehran street (1 frame), i paint damages on this frame in Photoshop because i need war atmosphere, then i add some smoke and cloud with particular .
    but i think this sequence is not realistic yet
    now i want add some moving paper in air and on street
    do u have any solution for how can i make this paper and moving those
    Thanks a lot
    and pardon me for bad English
    Ali Molavi

    The best tool to add this kind of particle is After Effects.
    If you have the Creative Cloud then I recommend you download that.
    Slightly annoying voice over, but here is a youtube tutorial you can follow top make floating particals. You can adjust it to make it look exactly as you want.
    http://www.youtube.com/watch?v=dq2op6yqvFk&noredirect=1

Maybe you are looking for

  • Schedule lines not generated after MRP run

    Dear All, I am trying to create Schedule lines through MRP run , but instead system creates MRP element PRqRel  and its PurRqs when i check in MD04 ,  the following are the prerequisite i done before MRP run , but still Schedule lines are not generat

  • I am trying to save a custom code snippet in Flash CC and it does not save, any ideas why?

    I am trying to save a custom code snippet in Flash CC and it does not save, any ideas why?  I am using Windows 8.1 with Flash CC. I even when into the "Edit Code Snippet XML" and added a Custom folder and a custom template.  Then I went back to add t

  • No provisioning of User Group for authorization field in user master

    We are implementing CUP 5.3 workflows. Both in manual proviosing and automated provisioning based on User Defaults the user group gets only provisioned to the Groups tab in SU01. The field User Group for authorization on the Logon data tab remains em

  • How to use sysdate

    SQL> create table test1( 2 DOB date); Table created. SQL> insert into test1 2 values(sysdate); 1 row created. SQL> select * from test1; DOB 27-APR-2007 SQL> insert into test1 2 values(sysdate+1); 1 row created. SQL> select * from test1; DOB 27-APR-20

  • Solaris 10 Certification (310-200)

    Hi, I am planning to give solaris 10 Certification SA-1. Please, can you tell me from where i can get study guide and test dumps for certification? Can anyone send me these documents if have? And what is the best way to pass the exam? Thanks, Raj