Show indices of Last TWO buttons pressed in a boolean array (how to?)

How would you go about showing the indices of the last TWO buttons pressed in an array of buttons, and only after TWO buttons have been pressed? I know how to show the LAST button pressed, and I know how to flag the event of two buttons being pressed (using the modulus), but I can't readily see how to show the indices of the last TWO.
For example, in an array of 24 buttons, someone presses buttons 2 and 7... an indicator says 2 & 7. Those buttons remain pressed. Now the user presses buttons 14 and 3, the same indicator now reads 14 & 3.
The indicator can be text, an int array, two ints, whatever. Any ideas?
Message Edited by LV_Addict on 07-28-2008 01:29 PM

Thanks Ben.
To get the LAST button pressed, I just XOR the array and look for the True, as shown. No biggie.
Yep, I know about the ability to expand the left side S/R to get a histogram, and have used that in the past. It doesn't seem to do anything for me here!
Attachments:
forumpic.jpg ‏9 KB

Similar Messages

  • We lost access to are computers in the last two month and we want to know how to deauthorize two computers from the itunes account can you please help us?

    We lost access to are computers in the last two months and we want to know how to deauthorize two computers from the ituns account can you please help me please?

    If you don't have access to the computers to manually deauthorize them (they were sold, stolen, etc), then you have to log into your account, deauthorize all computers, and then re-authorize the machine(s) that you want to have access. This page explains how.

  • Two buttons pressing

    I know some Java and I have to make a program that will press two buttons like this:
    If i press the button START it will
    1. Wait 5000 milliseconds
    2. Press F5
    3. Wait 100 milliseconds
    4. Press Enter
    5. Wait 2000 milliseconds
    and then over and over again from step 2, until i press the button STOP
    I don't think that it will work in applet, because when you minimize applet, it stops working. Am I right?
    So I will have to use the standard Java. Right?
    And by the way. What is the function for automatic press of some king of button?

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class RobotDemo {
        private final JButton startButton = new JButton("Start");
        private final JButton stopButton = new JButton("Stop");
        private final ButtonActionListener listener = new ButtonActionListener();
        private final JTextArea display = new JTextArea(10, 40);
        private final String newline = System.getProperty("line.separator");
        private PhantomKeyPresser phantom;
        public RobotDemo() {
            initGui();
        public static void main(String[] args) {
            new RobotDemo();
        private void initGui() {
            JFrame frame = new JFrame("RobotDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            display.setEditable(false);
            frame.getContentPane().add(new JScrollPane(display), BorderLayout.CENTER);
            startButton.addActionListener(listener);
            stopButton.addActionListener(listener);
            stopButton.setEnabled(false);
            JPanel buttonPanel = new JPanel();
            buttonPanel.add(startButton);
            buttonPanel.add(stopButton);
            frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
            display.addKeyListener(new KeyAdapter() {
                public void keyPressed(KeyEvent e) {
                    display("Somebody pressed: " + KeyEvent.getKeyText(e.getKeyCode()));
            display.requestFocus();
        private void display(final String message) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    display.append(message);
                    display.append(newline);
        private class ButtonActionListener implements ActionListener {
            public void actionPerformed(ActionEvent evt) {
                if (evt.getSource() == startButton) {
                    startButton.setEnabled(false);
                    stopButton.setEnabled(true);
                    startPhantom();
                } else if (evt.getSource() == stopButton) {
                    startButton.setEnabled(true);
                    stopButton.setEnabled(false);
                    stopPhantom();
        private void startPhantom() {
            phantom = new PhantomKeyPresser();
            Thread t = new Thread(phantom);
            t.start();
        private void stopPhantom() {
            phantom.stop();
        private class PhantomKeyPresser implements Runnable {
            private boolean iShouldKeepRunning = true;
            private Robot robot;
            public void run(){
                display("The phantom has been started!");
                try {
                    robot = new Robot();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                display("The phantom waits for 5 seconds...");
                sleep(5000);
                while (iShouldKeepRunning) {
                    display("The phantom presses the F5 key...");
                    robot.keyPress(KeyEvent.VK_F5);
                    sleep(100);
                    display("The phantom presses the Enter key...");
                    robot.keyPress(KeyEvent.VK_ENTER);
                    sleep(2000);
            public void stop() {
                iShouldKeepRunning = false;
                display("The phantom has been stopped!");
            private void sleep(long millis) {
                try {
                    Thread.sleep(millis);
                } catch (InterruptedException e) {
                    e.printStackTrace();
    }

  • Create Detail Record - always two button presses

    Ok, this shouldn't be this hard.
    I drag and drop a master/detail onto jsff
    I pick master form/detail table
    Add a "create" button to the detail table
    Set the partial trigger for the button (which also adds to the table)
    So, theoretically when positioned on a Master record when you press the Create button, a new record should open up, but it won't do this unless I click the button twice.
    What did I do wrong?

    Timo,
    As I mentioned I do have setter methods before setting the status as STATUS_INTIALIZED in my code. It looks something like this :
    newCustAccRow.setAttribute("CustomerId",customerId);
    newCustAccRow.setNewRowState(Row.STATUS_INITIALIZED);
    I've tried various combinations and none of them works for me. The row is now getting picked up as part of the transaction.
    Thanks,
    Shishir

  • I can get the apple logo on the phone but nothing else. Have tried resetting by pressing the two buttons at same time but no response. Any ideas please?

    iphone only displays logo, nothing beyond this. any suggestions please other than two buttons pressed at same time? thanks, stu

    See Here for Device Unresponsive
    http://support.apple.com/kb/ts1445
    The Basic Troubleshooting Steps are:
    Restart..  Reset..  Restore from Backup..  Restore as New...
    Try this First... You will Not Lose Any Data...
    Turn the Phone Off... ( if it isn’t already )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear and then Disappear...
    Usually takes about 15 - 20 Seconds... (But can take Longer...)
    Release the Buttons...
    Turn the Phone On...
    If that does not help... See Here:
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

  • Sales of Last two days of each week in a given Posting Period ???

    Hi,
    Here I would like to share one of my tech. requirement in Bex query, your inputs are much appreciated -
    Scenario - In report I want to show "Sales for Last two days of week". I elaborate more like -
    (1) User inputs will be given for "Fiscal period" through Variable.
    (2) In Row all weeks lying in this period will be displayed.
    (3) In Column 1, Sale for each week will be shown.
    (4) In Column 2, Sale for Last two days of each week is to be displayed. (here we need to restrict Sales with last 2 Calendar days of each week.)
    Point 4 is of my concern. Any suggestions will help a lot. Points must be assigned.
    Regards,
    Saurabh

    Hi,
    I do not have a very good solution for you - see if this is of use.
    Firstly, I am not sure if it is possible to show the query like you want, with the weekly sales and the "last 2 day/week" sales combined and intertwined in one query.
    To create a query which will only show the sales of last 2 days of every week, what you can do is to create a variable on 0calday which will be 'multiple single values' type and will be calculated based on the user input of fiscal period (exit variable). This exit logic should assign the variable the last 2 days of each week falling within this period.
    Now you can put 'week' in the in the rows and restrict the query filter using the 0calday variable; put the KF in the columns area. This would lead to one row being displayed for each week and sales for only the last 2 days showing in that row.
    Creating a query for weekly sales is simple - maybe then you can put these two queries side by side in a workbook/web template.

  • HT201412 My i Pad 3 shows "cannot Access Find My Friends open the app and review your sign in information to continue sharing your location. And I have two buttons : Later and Open but they don't work, As long as I have this situation I can do nothing on

    My i Pad 3 shows "cannot Access Find My Friends open the app and review your sign in information to continue sharing your location. And I have two buttons : Later and Open but they don't work. As long as I have this screen situation, I cann't do anything on my I Pad. Please help !!

    I have the same problem on my iPhone4. It is obviously a bug in the software. Once it pops out I am locked out of my phone. I can't even begin to describe the frustration this causes. All that stuff about holding down the buttons is useless. the phone won't even shut off. I can take a screen shot like that or go to voice control. Even when I got to a wifi connection, I can't get on. This app blocks everything else. This is a serious bug and can have serious consequences. The only thing my phone would do is go to voice control and let me play iTunes or phone people. Some smart phone hey?
    I have finally got to a place with a wide enough wifi to connect my computer and restore the phone. This has lasted over a day!
    I don't even know why Find My Friends is on my phone. Is it part of the package and how do I turn it off?

  • How can i delete the new feature "get in contact with your favourite persons"?? When u press the "home" button twice, theres a list on top of the ipad with the last persons youve been in contact with. How do i delete that, or some of them ;-)

    How can i delete the new feature "get in contact with your favourite persons"?? When u press the "home" button twice, theres a list on top of the ipad with the last persons youve been in contact with. How do i delete that, or some of them ;-) Sorry for the danish  

    You can turn that feature off in Settings>Mail, contacts, calendars>Contacts>Show in App Switcher>Recents>Off.

  • I downloaded the latest iOS7 to my iPad and then the screen went blank and would not respond.   I have tried pressing the two buttons together and briefly get the Apple logo but still can not start up, the logo disappears.   I have tried connecting the iP

    I downloaded the latest iOS7 to my iPad and then the screen went blank and would not respond.   I have tried pressing the two buttons together and briefly get the Apple logo but still can not restart, the logo disappears.   I have tried connecting to my iMac to restore the iPad but the device does not show up (I have an old iMac).   What else can I do?

    You need to be running Snow Leopard 10.6.8 at the very least in order to sync your iPad with iTunes so you could update your Mac, if it can be updated, and if you care to do so.
    If that's not an option, you will have to find someone that can restore the device for you with their computer running iTunes or make an appointment at an Apple Store and ask them to restore the device for you.
    I hope that you have an iCloud backup, because you will lose everything on the device when it is restored.
    Snow Leopard can still be purchased in the U.S. Apple Online Store.
    http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
    Also, I would not give up on the reset technique....holding down on the sleep and home buttons at the same time until the Apple logo appears. It takes about 10-15 seconds and sometimes just a little longer to get the logo to appear.

  • My iPad suddenly started to show crazy colors.  I turned it off and had to use the two button trick to turn it back on.  Now it shows only green stripes for a few seconds and goes back to sleep.

    My iPad suddenly started to show crazy colors.  I turned it off.  It would not reboot until I used the two-button reboot.  Now it shows only green stripes.  only for a few seconds and goes back to sleep.  HELP!

    Standard troubleshooting...
    1. Try a Restart by pressing the sleep/lock button until you see the slider.  Slide to power off.  Restart by pressing the sleep/lock button until you see the Apple logo.
    2. Try a Reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider if, it comes up. Takes about 5-15 secs of button holding and you won't lose any data or settings.
    3. Remove all apps from Recently Used list...
    - From any Home Screen, double tap the home button to bring up the Recents List
    - Tap and hold any icon in this list until they wiggle
    - Press the red to delete all apps from this list.
    - Press the home button twice when done.
    4. If still a problem restore with your backup.
    5. If still a problem restore as new, i.e. without your backup. See how it runs with nothing synced to it.
    6. If still a problem, it's likely a hardware issue.

  • My iPad is frozen. Does not turn off or charge just black screen with logo. Tried to reset by pressing the two buttons and nothing.

    My iPad is frozen. Does not turn off or charge just black screen with logo. Tried to reset by pressing the two buttons and nothing.

    Then you should try restoring the iOS software next. Read this and pay attention to the last part of the article that describes recovery mode, you may have to restore your iPad that way.
    iTunes: Restoring iOS software - Support - Apple

  • Command is not showing in to the list on pressing menu button on the device

    Hi Everyone,
    I have developed a midlet in which I have designed buttons or links using Custom Items. Command associated with the custom item is not showing in to the list on pressing menu button on the device 8300 Curve.
    For example - My login screen have SUBMIT and RESET custom items. I have designed them to be appear like links [no matter how I design them]. I have also added a command and listener to it like as below:
    CMD_SUBMIT = new Command(text, Command.ITEM, 1);
    setDefaultCommand(CMD_SUBMIT);
    setItemCommandListener(this);
    On running the midlet, my login screen appears. But when I travarse to the SUBMIT item, and press the menu button, my command doesnt appear in the list of commands. It shows only the Close command. I am not getting why this is happening.
    Please do me a favour and help me to sort out this. On other phones like 8520 curve the command is appearing in to the list when I press the menu button.
    Regards

    Is there any way to sort out this issue? I am not getting the cause
    behind this, and I am observing this only on 8300 Curve. On most of
    there phones [though not tested on every one] it is working as expected.
    Please guide me to proceed further. I am desperately waiting for the
    response. Regards.

  • Toolbar button/hotkey for "show cover page in two page view" in Acrobat X?

    In Acrobat X, how about make a toolbar button/hotkey for "show cover page in two page view"?  I find toggling this option to be useful for changing up the order of adjacent pages in magazines/books in which a two page spread has to match for a full large picture.  Due to frequent toggling, I would like a button/hotkey for this for easier access.

    Hotkeys for existing menu items are not modifiable, but you can add a scripted button which toggles it with the following code:
    if (layout.substr(-5)=="Right") layout = layout.replace("Right","Left");
    else layout = layout.replace("Left","Right");
    For info on how to add a button with a folder-level script, see the Acrobat SDK documentation. Scripted buttons will appear in a new panel on the tools pane in Acrobat X, not on the tool bar.

  • [Solved] Keep the last button pressed with a custom style

    Hello,
    I have a VBox with 20 buttons and I have this style applied (menu.css) (only for VBox wrapper):
    .button:focused {
        -fx-background-color: #0768A9;
        -fx-text-fill: #FFFFFF;
    But when I pressed other button outside the VBox the style disappears, because the other button get the focus.
    I'm afraid I'm taking the wrong way.
    How I can do to keep the last button pressed with a custom style? (Only for buttons containing the VBox).
    Best regards

    I created a simple method to change background colors in buttons:
        private void setSelectedBtnStyle(Button bboat) {
      // Change style oldSelectedBoat
        selectedBoat.setStyle("-fx-background-color: white;-fx-text-fill: black;");
        // oldSelectedBoat var change to newSelectedBoat
        this.selectedBoat = bboat;
      // Change style newSelectedBoat
        selectedBoat.setStyle("-fx-background-color: #0768A9;-fx-text-fill: #FFFFFF;");;
    Surely not the best solution, but it works for me.
    Best regards.

  • HT1446 My Mac book pro black out just so, and the charger show a blinking light after I pressed the power button (green to yellow)

    My Mac book pro black out just so, and the charger show a blinking light after I pressed the power button (green to yellow)

    2. Reset SMC.     http://support.apple.com/kb/HT3964
        Choose the method for:
        "Resetting SMC on portables with a battery you should not remove on your own".

Maybe you are looking for

  • 3D Dial Guage not showing up

    Hi All, After the upgrade of MII from 12.1 to 14,  I am unable to see the animated object. It displays nothing on click of the 3D Dial guage object in the Default folder of workbench. All other objects like Alerter,LED meter etc are displaying, excep

  • Capture Video from Panasonic AG-HMC40

    I am having trouble capturing video from my camera - Panasonic AG-HMC40 HD camera I keep getting a message:  Capture Device Offline. I am able to capture from iMovie and Final Cut X.... Does anyone know the correct capture settings?

  • Commit rotation in PSE 4

    I've looked everywhere to see how to commit rotations in PSE4. It reads the exif data and rotates the pics in the pse browser but there's no way I can find to commit the rotations so anytime I copy the pics they aren't rotated. I need some way to com

  • Issue with Safari and 10.6.5 update

    So ever since I updated 10.6.5 I've noticed when I've got Safari open my MacBook pro will lockup. It seems to only happen when flash is running but I'm not positive thats the culprit yet. Not all flash locks it up so its hard to say. Has anyone run i

  • CP5 - W7 - Advanced interactions - where to find information

    Hi there! Have you ever wondered where the complete list of variables used by Adobe Captivate 5 is. If you do not wonder, please show me where. I have a simple question, or maybe not so simple A user takes a test with 5 random questions 10 points eac