MouseListener to a array of buttons

I got a array of black&white buttons and i want to change the color of a particular button when it's pressed. Unfortunately i don't know how to access the button from within the Listener myButtonArray[i][j] is obviously wrong
        JButton[][]   myButtonArray = new JButton[2][2];
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 2; j++) {
                myButtonArray[i][j] = new JButton();
                myButtonArray[i][j].addMouseListener (new java.awt.event.MouseAdapter () {
                    public void mouseClicked (java.awt.event.MouseEvent evt) {
                        if (myButtonArray[i][j].getBackground() == Color.black) {
                            myButtonArray[i][j].setBackground(Color.white);
                        } else {
                            myButtonArray[i][j].setBackground(Color.black);
                if (Math.random() > 0.5) {
                    myButtonArray[i][j].setBackground(Color.black);
                } else {
                    myButtonArray[i][j].setBackground(Color.white);
                myJPanel.add(myButtonArray[i][j]);
        }please igonre that some characters are not displayed correctly.
THX

just cast the source of your mouse listener to the button:
public void mouseClicked(MouseEvent me) {
JButton actButton = (JButton)me.getSource();
if (actButton.getBackground().equals(Color.black)) { .... } else { ... }
hope this helps

Similar Messages

  • Connecting kurzweil sp88 to GB I want to connect my Kurzweil sp88 to GB. The Kurzweil has a baffling array of buttons and possible MIDI channels. It also has the old style MIDI plug ins. I've got the MIDI out connected to my MacBook Pro via USB adapter.

    I have my Kurzweil connected to my MacBook Pro via an adapter (old style MIDI from Kurzweil to USB adapter connecting to Mac). The Kurzweil has a baffling array of buttons and possible MIDI channels. Can anyone please tell me which of the channels I should use? Also, should I leave the MIDI In cable out of the Kurzweil? Thanks for as detailed an answer as possible. If you like you can respond directly to me at [email protected]

    First of all I do not own this keyboard. But a quick look at the manual (found on the internet) says that when first powered up the SP88 is in Internal Sounds mode. Meaning you hear the sounds selected when playing the keyboard. It also stated that the default Midi Transmit Channel is Midi Channel #1.
    Looks like you would need to go to the SP88 Keyboard's MIDI SETUP and simply select LOCAL OFF. Now the keyboard should be ready to transmit Midi Out only and no internal sounds should be heard.
    Next you may or may not need to do this but you might need to go into the Utilities Folder found in your Applications Folder on your Mac and double click AUDIO MIDI SETUP the keyboard Icon. Figure #1 below.
    Next you need to make a physical connection from the Midi Out of the SP88 to the Midi In on your Midi Interface. Figure #3 below. You may need to Click on Add Device first. Figure #2 below.
    In the examples shown below I have a Yamaha Electronic Drum Kit that is Midi Out only... not USB out. I had to plug a Midi cable from the Midi Out Port on the back of my Drum Module to the Midi In Port on the back of my Motu 828 Audio Inferface which is connected to my Mac. Next I created the Audio Interface and Drum Module "Devices" as mentioned above.
    I then double clicked on the Drum Module and made my Midi Out Selections. Figure #4 Below. And once it was setup and the icons closed I used my mouse to draw a virtual cable connection from the Drum Module Out to the Audio Interface In. Figure #3 below. This is how I got my Midi Devices to talk to one another.
    Once you have made your setup as I have outlined create a MIDI Instrument Track in Garageband, select an instrument for example a Piano then Record Enable that track in Garageband and see if you now hear what you are playing. In this example the SP88 is a Midi Controller only and you will only hear sounds selected in Garageband which is what you want.
    Keep in midi your setup may be different than mine. You can keep your SP88 Keyboard on the default Midi Channel #1. That would be a good place to start. Garageband receives Midi on all channels.

  • Array of buttons return indexof?

    Hi,
    I have an array of buttons. How do I get the value of the array so i know which button the user clicks on. If they click on button 10 i need to get the value 10. I cant copy and past the code here because its too long.If someones interested i can email the code and what i'm trying to do. If someone could give me a generic example of a situation that would be great.
    Thanks in advance

    public class KeyPadDemo extends Frame {
         KeyPad keyPad;
         TextArea textArea;
         public static void main(String[] args){
              new KeyPadDemo();
         public KeyPadDemo(){
              this.setSize(300,300);
              this.setLayout(new BorderLayout());
              this.add(textArea = new TextArea(), "North");
              this.add(keyPad = new KeyPad(textArea),"Center");
              this.setVisible(true);
    class KeyPad extends Panel{
         MyButton buttonZero, buttonOne, buttonTwo, buttonThree, buttonFour, buttonFive, buttonSix;
         MyButton buttonSeven, buttonEight, buttonNine, buttonDecimal, buttonZeroZero;
         TextArea outputArea;
         KeyPad(TextArea outputArea){
              this.outputArea=outputArea;
              setLayout(new GridLayout(4,3));                    //GUI number button pad
              add(buttonSeven = new MyButton("1"));
              add(buttonEight  = new MyButton("2"));
              add(buttonNine = new MyButton("3"));
              add(buttonFour = new MyButton("4"));
              add(buttonFive = new MyButton("5"));
              add(buttonSix = new MyButton("6"));
              add(buttonOne = new MyButton("7"));
              add(buttonTwo = new MyButton("8"));
              add(buttonThree = new MyButton("9"));
              add(buttonZero = new MyButton("0"));
              add(buttonDecimal  = new MyButton("."));
              add(buttonZeroZero = new MyButton("00"));
         class MyButton extends Button implements ActionListener{
              String string;
              public MyButton(String string){
                   super(string);
                   this.string=string;
                   addActionListener(this);
              public void actionPerformed(ActionEvent e){
                   outputArea.append(string);
    }

  • 9x9 array of buttons and not a single button worked

    im trying to build a 9 x 9 block composed of buttons. I used array of buttons.
    here's my code with my explanation and poor logic thinking details.
    public class ButtonArrayDemo extends JFrame implements ActionListener
    private JButton[] sButton;
    private int[] x;//manipulation purposes only
    public ButtonArrayDemo()
         JPanel buttonPanel = new JPanel();
         buttonPanel.setLayout( new GridLayout(9, 9) );
         sButton = new JButton[81];
         x = new int[81];
    // creates the buttons,action listeners, syntax is correct but
    // i doubt the logic
         for (int i = 0; i < sButton.length ; i++)
              JButton button = new JButton();
              button.setText(" ");
              button.addActionListener(this);
              sButton[i] = button;
              buttonPanel.add(sButton);
              x[i] = 0;
         getContentPane().add(buttonPanel,BorderLayout.SOUTH);
         setResizable(false);
    // what i want for this is that, when a button is clicked, it displays the
    //number 1 then increments by 1 if clicked again. Like,when i click a
    //blank button, it displays the number "1", if i clicked it again, it displays
    //the number 2. This goes on until number 9. When the button is clicked
    //on the 10th time, it leaves the button's text blank. Syntax is fine but
    //i doubt the logic.
    public void actionPerformed(ActionEvent e)
         int y;
         for(y = 0; y < sButton.length; y++)
              if(e.getActionCommand().equals(sButton[y]))
                   sButton[y].setText(Integer.toString(++x[y]));
                   if(x[y] == 10)
                   sButton[y].setText(" ");
                   x[y] = 0;
    Now, i created the main and compiled the program. The frames appeared complete with 81 buttons. But, when I click on any button,
    it does nothing. The button's text which is supposedly to change is not displaying anything. this is a vital thinking process for me and any help from someone would be very much appreciated.
    thanks for reading and i hope someone will respond to my problem.
    lots of thanks.

    I believe the problem is that you are using the actionCommand but you did not set the actioncommand for the buttons. I suggest you either set the action command for each button to a unique item or use getSource instead.
    Also, you might want to break out of your for loop once you find the correct button.
    Also, if the future use the code formatting tags and this probably should have been in the Swing forum.

  • Array of buttons and Event Structure

    I have a the same problem... I was wondering if you were able to find a soln.
    I have literally thousands of buttons and each button as a unique key code and unique name.
    For Example :  
    Button Name    – Key code #
    PUSH              - 1
    POP                 - 2
    PULL               - 3
    The way I program this simple algorithm is deadly painful. 
    1)      I create 1000 buttons by going to control->buttons.
    2)      Then I have to go through one by one to change the Boolean text to “PUSH,POP,PULL…”  
    3)      Then used the Event Structure, adding in all the controls names “PUSH, POP, PULL..” In side each event, I placed the key codes “1,2,3..”
    I have search and tried for weeks to find a better way, and still nothing comes to mind.  
    Please help.

    Hi Ben,
    Thank you for your reply, I have attached my try_code and a picture of the code I currently have.  I  am new in Labview, but I am confident that, there must be a easier way to make an array of buttons with different button name and an associated number to that button.  
    The 1st file, is to show you want I am currently doing, (painful)
    The 2nd file attached is some of the things i tried, I had great hope with my try_code, array_jan25.  But I couldn't get it.  I think I am very close.
    Thanks again,
    Attachments:
    ThePainfulWay.doc ‏63 KB
    Array_jan25.vi ‏42 KB

  • Creating array of buttons

    I'm trying to create an array of buttons, but I keep getting a npe
    Exception in thread "main" java.lang.NullPointerException
    at java.awt.Container.addImpl<Container.java:1031>
    at java.awt.Container.add<container.Java:352>
    at ButtonArray.main<ButtonArray.java:26>
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ButtonArray{
    static JLabel jl;
    public static void main(String[] args){
    JFrame jf = new JFrame();
    JPanel p1 = new JPanel();
    JPanel p2 = new JPanel();
    jl = new JLabel();
    int count = 30;
    JButton[] jbh;
    jbh = new JButton[count];
    //JButton[] jbh = new JButton[]{new JButton("1"), new JButton("2")};
    for(int x=1; x<count; x++) {
         jbh[x] = new JButton(Integer.toString(x));
    Container c = jf.getContentPane();
    for(int i = 0; i < jbh.length; ++i){
    p1.add(jbh);
    for(int i = 0; i < jbh.length; ++i){
    jbh[i].addActionListener(new ButtonListener());
    c.add(p1, BorderLayout.NORTH);
    p2.add(jl);
    c.add(p2, BorderLayout.SOUTH);
    jf.setSize(400,300);
    jf.setVisible(true);
    jf.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent evt){
    System.exit(0);
    static class ButtonListener implements ActionListener{
    public void actionPerformed(ActionEvent evt){
    jl.setText("Button" + evt.getActionCommand() + " was pressed");

    Just spotted the error.
    Your for loop adding buttons to the array begins at 1. Therefore there is a null still in position 0 of your array which you attempt to access in your next for loop.
    [shakes fist at Enc]
    Edited by: flounder on Aug 7, 2009 11:08 AM

  • 'action performed' on array of buttons.

    Hi everyone!
    I am trying to set up an array of buttons on a panel in the main frame of my application. I can get them on to the panel, displaying them correctly but i can;t seem to attach an action performed method to them. Ive attached the following code - if you have any ideas on how to solve this problem i would be very grateful. DO you think it is because they are on this panel and not directly on the main Frame.?
    If i try to attach say Button1_action performed then it clashes with my original button 1!
    Thanks in advance.....
    static int N=10;
    String lett[]={"a","b","c","d","e","f","g","h","i","j"};
    Button button[]=new Button[N];
    for(int k=0;k<N;++k)
    {button[k]=new Button();
    button[k].setLabel(lett[k]);
    button[k].setBackground(Color.darkGray);
    button[k].addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    button[k]_actionPerformed(e);
    this.panel1.add(button[k]);

A: 'action performed' on array of buttons.

viravan is right - your code should work except that button[k]_actionPerformed won't compile. Also, you don't need a separate ActionListener for each button - use a common one and test for the source.
e.g.
import java.awt.*;
import java.awt.event.*;
...code to define Frame, Panel etc...
static int N=10;
String lett[]={"a","b","c","d","e","f","g","h","i","j"};
Button button[]=new Button[N];
ActionListener common = (new ActionListener() {
     public void actionPerformed(ActionEvent e) {
            Button source = (Button)e.getSource();
             System.out.println("Label of button pressed = " + source.getLabel() );
for(int k=0;k<N;++k) {
    button[k]=new Button();
    button[k].setLabel(lett[k]);
    button[k].setBackground(Color.darkGray);
    button[k].addActionListener(common);
    panel1.add(button[k]);
}Another alternative is to addActionListener(this) and code the actionPerformed method as part of the Frame class.

viravan is right - your code should work except that button[k]_actionPerformed won't compile. Also, you don't need a separate ActionListener for each button - use a common one and test for the source.
e.g.
import java.awt.*;
import java.awt.event.*;
...code to define Frame, Panel etc...
static int N=10;
String lett[]={"a","b","c","d","e","f","g","h","i","j"};
Button button[]=new Button[N];
ActionListener common = (new ActionListener() {
     public void actionPerformed(ActionEvent e) {
            Button source = (Button)e.getSource();
             System.out.println("Label of button pressed = " + source.getLabel() );
for(int k=0;k<N;++k) {
    button[k]=new Button();
    button[k].setLabel(lett[k]);
    button[k].setBackground(Color.darkGray);
    button[k].addActionListener(common);
    panel1.add(button[k]);
}Another alternative is to addActionListener(this) and code the actionPerformed method as part of the Frame class.

  • Array of buttons with different boolean text ?

    I'm looking for a method of displaying a 2D button matrix with
    different boolean text on each button. It seems an array of booleans
    must all have the same text. Perhaps a cluster could be used, but the
    array makes button alignment easy and easy to determine which had been
    pressed (radiobutton style with only one button true at a time).
    Steve

    On 6 Dec 2002 05:31:21 -0800, [email protected] (humenik) wrote:
    >[email protected] (Steve Parus) wrote in message news:<[email protected]>...
    >> I'm looking for a method of displaying a 2D button matrix with
    >> different boolean text on each button. It seems an array of booleans
    >> must all have the same text. Perhaps a cluster could be used, but the
    >> array makes button alignment easy and easy to determine which had been
    >> pressed (radiobutton style with only one button true at a time).
    >It's easy to make them individuals in a cluster, and on the block
    >diagram use Cluster To Array to get it into array form for
    >manipulation. This can be superior to an array of buttons, not merely
    >because the buttons can thereby have differing colors and text. An
    >array of buttons cannot have the buttons Latched When Pressed; when in
    >a cluster, however, the latching action is available.
    When might that Latched When Pressed behavior be useful ? Using a 2D
    array of buttons (not cluster), in LV 6.1, a Value Changed event for
    the array can be used as you mention below to XOR the event's OldValue
    and NewValue and wire that to a local variable copy of the array.
    This easily gives a radio button effect for the entire 2D button
    matrix. The array control automatcially arranges the visual
    alignment of the buttons.
    For the cluster method, I'd like to programmatically change which
    button is true. All the approaches I come up with end up using
    Array-to-Cluster which then requires the cluster size to be specified.
    I may end up wanting to programmatically vary the number of buttons in
    both dimensions and hence the cluster size. LV's Align Objects and
    Distribue Objects ends up making the button visual alignment not
    difficult (for a 12 x 8 matrix).
    >Try this: take a cluster of four PB's (latched when pressed) put
    >inside a while loop. Initialize a boolean array of 4 to FALSE outside
    >the while loop, and attach it to a shift register input on the left
    >side of loop. Inside the loop, convert your cluster to an array. XOR
    >the shift register with this array from the buttons, and wire this to
    >the output shift register and to an indicator array. Set the boolean
    >to the loop so it will run free and start it up; on the control panel,
    >click on the PB's and you will see the outputs toggle.
    >
    >Greg

  • Pass a variable number into an Action method from an array of buttons

    Hello,
    I have created an array of buttons like so:
                       private javax.swing.JButton[] barray = new JButton[8];
    javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(K8055_Card_Control.JavaElectrodeSwitches1App.class).getContext().getActionMap(JavaElectrodeSwitches1View.class, this);
                 for (int i=0;i<8;i++)    // Create Output Check Boxes
              barray[i] = new JButton();
                            barray.setAction(actionMap.get("ButtonPressed"));
              barray[i].setName("Outbox"+ String.valueOf(i+1));
              barray[i].setText("Electrode " + String.valueOf(i+1));
    BoxLayout layout = new BoxLayout(jPanel1,BoxLayout.PAGE_AXIS);
    barray[i].setAlignmentX(JCheckBox.CENTER_ALIGNMENT) ;
    jPanel1.setLayout(layout);
    jPanel1.add(barray[i]);
    When a button is pressed it calls the method ButtonPressed()@Action
    public void ButtonPressed()
    // button pressed code here
    My problem is that once the button has been pressed I don't know how to find out which button called the method. Each button operates a different switch.
    I tried testing barray.isSelected(); however the ButtonPressed() method is only called once the button has released and is no longer selected.
    Any ideas?
    Thanks,

    Actually the answer to both of these questions is ActionEvent
    do for instance:
    JButton b = new JButton("test");
    JButon b2 = new JButton("test2");
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
      Object src = ae.getSource();
      String cmd = ae.getActionCommand();
      if (src == b) { //won't work unless you make b final
      //or
      if ("test".equals(cmd)) {
    b.addActionListener(al);
    b2.addActionListener(al);

  • Getting the index of the button pressed in an array of buttons

    Hi,
    I have an array of buttons.
    JButton buttons[];
    buttons = new JButton[18];
    for(int idx = 0; idx<buttons.length; idx++)
    buttons[idx] = new JButton("changing button name");
    buttons[idx].addActionListener(this);
    locationButtonGrid.add(buttons[idx]);
    locationButtonGrid.validate();
    I need to know the index of the button pressed. I can't work from the string that is to be sent to the actionListener as this is going to be coming from a database and changing all the time. The idea behind it is that I am narrowing a list of entries down in a database by dividing it into 18 different sections, then dividing that section into 18 different sections and so on.
    I need to know which of the 18 buttons was pressed. Is this possible?
    Please let it be so!
    Cheers,
    elmicko

    Try this (my code is in bold):
    JButton buttons[];
    buttons = new JButton[18];
    for(int idx = 0; idx<buttons.length; idx++)
    buttons[idx] = new JButton("changing button name");
    buttons[idx].addActionListener(this);
    buttons[idx].setID( String.valueOf( idx ) );
    locationButtonGrid.add(buttons[idx]);
    locationButtonGrid.validate();
    In the listener (assuming event is evt):
    buttons[ Integer.parseInt(evt.getSource().getID()) ]
    or
    int idx = Integer.parseInt(evt.getSource().getID());
    buttons[idx]
    finally, if you want to modify the button when you get the event, you can just call the JButton methods by casting the source to a JButton and working from there.

  • Mechanical Action of an array of buttons

    I have an array of buttons that get dynamically built when the front panel is loaded. When I select one of the buttons it remains "pressed in". If I right click on the button the "Mechanical Action" is greyed out. I pulled the button out of the array and checked the settings and its set to latch when released, its just not happening. Is their any way to set this property?

    Hi Rob,
    enclosed you will find two other solutions, simulating a radio button array based on a standard button array,
    this solution use a event loop.
    Version 1: Simulates Radio Buttons without "Allow False" Option
    Version 2: Simulates Radio Buttons with "Allow False" Option
    Attachments:
    ButtonArray1.vi ‏10 KB
    ButtonArray2.vi ‏10 KB

  • Array of buttons

    Hi everyone,
    I'm developing an app where I have a number of buttons, let's say 10. I named them button0, button1, ..., button9. Is there a way to cycle through all of them in a for loop?
    so instead of
    button0 setTitle:@"button 0" forState:UIControlStateNormal ;
    button1 setTitle:@"button 1" forState:UIControlStateNormal ;
    button9 setTitle:@"button 9" forState:UIControlStateNormal ;
    I could set up an array of titles and get a for loop going like this (this is PSEUDO CODE)
    for(int i = 0 ; i <= 9 ; i++)
    [(button + i) setTitle:[[titlesArray objectAtIndex:i] stringValue] forState:UIControlStateNormal];
    Any help would be truly appreciated!
    Thanks,
    Rolando

    orangekay wrote:
    uprise78 wrote:
    [butt doSomething];
    If you have to send this message you should consider more fiber in your diet.
    ROFL!!

  • How to create an Array of Button components in AS

    First I tried this:
    for (var j:uint = 0; j < 10; j++){
    var testButton:Button = new Button;
    testButton.label = "Test Button";
    testButton.addEventListener(MouseEvent.CLICK,
    function():void{trace("j = " + j);});
    addChild(testButton);
    But every button's mouse click returns a trace of 10. I need
    the button to be aware of it's index. How do I go about doing this?
    I tried making an array:
    var testButton:Array = [];
    for (var j:uint = 0; j < 10; j++){
    testButton[j]:Button = new Button;
    testButton[j].label = "Test Button";
    testButton[j].addEventListener(MouseEvent.CLICK,
    function():void{trace("j = " + j);});
    addChild(testButton[j]);
    But this gives a compile error:
    "Label must be simple identifier"

    You can use data property of the Button to store the index.
    You can use a ButtonBar to keep track of your buttons as a
    list.
    You can write a clickHandler as a normal function -- as
    opposed to anonymous one you have -- and pass the index of the
    button that you have stored in the data property.
    why you're not getting the behavior in the click handler that
    you're looking for? You'll need to study the scope and context for
    variables in Flex.
    Hope this helps.
    ATTA

  • Clearing array on button click

    i have a problem in clearing array.
    1. i have a vi witch on a button click add element in array ,and plot the values on graph.
    2. second time when i run vi on graph i get all the values witch i got in first run pluse the values on second run
    2. i want my graph should not plot values i got in first run
    3. if I initialise the shift reg.then at every button click it plots only one point on graph.
    4. I want all the points witch I added in my array at second run
    so please help me
    Shital"

    Ok, so we have an XY graph. Here I've attached two examples of the same approach as earlier (just second one use only one array of x-y pairs to store data). Local variables used only for cleaning graph display BEFORE any new points will be added (after first point you add, it will be also initialized). So this is just for cosmetic reasons
    Attachments:
    Shift_register_array_initialization1.vi ‏46 KB
    Shift_register_array_initialization2.vi ‏43 KB

  • Array of buttons .. wut do u thik right?

    here is the code i tried to create a bunch of JButtons in the frame ..
    wut is between the comments wut i tried and didn't work for me ..
    wut is my mistake .. please clearly explain to me .. oh by the way i don't want in my application to set a listener for my buttons ..
    i just want to show it ..
    regards
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class buttons extends JFrame
         public final int w = 200;
         public final int h = 200;
         JFrame frm = new JFrame();
         //JButton [] set = new JButton (10);
         public buttons ()
              /*for (int i = 0; i=set.length();i++)
                        set.add(i);
              //frm.add(set);
              frm.setSize(200,200);
              frm.setVisible(true);
         public static void main(String[]args)
              new buttons();
    }

    If you don't want the buttons to do anything, what's the point of having them? Maybe you want labels instead, they are used for displaying text with no interaction.
    As far as your code, you need to look at this tutorial:
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html
    specifically the part about arrays.
         //JButton [] set = new JButton (10);
            JButton[] set = new JButton[10];
         public buttons ()
              /*for (int i = 0; i=set.length();i++)
                        set.add(i);
                    for (int i = 0; i=set.length; i++) {
                   set[i] = new JButton("whatever text you want");
              }

  • Maybe you are looking for

    • Computer will not go to sleep

      I just installed Snow Leopard, upgrading from Leopard. Everything seems to be working fine, except that my computer will not go into sleep mode. Please help.

    • StrictXml2PlainBean - to have an XML - EDI conversion?

      Dear Experts, I'm experimenting with the EDIFACT XML --> EDIFACT conversion in XI. As we already know, there is no "out of the box" solution for it from SAP itslef. That's why we have to use a 3rd party solution for this conversion. (e.g. Seeburger,

    • Record no/Serial no in cross tab based on grouping

      Hi Experts, How to get Record no/Serial no in cross tab based on grouping

    • Constant camera speed on path

      I have a moving and tilting camera in 3D environment. I want to movement and tilting to different directions to be constant and smooth without 'locking' exact camera position to exact time. If I use keyframes to edit camera path, it messes up the con

    • Random sleep mode after Mountain Lion install

      Hello, I have a MacBook air 11" late 2011. after installing Mountain Lion I get random sleep modes, usually right after a waking up the computer. that has never happened before so I assume that it is a sotware issue. I do not have a hot corner for sl