Help with understand this code

hi,
i wont to now what doing this code i now that performed extraction but to
where?
LOOP AT work_days.
      CLEAR p0001.
      PROVIDE * FROM p0001
       BETWEEN work_days-date AND work_days-date.
      ENDPROVIDE .
      PROVIDE * FROM p0315
       BETWEEN work_days-date AND work_days-date.
      ENDPROVIDE .
      IF sy-subrc <> 0 .
        CLEAR p0315-accnt .
      ENDIF .
endloop.
Regards

hi
any suggstion?
regards

Similar Messages

  • Help with understanding multi-threaded code

    Hi Everyone,
    I am currently reading a book on multi-threading and up until recently I have been able to understand what is going on. The thing is the complexity of the code has just jumped up about two gears without warning. The code is now using inner classes which I am trying to develop an understanding of but I am not finding it easy going, and the book has been lite on explanations. If anybody can help with the following code it will be really appreciated.
    public class SetPriority extends Object
         private static Runnable makeRunnable()
              Runnable r = new Runnable()
                   public void run()
                        for(int i=0; i<5; i++)
                             Thread t = Thread.currentThread();
                             System.out.println("in run() - priority=" + t.getPriority() +
                                          ", name=" + t.getName());
                             try{
                                  Thread.sleep(2000);
                             }catch(InterruptedException x){
                                  //ignore
              return r;
         public static void main(String[] args)
              Thread threadA = new Thread(makeRunnable(), "threadA");
              threadA.setPriority(8);
              threadA.start();
              Thread threadB = new Thread(makeRunnable(), "threadB");
              threadB.setPriority(2);
              threadB.start();
              Runnable r = new Runnable()
                   public void run()
                        Thread threadC = new Thread(makeRunnable(), "threadC");
                        threadC.start();
              Thread threadD = new Thread(r, "threadD");
              threadD.setPriority(7);
              threadD.start();
              try{
                   Thread.sleep(3000);
              }catch(InterruptedException x){
                   //ignore
              threadA.setPriority(3);
              System.out.println("in main() - threadA.getPriority()=" + threadA.getPriority());
    }My greatest challenge is understanding how the makeRunnable() method works. I don't understand how this inner class can be declared static and then multiple "instances" created from it. I know that I have no idea what is going on, please help!!!
    Thanks for your time.
    Regards
    Davo
    P.S.: If you know of any really good references on inner classes, particularly URL resources, please let me know. Thanks again.

    Yikes!! The good news is that you're unlikely to see such convoluted code in real life. But here we go.
    "private static Runnable makeRunnable()" declares a method that returns objects of type Runnable. The fact that the method is declared "static" is pretty irrelevant - I'll describe what that means later.
    The body of the method creates and returns an object of type Runnable. Not much special about it, except that you can give such an object to the constructor of class Thread and as a result the run() method of this Runnable object will be called on a new thread of execution (think - in parallel).
    Now the way it creates this Runnable object is by using the "anonymous inner class" syntax. In effect the method is doing the same as
    public class MyNewClass implements Runnable {
        public void run() {
            // All the same code inside run()
    public class SetPriority {
        private static Runnable makeRunnable() {
            Runnable r = new MyNewClass();
            return r;
        // The rest of the original code
    }Except you don't bother declaring MyNewClass. You're not interested in defining any new method signatures. You just want to create an object that implements Runnable and has certain instructions that you want inside the run() method. Think of the whole approach as shorthand.
    Think about this for a while. In the mean time I'll write up the "static".

  • CrashReporter - Could you please help to understand this crash report?

    Could you please help to understand this crash report below?
    If I'm not wrong it started after update the Mac OS X to version 10.5.6 - every startup.
    Note: First update by regular update then after by combo.
    Thanks in advance!
    _ CrashReporter
    Process: aslmanager [218]
    Path: /usr/sbin/aslmanager
    Identifier: aslmanager
    Version: ??? (???)
    Code Type: X86 (Native)
    Parent Process: launchd [1]
    Date/Time: 2009-04-05 08:29:52.069 -0300
    OS Version: Mac OS X 10.5.6 (9G55)
    Report Version: 6
    Exception Type: EXCBADACCESS (SIGSEGV)
    Exception Codes: KERNINVALIDADDRESS at 0x0000000000200000
    Crashed Thread: 0
    Thread 0 Crashed:
    0 libSystem.B.dylib 0x952a8a85 asl_get64 + 11
    1 libSystem.B.dylib 0x952aa034 aslfile_fetchpos + 939
    2 libSystem.B.dylib 0x952aa2f6 aslfilematch + 339
    3 aslmanager 0x00002409 0x1000 + 5129
    4 aslmanager 0x00002b3e 0x1000 + 6974
    5 aslmanager 0x0000211a 0x1000 + 4378
    Thread 0 crashed with X86 Thread State (32-bit):
    eax: 0x001ffffc ebx: 0x952a9ca1 ecx: 0x00000000 edx: 0x00000000
    edi: 0x0000ff3d esi: 0x00100b30 ebp: 0xbffffbc8 esp: 0xbffffba0
    ss: 0x0000001f efl: 0x00010286 eip: 0x952a8a85 cs: 0x00000017
    ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
    cr2: 0x00200000
    Binary Images:
    0x1000 - 0x2ffd +aslmanager ??? (???) <201b2dea48b8d80ac1432ff85244ed31> /usr/sbin/aslmanager
    0x8fe00000 - 0x8fe2db43 dyld 97.1 (???) <100d362e03410f181a34e04e94189ae5> /usr/lib/dyld
    0x9444a000 - 0x9444efff libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib
    0x951a4000 - 0x951abfe9 libgcc_s.1.dylib ??? (???) <f53c808e87d1184c0f9df63aef53ce0b> /usr/lib/libgcc_s.1.dylib
    0x951ba000 - 0x95321ff3 libSystem.B.dylib ??? (???) <d68880dfb1f8becdbdac6928db1510fb> /usr/lib/libSystem.B.dylib
    0xffff0000 - 0xffff1780 libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib
    _ Log
    05/04/09 8:25:58 com.apple.loginwindow[35] Shutdown NOW!
    05/04/09 8:25:58 com.apple.loginwindow[35] System shutdown time has arrived
    05/04/09 8:25:58 com.apple.SystemStarter[30] Stopping Missing Sync Listener
    05/04/09 8:25:58 com.apple.SystemStarter[30] Stopping HP Trap Monitor
    05/04/09 8:25:58 com.apple.SystemStarter[30] Stopping HP IO Monitor
    05/04/09 8:25:59 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/Pvsnet.kext succeeded
    05/04/09 8:25:59 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/ConnectUSB.kext succeeded
    05/04/09 8:26:02 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/vmmain.kext succeeded
    05/04/09 8:26:02 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/hypervisor.kext succeeded
    05/04/09 8:26:35 com.apple.launchctl.System[2] BootCacheControl: could not open /var/db/BootCache.playlist: No such file or directory
    05/04/09 8:26:35 com.apple.launchctl.System[2] BootCacheControl: could not unlink playlist /var/db/BootCache.playlist: Unknown error: -1
    05/04/09 8:26:37 com.apple.launchctl.System[2] launchctl: Please convert the following to launchd: /etc/mach_init.d/dashboardadvisoryd.plist
    05/04/09 8:26:37 com.apple.launchd[1] (com.apple.blued) Unknown key for boolean: EnableTransactions
    05/04/09 8:26:37 com.apple.launchd[1] (org.cups.cupsd) Unknown key: SHAuthorizationRight
    05/04/09 8:26:37 com.apple.launchd[1] (org.ntp.ntpd) Unknown key: SHAuthorizationRight
    05/04/09 8:26:49 org.ntp.ntpd[27] Error : nodename nor servname provided, or not known
    05/04/09 8:26:57 com.apple.SystemStarter[30] Starting up Missing Sync Listener
    05/04/09 8:26:57 com.apple.SystemStarter[30] Starting HP IO Monitor
    05/04/09 8:26:58 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/hypervisor.kext is already loaded
    05/04/09 8:26:58 com.apple.SystemStarter[30] Starting HP Trap Monitor
    05/04/09 8:26:58 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/vmmain.kext is already loaded
    05/04/09 8:26:59 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/ConnectUSB.kext is already loaded
    05/04/09 8:27:00 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/Pvsnet.kext is already loaded
    05/04/09 8:27:00 com.apple.SystemStarter[30] kextload: /Library/StartupItems/Parallels/Pvsvnic.kext loaded successfully
    05/04/09 8:27:06 com.apple.SystemStarter[30] Sun Apr 5 08:27:06 wslys-Mac.local Missing Sync Listener[77] <Warning>: 3891612: (CGSLookupServerRootPort) Untrusted apps are not allowed to connect to or launch Window Server before login.
    05/04/09 8:27:06 com.apple.SystemStarter[30] Sun Apr 5 08:27:06 wslys-Mac.local Missing Sync Listener[77] <Error>: kCGErrorRangeCheck : On-demand launch of the Window Server is allowed for root user only.
    05/04/09 8:27:06 com.apple.SystemStarter[30] Sun Apr 5 08:27:06 wslys-Mac.local Missing Sync Listener[77] <Error>: kCGErrorRangeCheck : Set a breakpoint at CGErrorBreakpoint() to catch errors as they are returned
    05/04/09 8:27:08 com.apple.SystemStarter[30] _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
    05/04/09 8:27:20 com.apple.launchd[1] (com.apple.UserEventAgent-LoginWindow[123]) Exited: Terminated
    05/04/09 8:27:20 com.apple.launchctl.Aqua[129] launchctl: Please convert the following to launchd: /etc/machinit_peruser.d/RemoteUI.plist
    05/04/09 8:27:20 com.apple.launchd[116] (com.apple.AirPortBaseStationAgent) Unknown key for boolean: EnableTransactions
    05/04/09 8:27:21 com.apple.FolderActions.enabled[130] launchctl: Error unloading: com.apple.FolderActions.folders
    05/04/09 8:27:42 quicklookd[146] [QL ERROR] 'Creating thumbnail' timed out for '<QLThumbnailRequest /Users/wsly/Downloads/m090374535329zdwg_650ref.mov>'
    05/04/09 8:27:42 Dock[138] [QL ERROR] quicklookd crashed while thumbnailing /Users/wsly/Downloads/m090374535329zdwg_hdref.mov
    05/04/09 8:29:52 com.apple.launchd[1] (com.apple.aslmanager[218]) Exited abnormally: Segmentation fault

    Try repairing the disk through the Mac OS X install disk.

  • I keep getting this error message when I (right-click) on a photo file on my desktop to burn to a CD. I don't understand this code...does anyone?  Thanks  Ariel**:The disc can't be burned because an unexpected error occurred (error code 0x80020000).

    I keep getting this error message when I (right-click) on a photo file on my desktop to burn to a CD. I don't understand this code...does anyone?  Thanks  Ariel**:    The disc can’t be burned because an unexpected error occurred (error code 0x80020000).

    I tried every obvious solution to this problem with different types of disc (-R; +R; -RW and +RW) and the problem persisted.  Then I read about removing a hyphen in picture filenames.  I renamed all the images and bingo there were no further problems.  Apple should have solved this by now.  This error code has been reported for several years and my MacBook Pro is quite new.  Anyway, I hope this helps.  It does work.
    Piggywiggle

  • Help with Failure ID code

    My Computer Product ID is: G9D66UA#ABA (HP 15 laptop). I dropped this laptop, afterwhich it was still running, though quite fitfully. After a restart it came to a blue screen with a message saying it was running diagnostics and attempting to fix problems and further said "this may take more than an hour". After approxamately 16 hours, the same blue screen displayed same message. I later pressed F2 on start up , ran a couple tests and the following Failure ID came up for each test ran: RTTSMG-77K7MS-XD7V6J-60XJ03 Can someone please tell me what this failure code means. Also, what are my repair, and especially, data recovery options (unfortunately no recent backups)? Any help would understanding this failure ID code would be greatly appreciated, EE

     Whenever the Hard Disk Short DST test fails with 24 Digits Failure ID ,that indicates that the Hard Disk Drive has failed and that requires a replacement to resolve the issue This issue could be due to Application or driver conflicts, virus issues, file corruptions due to incompatible applications, improper shutdowns, update failures due to conflicts, sudden power surges, if notebook is dropped etc.. HP will provide a replacement Hard Disk Drive if the Notebook warranty is Active, If not you need buy a SATA Hard Disk Drive from a retail shop nearby Please make sure you are getting at least equal capacity as the original one in order to use Recovery Disks. If you need you can buy a larger, but not smaller capacity Hard Disk Drive. For example if you have a 500GB Hard Disk Drive you can upgrade it to 750GB Hard Disk Drive but not 320GB Hard Disk Drive Please try the below shown troubleshooting steps once:Step 01. Remove the battery and unplug the AC/Power AdapterStep 02. Press and hold the Power button for more than 30 SecondsStep 03. Plug in the AC/Power Adapter (leave the Battery out for now)Step 04. Press the Power button and check if the Unit works normal If the above mentioned steps does not help, then you can try reseating the Hard Drive on your Notebook If the issue persists again please Contact HP if your HP Notebook is under warranty, HP would replace the Hard Disk Drive and provide you a Recovery media to restore factory operating system after replacement (if you've not yet created Recovery Discs/USB Media) Note: Back up all the personal data to an external drive if it's possible. Otherwise you could connect the failed HDD via SATA to USB adapter with another PC or same PC after replacement of HDD & re-installation of OS and try copying /recovering the files. You can also refer to the below shown link for further supporthttp://www.wikihow.com/Recover-Data-from-the-Hard-Drive-of-a-Dead-Laptop Please click on the link In order to Identify, Prevent, Diagnose & Recover from Drive Failures on HP Notebook Hard Drives & Solid State Drives :http://h10032.www1.hp.com/ctg/Manual/c02876562.pdf  You can Check your warranty Here to verify the status and Click Here to order a new Hard Drive  Hope this helps, for any further queries reply to the post and feel free to join us again  **Click the White Thumbs Up Button on the right to say Thanks**Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. Thank You,GBL  84Although I am an HP employee, I am speaking for myself and not for HP

  • Help needed in this code

    Hi guys, I need help in debugging this code I made, which is a GUI minesweeper. Its extremely buggy...I particularly need help fixing the actionListener part of the code as everytime I press a button on the GUI, an exception occurs.
    help please!
    package minesweeperGUI;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MinesweeperGUI implements ActionListener
         //Declaration of attributes
         static int length = 0;
         JMenuItem menuItemNew = new JMenuItem();
         JRadioButtonMenuItem rbEasy = new JRadioButtonMenuItem();
         JRadioButtonMenuItem rbHard = new JRadioButtonMenuItem();
         JMenuItem menuItemExit = new JMenuItem();
         JButton buttonReset = new JButton();
         JButton buttonGrid[][] = null;
         JFrame frame = new JFrame();
         int getBombsTotal = 0;
         JLabel setBombsLabel = new JLabel();
         int a = 0;
         int b = 0;     
         //No constructor created. Uses default constructor
         //Create the menu bar
         public JMenuBar newMenuBar()
              //Sets up the menubar
              JMenuBar menuBar = new JMenuBar();
              //Sets up the Game menu with choice of new, grid size, and exit
              JMenu menu = new JMenu ("Game");
              menuBar.add (menu);
              menuItemNew = new JMenuItem ("New");
              menuItemNew.addActionListener (this);
              menu.add (menuItemNew);
              menu.addSeparator();
              //Sets up sub-menu for grid size with choice of easy and hard radio buttons
              JMenu subMenu = new JMenu ("Grid Size");
              rbEasy = new JRadioButtonMenuItem ("Easy: 5x5 grid");
              rbEasy.addActionListener (this);
              subMenu.add (rbEasy);
              rbHard = new JRadioButtonMenuItem ("Hard: 10x10 grid");
              rbHard.addActionListener (this);
              subMenu.add (rbHard);
              menu.add (subMenu);
              menu.addSeparator();
              menuItemExit = new JMenuItem ("Exit");
              menuItemExit.addActionListener (this);
              menu.add (menuItemExit);
              return menuBar;
         //Setting up of Bomb Grid
         public int [][] setGrid (int length)
              int grid[][] = null;
              grid = new int[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        grid[i][j] = ((int)Math.round(Math.random() * 10))% 2;
              return grid;     
         //Setting up of the of the graphical bomb grid
         public JButton[][] setButtonGrid (int length)
              JButton buttonGrid[][] = null;
              buttonGrid = new JButton[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        buttonGrid[i][j] = new JButton();
              return buttonGrid;
         //Setting up of a way to count the total number of bombs in the bomb grid
         public int getBombsTotal (int length, int setGrid[][])
              int bombsTotal = 0;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (setGrid[i][j] == 1)
                             bombsTotal += 1;
              return bombsTotal;
         //Create a label for number of bombs left
         public JLabel setBombsLabel (int getBombsTotal)
              JLabel bombsLabel = new JLabel(String.valueOf (getBombsTotal) + " Bombs Left");
              return bombsLabel;
         //Setting up a way to count the number of bombs around a button
         public String setBombs (int length, int setGrid[][], int x, int y)
              int bombs[][] = new int[length][length];
              String bombsString = null;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (i == 0 && j == 0)
                             bombs[i][j] = setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i ==0 && j == (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else if (i == (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1];
                        else if (i == (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1];
                        else if (i == 0 && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i][j+1] +
                                  setGrid[i+1][j-1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i == (length - 1) && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1];
                        else if (i != 0 && i != (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i != 0 && i != (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j] + setGrid[i+1][j+1];
              bombsString = String.valueOf (bombs[x][y]);
              return bombsString;
         //create the panel for the bombs label and reset button
         public JPanel newTopPanel(int length)
              int setGridNew [][] = null;
              setGridNew = new int[length][length];
              int getBombsTotalNew = 0;
              JLabel setBombsLabelNew = new JLabel();
              setGridNew = setGrid (length);
              getBombsTotalNew = getBombsTotal (length, setGridNew);
              setBombsLabelNew = setBombsLabel (getBombsTotalNew);
              JPanel topPanel = new JPanel ();
              topPanel.setLayout (new BorderLayout (50,50));
              JLabel bombsLabel = new JLabel ();
              bombsLabel = setBombsLabelNew;     
              topPanel.add (bombsLabel, BorderLayout.WEST);
              buttonReset = new JButton("Reset");
              buttonReset.addActionListener (this);
              topPanel.add (buttonReset, BorderLayout.CENTER);
              return topPanel;
         //create the panel for the play grids
         public JPanel newBottomPanel(int length)
              JButton setButtonGridNew[][] = null;
              setButtonGridNew = new JButton [length][length];
              setButtonGridNew = setButtonGrid (length);
              JPanel bottomPanel = new JPanel ();
              bottomPanel.setLayout (new GridLayout (length, length));
              buttonGrid = new JButton[length][length];          
              for (a = 0; a < length; a++)
                   for (b = 0; b < length; b++)
                        buttonGrid[a] = setButtonGridNew[a][b];
                        buttonGrid[a][b].addActionListener (this);
                        bottomPanel.add (buttonGrid[a][b]);
              return bottomPanel;
         //Overiding of abstract method actionPerformed
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == menuItemNew)
                   launchFrame(length);
              else if (e.getSource() == menuItemExit)
                   frame.setVisible (false);
                   System.exit(0);
              else if (e.getSource() == rbEasy)
                   length = 5;
                   launchFrame(length);
              else if (e.getSource() == rbHard)
                   length = 10;
                   launchFrame(length);     
              else if (e.getSource() == buttonReset)
                   launchFrame(length);
              else if (e.getSource() == buttonGrid[a][b])
                   int setGridNew [][] = null;
                   setGridNew = new int[length][length];               
                   JButton bombButton [][] = null;
                   bombButton = new JButton [length][length];
                   String bombString [][] = null;
                   bombString = new String[length][length];
                   setGridNew = setGrid (length);               
                   bombString[a][b] = setBombs (length, setGridNew, a, b);
                   bombButton[a][b] = new JButton (bombString[a][b]);
                   if (setGridNew[a][b] == 0)
                        buttonGrid[a][b] = bombButton[a][b];
                        getBombsTotal--;
                        JLabel setBombsLabelNew = new JLabel();
                        setBombsLabelNew = setBombsLabel (getBombsTotal);
                   else if (setGridNew[a][b] == 1 )
                        buttonGrid[a][b] = new JButton("x");
                        JOptionPane.showMessageDialog (null, "Game Over. You hit a Bomb!");
                        System.exit(0);     
         //create the content pane
         public Container newContentPane(int length)
              JPanel topPanel = new JPanel();
              JPanel bottomPanel = new JPanel();          
              topPanel = newTopPanel(length);
              bottomPanel = newBottomPanel (length);
              JPanel contentPane = new JPanel();
              contentPane.setOpaque (true);
              contentPane.setLayout (new BorderLayout(50,50));
              contentPane.add (topPanel, BorderLayout.NORTH);
              contentPane.add (bottomPanel, BorderLayout.CENTER);
              return contentPane;
         public void launchFrame (int length)
              //Makes sure we have nice window decorations
              JFrame.setDefaultLookAndFeelDecorated(true);          
              //Sets up the top-level window     
              frame = new JFrame ("Minesweeper");
              //Exits program when the closed button is clicked
              frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar menuBar = new JMenuBar();
              Container contentPane = new Container();
              menuBar = newMenuBar();
              contentPane = newContentPane (length);
              //Sets up the menu bar and content pane
              frame.setJMenuBar (menuBar);
              frame.setContentPane (contentPane);
              //Displays the window
              frame.pack();
              frame.setVisible (true);
         public static void main (String args[])
              //Default length is 5
              length = 5;
              MinesweeperGUI minesweeper = new MinesweeperGUI();
              minesweeper.launchFrame(length);

    hi, thanks. that removed the exception; although now the buttons action listener won't work :(
    here is the revised code:
    To anyone out there, can you guys run this code and help me debug it?
    I'm really desperate as this is a school project of mine and the deadline is 7 hours away. I have already been working on it for 3 days, but the program is still very buggy.
    thanks!
    /* Oliver Ian C. Wee 04-80112
    * CS12 MHRU
    * Machine Problem 2
    package minesweeperGUI;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MinesweeperGUI implements ActionListener
         //Declaration of attributes
         static int length = 0;
         JMenuItem menuItemNew = new JMenuItem();
         JRadioButtonMenuItem rbEasy = new JRadioButtonMenuItem();
         JRadioButtonMenuItem rbHard = new JRadioButtonMenuItem();
         JMenuItem menuItemExit = new JMenuItem();
         JButton buttonReset = new JButton();
         JButton buttonGrid[][] = null;
         JFrame frame = new JFrame();
         int getBombsTotal = 0;
         JLabel setBombsLabel = new JLabel();
         int a = 0;
         int b = 0;
         //No constructor created. Uses default constructor
         //Create the menu bar
         public JMenuBar newMenuBar()
              //Sets up the menubar
              JMenuBar menuBar = new JMenuBar();
              //Sets up the Game menu with choice of new, grid size, and exit
              JMenu menu = new JMenu ("Game");
              menuBar.add (menu);
              menuItemNew = new JMenuItem ("New");
              menuItemNew.addActionListener (this);
              menu.add (menuItemNew);
              menu.addSeparator();
              //Sets up sub-menu for grid size with choice of easy and hard radio buttons
              JMenu subMenu = new JMenu ("Grid Size");
              ButtonGroup bg = new ButtonGroup();
              rbEasy = new JRadioButtonMenuItem ("Easy: 5x5 grid");
              bg.add (rbEasy);
              rbEasy.addActionListener (this);
              subMenu.add (rbEasy);
              rbHard = new JRadioButtonMenuItem ("Hard: 10x10 grid");
              bg.add (rbHard);
              rbHard.addActionListener (this);
              subMenu.add (rbHard);
              menu.add (subMenu);
              menu.addSeparator();
              menuItemExit = new JMenuItem ("Exit");
              menuItemExit.addActionListener (this);
              menu.add (menuItemExit);
              return menuBar;
         //Setting up of Bomb Grid
         public int [][] setGrid (int length)
              int grid[][] = null;
              grid = new int[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        grid[i][j] = ((int)Math.round(Math.random() * 10))% 2;
              return grid;     
         //Setting up of the of the graphical bomb grid
         public JButton[][] setButtonGrid (int length)
              JButton buttonGrid[][] = null;
              buttonGrid = new JButton[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        buttonGrid[i][j] = new JButton();
              return buttonGrid;
         //Setting up of a way to count the total number of bombs in the bomb grid
         public int getBombsTotal (int length, int setGrid[][])
              int bombsTotal = 0;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (setGrid[i][j] == 1)
                             bombsTotal += 1;
              return bombsTotal;
         //Create a label for number of bombs left
         public JLabel setBombsLabel (int getBombsTotal)
              JLabel bombsLabel = new JLabel("  " +String.valueOf (getBombsTotal) + " Bombs Left");
              return bombsLabel;
         //Setting up a way to count the number of bombs around a button
         public String setBombs (int length, int setGrid[][], int x, int y)
              int bombs[][] = new int[length][length];
              String bombsString = null;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (i == 0 && j == 0)
                             bombs[i][j] = setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i ==0 && j == (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else if (i == (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1];
                        else if (i == (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1];
                        else if (i == 0 && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i][j+1] +
                                  setGrid[i+1][j-1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i == (length - 1) && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1];
                        else if (i != 0 && i != (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i != 0 && i != (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j] + setGrid[i+1][j+1];
              bombsString = String.valueOf (bombs[x][y]);
              return bombsString;
         //create the panel for the bombs label and reset button
         public JPanel newTopPanel(int length)
              int setGridNew [][] = null;
              setGridNew = new int[length][length];
              int getBombsTotalNew = 0;
              JLabel setBombsLabelNew = new JLabel();
              setGridNew = setGrid (length);
              getBombsTotalNew = getBombsTotal (length, setGridNew);
              setBombsLabelNew = setBombsLabel (getBombsTotalNew);
              JPanel topPanel = new JPanel ();
              topPanel.setLayout (new BorderLayout (20,20));
              JLabel bombsLabel = new JLabel ();
              bombsLabel = setBombsLabelNew;     
              topPanel.add (bombsLabel, BorderLayout.WEST);
              buttonReset = new JButton("Reset");
              buttonReset.addActionListener (this);
              topPanel.add (buttonReset, BorderLayout.CENTER);
              return topPanel;
         //create the panel for the play grids
         public JPanel newBottomPanel(int length)
              JButton setButtonGridNew[][] = null;
              setButtonGridNew = new JButton [length][length];
              setButtonGridNew = setButtonGrid (length);
              JPanel bottomPanel = new JPanel ();
              bottomPanel.setLayout (new GridLayout (length, length));
              buttonGrid = new JButton[length][length];          
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        buttonGrid[i][j] = setButtonGridNew[i][j];
                        buttonGrid[i][j].addActionListener (this);
                        bottomPanel.add (buttonGrid[i][j]);
              return bottomPanel;
         //Overiding of abstract method actionPerformed
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == menuItemNew)
                   closeFrame();
                   launchFrame(length);
              else if (e.getSource() == menuItemExit)
                   frame.setVisible (false);
                   System.exit(0);
              else if (e.getSource() == rbEasy)
                   closeFrame();
                   length = 5;
                   launchFrame(length);
              else if (e.getSource() == rbHard)
                   closeFrame();
                   length = 10;
                   launchFrame(length);     
              else if (e.getSource() == buttonReset)
                   closeFrame();
                   launchFrame(length);
              else if (e.getSource() == buttonGrid[a])
                   int setGridNew [][] = null;
                   setGridNew = new int[length][length];               
                   JButton bombButton [][] = null;
                   bombButton = new JButton [length][length];
                   String bombString [][] = null;
                   bombString = new String[length][length];
                   setGridNew = setGrid (length);               
                   for (int i = 0; i < length; i++)
                        for (int j = 0; j < length; j++)
                             bombString[i][j] = setBombs (length, setGridNew, i, j);
                             bombButton[i][j] = new JButton (bombString[i][j]);
                   if (setGridNew[a][b] == 0)
                        buttonGrid[a][b] = bombButton[a][b];
                        getBombsTotal--;
                        JLabel setBombsLabelNew = new JLabel();
                        setBombsLabelNew = setBombsLabel (" " String.valueOf (getBombsTotal) " Bombs Left");
                   else if (setGridNew[a][b] == 1 )
                        buttonGrid[a][b] = new JButton("x");
                        JOptionPane.showMessageDialog (null, "Game Over. You hit a Bomb!");
                        System.exit(0);     
         //create the content pane
         public Container newContentPane(int length)
              JPanel topPanel = new JPanel();
              JPanel bottomPanel = new JPanel();          
              topPanel = newTopPanel(length);
              bottomPanel = newBottomPanel (length);
              JPanel contentPane = new JPanel();
              contentPane.setOpaque (true);
              contentPane.setLayout (new BorderLayout(5,5));
              contentPane.add (topPanel, BorderLayout.NORTH);
              contentPane.add (bottomPanel, BorderLayout.CENTER);
              return contentPane;
         public void closeFrame ()
              frame = new JFrame ("Minesweeper");
              frame.dispose();
         public void launchFrame (int length)
              //Makes sure we have nice window decorations
              JFrame.setDefaultLookAndFeelDecorated(true);          
              //Sets up the top-level window     
              frame = new JFrame ("Minesweeper");
              //Exits program when the closed button is clicked
              frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar menuBar = new JMenuBar();
              Container contentPane = new Container();
              menuBar = newMenuBar();
              contentPane = newContentPane (length);
              //Sets up the menu bar and content pane
              frame.setJMenuBar (menuBar);
              frame.setContentPane (contentPane);
              //Displays the window
              frame.pack();
              frame.setVisible (true);
         public static void main (String args[])
              //Default length is 5
              length = 5;
              MinesweeperGUI minesweeper = new MinesweeperGUI();
              minesweeper.launchFrame(length);

  • Hi Pls help me understand this problem

    Hi,
    I know its a weired doubt, i select (select empno,ename,sal,deptno from emp where ename = 'SMITH')
    Result what i have is
    EMPNO ENAME SAL DEPTNO
    7369 SMITH 800 20
    I copied the result from the sql*plus and pasted the same into the same tool,
    SQL> EMPNO ENAME SAL DEPTNO
    SP2-0734: unknown command beginning "EMPNO ENAM..." - rest of line ignored.
    SQL> ------ ---------- ---------- ----------
    SQL> 7369 SMITH 800 20
    SQL>|
    For first copyied line i got error message: SP2-0734: unknown command beginning "EMPNO ENAM..." - rest of line ignored. And for second line i did not get error why ? could any one help me understand this.
    Thanks in advance
    Mahesh Ragineni

    Hi,
    The first line from
    EMPNO ENAME SAL DEPTNO
    7369 SMITH 800 20
    is treated as sql statement and gave the error.
    the second line is treated as comment hence no error;
    In the third line as the line begin with the number
    and followed by text it is treated as the sql statement to be added at the given line hence no error. if the first field was not number you will receive error.
    for ex:- SMITH 7369 800 20 will give u error.
    try this when u get sql prompt after
    7369 SMITH 600 20
    press / and press enter(to execute the 7369 SMITH 600 20)
    then u will receive error.
    Regs
    Dhananjaya

  • Pls help to understand this routine program

    Pls help to understand this routine program written in transformation level for a field.
    Data a Type /bic/oizsnote_2.
    Data: l_len type i,
          l_time type i.
    Move source_fields-zztdline+60(60) TO a.
    l_len = STRLEN(a).
    DO l_len TIMES.
    IF a+l_time(1) CN
    ',<>?/:;"''ABCDEFGHIJKLMNOPQTRSTUVWXYZ abcdefghijklmnopqrstuvwxyz!%^&' & '*' & "()__+=12346567890'
    a+l_time(1) = '~'.
    Endif.
    l_time = l_time + 1.      
    enddo.
    replace all occurrences of '~' in a with space.
    Result = a.
    not having much exposure in ABAP programming.
    Raj

    In addition to the above to posts..
    HI Raj,
    Your routine is used to remove the invalid characters.
      IF  A+l_time(1)  CN
    A is a Char which contains the data .*
      I_time is used for iteration(itu2019ll check each char by char in a word/Sentence).
    *CN u2013 Contains not
    ,?/:;"''ABCDEFGHIJKLMNOPQTRSTUVWXYZ abcdefghijklmnopqrstuvwxyz!%^&' & '*' & "()__+=12346567890.
    These are the Valid chars and numbers which will be accepted by BW system, System will throw an error only when load receives a char which is not there in the above. And that char will be treated as a Invalid Char.
    A+l_time(1) = '~'.
    What ever the special/Invalid char appears in the load apart from the above mentioned, system will convert  them to u2018~u2019
    REPLACE ALL OCCURRENCES OF '~' IN a WITH space.
       CONDENSE A.
    System will replace all the ~ with space, then condenses the space.
    You can do this using RSKC transaction instead of going for routine.

  • HT4203 I have turned off the Data use on the I-phone 4s but am told by AT&T that data is still being used for applications.  How is this possible. Can someone help me understand this.  Thanks.

    I have turned off the Data use on the I-phone 4s but am told by AT&T that data is still being used for applications.  How is this possible. Can someone help me understand this. 

    I assume you are including the STIX font as part of your epub files?     
    Perhaps the folks who do this blog might be able to help -- they have done some work with font embedding:
    http://www.pigsgourdsandwikis.com/2011/04/embedding-fonts-in-epub-ipad-iphone-an d.html

  • I try to sync my nano and get:  the ipod cant be synced because there is not enough free space to hold all of the items in the items library (need 100MB) - I have a new computer?? can you help me understand this message: what to do?

    I try to sync my nano and get:  the ipod cant be synced because there is not enough free space to hold all of the items in the items library (need 100MB) - I have a new computer?? can you help me understand this message: what to do?

    Hello pryan1012,
    What this message means is that you have more music in your itunes library than there is free space in your ipod.
    I had this same issue at one time. This is what helped me put my music on the ipod. I used manually manage.
    Learn how to sync muisc here.
    Hope this helps.
    ~Julian

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • Urgent help in understanding this

    Hi
    I have  the attached Vi. Ths VI generate six  different number  between 0 and 45 i dont understand very well the logic of program. I dont understand the input of shift register []DBL. is it in funtions palette?
    I would like that you help to understand this program.
    Attachments:
    Array of Random Numbers (LV 2009) (1).vi ‏11 KB

    The input to the shift register is an empty array for double floating point numbers.
    I don't know if you;ve been pointed to this before, but I would highly recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours
    And please give a more descriptive subject line then "urgent help in understand this".

  • Help to understand this question.

    for(int i = 1; i < 22; i++)
    if(i % 5 == 0 || i % 2 != 0 && i % 3 == 0)
    System.out.print(i + ? ?);
    I already know the answer this (3 5 9 10 15 20 21) but I do not understand how come..Can you help me understand this?

    In this program the and(&&) operator takes precedence among all opertors so, the "If" condition evalutes by considering && opertion first then || operation.,i.e. when i=3 the condition holds true(i % 2 !=0 && i %3==0). i think u can understand the logic now.

  • HT3209 Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    You will need to contact the movie studio that produced the DVD and ask if they can issue you a new code valid for Canada. Apple cannot help you, and everyone here in these forums is just a fellow user.
    Regards.

  • Can someone please help me understand this

    I am a new poster here and was hoping someone might be able to help me...
    I am writing a program that is supposed to generate a non applet (IE text) version of a 4-way intersection....however i have run into a problem that i simply cannot see a solution....please tell me why this code does not do what it is supposed to:
    in i meant to call the car arrives method which is supposed to enqueue based on some randomly determined parameters, known as direction and bound....it is supposed to loop through and do that for every car created.. what i think is happnening is that everything is getting overwritten rather than enqueued...what i dont understand is why...the reason i believe that nothing is enqueuing is because later in the code i attempt to dequeue these queues and and set a paramter and i get a null pointer exception
    PLEASE NOTE I RECIEVED THESE ERRORS BEFORE INSTANTIATING THE VEHICLE CURRENT CAR AS NULL...perhaps it is an instantiation problem but i cannot tell...please help me out as I have worked on this forthe last few days and am desparate for an answer
    Vehicle CurrentCar = null;
         do
              //this ensures that the number of vehicles generated is within the spec guidelines
              if (j == 1)//might need to be changed
                   numCars = generator.nextInt(7) + 4;
              else if ((j%2) == 0)
                   numCars = generator.nextInt(6) + 10;
              else if ((j>1)&&( (j%2) !=0))
                   numCars = generator.nextInt(4) + 10;
              totalCars += numCars;
              System.out.println("j is " + j);
              System.out.println( numCars);
              System.out.println(totalCars);
              //this ensures the number of vehicles never goes over 100
                   if (totalCars>100)
                        int subCars = (totalCars - 100); //ensures that car total never goes above 100
                        numCars = numCars - subCars;
                   //calls the MakeMeaCar method which contains the vehicle constructor
                   for (int k=1;k <= numCars; k++)
                   CurrentCar = MakeMeACar(count);
                   count ++;
                   Street.CarArrives(CurrentCar);
                   CurrentCar.toString();
    HERE IS THE CAR ARRIVES METHOD
    public static void CarArrives (Vehicle CurrentCar)
    //These if-else statements evaluate the enum parameters from the vehicle class and assigns them to a queue based on those parameters
    if (CurrentCar.getDirection() == Directenum.s)
         if ((CurrentCar.getBound() == Boundenum.nB) || (CurrentCar.getBound() == Boundenum.wB))
              lfstrChurchNorthbound.enqueue(CurrentCar);
         else if (CurrentCar.getBound() == Boundenum.eB)
              rChurchNorthbound.enqueue(CurrentCar);
    else if (CurrentCar.getDirection() == Directenum.n)
         if ((CurrentCar.getBound() == Boundenum.sB) || (CurrentCar.getBound() == Boundenum.eB))
              lfstrChurchSouthbound.enqueue(CurrentCar);
         else if (CurrentCar.getBound() == Boundenum.wB)
              rChurchSouthbound.enqueue(CurrentCar);
    else if (CurrentCar.getDirection() == Directenum.e)
         if ((CurrentCar.getBound() == Boundenum.wB) || (CurrentCar.getBound() == Boundenum.sB))
              lfstrMainEastbound.enqueue(CurrentCar);
         else if (CurrentCar.getBound() == Boundenum.nB)
              rMainEastbound.enqueue(CurrentCar);
    else if (CurrentCar.getDirection() == Directenum.w)
         if ((CurrentCar.getBound() == Boundenum.eB) || (CurrentCar.getBound() == Boundenum.nB))
              lfstrMainWestbound.enqueue(CurrentCar);
         else if (CurrentCar.getBound() == Boundenum.sB)
              rMainWestbound.enqueue(CurrentCar);
    if you need more code to help please let me know...i would post it all but it about 8 pages or more total (inlcuding the various classes)
    thanks
    I appreciate all help given

    ok running it through a debugger DID NOT HELP at all, please somebody help me, im very desparate now. i have spent 15 hours on this problem alone. i see absolutley nothing wrong with my code and have tried about 10 doifferent ways of trying this.,....i cannot get it to work, somebody please help me, ...in addition i was hoping someone could clear up an issue i have with enums...i do not understand how i can access the variable of the enum, the only access to it my text book provides is how to acess the string associated with enums....but i need to access the variable itself...how would i design such a get method....ive tried that a bunch of different ways as well, and right now im so lost that i want to cry, somebody please help, im begging on my knees...i really need someone to explain this to me....

Maybe you are looking for