Need help with effect / function stop!

Hi all!
I tried to build some kind of custom pop-up-menu with fade
in/out effect, however the menu sometimes (< very often, but not
always) disappears while the mouse is still over it.
So i defined a function to stop/abort the effects, but this
doesn't work right.
Could anybody please tell me, how to stop all functions,
while the mouse is over a link?
/// This is the container to appear / disappear:
<div id="navislide" style="height:292px;
overflow:hidden;">
<a href="mylink.html" onMouseOver="killall();"
onMouseOut="hideit();">mylink</a>
</div>
/// This is the link to show the container:
<a href="#"
onMouseOver="slidefadein.start();">mylink</a>
<script type="text/javascript">
function displayblock() {
var thediv = document.getElementById('navislide');
thediv.style.display= "block";
slidetimer = setTimeout('slidefadeout.start();', 2000);
hideit = function() {
slidetimer = setTimeout('slidefadeout.start();', 2000);
function displaynone() {
var thediv = document.getElementById('navislide');
thediv.style.display= "none";
killall = function() {
clearTimeout(slidetimer);
slidefadeout.stop();
slidefadein.stop();
displayblock();
slidefadeup.start();
var slidefadein = new Spry.Effect.Fade("navislide", {from:0,
to:100, toggle:false, setup:displayblock, finish:hideit});
var slidefadeout = new Spry.Effect.Fade("navislide",
{from:100, to:0, toggle:false, finish:displaynone});
var slidefadeup = new Spry.Effect.Fade("navislide",
{from:100, to:100, toggle:false});
</script>
Probably, its all about the "killall"-function, because when
the mouse moves over the link, the function to abort all other
effects, does not take effect.
Thank you so much vor any kind of help or hint!!
Cheers,
idefix

I would be most interested in a reply to this for I asked
weeks ago how to use an onClick stop() function for the links in my
page. I was given the stop function by VFusion (it is to stop
panels from rotating), but I could never figure out how to actually
get the function to stop the panels and could not get it no matter
what I tried, eventually had to take the panel rotation out.

Similar Messages

  • I need help with Analytic Function

    Hi,
    I have this little problem that I need help with.
    My datafile has thousands of records that look like...
    Client_Id Region Countries
    [1] [1] [USA, Canada]
    [1] [2] [Australia, France, Germany]
    [1] [3] [China, India, Korea]
    [1] [4] [Brazil, Mexico]
    [8] [1] [USA, Canada]
    [9] [1] [USA, Canada]
    [9] [4] [Argentina, Brazil]
    [13] [1] [USA, Canada]
    [15] [1] [USA]
    [15] [4] [Argentina, Brazil]
    etc
    My task is is to create a report with 2 columns - Client_Id and Countries, to look something like...
    Client_Id Countries
    [1] [USA, Canada, Australia, France, Germany, China, India, Korea, Brazil, Mexico]
    [8] [USA, Canada]
    [9] [USA, Canada, Argentina, Brazil]
    [13] [USA, Canada]
    [15] [USA, Argentina, Brazil]
    etc.
    How can I achieve this using Analytic Function(s)?
    Thanks.
    BDF

    Hi,
    That's called String Aggregation , and the following site shows many ways to do it:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    Which one should you use? That depends on which version of Oracle you're using, and your exact requirements.
    For example, is order importatn? You said the results shoudl include:
    CLIENT_ID  COUNTRIES
    1        USA, Canada, Australia, France, Germany, China, India, Korea, Brazil, Mexicobut would you be equally happy with
    CLIENT_ID  COUNTRIES
    1        Australia, France, Germany, China, India, Korea, Brazil, Mexico, USA, Canadaor
    CLIENT_ID  COUNTRIES
    1        Australia, France, Germany, USA, Canada, Brazil, Mexico, China, India, Korea?
    Mwalimu wrote:
    ... How can I achieve this using Analytic Function(s)?The best solution may not involve analytic functions at all. Is that okay?
    If you'd like help, post your best attempt, a little sample data (CREATE TABLE and INSERT statements), the results you want from that data, and an explanation of how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Aug 29, 2011 3:05 PM

  • Need help with effect!

    I need help with the following:
    I am currently making a Harry Potter short film and I'm doing a spell that hits my friend and my friend needs to be blown backwards (if you know what I mean, he needs to like kinda fly backwards because of the force from the spell).
    Can you in anyway help me with this or give me an idea on how to proceed?
    I've been thinking of setting a green screen up where the person jumps backwards on a mattress or similar.
    Thank you so much, I really hope you can help me.
    I have been searching the web for a long long time and didn't find any answer.
    Contact:
    Reply here
    Skype: asgerrockz

    Be careful here. Someone yanking on another person rigged with a professional harness can suffer permanent spinal injury. I have a home and a family and I wouldn't attempt even a simple version of this kind of stunt without a rider on my liability policy, a professional and therefore bondable stunt coordinator, and a trained stunt person. No offence Todd but I'd never yank someone backward by a wire or cord attached to their torso.
    You can do this very gently by having the actor just throw out their arms and jump backwards a bit then do the majority of the move in AE. Having the camera on a simple slider would also help. As the actor jumps back dolly the camera back on a slider.
    I've been shooting and producing films for more than 40 years when not one injury on the set except for me. Fractured my L2 and L3 vertebrae on a fall with a SetadyCam in 1975 because we didn't do a thorough enough safety briefing. Don't just try and do something you think you have seen on YouTube without some serious planning. There's no need for anyone to get hurt on a set.

  • AE "newbie" needs help with effect - (please!)

    Hi all:
    I'm working on a highlight video of my daughter - she's the goalie for her H.S. Lacrosse team.  I recently bought the Creative Cloud subscription. I'm editing the video in Premiere Pro CC on an iMac - OSX 10.7.5.
    I'm putting together a short intro/open, and trying to add some effect to my daughter in the clip shown below.  She is running/jumping - I want to be able to isolate just her and add some sort of color effect, a glow (or even just make everything else b&w).  Obviously, my problem is with masking or roto brushing.  I've spent many hours (probably too many!) watching tutorials and reading the help articles -- and I just can't seem to get it right.  I saw a video talking about the much anticipated October update - and wondering if the new Mask Tracker will do what I need/want?
    Here is the clip - (my daughter is #11 - the only one wearing a helmet)
    Thanks in advance for any guidance/help/suggestions you can provide,
    Kim

    Thanks again for pointing me in the direction of the Motion Tracking and Rotoscoping tutorial.
    I successfully (in my opinion, anyway!) was able to apply an effect to the moving object (my daughter ).  There are a few places that I could tighten up the mask, but it's not too bad - and I just realized I forgot to feather the mask - so that will help as well.
    I tried a bunch of different effects -- but really wasn't happy with any of them.  I went ahead and just made her B&W just for illustrative purposes.
    What I'd really like to do is make the background B&W and keep her in color.
    I tried applying the B&W effect onto the footage layer -- but it seemed to make everything b&w - including my masked/rotoscoped object. I am sure that it is very simple to do -- but haven't been able to find the right instructions.
    (I looped the clip a few times - since it is only about 1.5 seconds long)..
    So - again - thanks in advance for helping me figure out how to apply the B&W to just the background!
    Kim

  • Need help with  effect to sing vocal hook with

    I have to sign a hook along with a singer but i'm not a singer i'm a rapper, can anyone point in the direction of an effect that would help smooth me out or even give my voice less cringing ability. I've been reviewing artists who sing (not well but good enough on a track) and need to figure out how to achieve this sound. I am providing a link to an artist named hard target.
    http://www.myspace.com/hardtarget
    I will either be doing this on logic express or garageband

    Hi,
    try these effects:
    - pitch correction
    - vocal transformer
    - compressor
    - limiter
    - EQ
    I'm afraid I could write at least 10 pages about this subject... experimenting will be the best thing to learn!
    Kind regards,
    Jaap

  • Need help with MAX function to return values

    I am trying to create a report to return slow moving inventory data. One of the requests is that it return only the latest date that an item transacted upon. One sheet will show the last receipt date for a part, another will show the last time a part was issued or shipped on a sales order.
    The hiccup is that it is returning every single last time that an item was received, and every single last issuance of the material (on the second sheet) of items on hand.
    Could someone help me to define the max value function? As listed below, and many variations, the sheet comes up with no data or corrupt dates.
    MAX(Transaction Date MAX) OVER(PARTITION BY Material Transactions.Item ORDER BY Material Transactions.Item )
    Still returns both the following when in reality I just want the one with the most recent date (April 2010).
    100034     BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT     A400M     AB01D..     $0.00     WIP component issue     11-Sep-2009     -3
    100034     BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT     A400M     AD01D..     $0.00     WIP component issue     13-Apr-2010     -16
    Thank you for your assistance.
    Becka

    Hi Becka
    It does look correct. When I look at your data I can see 2 different items:
    100034 BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT A400M AB01D.. $0.00 WIP component issue 11-Sep-2009 -3
    100034 BNDSCE-105 - QUALITY BEARINGS OR EQUIVILANT A400M AD01D.. $0.00 WIP component issue 13-Apr-2010 -16
    One is AB01D and the other being AD01D. Is this expected?
    To get the right date you might want to PARTITION BY the BNDSCE-105 which might be the Item Number?
    If you can get your calculation to return the correct date then you next need to put in a new condition where the Transaction Date = MAX Transaction Date
    One part of the function that I would question is the use of MAX in both parts like this: MAX(Transaction Date MAX). You might be better just using MAX(Transaction Date) OVER ......
    Does this help?
    Best wishes
    Michael

  • Need help with responsibility/ functions query

    hi,
    we are working in oracle applications 11i.
    I have a requirement to extract the responsibility list of functions and menus.
    I need to omit the excluded menus from each responsibility
    this what I have so far (after researching the internet):
    SELECT
    FRTL.RESPONSIBILITY_NAME,
    FFL.USER_FUNCTION_NAME, FFF.FUNCTION_NAME,ft.RESPONSIBILITY_NAME
    FROM
    FND_USER_RESP_GROUPS FURG,
    fnd_responsibility_tl ft ,
    FND_RESPONSIBILITY FR,
    FND_COMPILED_MENU_FUNCTIONS FCMF,
    FND_FORM_FUNCTIONS FFF,
    FND_RESPONSIBILITY_TL FRTL,
    FND_FORM_FUNCTIONS_TL FFL
    WHERE
    FURG.RESPONSIBILITY_ID = FR.RESPONSIBILITY_ID
    and ft.RESPONSIBILITY_ID(+)= fr.RESPONSIBILITY_ID
    AND FURG.RESPONSIBILITY_APPLICATION_ID = FR.APPLICATION_ID
    AND FR.MENU_ID = FCMF.MENU_ID
    AND FCMF.GRANT_FLAG = 'Y'
    AND FCMF.FUNCTION_ID = FFF.FUNCTION_ID
    AND SYSDATE BETWEEN FR.START_DATE AND NVL(FR.END_DATE, SYSDATE+1)
    and fr.CREATION_DATE >= to_date('01-jan-2005','dd-mon-yyyy')
    AND FURG.RESPONSIBILITY_ID = FRTL.RESPONSIBILITY_ID
    AND FR.RESPONSIBILITY_ID = FRTL.RESPONSIBILITY_ID
    AND FRTL.LANGUAGE = 'US'
    AND FFL.LANGUAGE = 'US'
    AND FFF.FUNCTION_ID = FFL.FUNCTION_ID
    AND (FURG.END_DATE > SYSDATE
    OR FURG.END_DATE IS NULL)
    AND FFF.FUNCTION_NAME NOT IN
    SELECT FF.FUNCTION_NAME
    FROM FND_RESPONSIBILITY R, FND_USER_RESP_GROUPS RG
    , FND_RESP_FUNCTIONS RF, FND_FORM_FUNCTIONS FF, FND_RESPONSIBILITY_TL FRTL
    WHERE RG.RESPONSIBILITY_ID = R.RESPONSIBILITY_ID
    AND RF.RESPONSIBILITY_ID = R.RESPONSIBILITY_ID
    AND RF.RULE_TYPE = 'F'
    AND FF.FUNCTION_ID = RF.ACTION_ID
    AND FRTL.RESPONSIBILITY_ID = R.RESPONSIBILITY_ID
    AND FRTL.RESPONSIBILITY_ID = RG.RESPONSIBILITY_ID
    AND FRTL.LANGUAGE = 'US'
    help me please to exclude the menus.

    tried it and had the following error:
    if((tbl_menu_id.FIRST is NULL) or (tbl_menu_id.FIRST 1)) then
    ERROR at line 136:
    ORA-06550: line 136, column 54:
    PLS-00103: Encountered the symbol "1" when expecting one of the following:
    *. ( ) , * @ % & | = - + < / > at in is mod not range rem =>*
    *.. <an exponent (**)> <> or != or ~= >= <= <> and or like*
    between ||
    The symbol "," was substituted for "1" to continue.
    from another perspective, from applications front end, when I press ctrl +L on any responsibility menu, I get the list of the forms names.
    which database tables can I get that from?

  • Need help with Timer function

    I am using a timer class for my application such that when i log in, i immediately call the timer.start function from the Timer.java class.
    The problem i am having, is that when this timer expires, it calls an exit function, but i want it to restart the original application. i have tried to create an instance of the old session to kill its timer and a new instance that spawns a new start page, but this doesnt work well because i have both applications running and if i close either one of them, both get killed!!
    Can anyone help me out in this regard?
    Sule.
    public void timeout()
            System.err.println ("terminating");        
            System.exit(1);
                         // instance.getContentPane().add(d2.new StartPage());                     
                         // instance.setVisible(true);
                         // previousInstance.timer.stop();
            }

    hey Uhrand.. thanks for your suggestions. I really appreciate them, however it doesnt completely solve my problem. As I stated before my Timer program runs in its own class file. so i have in one class file
    public class Timer extends thread {
    public static Application dl = new Application();
    public void timeout()
                          System.err.println ("Logging-Off");
            new Application();             
            dl.timer.stop();
            }and then i have another class file for the main program like this...
    import java.awt.*;
    import javax.swing.*;
    public class Application {
        public Application() {
            app = new JFrame("'Application' restarts every 15 seconds");
            app.add(new JLabel("Please watch the Title of this frame"));
            app.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            app.setBounds((screenSize.width-400)/2, (screenSize.height-150)/2, 400, 150);
            app.setVisible(true);
            (new Thread(new Timer(app))).start();
        public static void main(String args[]) {new Application();}
        private JFrame app;
        private JFrame app;
    }when the timer expires, i am not able to create a new Application without the old Application.
    I would appreciate it if you can respond.
    thanks
    salau

  • Hi i need help with applescript to stop downloads when vpn fails

    I am an apple script novice, I would like to be able to have a script run all the time to detect vpn failures and close transmission when this happens:
    so far:
    on idle
              do shell script "ifconfig -lu"
              if "ifconfig -lu" contains "tun0" then
              else if "ifconfig -lu" does not contain "tun0" then
                        tell application "System Events"
                                  tell application "Transmission"
                                            quit
                                  end tell
                        end tell
              end if
    end idle
    it closes transmission and nothing else.  tun0 is my vpn interface and seemed the most fireproof way of understanding the state of the vpn connect.  When VPN is down tun0 doesnt exist.  Please help.
    many thanks

    There are several things wrong with your script.
    First, the glaring one:
              if "ifconfig -lu" contains "tun0" then
    This will never, ever, ever be true. What you're asking AppleScript is whether the string "ifconfig -lu" contains the string "tun0". Never going to happen. Not even close.
    What you really mean is whether the output of the shell command 'ifconfig -lu' contains 'tun0'. The easiest way to do that is to capture the output of the do shell script command in a variable and then test the variable, not the literal string:
    set activeInterfaces to do shell script "ifconfig -lu"
    if activeInterfaces does not contain "tun0" then
      -- stuff goes here
    end if
    Now AppleScript runs the shell script and puts the result in activeInterfaces which you then test to see if it contains (or, in this case, does not contain) the string you're looking for.
    Note that I've also reworked your if statement.. there's no need to have an empty 'if' clause followed by an else if that checks the opposite... by definition if the first one fails the second one will be true.
    Also note that there's no need to tell System Events to tell another application to quit - you can just do that directly.
    Next up is that you don't exit your own script after you quit Transmission. So now you have the scenario where the VPN drops, your script detects it and tells transmission to quit. However, your script keeps running so it then rechecks whether the tunnel is up... since it presumably isn't, it then relaunches Transmission in order to tell it to quit again. Then it rechecks whether the tunnel is up, if it isn't, it relaunches Transmission to tell it to quit... then it rechecks... you get the idea.
    Ideally you should tell your own script to quit after Transmission has exited so that you're not stuck in this loop.
    Lastly you don't include a return value in your idle handler. This means that your idle handler will run every 30 seconds. That might be good enough, or you might want to check more or less frequently. Just return a value indicating the number of seconds to pause between iterations -  realise that the more frequently you check, of course, the more load you put on your system
    Adding that all up you'll end up with something like:
    on idle
              set activeInterfaces to do shell script "ifconfig -lu"
              if activeInterfaces does not contain "tun0" then
                        tell application "Transmission" to quit
                        tell me to quit
              end if
              return 30 -- 30 is default value, but it doesn't hurt to include it here
    end idle

  • Need help with Math functions for text-based calculator!!!

    I have the calculator working but I am having trouble figuring out thow to do a square root function, nth factorial, absolute value, and Fibonacci. Basically i got the easy part done. Also I am using the case to do the funtions but I am not sure if there are symbols on the keyboard that are commonly used for these funtions so i just made some up. I am new to java and this is only my second assignment so any help would be appreciated. Thanks
    import java.util.*;
    import java.math.*;
    public class calculator
    static Scanner console=new Scanner(System.in);
    public static void main(String[]args)
    double num1=0,num2=0;
    double result=0;
    char expression;
    char operation;
    String Soperation;
    System.out.println("Enter ? for help or enter the operation in which to be processed");
    Soperation=console.next();
    operation = Soperation.charAt(0);
    switch(operation)
    case '+':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    result=num1+num2;
    break;
    case'-':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    result=num1-num2;
    break;
    case'*':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    result=num1*num2;
    break;
    case'/':
    System.out.println("Please the first number");
    num1=console.nextInt();
    System.out.println("Please enter the second number");
    num2=console.nextInt();
    if(num2==0)
    System.out.println("Cannot Divide by Zero");
    result=num1/num2;
    break;
    //square root
    case'^':
    System.out.println("Please enter a number");
    break;
    //fibonacci     
    case'#':
    System.out.println("Please enter the position of the Fibonacci number");
    break;
    //factorial
    case'!':
    System.out.println("Please enter the number for factoring");
    break;
              //absolute value
    case'&':
    System.out.println("Please enter a number");
    num1=console.nextInt();
    result=num1;
    break;
         // help funtion
    case'?':
    System.out.println("Type + for addition, - for subtraction");
    System.out.println("* for multipliction, / for division,^ for the square root");
    System.out.println(" & for absolute value, # for fibonacci,and ! for factorial");
    break;
    System.out.println("The result is:"+result);     
    }

    rmabrey wrote:
    I have the calculator working but I am having trouble figuring out thow to do a square root function, nth factorial, absolute value, and Fibonacci. java.lang.Math.sqrt()
    nothing for factorial - write your own.
    java.lang.Math.abs()
    nothing for Fibonacci - write your own.
    %

  • Need help with DECODE function

    Hello,
    I am trying to use default within the decode function and every time I get a missing expression. I have searched everywhere and cant figure out what I'm doing wrong. Thanks
    select decode (request_id,0,'No files found', DEFAULT)

    Hi,
    Welcome to the forum!
    When you use a default value, the last argument to DECODE is the actual value you want as a default.
    For example:
    SELECT       ename
    ,       deptno
    ,       DECODE ( deptno
                 , 30     , 'Sales'
                      , 'All others'     -- Default value
                  )                 AS dname
    FROM      scott.emp
    ORDER BY  ename
    ;Output:
    ENAME          DEPTNO DNAME
    ADAMS              20 All others
    ALLEN              30 Sales
    BLAKE              30 Sales
    CLARK              10 All others
    FORD               20 All others
    JAMES              30 Sales
    JONES              20 All others
    KING               10 All others
    MARTIN             30 Sales
    MILLER             10 All others
    SCOTT              20 All others
    SMITH              20 All others
    TURNER             30 Sales
    WARD               30 Sales 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    If you can show the problem using commonly available tables (such as those in the scott schema) then you don't need to post any sample data; just the results and the explanation.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Need Help With a Function

    Hope this is the right place to ask.
    I have a field that looks like this: LastName, First Name Middle Name Other Name
    I need to have a Last Name field, and a First Name (and possibly other) field.
    In other words, I need to be able to pull out eveything on either side of the comma.
    I know this should be simple; just don't have the time to figure it out for myself.
    Thanks in advance.

    This will extract the last name. This formula bas based on one that looked for spaces, not commas, so you may not need the TRIM functions in there. Plus it does some other checking.
    =IFERROR(LEFT(TRIM(B2),SEARCH(",",TRIM(B2))-1),IF(ISBLANK(B2),"",TRIM(B2)))
    more basic is
    =LEFT(B2,SEARCH(",",B2)-1)

  • Need help with search function in my program

    Hello all, some of you may remeber me from my previous inventory programs. Well I am finally on my last one and I need to add a search option to the code. Here is the class that will contain that option.
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Inventory2 extends JFrame implements ActionListener {
    //Utility class for displaying the picture
    //If we are going to use a class/method/variable inside that class only, we declare it private in that class
    private class MyPanel extends JPanel {
    ImageIcon image = new ImageIcon("Sample.jpg");
    int width = image.getIconWidth();
    int height = image.getIconHeight();
    long angle = 30;
    public MyPanel(){
    super();
    public void paintComponent(Graphics g){
         super.paintComponent(g);
         Graphics2D g2d = (Graphics2D)g;
         g2d.rotate (Math.toRadians(angle), 60+width/2, 60+height/2);
         g2d.drawImage(image.getImage(), 60, 60, this);
         g2d.dispose();
    }//end class MyPanel
    int currentIndex; //Currently displayed Item
    Product[] supplies = new Product[4];
    JLabel name ;
    JLabel number;
    JLabel rating;
    JLabel quantity;
    JLabel price;
    JLabel fee;
    JLabel totalValue;
    JTextField nameField = new JTextField(20);
    JTextField numberField = new JTextField(20);
    JTextField ratingField = new JTextField(20);
    JTextField quantityField = new JTextField(20);
    JTextField priceField = new JTextField(20);
    JPanel display;
    JPanel displayHolder;
    JPanel panel;
    boolean locked = false; //Notice how I've used this flag to keep the interface clean
    public Inventory2() {
    makeTheDataItems();
    setSize(700, 500);
    setTitle("Inventory Program");
    //make the panels
    display = new JPanel();
    JPanel other = new JPanel();
    other.setLayout(new GridLayout(2, 1));
    JPanel picture = new MyPanel();
    JPanel buttons = new JPanel();
    JPanel centerPanel = new JPanel();
    displayHolder = new JPanel();
    display.setLayout(new GridLayout(7, 1));
    //other.setLayout(new GridLayout(1, 1));
    //make the labels
    name = new     JLabel("Name :");
    number = new JLabel("Number :");
    rating = new JLabel("Rating     :");
    quantity = new JLabel("Quantity :");
    price = new JLabel("Price     :");
    fee = new JLabel("Restocking Fee (5%) :");
    totalValue = new JLabel("Total Value :");
    //Use the utility method to make the buttons
    JButton first = makeButton("First");
    JButton next = makeButton("Next");
    JButton previous = makeButton("Previous");
    JButton last = makeButton("Last");
    JButton search = makeButton("Search");
    //Other buttons
    JButton add = makeButton("Add");
    JButton modify = makeButton("Modify");
    JButton delete = makeButton("Delete");
    JButton save = makeButton("Save");
    JButton exit = makeButton("Exit");
    //Add the labels to the display panel
    display.add(name);
    display.add(number);
    display.add(rating);
    display.add(quantity);
    display.add(price);
    display.add(fee);
    //add the buttons to the buttonPanel
    buttons.add(first);
    buttons.add(previous);
    buttons.add(next);
    buttons.add(last);
    buttons.add(search);
    //Add the picture panel and display to the centerPanel
    displayHolder.add(display);
    centerPanel.setLayout(new GridLayout(2, 1));
    centerPanel.add(picture);
    centerPanel.add(displayHolder);
    other.add(buttons);
    JPanel forAdd = new JPanel(); // add the other buttons to this panel
    forAdd.add(add);
    forAdd.add(modify);
    forAdd.add(delete);
    forAdd.add(save);
    forAdd.add(exit);
    other.add(forAdd);
    //Add the panels to the frame
    getContentPane().add(centerPanel, "Center");
    getContentPane().add(other, "South");
    this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setVisible(true);
    private void makeTheDataItems () {
    Product p1 = new DVD("The one", 001, 200, 100, "The one");
    Product p2 = new DVD("Once upon a time in China V", 002, 500, 10000, "Once upon a time in China V");
    Product p3 = new DVD("Rat Race", 003, 100, 3000, "Rat Race");
    Product p4 = new DVD("The Man in the Iron Mask", 004, 3000, 9000, "The Man in the Iron Mask");
    supplies[0] = p1;
    supplies[1] = p2;
    supplies[2] = p3;
    supplies[3] = p4;
    //Utility method for creating and dressing buttons
    private JButton makeButton(String label) {
    JButton button = new JButton(label);
    button.setPreferredSize(new Dimension(100, 25));
    button.setActionCommand(label);
    button.addActionListener(this);
    return button;
    private void addItem() {
    panel = new JPanel();
    JPanel add = new JPanel();
    add.setLayout(new GridLayout(7, 2));
    JButton addIt = makeButton("Add Item");
    JLabel name = new JLabel("Name :");
    JLabel rating = new JLabel("Rating     :");
    JLabel quantity = new JLabel("Quantity :");
    JLabel price = new JLabel("Price     :");
    add.add(name); add.add(nameField);
    add.add(rating); add.add(ratingField);
    add.add(quantity); add.add(quantityField);
    add.add(price); add.add(priceField);
    panel.add(add);
    JPanel forAddIt = new JPanel();
    forAddIt.add(addIt);
    panel.add(forAddIt);
    displayHolder.remove(display);
    displayHolder.add(panel);
    //display = panel;
    this.setVisible(true);
    public static void main( String args[]) {
    new Inventory2().displayFirst(); //The main method should not have too much code
    } // end main method
    public void actionPerformed(ActionEvent event) {
      String command = event.getActionCommand(); //This retrieves the command that we set for the button
      //Always compare strings using the .equals method and not using ==
      if(command.equals("First")) {
       if(!locked) {
         displayFirst();
      else if(command.equals("Next")) {
       if(!locked) {
         displayNext();
      else if(command.equals("Previous")) {
       if(!locked) {
         displayPrevious();
      else if(command.equals("Last")) {
       if(!locked) {
         displayLast();
      else if(command.equals("Exit")) {
       this.dispose();
       System.exit(0);
      else if(command.equals("Add")) {
       if(!locked) {
         addItem();
         locked = true;
      else if(command.equals("Add Item")) {
       addItemToArray();
      else if(command.equals("Modify")) {
       if(!locked) {
         modify();
         locked = true;
      else if(command.equals("Update")) {
          if(!locked) {
         modifyItemInArray();
         locked = true;
      else if(command.equals("Delete")) {
       if(!locked) {
         DVD dvd = (DVD)supplies[currentIndex];
            int confirm = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete item "+dvd.getItemNumber());
                if(confirm == JOptionPane.YES_OPTION) {
          removeItemAt(currentIndex);
          displayFirst();
    private void modify() {
    DVD dvd = (DVD)supplies[currentIndex];
    panel = new JPanel();
    JPanel add = new JPanel();
    add.setLayout(new GridLayout(7, 2));
    JButton update = makeButton("Update");
    JLabel number = new JLabel("Number :");
    JLabel name = new JLabel("Name :");
    JLabel rating = new JLabel("Rating     :");
    JLabel quantity = new JLabel("Quantity :");
    JLabel price = new JLabel("Price     :");
    add.add(number);
    numberField.setText(""+dvd.getItemNumber()); numberField.setEditable(false); add.add(numberField);
    add.add(name);
    nameField.setText(dvd.getItemName()); add.add(nameField);
    ratingField.setText(dvd.getRating()); ratingField.setEditable(false);
    add.add(rating); add.add(ratingField);
    add.add(quantity);
    quantityField.setText(""+dvd.getStockQuantity());
    add.add(quantityField);
    add.add(price);
    add.add(priceField); priceField.setText(""+dvd.getItemPrice());
    panel.add(add);
    JPanel forAddIt = new JPanel();
    forAddIt.add(update);
    panel.add(forAddIt);
    displayHolder.remove(display);
    displayHolder.add(panel);
    //display = panel;
          this.setVisible(true);
    private void addItemToArray() {
    Product p = new DVD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
    Double.parseDouble(priceField.getText()), ratingField.getText());
    //Extend size of array by one first
    Product[] ps = new Product[supplies.length + 1];
    for(int i = 0; i < ps.length-1; i++) {
    ps[i] = supplies;
    ps[supplies.length] = p;
    supplies = ps;
    displayHolder.remove(panel);
    displayHolder.add(display);
    displayLast();
    this.setVisible(false);
    this.setVisible(true);
    //Utility method to ease the typing and reuse code
    //This method reduces the number of lines of our code
    private void displayItemAt(int index) {
    DVD product = (DVD)supplies[index];
    name.setText("Item Name: "+ product.getItemName());
    number.setText("Item Number: "+ product.getItemNumber());
    rating.setText("Rating: "+ product.getRating());
    quantity.setText("Quantity In Stock: "+ product.getStockQuantity());
    price.setText("Item Price: "+ product.getItemPrice());
    totalValue.setText("Total: " + product.calculateInventoryValue());
    fee.setText("Restocking Fee (5%) :"+product.calculateRestockFee());
    locked = false;
    this.repaint();
    this.setVisible(true);
    private void modifyItemInArray() {
    Product p = new DVD(nameField.getText(), supplies.length + 1, Long.parseLong(quantityField.getText()),
    Double.parseDouble(priceField.getText()), ratingField.getText());
    supplies[currentIndex] = p;
    displayHolder.remove(panel);
    displayHolder.add(display);
         displayItemAt(currentIndex);
    this.setVisible(false);
    this.setVisible(true);
    private void removeItemAt(int index) {
    Product[] temp = new Product[supplies.length-1];
    int counter = 0;
    for(int i = 0; i < supplies.length;i++) {
    if(i == index) { //skip the item to delete
    else {
         temp[counter++] = supplies[i];
    supplies = temp;
    public void displayFirst() {
    displayItemAt(0);
    currentIndex = 0;
    public void displayNext() {
    if(currentIndex == supplies.length-1) {
    displayFirst();
    currentIndex = 0;
    else {
    displayItemAt(currentIndex + 1);
    currentIndex++;
    public void displayPrevious() {
    if(currentIndex == 0) {
    displayLast();
    currentIndex = supplies.length-1;
    else {
    displayItemAt(currentIndex - 1);
    currentIndex--;
    public void displayLast() {
    displayItemAt(supplies.length-1);
    currentIndex = supplies.length-1;
    }//end class Inventory2
    I am not sure where to put it and how to set it up. If you guys need the other two classes let me know. Thanks in advanced.

    Here are the other two classes:
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class Product implements Comparable {
    String name;
    int number;
    long stockQuantity;
    double price;
    public Product() {
      name = "";
          number = 0;
          stockQuantity = 0L;
          price = 0.0;
    public Product(String name, int number, long stockQuantity, double price) {
      this.name = name;
          this.number = number;
          this.stockQuantity = stockQuantity;
          this.price = price;
         public void setItemName(String name) {
      this.name = name;
    public String getItemName() {
      return name;
    public void setItemNumber(int number) {
      this.number = number;
    public int getItemNumber() {
      return number;
    public void setStockQuantity(long quantity) {
      stockQuantity = quantity;
    public long getStockQuantity() {
      return stockQuantity;
    public void setItemPrice(double price) {
      this.price = price;
    public double getItemPrice() {
      return price;
    public double calculateInventoryValue() {
      return getItemPrice() * getStockQuantity();
    public int compareTo (Object o) {
      Product p = (Product)o;
      return name.compareTo(p.getItemName());
    public String toString() {
      return "Name :"+getItemName() + "\nNumber"+number+"\nPrice"+price+"\nQuantity"+stockQuantity + "\nValue :"+calculateInventoryValue();
    class DVD extends Product implements Comparable {
    private String rating;
    public DVD() {
      super(); //Call the constructor in Product
      rating = ""; //Add the additonal attribute
    public DVD(String name, int number, long stockQuantity, double price, String rating) {
      super(name, number, stockQuantity, price); //Call the constructor in Product
      this.rating = rating; //Add the additonal attribute
         public void setRating(String rating) {
      this.rating = rating;
    public String getRating() {
      return rating;
    public double calculateInventoryValue() {
      return getItemPrice() * getStockQuantity() + getItemPrice()*getStockQuantity()*0.05;
    public double calculateRestockFee() {
      return getItemPrice() * 0.05;
    public int compareTo (Object o) {
      Product p = (Product)o;
      return getItemName().compareTo(p.getItemName());
    public String toString() {
      return "Name :"+getItemName() + "\nNumber"+getItemNumber()+"\nPrice"+getItemPrice()+"\nQuantity"+getStockQuantity() +"\nRating :"+getRating()+"\nValue"+calculateInventoryValue();
    }You should be able to search through these items, and any other items that have been added to the program.

  • [solved] Need Help with bash function

    I would like to have a bash function that lets me create tar.xz archives. I have the following in my bash now:
    mktar() { tar cf "${1%%/}.tar" "${1%%/}/"; }
    mktgz() { tar czf "${1%%/}.tar.gz" "${1%%/}/"; }
    mktbz() { tar cjf "${1%%/}.tar.bz2" "${1%%/}/"; }
    Any advice would be appreciated.
    Last edited by orphius1970 (2010-09-06 11:10:39)

    orphius1970 should learn some shell scripting.
    $FILE is obviously the archive name and is $1 the first argument.
    $* would be the rest of the arguments (only so after the shift command.
    So, archive archive_name list of files to be archived.
    Example: archive stuff.tar.gz stuff/

  • Need help with INSTR function

    I am trying use INSTR and SUBSTR function to parse a variable without breaking up the variable. As you can see the problem arises negotiating the blank space,
    DECLARE
         blank_space NUMBER(2);
         full_name VARCHAR2(30) := 'Robert P. Simmons');
         first_name VARCHAR2(30);
         last_name VARCHAR2(30);
    BEGIN
         blank_space := INSTR(full_name, ' ');
         first_name := SUBSTR(full_name, 1, (blank_space -1));
         DBMS_OUTPUT.PUT_LINE( 'Your first name is ' || first_name);
         last_name := SUBSTR(full_name, (blank_space + 1),
         (LENGTH(full_name) - blank_space));               
         DBMS_OUTPUT.PUT_LINE( 'You have ' ||
         LENGTH(last_name) || ' characters in your last name!');
    END;     How can I list the number of characters in the last_name only? It just list everything to the right side of the 1st blank_space.
    Thanks

    SQL> DECLARE
      2     blank_space NUMBER(2);
      3     full_name VARCHAR2(30) := 'Robert P. Simmons';
      4     first_name VARCHAR2(30);
      5     middle_initial VARCHAR2(30);
      6     last_name VARCHAR2(30);
      7
      8  BEGIN
      9     blank_space := INSTR(full_name, ' ');
    10     first_name := SUBSTR(full_name, 1, (blank_space -1));
    11     DBMS_OUTPUT.PUT_LINE( 'Your first name is ' || first_name);
    12     middle_initial := SUBSTR(full_name, (blank_space +1), INSTR(full_name, ' ',1,2)-blank_space-1);
    13     DBMS_OUTPUT.PUT_LINE( 'Your middle initial is ' || middle_initial);
    14  last_name := SUBSTR(full_name, INSTR(full_name, ' ',1,2)+1);
    15     DBMS_OUTPUT.PUT_LINE( 'You have ' ||
    16     LENGTH(last_name) || ' characters in your last name!');
    17
    18  END;
    19  /
    Your first name is Robert
    Your middle initial is P.
    You have 7 characters in your last name!
    Procedura PL/SQL completata correttamente.Max
    http://oracleitalia.wordpress.com

Maybe you are looking for

  • HP LaserJet 1160 and Airport Express

    I recently got an HP LaserJet 1160le and wanted to hook it up to my network using an Airport Express. I have used other printers with the airport express in its current config with no problems, but now I have an issue. If i plug the printer directly

  • How to go for some customize change in SAP Std.

    Hi all, I have to hide some in F-47 and other operation in some fields. My question is how to go for enhancing a SAP std. and how to identify the exits in which the code is to be return and how to activate that exit. Pls help me with the steps. Thank

  • Monitor Mixer Error!

    When I try to preview my "program monitor" window, I get the following error: Premiere Pro has encountered and error. [..\..\Src\Audio\MonitorMixer.ccp-153] It won't play my timeline to let me preview my work! I can open seperate clips in the source

  • Texas Holdem Sync Problem. Please Help Me!!

    I purchased texas holdem last year. I have had to reinstall the operating system on my laptop and now itunes will not transfer the game back to the ipod. Everything else has been transfered. Can anyone help?

  • The capasity and compatibility of the widow to apple products

    what is the best way to describe the new and old agreement between the widow and mac family. I was wondering how use full the products was for the apple computer. I like to play window base games and find it hard to find mac base games in my area. I