Output of last command NOT accurate

Hi,
We have Solaris 10 Server running Oracle 10g. when i run last command it shows upto "Mar 21" and today is "May 12". But I see wtmpx being updated properly, Please advise as to how to fix this issue.
#last |more
oracle    sshd         enter            Sun Mar 21 12:32   still logged in
oracle    pts/1        enter            Sat Mar 20 20:18 - 20:26  (00:08)
oracle    sshd         enter            Sat Mar 20 20:18 - 20:26  (00:08)
dev       pts/1        192.168.116.5    Sat Mar 20 09:46 - 09:50  (00:04)

IIRC this happens when wtmpx grows to large, you can fix it by, as you did, nullify the old files, or move them aside if you would be interested in using them at a later stage..
.7/M.

Similar Messages

  • Command Line Recall (Korn Shell) - Last Command Not Blank

    I'm using emacs for command line recall, so I use the up and down arrow keys, which work fine.
    However, I come from a Tru64 background, and when I go back through the commands, and then come forward again, I expect to be able to go past the last command entered and return to a blank command line, so if I don't want to choose anything from history I can enter a new command. What's happening for me on the Solaris box I am now working on is that going forward in history sticks on the last command entered, so I have to backspace it to enter anything new.
    Any ideas on how I can change this behaviour?

    Kevin,
    Python has some great libraries to do what you are asking in the Unix enviornment:
    To get enviornmental variables:
    ====================
    import os
    # store the env var audit_username in a variable; if it doesn't exist, use 'davew' as the default
    username = os.getenv("audit_username",default='davew')
    To run Unix commands:
    ====================
    import commands
    # run a command from unix (example from Python manual
    commands.getstatusoutput('ls /bin/ls')
    Dave Warner

  • Could not complete the last command : problem with toast 10

    Hi, I am trying to burn blu ray content with Toast 10 Pro (blu-ray content burned to DVD). I have created the content (Quick Time movie) with FCP 7 (into an MOV file). And then added it to Toast 10. Then I tried to create disk image. It gave me this error:
    could not complete the last command because there is a problem with the source material: Error code - 18771.
    I tried to directly burn DVD also, and also not successful. Anybody has the same error and how to solve it?
    Thanks a lot, and happy new year.

    I posted some more experiences with using TOAST on Roxio forum. I thought I'd share them here.
    1. 98 video clip limit. I have been helping my parents and some friends to produce un-edited videos after their vacations, etc. And I quickly ran into this 98 video clip limit, to the point I had to produce multiple DVDs for them.
    2. Error 18771 issue. This happens if the individual video clips are too long. If I edit the video using FCP or FCE, and produce, say, half an hour of video, put it into a MOV file. Then add it into Toast. It will encounter this issue. So, the way I dealt with it, was to produce shorter video clips. So far it has been working out for me.
    3. Between video clips, I am not sure how to do transition. So far, between clips, there is this annoying pause. I would rather, either it just immediately jump to the next clip. Or, out of my own choice, insert some kind of transition. Not sure how to do that. If fellow toast users can point me in the right direction, that will be certainly appreciate it.
    4. I have not been able to get the Chapter Markers from FCP to effectively show up and be reflected in Toast as it defines the menus and chapters. Again, this may be because of my own lack of knowledge. If somebody can give me the pointer to do it, again, very much obliged.
    Message was edited by: seantshen

  • Render Times on FCP Not Accurate?

    Hi, <- My casual Greeting
    Hopefully there are a few video editors out there on the forum... cause this one is program specific....
    So I have been an avid Final Cut Pro guy for the last 4 years. I love the program.... I can work very easily in it but recently I got a new job in which I have been using both FCP and Adobe Premier.
    Here is my issue... I have been using files that come in as MPEG 2 and have been using MPEG Streamclip to convert them over to a ProRes file for FCP. From FCP I have had to export them into 3 formats
    1. Mpeg 4 (the file format our website takes)
    2. FLV (Format for online video sites)
    3. QuickTime (XDCAM) for our tricaster
    The last week I have been using FCP and my render times have been (for a 5 min clip)
    1. Mpeg 1 hour+
    2. FLV 20 min+
    3. QuickTime (XDCAM) 1 hour +
    Yesterday I was told to use Premier as my boss uses Premier on a regualr basis and I assured him that the times would be the same as FCP is a Mac native program and that Premier was made to work on a mac but is essentially a PC program (I am eating my words now)...
    I redid the renders on the same file...
    On premier the render times were
    1. Mpeg 30+ min
    2. FLV 12 min
    3. QuickTime (XDCAM) 40 min
    Why is this? Do I just have something really messed up in my settings that FCP is not rendering quickly and Premier is? I would hate to have to hop over to Premier... I enjoy using FCP way to much.
    The other question I have is why are FCP render times not accurate...
    The renders will start saying 5 min then 10 then an hour etc.... and the time will not be accurate. If it says 5 min it may go for an hour... or if it says an hour it may just complete while still telling me I have an hour to wait.
    Adobe Premier, right off the bat, will tell me the frame it is on and the percent and time left... almost to the T.
    If possible... please help me get my fcp back on the right track.
    Tim

    Rendering can be much faster if you have a multi core intel Mac and you use Qmaster with Quick Clusters.
    Here's how.
    Set up Quick Clusters in Qmaster. (A description of how to do this is in the manual and also can be found in the Qmaster forum here in the Apple discussions as well as out on the web.)
    Export your sequence from FCP using "current settings". (Do NOT use Quicktime Conversion!)
    Open up Compressor and submit your file. Add the three output elements.
    Submit the file and click "use unmanaged services"
    Go have a cup of coffee while all the cores chug away at things. I guarantee it will be faster than the way you are currently exporting (if you aren't using clusters)
    x

  • [SOLVED] sudo and "command not found" problems

    Ok, the problem I've got is this: sudo has suddenly started acting real strange. It can't find any programs. For example, if i type
    sudo echo
    It just goes
    sudo: echo: command not found
    And another problem I've got, is that as a regular user, it can't find programs in /sbin, or other "exotic" places. For example it can't find firefox, because it's not in /usr/bin or /bin, but in /opt/mozilla/bin.
    Please, help me!
    Last edited by mrpedroxx (2008-06-14 13:23:49)

    sudo -V outputs this
    Sudo version 1.6.9p15
    $PATH outputs
    bash: /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.: No such file or directory
    pacman -Q firefox outputs
    firefox 2.0.0.7-1
    Yeah, maybe I should update it anyway
    And /var/log/errors.log does contain stuff about hard disks, but it's just me mounting my iPod and the Windows partition on my hd

  • Sysql - use SQL queries against output of linux commands

    Hello!
    Many linux commands have table-like output. Sometimes it is better to analyze such output as a real table in relational database. I have published prototype of utility that parses output of one or several linux commands, saves it in database and allows to make SQL queries to that data. Program is written on python and uses sqlite database engine.
    sysql at AUR
    sysql at Github
    Here is why I wrote it:
    * No need to remember command syntax to format command output - just select necessary fields in SQL query
    * No need to know sed, awk, head, join and other linux commands to manipulate with output - it's all SQLite
    * Table data is stored with meaningful column name and type (int, text, float, datetime etc)
    * All power of SQL can be used to query output (JOIN, WHERE, GROUP BY etc.)
    * To support new command, output parser must be developed only once and then can be shared with community to make life easier
    * All supported commands are kept in one place as set of python files, so it is easy to find out how to customize existing parsers or create new ones
    This is my first community contribution, so kindly ask everyone to share your opinions and advices on what can be done better. Thank you!
    Examples:
    Display help and list of available commands:
    sysql
    Display output of ps command:
    sysql ps
    Query output of lsblk command:
    sysql -q "SELECT device,uuid,filesystem FROM lsblk" lsblk
    Query output of several commands:
    sysql -q "SELECT ps.pid, ps.command, ps.elapsed_time, lsof.name FROM ps JOIN lsof ON ps.pid = lsof.pid WHERE name LIKE '%LISTEN%'" ps -e --- lsof -Pni4

    I am not sure, if I will ever use it, but I do think, this is an _amazing_ idea!
    You may consider something like a global repository for output parsers accessable directly via sysql.
    Last edited by myname (2013-11-24 09:16:59)

  • Ln command not found causing Silverlight installation failure

    Hi, I have been working on fixing my silverlight installation for last couple of days. From the verbose in /var/log/install.log, it seems to be failing in the last line of the install code where it tries to create a symbolic link (ln -s)
    Not sure what happened, but i am unable to locate ln command in my terminal.
    My path is  set correctly
    bash-3.2$ echo $PATH
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
    How do i re-install ln ? I downloaded xcode as well as the command line tools, unfortunately "ln" is NOT part of it.

    Triple-click anywhere in the line below to select it:
    codesign -vv /bin/ln | open -f -a TextEdit
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    A TextEdit window will open with the output of the command. Post the contents of that window (not the Terminal window), if any — the text, please, not a screenshot. The title of the window doesn't matter, and you don't need to post that.

  • Bmon -o format, command not found, help!

    Hi,
    I'm looking for something as simple as it can be, with one-line conky-like output like
    dl: 150kpbs ul: 60kbps
    - that's all I need.
    EDIT:
    I'm trying to achieve something with bmon, however I keep getting errors
    bmon -p wlan0 -o format:fmt="$(item:name)\n"
    zsh: command not found: item:name
    Last edited by vi3dr0 (2009-12-04 18:53:58)

    The tag $(item:name) is caught by zsh, it tries to interpret it as a command substitution and complains about not having such a command (of course). You should protect it from zsh with simple quotes to let it interpret by bmon:
    bmon -p wlan0 -o 'format:fmt=$(item:name)\n'
    Actually for download and upload rates you have to write 'attr:rxrate:bytes' and 'attr:txrate:bytes' instead of 'item:name', respectively.
    In this case you always get bps, so if you would like it to be in kbps, you should catch the output and divide it by 1024. (Possibly some scripting is needed.)

  • [SOLVED] Error uninstalling eclipse: "post-install: command not found"

    When I try uninstalling eclipse , I get "error: command failed to execute correctly"
    w0ng@e8500 ~
    % sudo pacman -Rns eclipse
    checking dependencies...
    Targets (8): glib-networking-2.30.2-1 gsettings-desktop-schemas-3.2.0-1 gstreamer0.10-0.10.36-1
    gstreamer0.10-base-0.10.36-1 libproxy-0.4.7-1 libsoup-2.36.1-1 libwebkit-1.6.3-1
    eclipse-3.7.2-2
    Total Removed Size: 243.84 MiB
    Do you want to remove these packages? [Y/n] y
    (1/8) removing eclipse [######################################] 100%
    /tmp/alpm_eY6rVO/.INSTALL: line 10: post-install: command not found
    error: command failed to execute correctly
    (2/8) removing libwebkit [######################################] 100%
    (3/8) removing libsoup [######################################] 100%
    (4/8) removing glib-networking [######################################] 100%
    (5/8) removing libproxy [######################################] 100%
    (6/8) removing gsettings-desktop-schemas [######################################] 100%
    No schema files found: removed existing output file.
    (7/8) removing gstreamer0.10-base [######################################] 100%
    (8/8) removing gstreamer0.10 [######################################] 100%
    w0ng@e8500 ~
    But all files appear to be removed successfully.
    w0ng@e8500 ~
    % sudo updatedb && locate eclipse
    /usr/share/highlight/themes/edit-eclipse.theme
    /usr/share/icons/Faenza/apps/16/eclipse.png
    /usr/share/icons/Faenza/apps/22/eclipse.png
    /usr/share/icons/Faenza/apps/24/eclipse.png
    /usr/share/icons/Faenza/apps/32/eclipse.png
    /usr/share/icons/Faenza/apps/48/eclipse.png
    /usr/share/icons/Faenza/apps/64/eclipse.png
    /usr/share/icons/Faenza/apps/96/eclipse.png
    /usr/share/icons/Faenza/apps/scalable/eclipse.svg
    /var/abs/community/eclipse-cdt
    /var/abs/community/eclipse-cdt/PKGBUILD
    /var/abs/core/licenses/eclipse-1.0.txt
    /var/abs/extra/eclipse
    /var/abs/extra/eclipse-ecj
    /var/abs/extra/eclipse/PKGBUILD
    /var/abs/extra/eclipse/eclipse.desktop
    /var/abs/extra/eclipse/eclipse.install
    /var/abs/extra/eclipse/eclipse.sh
    /var/abs/extra/eclipse/eclipse.svg
    /var/abs/extra/eclipse-ecj/PKGBUILD
    /var/abs/extra/eclipse-ecj/ecj
    w0ng@e8500 ~
    Should I be concerned or is everything fine? Can anyone reproduce this?
    Last edited by w0ng (2012-03-28 19:00:30)

    Check /var/abs/extra/eclipse/eclipse.install. Typo in post_remove: post-install should be post_install. You can run the post_install manually (and maybe report this in the bug tracker), but it just updates the gtk icon cache, so it's nothing to worry about.

  • [SOLVED] "ip: command not found" after power failure

    Hello,
    After a power failure my Arch box has no network connection available. An 'ip addr' command showed me the outrageous error message :
    bash: ip: command not found
    How could this ever happen ? How do I recover from such an error ?
    Last edited by singleton (2014-12-19 17:34:58)

    I wasn't doing any system maintenance when the power failed, just some regular browsing.
    Here's the output of each command :
    pacman -Qk
    https://bpaste.net/show/e06fb962c42c
    echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    ls -l /usr/bin/ip
    ls: cannot access /usr/bin/ip: No such file or directory
    pacman -Qi iproute2
    error: package 'iproute2' was not found
    I 'm suspecting I will need to use a fresh installation CD to get over this. Any guidance will be greatly appreciated though!

  • [solved]yaourt local database save - command not found

    i tried following this link to save yaourt packages to a local folder, but i get an error
    [root@myhost yaourt]# yaourt -Syu --devel --aur
    /etc/yaourtrc: line 49: ExportToLocalRepository: command not found
    comments at this page with similar errors doesnt offer any solution.
    what am i missing here?
    Last edited by hadrons123 (2011-11-19 17:07:15)

    1.first thing i just added the line
    ExportToLocalRepository /var/cache/pacman/pkg-local
    to the bottom of the yaourtrc file as per the wiki and ended up with the error.
    /etc/yaourtrc: line 49: ExportToLocalRepository: command not found
    2.after falconindy's idea i added #
    #ExportToLocalRepository /var/cache/pacman/pkg-local
    but now i dont see the error but then package is not getting saved in the pkg-local folder.
    3.karol i tried your step,but still the packages are not saved in the pkg-local folder.
    this is yaourtrc file after the edits but still packages are not saved....
    # yaourtrc - Configuration for yaourt
    # See yaourtrc(5) for more information
    # ABS_REPO list repositories available on archlinux rsync server
    ABS_REPO=(testing core extra community-testing community gnome-unstable kde-unstable)
    # General
    #AUTOSAVEBACKUPFILE=0
    #DEVELBUILDDIR="/var/abs/local/yaourtbuild"
    #DEVEL=0
    #EDITOR="$EDITOR"
    #FORCEENGLISH=0
    #FORCE=0
    #TMPDIR="/tmp"
    #SUDONOVERIF=0 # Avoid multiple sudo checks when timestamp_timeout=0
    # AUR
    #AURCOMMENT=5
    #AURDEVELONLY=0
    #AURSEARCH=1
    #AURUPGRADE=0
    #AURVOTE=1
    # Build
    #EXPORT=0 # Export builded package
    #EXPORTSRC=0 # Need EXPORT=1 to be used
    #EXPORTDIR="" # If empty, use makepkg's connfiguration (see makepkg.conf)
    #EXPORT=0 # Export to 1: EXPORTDIR or PKGDEST
    # 2: pacman cache (as root)
    #EXPORTSRC=0 # Need EXPORT>0 to be used
    #EXPORTDIR="" # If empty, use makepkg's connfiguration (see makepkg.conf)
    # Prompt
    #NOCONFIRM=0
    #UP_NOCONFIRM=0 # No prompt while build upgrades (including -Sbu)
    #BUILD_NOCONFIRM=0 # Only prompt for editing files
    #EDITFILES=1
    #NOENTER=1
    # Output
    #USECOLOR=1
    #DETAILUPGRADE=1
    #SHOWORPHANS=1
    #TERMINALTITLE=1
    # Command
    #PACMAN="pacman"
    #DIFFEDITCMD="vimdiff"
    #ExportToLocalRepository /var/cache/pacman/pkg-local
    thanks for the replies though!

  • [solved] gconfpkg: command not found

    From my pacman output:
    (11/14) upgrading fusion-icon
    ==> Updating icon-cache.....
    /tmp/alpm_Napi2c/.INSTALL: line 32: gconfpkg: command not found
    error: command failed to execute correctly
    I reinstalled gconf and re-updated fusion-icon, the installation completed succesfully.
    This has happened before, should I be worried?
    p.s. these errors are not logged in pacman.log!
    Last edited by stefanwilkens (2009-12-03 13:35:44)

    problem solved, the location of gconfpkg wasn't in PATH
    locate gconfpkg
    /usr/sbin/gconfpkg
    I added /usr/sbin to the PATH definition in /etc/profile. Rebooted and all was working as it should

  • Timer Class not accurate and slows down my animation!?

    Does anyknow how why my timer object is not accurate and why it slows down my animation that is also present on my GUI at the same time?
    I have a timer in the form of 0.00 the left of the decimal point should represent a second but it doesnt, run my code and see for yourselves. below is my code if anyone can fix these 2 problems i will be very thankfull:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.Shape;
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.Timer;
    import java.sql.*;
    import java.text.*;
    public class RT extends JFrame implements MouseMotionListener
        //declares a number of swing componets to be used for the JFrame
        private JTextArea infoJTextArea;
        private JPanel showJPanel, startJPanel, helpJPanel, resultsJPanel;
        private JLabel de4JLabel, de3JLabel, mainTitleJLabel, nameJLabel, ageJLabel,
                       deJLabel, de1JLabel, de2JLabel, timeJLabel,nameResultJLabel,
                       ageResultJLabel, timeResultsJLabel, ratingJLabel, coJLabel, shJLabel;
        private JTextField nameJTextField, ageJTextField,nameResultJTextField,
                       ageResultsJTextField, timeResultsJTextField, ratingJTextField;
        private JButton exitJButton, showJButton, loginJButton, startTestJButton,
                        tempObjectJButton;
        private JScrollPane scroll;
    public JComboBox colourJComboBox, sizeJComboBox, shapeJComboBox, speedJComboBox;
    private static Connection dbcon;
    int temp=0;
    private String[] col = { "Red", "Blue", "Green","Yellow","Orange","Black"};
    private String[] shapeA = { "Normal Rectangle", "Normal Circle", "Normal Oval","BIG Rectangle", "BIG Circle","BIG Oval","small rectangle","small circle", "small oval"};
    private String[] speed = { "Fast", "Normal", "Slow"};
    public int checking;
    static int flag, flagshape, flagspeed;
        // creates and sets up a number of varibles to be used by the class
        public long timeLimit = 0;
        DecimalFormat timeDec = new DecimalFormat (":00");
        public int age;
        public String name, shapeChoice="Normal Rectangle(Never selected anything)", colourChoice="Black(Never selected anything)";
        private Timer TimeNow;
        private JTextField timerJTextField;
        ShapeMovingPanel testJPanel;
        Random seed;
        Shape shape;
        Shape[] shapes = {new Rectangle2D.Double(50, 30, 75, 25),new Ellipse2D.Double(175, 125, 50, 50),new Ellipse2D.Double(90, 100, 75, 35),new Rectangle2D.Double(50, 30, 175, 125),new Ellipse2D.Double(175, 125, 125, 125),new Ellipse2D.Double(90, 100, 175, 135),new Rectangle2D.Double(50, 30, 55, 15),new Ellipse2D.Double(175, 125, 20,20),new Ellipse2D.Double(90, 100, 55, 15)};
    //50, 30, 75, 25 change starting point here****************************************
        public RT()            // constructor method
            seed = new Random();
            shape = shapes[0];
            //sets up the Timer
            TimeNow = new Timer((1), new TimerListener());//++++++++++++++++++++++++++timer -17
            createUserInterface();          // method that creates the user interface     
        private void createUserInterface()
            new Thread(new Runnable()
                public void run()
                    String results = "";
                    int count = 0;
                    boolean journeyOn = true;
                    while(journeyOn && count < 3)
                        try
                            Thread.sleep(1000);
                        catch(InterruptedException ie)
                            System.err.println("show interrupt: " + ie.getMessage());
                            journeyOn = false;
                        results += count++ + ", ";
                    try {
                             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                             dbcon = DriverManager.getConnection("jdbc:odbc:CMT3991", "", ""); // Access/ODBC
                          //connection ash used to connect to the user table in access
                           } catch(Exception eee)
                           eee.printStackTrace();  //exception if error occurs during the driver connection
                             System.out.println("* UserDA CONNECTED *");
            }).start();
            Container contentPane = getContentPane();
            contentPane.setLayout( null );
            // set up infoJTextField
            infoJTextArea = new JTextArea();
            infoJTextArea.setBounds( 20, 420, 550, 170  );
            infoJTextArea.setEditable( false);
            infoJTextArea.setText("\n    Welcome to the reaction testing program, this " +
                            "program is designed to test your reactions in a  \n"+
                            "    number of different situations.\n"+"\n    Please " +
                            "enter your name and age, or select show previous results.");
            contentPane.add( infoJTextArea );
            scroll = new JScrollPane(infoJTextArea);
            scroll.setBounds(  20, 420, 550, 170 );
            contentPane.add( scroll );
                  startJPanel = new JPanel();
            startJPanel.setBounds( 16,16, 560, 375 );
            startJPanel.setBorder(
                    new TitledBorder( "WELCOME - PLEASE ENTER YOUR NAME AND AGE:" ) );
            startJPanel.setLayout( null );
            contentPane.add( startJPanel );
            //sets up a JPanel
            mainTitleJLabel = new JLabel();
            mainTitleJLabel.setIcon( new ImageIcon( "title.png" ) );
            mainTitleJLabel.setBounds( 30, 10, 520, 170 );
            mainTitleJLabel.setHorizontalAlignment( JLabel.CENTER );
            startJPanel.add( mainTitleJLabel );
            //creates a newJLabel
            nameJLabel= new JLabel();
            nameJLabel.setBounds( 52, 200, 70, 35 );
            nameJLabel.setText("Name:");
            startJPanel.add( nameJLabel);
            //creates a new JTextField
            nameJTextField = new JTextField();
            nameJTextField.setBounds( 130, 200, 300, 24 );
            startJPanel.add( nameJTextField );
            //creates a newJLabel
            ageJLabel = new JLabel();
            ageJLabel.setBounds( 52, 245, 100, 35 );
            ageJLabel.setText("Age:");
            startJPanel.add( ageJLabel );
            //creates a new JTextField
            ageJTextField = new JTextField();
            ageJTextField.setBounds( 130, 245, 300, 24 );
            startJPanel.add( ageJTextField );
            //creates a JButton
            loginJButton = new JButton();
            loginJButton.setBounds( 440, 200, 90, 24 );
            loginJButton.setText( "Login" );
            loginJButton.setBackground( Color.YELLOW );
            startJPanel.add( loginJButton );
            loginJButton.setEnabled(true);
    //        loginJButton.setVisible(true);
            loginJButton.addActionListener(
                new ActionListener()    // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                        // not necessary to pass events to these methods...
                        Login();  // calls the Login method                       
            //creates a JButton
            showJButton = new JButton();
            showJButton.setBounds( 200, 320, 180, 24 );
            showJButton.setText( "Show previous results" );
            showJButton.setBackground( Color.YELLOW );
            startJPanel.add( showJButton );
            showJButton.setEnabled(true);
    //        showJButton.setVisible(true);
            showJButton.addActionListener(
                new ActionListener()    // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                        showData();   // calls the showData method                       
            //sets up a JPanel
            showJPanel = new JPanel();
            showJPanel.setBounds( 16,16, 560, 375 );
            showJPanel.setBorder(new TitledBorder( "PREVIOUS RESULTS:" ) );
            showJPanel.setLayout( null );
            contentPane.add( showJPanel );
            //sets up a JPanel
            helpJPanel = new JPanel();
            helpJPanel.setBounds( 16,16, 560, 375 );
            helpJPanel.setBorder(
            new TitledBorder( "CHOOSE A NUMBER OF OPTIONS AND GET READY:" ) );
            helpJPanel.setLayout( null );
            helpJPanel.setVisible(false);
            contentPane.add( helpJPanel );
            //creates a newJLabel
            deJLabel= new JLabel();
            deJLabel.setBounds( 23, 390, 530, 35 );
            deJLabel.setText("Details:");
            contentPane.add( deJLabel);
            //creates a newJLabel
            coJLabel= new JLabel();
            coJLabel.setBounds( 70, 40, 530, 35 );
            coJLabel.setText("Choose a colour:");
            helpJPanel.add( coJLabel);
            //creates a newJLabel
            de1JLabel= new JLabel();
            de1JLabel.setBounds( 25, 100, 530, 35 );
            de1JLabel.setText("You are about to start the reaction test, when you " +
                              "press the start button it will begin.");
            helpJPanel.add( de1JLabel);
            //creates a newJLabel
            de1JLabel= new JLabel();
            de1JLabel.setBounds(160, 145, 530, 35 );
            de1JLabel.setText("Simply catch the moving item and click.");
            helpJPanel.add( de1JLabel);
            colourJComboBox = new JComboBox( col );
               colourJComboBox.setBounds( 70, 70, 135, 21 );
               colourJComboBox.setMaximumRowCount( 3 );
               helpJPanel.add( colourJComboBox );
              colourJComboBox.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                         colourChoice="Black";
                         int x = colourJComboBox.getSelectedIndex();
                        if( x  == 0)
                             flag = 1;
                             colourChoice="Red";
                        else if(x  == 1)
                             flag = 2;
                             colourChoice="Blue";
                        else if(x  == 2)
                             flag = 3;
                                colourChoice="Green";
                         else if(x  == 3)
                             flag = 4;
                                colourChoice="Yellow";
                         else if(x  == 4)
                             flag = 5;
                                colourChoice="Orange";
                           else if(x  == 5)
                             flag = 6;
                                colourChoice="Black";
            shJLabel= new JLabel();
            shJLabel.setBounds( 340, 40, 530, 35 );
            shJLabel.setText("Choose a shape and size:");
            helpJPanel.add( shJLabel);
            shapeJComboBox = new JComboBox( shapeA );
               shapeJComboBox.setBounds( 340, 70, 135, 21 );
               shapeJComboBox.setMaximumRowCount( 3 );
               helpJPanel.add( shapeJComboBox );
              shapeJComboBox.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                          int xshape = shapeJComboBox.getSelectedIndex();
                        //shapeChoice="Normal Rectangle";
                        if( xshape  == 0)
                        {     flagshape = 1;
                             shapeChoice="Normal Rectangle";
                        else if(xshape  == 1)
                        {     flagshape = 2;
                             shapeChoice="Normal Circle";
                        else if(xshape  == 2)//**********here
                        {     flagshape = 3;
                             shapeChoice="Normal Oval";
                        else if(xshape  == 3)
                        {     flagshape = 4;
                             shapeChoice="BIG Rectangle";
                        else if(xshape  == 4)
                       {      flagshape = 5;
                             shapeChoice="BIG Circle";
                        else if(xshape  == 5)
                     {        flagshape = 6;
                             shapeChoice="BIG Oval";
                        else if(xshape  == 6)
                             flagshape = 7;
                             shapeChoice="small rectangle";
                        else if(xshape  == 7)
                     {        flagshape = 8;
                             shapeChoice="small circle";
                        else if(xshape  == 8)
                     {        flagshape = 9;
                             shapeChoice="small oval";
          /*  speedJComboBox = new JComboBox( speed );
               speedJComboBox.setBounds( 10, 150, 135, 21 );
               speedJComboBox.setMaximumRowCount( 3 );
               helpJPanel.add( speedJComboBox );
              speedJComboBox.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                          int xspeed = speedJComboBox.getSelectedIndex();
                        if( xspeed  == 0)
                             flagspeed = 1;
                             else if(xspeed  == 1)
                             flagspeed = 2;
                             else
                             flagspeed = 3;
                        System.out.println(flagspeed);     
            //creates a newJLabel
            de2JLabel= new JLabel();
            de2JLabel.setBounds( 20, 380, 70, 35 );
            de2JLabel.setText("Details:");
            helpJPanel.add( de2JLabel);
            //creates a JButton
            startTestJButton = new JButton();
            startTestJButton.setBounds( 185, 205, 180, 60 );
            startTestJButton.setText( "START" );
            startTestJButton.setBackground( Color.YELLOW );
            helpJPanel.add( startTestJButton );
            startTestJButton.setEnabled(true);
    //        startTestJButton.setVisible(true);
            startTestJButton.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                        startTest();
            //sets up an animation panel
            testJPanel = new ShapeMovingPanel(this);
            testJPanel.setBounds( 16,16, 560, 375 );
            testJPanel.setBorder(new TitledBorder("Click the moving object:"));
            testJPanel.setLayout( null );
            testJPanel.setVisible(false);
            contentPane.add( testJPanel );
            testJPanel.addMouseMotionListener(this);
            //creates a newJLabel
            timeJLabel = new JLabel();
            timeJLabel.setBounds( 440, 330, 100, 35 );
            timeJLabel.setText("Time:");
            testJPanel.add( timeJLabel );
            //creates a new JTextField
            timerJTextField = new JTextField();
            timerJTextField.setBounds( 480, 335, 60, 24 );
            timerJTextField.setText(String.valueOf(timeLimit));
            timerJTextField.setHorizontalAlignment(JTextField.CENTER );
            timerJTextField.setEditable(false);
            timerJTextField.setBackground( Color.YELLOW );
            testJPanel.add( timerJTextField );
            resultsJPanel = new JPanel();
            resultsJPanel.setBounds( 16,16, 560, 375 );
            resultsJPanel.setBorder(new TitledBorder("HERE ARE YOUR RESULTS:"));
            resultsJPanel.setLayout( null );
            resultsJPanel.setVisible(false);
            contentPane.add( resultsJPanel );
            de3JLabel= new JLabel();
            de3JLabel.setBounds(20, 200, 530, 35 );
            de3JLabel.setText("Below is also the movements you made with your mouse, " +
                              "you may exit the program now.");
            resultsJPanel.add( de3JLabel);
            de4JLabel= new JLabel();
            de4JLabel.setBounds(135, 245, 530, 35 );
            de4JLabel.setText("Thank you for trying the Reaction Testing program");
            resultsJPanel.add( de4JLabel);
            //creates a newJLabel
            nameResultJLabel= new JLabel();
            nameResultJLabel.setBounds( 62, 55, 50, 35 );
            nameResultJLabel.setText("Name:");
            resultsJPanel.add( nameResultJLabel);
            //creates a new JTextField
            nameResultJTextField = new JTextField();
            nameResultJTextField.setBounds( 140, 55, 300, 24 );
            resultsJPanel.add( nameResultJTextField );
            nameResultJTextField.setEditable(false);
            //creates a newJLabel
            ageResultJLabel = new JLabel();
            ageResultJLabel.setBounds( 62, 90, 100, 35 );
            ageResultJLabel.setText("Age:");
            resultsJPanel.add( ageResultJLabel );
            //creates a new JTextField
            ageResultsJTextField = new JTextField();
            ageResultsJTextField.setBounds( 140, 90, 300, 24 );
            resultsJPanel.add( ageResultsJTextField );
            ageResultsJTextField.setEditable(false);
            //creates a newJLabel
            timeResultsJLabel = new JLabel();
            timeResultsJLabel.setBounds( 62, 125, 100, 35 );
            timeResultsJLabel.setText("Time taken:");
            resultsJPanel.add( timeResultsJLabel );
            //creates a new JTextField
            timeResultsJTextField = new JTextField();
            timeResultsJTextField.setBounds( 140, 125, 300, 24 );
            resultsJPanel.add( timeResultsJTextField );
            timeResultsJTextField.setEditable(false);
            //creates a newJLabel
            ratingJLabel = new JLabel();
            ratingJLabel.setBounds( 62, 160, 100, 35 );
            ratingJLabel.setText("Your Rating:");
            resultsJPanel.add( ratingJLabel );
            ratingJTextField = new JTextField();
            ratingJTextField.setBounds( 140, 160, 300, 24 );
            resultsJPanel.add( ratingJTextField );
            ratingJTextField.setEditable(false);
            //creates a JButton
            exitJButton = new JButton();
            exitJButton.setBounds( 235, 310, 90, 24 );
            exitJButton.setText( "Exit" );
            exitJButton.setBackground( Color.WHITE );
            resultsJPanel.add( exitJButton );
            exitJButton.setEnabled(true);
            exitJButton.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when exitJButton is pressed
                    public void actionPerformed( ActionEvent event )
                        System.exit(0); //closes the programme
            }); // end anonymous inner class
            addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            // set properties of application's window
            setTitle( "Reaction Tester - CMT3991" ); // set JFrame's title bar string
            //setSize( 1280,995 );    // set width and height of JFrame
            setSize( 608, 650 );         // set width and height of JFrame
            setVisible( true );       // display JFrame on screen
        //** set up of method main */
        public static void main( String[] args )
            RT application = new RT();
            application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        } // end method main
         * action listener for TimeNow Timer
        private class TimerListener implements ActionListener
            public void actionPerformed(ActionEvent event)
                timeLimit ++;          
                if (timeLimit==100)
                     temp++;
                     timeLimit=0;
                timerJTextField.setText(String.valueOf(temp +""+timeDec.format(timeLimit)));
        private void Login()
            try
                name = nameJTextField.getText();
                age = Integer.parseInt(ageJTextField.getText());
                startJPanel.setVisible(false);
                showJPanel.setVisible(false);
                helpJPanel.setVisible(true);
                infoJTextArea.setText("\n    Welcome "+name+" you will soon know how " +
                                      "fast your reactions are.");
            catch (NumberFormatException exception)
                JOptionPane.showMessageDialog(this,
                        "There is either a blank field or a number hasn't been entered",
                        "Input Type error", JOptionPane.ERROR_MESSAGE);
                //shows this is something has been entered wrong
        private void startTest()
            helpJPanel.setVisible(false);
          //  System.out.println(""+ seed.nextInt(shapes.length));
            //shape = shapes[seed.nextInt(shapes.length)];//****************************
            if (flagshape==1)
                 shape = shapes[0];// changed colour here***************************
            else if (flagshape==2)
                 shape = shapes[1];// changed colour here***************************
            else if (flagshape==3)
                 shape = shapes[2];// changed colour here***************************
           else if (flagshape==4)
                 shape = shapes[3];// changed colour here***************************
             else if (flagshape==5)
                 shape = shapes[4];// changed colour here***************************
            else if (flagshape==6)
                 shape = shapes[5];// changed colour here***************************
            else if (flagshape==7)
                 shape = shapes[6];// changed colour here***************************
            else if (flagshape==8)
                 shape = shapes[7];// changed colour here***************************
            else if (flagshape==9)
                 shape = shapes[8];// changed colour here***************************
           // shape = shapes[8];
            System.out.println(shape.toString());
            testJPanel.setShape(shape);
            testJPanel.setVisible(true);
            testJPanel.start();
            infoJTextArea.setText("");
            TimeNow.start();
         * called by animation panel after shape is clicked
        public void stop()
            TimeNow.stop();
            movingObject();
         * this will compete with your animation
         * ie, it will slow it down or make it appear jerky
        public void mouseMoved(MouseEvent e)
            saySomething("\n    Mouse moved", e);
        public void mouseDragged(MouseEvent e)
            saySomething("\n    Mouse dragged", e);
        void saySomething(String eventDescription, MouseEvent e)
            infoJTextArea.append(eventDescription
                         + " (" + e.getX() + "," + e.getY() + ")");
            infoJTextArea.setCaretPosition(infoJTextArea.getDocument().getLength());
        private void movingObject()
            TimeNow.stop();
            //timeLimit;
            testJPanel.setVisible(false);
            resultsJPanel.setVisible(true);
            nameResultJTextField.setText(name);
            ageResultsJTextField.setText(String.valueOf(age)+" years old");
    System.out.println("shape used: "+shapeChoice);
            String mouse = infoJTextArea.getText();
            String tick = timerJTextField.getText();
            timeResultsJTextField.setText(tick);
            try
                // create a file called welch.txt
                final FileWriter outputFile = new FileWriter("Backup_of_"+name+"s_results.txt", true);
                final BufferedWriter outputBuffer = new BufferedWriter(outputFile);
                // converts data to a formatted string
                final PrintWriter printstream = new PrintWriter(outputBuffer);
                printstream.println("THIS IS A BACKUP");
                printstream.println("The person's name is: "+name);
                printstream.println("There age is: "+age);
                printstream.println("Time taken: "+tick+" seconds");
                printstream.println("The Shape and size was: "+shapeChoice);
                printstream.println("It's colour was: "+colourChoice);
                printstream.println("The mouse moved as follows: "+mouse);
                //states what needs to be printed to the new file
                printstream.close(); // closes teh printstream
            catch(IOException eio)
                //catchs the IO exception
            if(temp<5.00)
                ratingJTextField.setText("Thierry Henry");     
            else if(timeLimit<=10)
                ratingJTextField.setText("Average");     
            else if(timeLimit<=15)
                ratingJTextField.setText("You gotta be fat or something");     
            else if(timeLimit<=20)
                ratingJTextField.setText("See a doctor");
            else if(timeLimit>20)
                ratingJTextField.setText("DO YOU KNOW WHAT YOU DOING!?");
            String rate=ratingJTextField.getText();
            try
                   Statement st = dbcon.createStatement();
                   String cmd = "INSERT INTO users (Name, Age, Time_Taken, Rating, Mouse_Movement,Shape_and_Size, Shape_Colour) VALUES ('" + name + "' , " + age + " , '" + tick + "' , '" + rate+"','"+ mouse+"','"+ shapeChoice+"','"+ colourChoice+"');";
                //creates a SQL statement and executes it
                st.executeUpdate(cmd);
                   st.close();//close the statement
              } catch (Exception eDA)
                   eDA.printStackTrace();
        private void showData()
            // pretend this takes awhile -> 3 seconds (count)
            new Thread(new Runnable()
                public void run()
                    String results = "";
                    int count = 0;
                    boolean journeyOn = true;
                    while(journeyOn && count < 3)
                        try
                            Thread.sleep(1000);
                        catch(InterruptedException ie)
                            System.err.println("show interrupt: " + ie.getMessage());
                            journeyOn = false;
                        results += count++ + ", ";
                    infoJTextArea.setText("Here are your results:\n"+results);
                    startJPanel.setVisible(false);
                    showJPanel.setVisible(true);
            }).start();
    class ShapeMovingPanel extends JPanel implements ActionListener
        RT host;
        Timer timer;
        Shape shape, xformed;
        int x, y, dx, dy;
        public ShapeMovingPanel(RT rt)
            timer = new Timer(-20, this);     
            host = rt;
        /*    if (rt.flagspeed==1)
            timer = new Timer(-20, this);
            else if (rt.flagspeed==2)
                timer = new Timer(20, this);
            else if (rt.flagspeed==3)
            timer = new Timer(100, this);
            //change speed here******************************
            x = 0;//0
            y = 0;//0
            dx =2;//2
            dy = 3;//3
            //setBackground(Color.pink);
            addMouseListener(new ShapeTender());
        public void actionPerformed(ActionEvent e)
            int w = getWidth();
            int h = getHeight();
            if(w <= 0 || h <= 0)
                return;
            checkBoundries(w,h);
            x += dx;
            y += dy;
            repaint();
        private void checkBoundries(int w, int h)
            Rectangle r = xformed.getBounds();
            Insets insets = getInsets();
            if(r.x + dx < insets.left || r.x + r.width + dx > w - insets.right)
                dx *= -1;
            if(r.y + dy < insets.top || r.y + r.height + dy > h - insets.bottom)
                dy *= -1;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            AffineTransform at = AffineTransform.getTranslateInstance(x, y);
            if (RT.flag==1)
            {g2.setPaint(Color.red);// changed colour here***************************
            else if (RT.flag==2)
            {g2.setPaint(Color.blue);// changed colour here***************************
            else if (RT.flag==3)
            {g2.setPaint(Color.green);// changed colour here***************************
            else if (RT.flag==4)
            {g2.setPaint(Color.yellow);// changed colour here***************************
            else if (RT.flag==5)
            {g2.setPaint(Color.orange);// changed colour here***************************
            else if (RT.flag==6)
            {g2.setPaint(Color.black);// changed colour here***************************
            xfo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

    I'm (being lazy and) using the older RT app posted on your last thread. I removed the
    TimeNow timer from the RT class and used System.currentTimeMillis (as you requested) to
    determine the elapsed time during the animation (see "startTest", "stop" and
    "movingObject" methods). Also changed the DecimalFormat to NumberFormat and set the
    "maximumFractionDigits" to "2" so it will truncate the fraction to two digits (more simple
    than before). Made arrangements for the ShapeMovingPanel class to update the
    "timerJTextField" during the animation (RT.updateTime method).
    The MouseMotionListener is causing the animation to appear jerky and uneven. The
    "mouseMoved" method is very busy while the mouse is moving. You might consider recording
    the "mousePressed" events instead of the "mouseMoved" events, ie, the events where the user
    is attempting to click inside the moving shape. It would allow the app to be more
    responsive and might eliminate the uneven motion of the animating shape.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.Timer;
    public class RT extends JFrame implements MouseMotionListener
        //declares a number of swing componets to be used for the JFrame
        private JTextArea infoJTextArea;
        private JPanel showJPanel, startJPanel, helpJPanel, resultsJPanel;
        private JLabel de4JLabel, de3JLabel, mainTitleJLabel, nameJLabel, ageJLabel,
                       deJLabel, de1JLabel, de2JLabel, timeJLabel,nameResultJLabel,
                       ageResultJLabel, timeResultsJLabel, ratingJLabel;
        private JTextField nameJTextField, ageJTextField,nameResultJTextField,
                       ageResultsJTextField, timeResultsJTextField, ratingJTextField;
        private JButton exitJButton, showJButton, loginJButton, startTestJButton,
                        tempObjectJButton;
        private JScrollPane scroll;;
        // creates and sets up a number of varibles to be used by the class
        private long startTime;
        private long endTime;
        public int timeLimit = 0;
        public int age;
        public String name;
        private JTextField timerJTextField;
        ShapeMovingPanel testJPanel;
        NumberFormat timeDec;
        Random seed;
        Shape shape;
        Shape[] shapes = {
            new Rectangle2D.Double(50, 30, 75, 25),
            new Ellipse2D.Double(175, 125, 50, 50),
            new Ellipse2D.Double(90, 100, 75, 35)
        public RT()
            timeDec = NumberFormat.getInstance();
            timeDec.setMaximumFractionDigits(2);
            seed = new Random();
            shape = shapes[0];
            createUserInterface();
        private void createUserInterface()
            Container contentPane = getContentPane();
            contentPane.setLayout( null );
            // set up infoJTextField
            infoJTextArea = new JTextArea();
            infoJTextArea.setBounds( 20, 420, 550, 170  );
            infoJTextArea.setEditable( false);
            infoJTextArea.setText("\n    Welcome to the reaction testing program, this " +
                            "program is designed to test your reactions in a  \n"+
                            "    number of different situations.\n"+"\n    Please " +
                            "enter your name and age, or select show previous results.");
            contentPane.add( infoJTextArea );
            scroll = new JScrollPane(infoJTextArea);
            scroll.setBounds(  20, 420, 550, 170 );
            contentPane.add( scroll );
              startJPanel = new JPanel();
            startJPanel.setBounds( 16,16, 560, 375 );
            startJPanel.setBorder(
                    new TitledBorder( "WELCOME -PLEASE ENTER YOUR NAME AND AGE:" ) );
            startJPanel.setLayout( null );
            contentPane.add( startJPanel );
            //sets up a JPanel
            mainTitleJLabel = new JLabel();
            mainTitleJLabel.setIcon( new ImageIcon( "title.png" ) );
            mainTitleJLabel.setBounds( 30, 10, 520, 170 );
            mainTitleJLabel.setHorizontalAlignment( JLabel.CENTER );
            startJPanel.add( mainTitleJLabel );
            //creates a newJLabel
            nameJLabel= new JLabel();
            nameJLabel.setBounds( 52, 200, 70, 35 );
            nameJLabel.setText("Name:");
            startJPanel.add( nameJLabel);
            //creates a new JTextField
            nameJTextField = new JTextField();
            nameJTextField.setBounds( 130, 200, 300, 24 );
            startJPanel.add( nameJTextField );
            //creates a newJLabel
            ageJLabel = new JLabel();
            ageJLabel.setBounds( 52, 245, 100, 35 );
            ageJLabel.setText("Age:");
            startJPanel.add( ageJLabel );
            //creates a new JTextField
            ageJTextField = new JTextField();
            ageJTextField.setBounds( 130, 245, 300, 24 );
            startJPanel.add( ageJTextField );
            //creates a JButton
            loginJButton = new JButton();
            loginJButton.setBounds( 440, 200, 90, 24 );
            loginJButton.setText( "Login" );
            loginJButton.setBackground( Color.YELLOW );
            startJPanel.add( loginJButton );
            loginJButton.setEnabled(true);
            loginJButton.addActionListener(
                new ActionListener()    // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                        // not necessary to pass events to these methods...
                        Login();  // calls the Login method                       
            //creates a JButton
            showJButton = new JButton();
            showJButton.setBounds( 200, 320, 180, 24 );
            showJButton.setText( "Show previous results" );
            showJButton.setBackground( Color.YELLOW );
            startJPanel.add( showJButton );
            showJButton.setEnabled(true);
            showJButton.addActionListener(
                new ActionListener()    // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                        showData();   // calls the showData method                       
            //sets up a JPanel
            showJPanel = new JPanel();
            showJPanel.setBounds( 16,16, 560, 375 );
            showJPanel.setBorder(new TitledBorder( "PREVIOUS RESULTS:" ) );
            showJPanel.setLayout( null );
            contentPane.add( showJPanel );
            //sets up a JPanel
            helpJPanel = new JPanel();
            helpJPanel.setBounds( 16,16, 560, 375 );
            helpJPanel.setBorder(
            new TitledBorder( "HELP DETAILS:" ) );
            helpJPanel.setLayout( null );
            helpJPanel.setVisible(false);
            contentPane.add( helpJPanel );
            //creates a newJLabel
            deJLabel= new JLabel();
            deJLabel.setBounds( 23, 390, 530, 35 );
            deJLabel.setText("Details:");
            contentPane.add( deJLabel);
            //creates a newJLabel
            de1JLabel= new JLabel();
            de1JLabel.setBounds( 25, 100, 530, 35 );
            de1JLabel.setText("You are about to start the reaction test, when you " +
                              "press the start button it will begin.");
            helpJPanel.add( de1JLabel);
            //creates a newJLabel
            de1JLabel= new JLabel();
            de1JLabel.setBounds(160, 145, 530, 35 );
            de1JLabel.setText("Simply catch the moving item and click.");
            helpJPanel.add( de1JLabel);
            //creates a newJLabel
            de2JLabel= new JLabel();
            de2JLabel.setBounds( 20, 380, 70, 35 );
            de2JLabel.setText("Details:");
            helpJPanel.add( de2JLabel);
            //creates a JButton
            startTestJButton = new JButton();
            startTestJButton.setBounds( 185, 205, 180, 60 );
            startTestJButton.setText( "START" );
            startTestJButton.setBackground( Color.YELLOW );
            helpJPanel.add( startTestJButton );
            startTestJButton.setEnabled(true);
            startTestJButton.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when search is pressed
                    public void actionPerformed( ActionEvent event )
                        startTest();
            //sets up an animation panel
            testJPanel = new ShapeMovingPanel(this);
            testJPanel.setBounds( 16,16, 560, 375 );
            testJPanel.setBorder(new TitledBorder("Click the moving object:"));
            testJPanel.setLayout( null );
            testJPanel.setVisible(false);
            contentPane.add( testJPanel );
    // this is causing the animation to appear uneven
    // you can try the app with and without this to see
    //        testJPanel.addMouseMotionListener(this);
            //creates a newJLabel
            timeJLabel = new JLabel();
            timeJLabel.setBounds( 440, 330, 100, 35 );
            timeJLabel.setText("Time:");
            testJPanel.add( timeJLabel );
            //creates a new JTextField
            timerJTextField = new JTextField();
            timerJTextField.setBounds( 480, 335, 60, 24 );
            timerJTextField.setText(String.valueOf(timeLimit));
            timerJTextField.setHorizontalAlignment(JTextField.CENTER );
            timerJTextField.setEditable(false);
            timerJTextField.setBackground( Color.YELLOW );
            testJPanel.add( timerJTextField );
            resultsJPanel = new JPanel();
            resultsJPanel.setBounds( 16,16, 560, 375 );
            resultsJPanel.setBorder(new TitledBorder("HERE ARE YOUR RESULTS:"));
            resultsJPanel.setLayout( null );
            resultsJPanel.setVisible(false);
            contentPane.add( resultsJPanel );
            de3JLabel= new JLabel();
            de3JLabel.setBounds(20, 200, 530, 35 );
            de3JLabel.setText("Below is also the movements you made with your mouse, " +
                              "you may exit the program now.");
            resultsJPanel.add( de3JLabel);
            de4JLabel= new JLabel();
            de4JLabel.setBounds(135, 245, 530, 35 );
            de4JLabel.setText("Thank you for trying the Reaction Testing program");
            resultsJPanel.add( de4JLabel);
            //creates a newJLabel
            nameResultJLabel= new JLabel();
            nameResultJLabel.setBounds( 62, 55, 50, 35 );
            nameResultJLabel.setText("Name:");
            resultsJPanel.add( nameResultJLabel);
            //creates a new JTextField
            nameResultJTextField = new JTextField();
            nameResultJTextField.setBounds( 140, 55, 300, 24 );
            resultsJPanel.add( nameResultJTextField );
            nameResultJTextField.setEditable(false);
            //creates a newJLabel
            ageResultJLabel = new JLabel();
            ageResultJLabel.setBounds( 62, 90, 100, 35 );
            ageResultJLabel.setText("Age:");
            resultsJPanel.add( ageResultJLabel );
            //creates a new JTextField
            ageResultsJTextField = new JTextField();
            ageResultsJTextField.setBounds( 140, 90, 300, 24 );
            resultsJPanel.add( ageResultsJTextField );
            ageResultsJTextField.setEditable(false);
            //creates a newJLabel
            timeResultsJLabel = new JLabel();
            timeResultsJLabel.setBounds( 62, 125, 100, 35 );
            timeResultsJLabel.setText("Time taken:");
            resultsJPanel.add( timeResultsJLabel );
            //creates a new JTextField
            timeResultsJTextField = new JTextField();
            timeResultsJTextField.setBounds( 140, 125, 300, 24 );
            resultsJPanel.add( timeResultsJTextField );
            timeResultsJTextField.setEditable(false);
            //creates a newJLabel
            ratingJLabel = new JLabel();
            ratingJLabel.setBounds( 62, 160, 100, 35 );
            ratingJLabel.setText("Your Rating:");
            resultsJPanel.add( ratingJLabel );
            ratingJTextField = new JTextField();
            ratingJTextField.setBounds( 140, 160, 300, 24 );
            resultsJPanel.add( ratingJTextField );
            ratingJTextField.setEditable(false);
            //creates a JButton
            exitJButton = new JButton();
            exitJButton.setBounds( 235, 310, 90, 24 );
            exitJButton.setText( "Exit" );
            exitJButton.setBackground( Color.WHITE );
            resultsJPanel.add( exitJButton );
            exitJButton.setEnabled(true);
            exitJButton.addActionListener(
                new ActionListener() // adds an action listener,anonymous inner class
                    // event handler called when exitJButton is pressed
                    public void actionPerformed( ActionEvent event )
                        System.exit(0); //closes the programme
            }); // end anonymous inner class
            addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            // set properties of application's window
            setTitle( "Reaction Tester - CMT3991" ); // set JFrame's title bar string
            //setSize( 1280,995 );    // set width and height of JFrame
            setSize( 608, 650 );         // set width and height of JFrame
            setVisible( true );       // display JFrame on screen
        //** set up of method main */
        public static void main( String[] args )
            RT application = new RT();
            application.setDefaultCloseOperation( EXIT_ON_CLOSE );
        } // end method main
        private void Login()
            try
                name = nameJTextField.getText();
                age = Integer.parseInt(ageJTextField.getText());
                startJPanel.setVisible(false);
                showJPanel.setVisible(false);
                helpJPanel.setVisible(true);
                infoJTextArea.setText("\n    Welcome "+name+" you will soon know how " +
                                      "fast your reactions are");
            catch (NumberFormatException exception)
                JOptionPane.showMessageDialog(this,
                        "There is either a blank field or a number hasn't been entered",
                        "Input Type error", JOptionPane.ERROR_MESSAGE);
                //shows this is something has been entered wrong
        private void startTest()
            helpJPanel.setVisible(false);
            shape = shapes[seed.nextInt(shapes.length)];
            testJPanel.setShape(shape);
            testJPanel.setVisible(true);
            testJPanel.start();
            startTime = System.currentTimeMillis();
            infoJTextArea.setText("");
         * called by animation panel after shape is clicked
        public void stop()
            endTime = System.currentTimeMillis();
            movingObject();
         * called by timer actionPerformed in ShapeMovingPanel
        public void updateTime()
            long timeNow = System.currentTimeMillis();
            double elapsed = (timeNow - startTime)/1000.0;
            timerJTextField.setText(timeDec.format(elapsed));
         * this will compete with your animation
         * ie, it will slow it down or make it appear jerky
        public void mouseMoved(MouseEvent e)
            saySomething("\n    Mouse moved", e);
        public void mouseDragged(MouseEvent e)
            saySomething("\n    Mouse dragged", e);
        void saySomething(String eventDescription, MouseEvent e)
            infoJTextArea.append(eventDescription
                         + " (" + e.getX() + "," + e.getY() + ")");
            infoJTextArea.setCaretPosition(infoJTextArea.getDocument().getLength());
        private void movingObject()
            testJPanel.setVisible(false);
            resultsJPanel.setVisible(true);
            nameResultJTextField.setText(name);
            ageResultsJTextField.setText(String.valueOf(age)+" years old");
            double elapsedTime = (endTime - startTime)/1000.0;
            timeLimit = (int)elapsedTime;
            timeResultsJTextField.setText(timeDec.format(elapsedTime)+" seconds");
            String mouse = infoJTextArea.getText();
            String tick = timeDec.format(elapsedTime);
            try
                // create a file called welch.txt
                final FileWriter outputFile = new FileWriter(name+".txt", true);
                final BufferedWriter outputBuffer = new BufferedWriter(outputFile);
                // converts data to a formatted string
                final PrintWriter printstream = new PrintWriter(outputBuffer);
                printstream.println("The person's name is: "+name);
                printstream.println("There age is: "+age);
                printstream.println("Time taken: "+tick+" seconds");
                printstream.println("The mouse moved as follows: "+mouse);
                //states what needs to be printed to the new file
                printstream.close(); // closes teh printstream
            catch(IOException eio)
                //catchs the IO exception
            if(timeLimit<5)
                ratingJTextField.setText("Thierry Henry");     
            if(timeLimit>5)
                ratingJTextField.setText("Average");     
            if(timeLimit>10)
                ratingJTextField.setText("You gotta be fat or something");     
            if(timeLimit>20)
                ratingJTextField.setText("See a doctor");
            String rate=ratingJTextField.getText();
        private void showData()
    //        String results = "";
    //        infoJTextArea.setText("Here are your results:\n"+results);
            startJPanel.setVisible(false);
            showJPanel.setVisible(true);
    class ShapeMovingPanel extends JPanel implements ActionListener
        RT host;
        Timer timer;
        Shape shape, xformed;
        int x, y, dx, dy;
        public ShapeMovingPanel(RT rt)
            host = rt;
            timer = new Timer(25, this);
            x = 0;
            y = 0;
            dx = 2;
            dy = 3;
            setBackground(Color.pink);
            addMouseListener(new ShapeTender());
        public void actionPerformed(ActionEvent e)
            int w = getWidth();
            int h = getHeight();
            if(w <= 0 || h <= 0)
                return;
            checkBoundries(w,h);
            x += dx;
            y += dy;
            repaint();
            // update RT.timerJTextField
            host.updateTime();
        private void checkBoundries(int w, int h)
            Rectangle r = xformed.getBounds();
            Insets insets = getInsets();
            if(r.x + dx < insets.left || r.x + r.width + dx > w - insets.right)
                dx *= -1;
            if(r.y + dy < insets.top || r.y + r.height + dy > h - insets.bottom)
                dy *= -1;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            AffineTransform at = AffineTransform.getTranslateInstance(x, y);
            g2.setPaint(Color.red);
            xformed = at.createTransformedShape(shape);
            g2.draw(xformed);
        public void start()
            if(!timer.isRunning())
                timer.start();
        public void setShape(Shape s)
            shape = s;
            Rectangle r = shape.getBounds();
            x = r.x;
            y = r.y;
            repaint();
        private class ShapeTender extends MouseAdapter
            public void mousePressed(MouseEvent e)
                if(xformed.contains(e.getPoint()))
                    timer.stop();
                    host.stop();
    }

  • Command not found error while executing shell programs in terminal

    I have written one sample shell program.
    while executing shell program in terminal,it shows COMMAND NOT FOUND error.
    How to slove this.

    Post the "Actual" error.  It says more than command not found.
    Post your script.
    Post the output from:
    echo $PATH
    Post the output from:
    which name_of_command_not_found

  • How to know last command used in solaris

    Dear Friends,
    We have a Solaris 8 server. Someone changed ownership of files. Is there any way to find out who logged in the server & changed ownership ? ?
    last command is not giving much information . Since /var/adm/lastlog is in binary format I am not able to read it's contents.
    Requesting to help me out.
    Regards,
    Tejas J Raval

    You can also check the history of a particular user. By instance, if it use bash, check this file :
    ~/.bash_historyand check his :
    ~/bash_loginand :
    ~/.bashrcbecause he has perhaps some special feature, like to set his history in an other file by instance.

Maybe you are looking for

  • The respond button on eBay works with Internet Explorer, but NOT with Firefox.

    The "Ask a question == This happened == Every time Firefox opened == Yesterday

  • Ipod touch over capacity

    I recently got a new windows 7 hp desktop. I transfered all of my music via external hard drive, and transfered my apps via itunes transfer purchases. I have not synced my ipods' photos yet. When I click sync, it goes through step one and two, then I

  • Using DEBUG Mode in Oracle SQL Developer Data Modeler to Log SQL

    Hello, I am looking for the possibilty to enable the logging of SQL in Data Modeler. Jeff Smith wrote an article how to do this for SQL Developer, for Data Modeler there are other configuration files. Does anyone have an idea? Best regards, Joop

  • Need Help on Oracle text

    Hi Masters, I am working on Oracle Text. I have executed the below step/commands. All are executed successfully. But I didn't seen any improvement in my task. But I have one doubt, will explain below. create table ent_dnt as select * from entitlement

  • Unable to connect to essbase server with Smart View

    Hi, I'm having trobules connecting Smart View in order to make some adhoc analysis, however I could perfectly establish connection with Planning and navigate through web forms in excel. The address I'm using to connect to Essbase is: http://<server>: