Help with  On key press and Frame

Hi everybody,
I have been trying to make this work but not able to. It would be of great help if u can tell where i am going wrong. Here is my code ( it is prety small) :
I am trying to draw a random line when i do a keypress on the text field.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class KeyPress extends Frame{
Label label;
TextField txtField;
public static void main(String[] args) {
KeyPress k = new KeyPress();
public KeyPress(){
super("Key Press Event Frame");
Panel panel = new Panel();
label = new Label();
txtField = new TextField(20);
txtField.addKeyListener(new MyKeyListener());
add(label, BorderLayout.NORTH);
panel.add(txtField, BorderLayout.CENTER);
add(panel, BorderLayout.CENTER);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
setSize(400,400);
setVisible(true);
public class MyKeyListener extends KeyAdapter{
public void keyPressed(KeyEvent ke){
char i = ke.getKeyChar();
String str = Character.toString(i);
label.setText(str);
Line2D myLine = new Line2D.Double(5,5,100,100);
}

Here's what I come up when I played with your code.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.util.Random;
public class KeyPress extends Frame {
    TextField txtField;
    Panel panel;
    public static void main(String[] args) {
        KeyPress k = new KeyPress();
    public KeyPress(){
        super("Key Press Event Frame");
        panel = new myCanvass();
        txtField = new TextField(20);
        txtField.addKeyListener(new MyKeyListener());
        panel.setBackground(Color.LIGHT_GRAY);
        add(txtField, BorderLayout.PAGE_END);
        add(panel, BorderLayout.CENTER);
        addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent we){
                System.exit(0);
        setSize(400,400);
        setVisible(true);
    class myCanvass extends Panel {
        private Graphics2D g2;
        public void paint(Graphics g) {
            drawLine(g);
        private void drawLine(Graphics g) {
            g2 = (Graphics2D) g;
            g2.setColor(Color.RED);
            g2.draw(new Line2D.Double(Math.random() * 150, Math.random() * 150, Math.random() * 200, Math.random() * 200));
    class MyKeyListener extends KeyAdapter{
        public void keyPressed(KeyEvent ke){
            char i = ke.getKeyChar();
            String str = Character.toString(i);
            panel.repaint();
}

Similar Messages

  • I did force shutdown on my MacBook Pro (2006 year, 15.4"), so, when I tried to boot, it shows apple logo (as usual) and shuts down. When I booting MacBook with Option key pressed it shows lock icon and field for password. Please help me.

    I did force shutdown on my MacBook Pro (2006 year, 15.4"), so, when I tried to boot, it shows apple logo (as usual) and shuts down. When I booting MacBook with Option key pressed it shows lock icon and field for password. Please help me.

    Wait for advice on repairing a damaged filesystem.  Forceshutdown stops processs in mid-stream and leaves some parts not-valid.
    Do not proceed until you get that avice.

  • IPhoto opens but then the spinning rainbow wheel appears and I can't do anything. I have opend iPhoto with the Option key pressed and rebuilt the library and it still happens.  I want to at least access my photos and copy them to an external drive.

    iPhoto opens but then the spinning rainbow wheel appears and I can't do anything. I have opend iPhoto with the Option key pressed and rebuilt the library and it still happens.  I want to at least access my photos and copy them to an external drive. Anyone have ideas on how to get to them?

    Make a temporary, backup copy (if you don't already have a backup copy) of the library and try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    Click to view full size
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    OT

  • Help with understanding key event propagation

    Hello,
    I am hoping someone can help me understand a few things which are not clear to me with respect to handling of key events by Swing components. My understanding is summarized as:
    (1) Components have 3 input maps which map keys to actions
    one for when they are the focused component
    one for when they are an ancestor of the focused component
    one for when they are in the same window as the focused component
    (2) Components have a single action map which contains actions to be fired by key events
    (3) Key events go to the currently focused component
    (4) Key events are consumed by the first matching action that is found
    (5) Key events are sent up the containment hierarchy up to the window (in which case components with a matching mapping in the WHEN_IN_FOCUSED_WINDOW map are searched for)
    (6) The first matching action handles the event which does not propagate further
    I have a test class (source below) and I obtained the following console output:
    Printing keyboard map for Cancel button
    Level 0
    Key: pressed C
    Key: released SPACE
    Key: pressed SPACE
    Level 1
    Key: pressed SPACE
    Key: released SPACE
    Printing keyboard map for Save button
    Level 0
    Key: pressed SPACE
    Key: released SPACE
    Level 1
    Key: pressed SPACE
    Key: released SPACE
    Printing keyboard map for Main panel
    Event: cancel // typed SPACE with Cancel button having focus
    Event: save // typed SPACE with Save button having focus
    Event: panel // typed 'C' with panel having focus
    Event: panel // typed 'C' with Cancel button having focus
    Event: panel // typed 'C' with Save button having focus
    I do not understand the following aspects of its behaviour (tested on MacOSX although I believe the behaviour is not platform dependent):
    (1) I assume that the actions are mapped to SPACE since the spacebar clicks the focused component but I don't explicitly set it?
    (2) assuming (1) is as I described why are there two mappings, one for key pressed and one for key released yet the 'C' key action only has a key pressed set?
    (3) assuming (1) and (2) are true then why don't I get the action fired twice when I typed the spacebar, once when I pressed SPACE and again when I released SPACE?
    (4) I read that adding a dummy action with the value "none" (i.e. the action is the string 'none') should hide the underlying mappings for the given key, 'C' the my example so why when I focus the Cancel button and press the 'C' key do I get a console message from the underlying panel action (the last but one line in the output)?
    Any help appreciated. The source is:
    import javax.swing.*;
    public class FocusTest extends JFrame {
         public FocusTest ()     {
              initComponents();
              setTitle ("FocusTest");
              setLocationRelativeTo (null);
              setSize(325, 160);
              setVisible (true);
         public static void main (String[] args) {
              new FocusTest();
    private void initComponents()
         JPanel panTop = new JPanel();
              panTop.setBackground (java.awt.Color.RED);
    JLabel lblBanner = new javax.swing.JLabel ("PROPERTY TABLE");
    lblBanner.setFont(new java.awt.Font ("Lucida Grande", 1, 14));
    lblBanner.setHorizontalAlignment (javax.swing.SwingConstants.CENTER);
              panTop.add (lblBanner);
              JPanel panMain = new JPanel ();
              JLabel lblKey = new JLabel ("Key:");
              lblKey.setFocusable (true);
              JLabel lblValue = new JLabel ("Value:");
    JTextField tfKey = new JTextField(20);
    JTextField tfValue = new JTextField(20);
    JButton btnCancel = new JButton (createAction("cancel"));     // Add a cancel action.
    JButton btnSave = new JButton (createAction("save"));          // Add a sve action.
              panMain.add (lblKey);
              panMain.add (tfKey);
              panMain.add (lblValue);
              panMain.add (tfValue);
              panMain.add (btnCancel);
              panMain.add (btnSave);
              add (panTop, java.awt.BorderLayout.NORTH);
              add (panMain, java.awt.BorderLayout.CENTER);
    setDefaultCloseOperation (javax.swing.WindowConstants.EXIT_ON_CLOSE);
    // Add an action to the panel for the C key.
              panMain.getInputMap (JComponent.WHEN_IN_FOCUSED_WINDOW).put (KeyStroke.getKeyStroke (java.awt.event.KeyEvent.VK_C, 0), "panel");
              panMain.getActionMap ().put ("panel", createAction("panel"));
              // FAILS ???
              // Add an empty action to the Cancel button to block the underlying panel C key action.
    btnCancel.getInputMap().put (KeyStroke.getKeyStroke (java.awt.event.KeyEvent.VK_C, 0), "none");
    // Print out the input map contents for the Cancel and Save buttons.
    System.out.println ("\nPrinting keyboard map for Cancel button");
    printInputMaps (btnCancel);
    System.out.println ("\nPrinting keyboard map for Save button");
    printInputMaps (btnSave);
              // FAILS NullPointer because the map contents are null ???
    System.out.println ("\nPrinting keyboard map for Main panel");
    // printInputMaps (panMain);
    private AbstractAction createAction (final String actionName) {
         return new AbstractAction (actionName) {
              public void actionPerformed (java.awt.event.ActionEvent evt) {
                   System.out.println ("Event: " + actionName);
    private void printInputMaps (JComponent comp) {
         InputMap map = comp.getInputMap();
         printInputMap (map, 0);
    private void printInputMap (InputMap map, int level) {
         System.out.println ("Level " + level);
         InputMap parent = map.getParent();
         Object[] keys = map.allKeys();
         for (Object key : keys) {
              if (key.equals (parent)) {
                   continue;
              System.out.println ("Key: " + key);
         if (parent != null) {
              level++;
              printInputMap (parent, level);
    Thanks,
    Tim Mowlem

    Use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.
    1) In the Metal LAF the space bar activates the button. In the Windows LAF the Enter key is used to activate the button. Therefore these bindings are added by the LAF.
    2) The pressed binding paints the button in its pressed state. The released binding paint the button in its normal state. Thats why the LAF adds two bindings.
    In your case you only added a single binding.
    3) The ActionEvent is only fired when the key is released. Same as a mouse click. You can hold the mouse down as long as you want and the ActionEvent isn't generated until you release the mouse. In fact, if you move the mouse off of the button before releasing the button, the ActionEvent isn't even fired at all. The mouse pressed/released my be generated by the same component.
    4) Read (or reread) the [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html#howto]How to Remove Key Bindings section. "none" is only used to override the default action of a component, it does not prevent the key stroke from being passed on to its parent.

  • Detect Key Press and Mouse Motion in ONE event?

    Hi
    I am trying to create a functionality where a mouse motion from left to right performs one action, and the same motion while a given key is pressed performs another action.
    How can i combine the two events? How do I unify the KeyEvent and MouseEvent, particulary when I need to capture the directional motion of the mouse together with the key press?
    many thanks for any insight

    you cannot actualy combine them into 1 event but there is an easy way around this:boolean mouseKeyPressed = false;
    public void keyPressed (KeyEvent e)
      if (e.getKeyCode () == ??) \\ or e.isCtrlDown(), e.isAltDown(), ...
        mouseKeyPressed = true;
    public void keyReleased (KeyEvent e)
      if (e.getKeyCode () == ??) \\ or !e.isCtrlDown(), !e.isAltDown(), ...
        mouseKeyPressed = false;
    public void mouseMoved (MouseEvent e)
      if (mouseKeyPressed)
        //processAction
    }hope this helps,
    greetz,
    Stijn

  • Help with opening Adobe Reader and downloading updates

    I can not open Adobe .pdf files any longer (this started yesterday, prior to that I could open adobe files).
    When I double click a .pdf file I get this notice on my screen: Windows cannot access the specified device path or file. You may not have the appropriate permission to access file.
    So I went to the Adobe download site to download a new copy of Adobe.  When I start the download I get this on the screen:  The instruction at "0x0e3a0068" referenced memory at "0x0e3a0068."  The memory could not be written.  Then two options are listed: click OK to terminate or cancel to debug.  So I click on cancel and I get this on my screen: Internet Explorer has closed this webpage to help protect your computer.   A malfunctioning or malicious addon has caused I.E. to close this webpage.
    I don't have AVG running, I do have avast but I've disabled it.  I ran Registry Mechanic and an I.E. erasure program but nothing helps.
    I have gone into I.E. and reduced the security level to its lowest state but no joy.
    So, any ideas or suggestions on what's the problem and how to overcome it would be appreciated.  Thanks, in advance, for your reply.  Jim R.

    Hi Mike..tried that as well but no joy.  A friend of mine was looking at it all and noticed that it was an I.E. thing as far as not letting me redownload the reader so I went to Mozilla Firefox and I could download a new version but....whenever I attempt to open a .pdf file I get that message, "Windows can not open the specified device, path or file. You man not have the appropriate permissions to access the item." 
    Damn...this is irritating as I need to get to some of thos files as I need them for a Journal I'm working on as editor-in-chief. 
    It all worked just fine last Saturday but starting Monday when I was on my flight out to D.C.  no joy. 
    Sigh...Jim R.
    Jim R.
    Date: Tue, 1 Dec 2009 14:50:27 -0700
    From: [email protected]
    To: [email protected]
    Subject: Help with opening Adobe Reader and downloading updates
    Under the help menu, there is an option to repair the installation of reader. Did you try that?
    >

  • I need help with Creating Key Pairs

    Hello,
    I need help with Creating Key Pairs, I generate key pais with aba provider, but the keys generated are not base 64.
    the class is :
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import au.net.aba.crypto.provider.ABAProvider;
    class CreateKeyPairs {
    private static KeyPair keyPair;
    private static KeyPairGenerator pairGenerator;
    private static PrivateKey privateKey;
    private static PublicKey publicKey;
    public static void main(String[] args) throws Exception {
    if (args.length != 2) {
    System.out.println("Usage: java CreateKeyParis public_key_file_name privete_key_file_name");
    return;
    createKeys();
    saveKey(args[0],publicKey);
    saveKey(args[1],privateKey);
    private static void createKeys() throws Exception {
    Security.addProvider(new ABAProvider());
    pairGenerator = KeyPairGenerator.getInstance("RSA","ABA");
    pairGenerator.initialize(1024, new SecureRandom());
    keyPair = pairGenerator.generateKeyPair();
    privateKey = keyPair.getPrivate();
    publicKey = keyPair.getPublic();
    private synchronized static void saveKey(String filename,PrivateKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    private synchronized static void saveKey(String filename,PublicKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream( new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    the public key is:
    �� sr com.sun.rsajca.JSA_RSAPublicKeyrC��� xr com.sun.rsajca.JS_PublicKey~5< ~��% L thePublicKeyt Lcom/sun/rsasign/p;xpsr com.sun.rsasign.anm����9�[ [ at [B[ bq ~ xr com.sun.rsasign.p��(!g�� L at Ljava/lang/String;[ bt [Ljava/lang/String;xr com.sun.rsasign.c�"dyU�|  xpt Javaur [Ljava.lang.String;��V��{G  xp   q ~ ur [B���T�  xp   ��ccR}o���[!#I����lo������
    ����^"`8�|���Z>������&
    d ����"B��
    ^5���a����jw9�����D���D�)�*3/h��7�|��I�d�$�4f�8_�|���yuq ~
    How i can generated the key pairs in base 64 or binary????
    Thanxs for help me
    Luis Navarro Nu�ez
    Santiago.
    Chile.
    South America.

    I don't use ABA but BouncyCastle
    this could help you :
    try
    java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    java.security.KeyPairGenerator kg = java.security.KeyPairGenerator.getInstance("RSA","BC");
    java.security.KeyPair kp = kg.generateKeyPair();
    java.security.Key pub = kp.getPublic();
    java.security.Key pri = kp.getPrivate();
    System.out.println("pub: " + pub);
    System.out.println("pri: " + pri);
    byte[] pub_e = pub.getEncoded();
    byte[] pri_e = pri.getEncoded();
    java.io.PrintWriter o;
    java.io.DataInputStream i;
    java.io.File f;
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pub64"));
    o.println(new sun.misc.BASE64Encoder().encode(pub_e));
    o.close();
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pri64"));
    o.println(new sun.misc.BASE64Encoder().encode(pri_e));
    o.close();
    java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader("d:/pub64"));
    StringBuffer keyBase64 = new StringBuffer();
    String line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] pubBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    br = new java.io.BufferedReader(new java.io.FileReader("d:/pri64"));
    keyBase64 = new StringBuffer();
    line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] priBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    java.security.KeyFactory kf = java.security.KeyFactory.getInstance("RSA","BC");
    java.security.Key pubKey = kf.generatePublic(new java.security.spec.X509EncodedKeySpec(pubBytes));
    System.out.println("pub: " + pubKey);
    java.security.Key priKey = kf.generatePrivate(new java.security.spec.PKCS8EncodedKeySpec(priBytes));
    System.out.println("pri: " + priKey);
    catch(Exception e)
    e.printStackTrace ();
    }

  • Need help with my iPhone 5 and my Macbook Pro.

    Need help with my iPhone 5 and my Macbook Pro.  I was purchased some music on itunes at my mac. Some reason I deleted those music from both on Mac and iPhone 5.  Today, I went to my iPhone iTunes store inside of iCloud to redownload my puchased. But those song won't able to sync back to my iTunes library on my Mac.  Can anyone help me with that ??....
    iPhone 5, iOS 6.0.1

    You've posted to the iTunes Match forum, which your question does not appear to be related to. You'll get better support responses by posting to either the iTunes for Mac or iTunes for Windows forum. Which ever is more appropriate for your situation.

  • Barbara Brundage, can you help with PS Elements 11 and Epson R2000 printer issue?

    Seeking help with PS Elements 11 which does not work with Epson r2000 printer.  Epson tech support could not fix, said it is PS e11 problem.  Receive prompt on PS e11 screen when I try to print stating "not compatible or settings are not correct.  Have set PS to manage color and printer manages color to off.  Would appreciate any suggestions.  Thank you.

    Hi,
    Sincerely appreciate your help.  Running Windows 7 on a  Dell XPS420.  System has been very stable for years.  Before purchasing the Epson r2000, I owned an r1800 which was an excellent printer but after seven years started to exhibit paper feed problems.  The r1800 worked with all applications and I was well satisfied with the saturation, contrast, etc. printing mostly 8x10 and 11x17 prints. 
    Thank you for the information about the # of installs for PS E11, will try uninstall/reinstall this morning.
    Will let you know how things go.
    Richard
    Date: Thu, 12 Sep 2013 19:47:38 -0700
    From: [email protected]
    To: [email protected]
    Subject: Barbara Brundage, can you help with PS Elements 11 and Epson R2000 printer issue?
        Re: Barbara Brundage, can you help with PS Elements 11 and Epson R2000 printer issue?
        created by Barbara B. in Photoshop Elements - View the full discussion
    What operating system are you using?
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5678022#5678022
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5678022#5678022
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5678022#5678022. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Elements by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Track key press and key release on WPF applications

    Is there a way to track key press and release actions on WPF?
    This is what I've tried so far, but what I'm finding is that the _upDownKeyIsPressed is
    only set to false if I press another key - not when the up or down key is released.
    private void TrackUpDownKeyPress(KeyEventArgs e)
    if (e.Key == Key.Up || e.Key == Key.Down)
    // set to true if either up or down key is pressed
    _upDownKeyIsPressed = true;
    else
    // set to false once up or down key is released
    _upDownKeyIsPressed = false;
    private void PlotListView_KeyUp(object sender, KeyEventArgs e)
    TrackUpDownKeyPress(e);

    You want to track the Up and Down events. If you only use the Up event, then the variable will only be set to false when
    another key triggers the Up event:
    private void PlotListView_KeyUp(object sender, KeyEventArgs e)
    if (e.Key == Key.Up || e.Key == Key.Down)
    // set to true if either up or down key is pressed
    _upDownKeyIsPressed = true;
    private void PlotListView_KeyDown(object sender, KeyEventArgs e)
    if (e.Key == Key.Up || e.Key == Key.Down)
    // set to false if either up or down key is depressed
    _upDownKeyIsPressed = false;

  • New help with my mac air and airport extreme time capsule dont know how to save to time capsule and use as a external hd

    new help with my mac air and airport extreme time capsule dont know how to save to time capsule and use as a external hd would like 2 store my home videos and pictures on the time machine (ONLY) as the MAC AIR has storage space limited space please help. THANK YOU.

    See the info here about sharing or using the TC for data.
    Q3 http://pondini.org/TM/Time_Capsule.html
    It is extremely important you realise.. the Time Capsule was never designed for this.
    It is a backup target for Time Machine.. that is the software on the computer that does backups.. it has no direct connection to the Time Capsule.
    It has no ability to back itself up.. unlike all other NAS in the market. It is therefore likely one day you will lose all your files unless you seriously work out how to backup.
    The TC is slow to spin up the hard disk and fast to spin down. iTunes and iPhoto will continually lose connection to their respective libraries.
    iPhoto in particular is easy to corrupt when you move photos over wireless into the library.. once corrupted all is corrupt. A single photo will ruin it all.. so backup is utterly essential.
    Time Machine cannot do backups of network drives. ie the TC. You will need a different backup software like CCC. You will then need another target to backup to..

  • How do I turn on long press keyboard to write the same character many times with one keystroke only? I can only write 1 letter at a time with each key press. To write "aaaaa" I need to press 5 times the A key. I didn't use to do this.

    I know this has something to do with INSERT key in Windows I guess. But suddenly I was using Mac OS X Lion and a keyboard sign appeared in the top bar, and the keyboard didnt work as it usually does. I mean, I wanted the long press key to write multiple caracters of course. Please help!

    It's now a hidden option that can be turned on with a terminal command.  The easiest way to do this is to download TinkerTool from this site:
    http://www.bresink.com/osx/0TinkerTool/download.php5
    Then go to Tinkertool > General tab > Select "support key repeat".
    Logoff and login again.
    Regards,
    Captfred

  • MacBook stuck with shift key enabled and numbers not working - even the keyboard app in languages wont type lowercase nor numbers?!  Anyone know whats up?  no spillage...cant understand why the keyboard app wont do anything.

    Anyone have a clue?  I can understand the keyboard being broke / shift key being stuck but why in the world would I not be able to type the numbers on the language keyboard app on the operating system?  Numbers show up on the app but when I press them I still get the special characters like #^&#* and it wont type lower case. Nothing has ever been spilt, just stopped working one day.  Rebooted from Time Capsule restore dated a month ago and its still doing it. (problem started two weeks ago).  Only way to get lower case or numbers to actually show up is the copy and paste.
    Any help would be amazing!
    Details on computer:  13 inch MacBook6, 1  (Late 2009) / Intel Core 2 DUO /  2.26GHZ / 2GB /  Memory running Mac OS X Lion 10.7.5

    If you can afford it, I would recommend replacing the topcase and keyboard as Apple suggests. If like me, you can't afford it or are open to a hack fix, then read on.
    The problem
    Yesterday, a little water spilt on my 13" MBP keyboard. I turned it around immediately, drained out the water and used tissue to suck it all up but the keyboard was still acting funny. I turned it off and left it out in the sun for a couple of hours and turned it on again but problems remained. Like Rickdubya, my warranty had run out just a month ago and I knew Apple would not cover this under warranty. I tried to clean the shift keys and left it overnight with some rice on them with hopes that the moisture might get sucked out. Nothing worked. (The rice bit is an urban legend that seems to work with some electronics). Went to the Apple Store this morning and was told that they wouldn't even take out the key and clean it, and that the entire top case would have to be replaced. A total bill of 156 Euros which I cannot afford. I had a USB keyboard that would let me use the Mac for the moment so I decided to try to work out a fix.
    Symptoms
    - Boots in safe mode everytime (which I later found out was because the shift key is pressed)
    - Cannot login because password is in lower case or has numbers
    - Cannot boot in super user mode and try to disable keys or override password as some commands won't work in uppercase (I wouldn't recommend this anyway because its super user mode)
    - All text is in caps and numbers are symbols as though shift key is always pressed
    - Audio doesn't work
    - Keyboard viewer would not always show the shift key pressed. The key seemed to get pressed at random
    Fix
    1. Hold the Option button down on boot to bypass the Safe Mode ensure a normal boot
    2. At the login screen, plug in a USB keyboard and enter your password to login
    3. Change your password to one that uses all caps and no numbers
    4. Download and install KeyRemap4MacBook .
    5. Use a combination of the functionalities of the Keyboard Viewer and KeyRemap4MacBook to figure out which shift key is the problem. In my case, I found out that it was only my left shift key.
    6. Disable the left/right shift key on KeyRemap4MacBook and click on the 'Reload XML' button to make that take effect.
    If only one shift key was the problem, then you are done. If both shift keys were shorted, then its likely other keys are too. In which case you should probably just replace the entire thing. If you think other keys are not affected, then you can use KeyRemap4MacBook itself to remap the shift functionality to a lesser used key like the Left Option key.
    7. Under System Preferences > Users & Groups > Login Items , add KeyRemap4MacBook as an application that should start on login. This will ensure that your disable/remap of the shift key is active everytime you login.
    Usage change/Things to remember
    1. Remember to hold down the Option key everytime the computer boots or reboots to bypass safe mode. The fix above is at the software level. The key is physically still shorted at the hardware level and will affect boot.
    2. Remember that at the login screen, the disable/remap is not active. So your password now has to be all caps and only letters.
    As soon as I can save some money, I will get my topcase and keyboard replaced but until then this solution works great with minimal change. Hope this helps!

  • Help with ibook G4, Freezing and wont turn on :-(

    Can anyone help a fellow MacLady?
    I have an ibook G4, her her a year with no problems,
    2 days ago cursor froze, and I turned off and restarted and am left with a blank screen.
    Every now and then it starts up, all my documents are there, connects to to wireless ok, and last for anything from 5mins to 1hr. Then freezes again.
    Took it to a local PC man who looked and said he doenst really know apples but guessed it was Hard Drive.
    Have no lost NO information from the PC, its all backed up now thankfully as I do occassionaly get access to it, though all my 876 entourage emails have strangely dissapeard. Aghhhhhhhhhhhhhh
    Have an appointment with a "Genius" in Bluewater on Wednesday (earliest they can see me), but just wondered if anyone knew what the problem might be and how much I am maybe looking at for a repair? As the PC man told me to buy a new one as this will cost hundreds.
    I work from home so not been able to print or do hardly anything so am running out of time
    Thanks for any help, the PC is here next to me (am on my old Win one, blergh) so if anyone can help or give advice I would really appreciate it,
    Thanks for any help in advance.

    Hi LadyMacB and welcome to Apple Discussions.
    First of all see if you can start up inSafe Mode.
    Safe Boot takes longer than normal startup.
    What is Safe Boot, Safe Mode.
    If you are able to start up in Safe Mode and reboot into normal mode this may, in itself, be enough. If not restart in Safe Mode, if you are able, & put your OS X install disk in and restart holding the C key until you see the spinning gear wheel. When you get to the Language screen select your language and select 'Next'.
    At the top of the screen towards the left in the menu bar select Utilities>Disk Utility. Select the Drive name at the very top, then look at the report at the bottom of the window. Amongst everything else you will, hopefully, see S.M.A.R.T. status 'Verified'.
    If it says 'Failing' then your PC bloke is spot on. Be grateful that you were able to get everything backed up. Otherwise proceed…
    Select your OS volume 2nd down in the left hand box, then click the 'Repair Disk' button. Leave Disk Repair to run, If it reports that repairs were made select 'Repair Disk' again until you get the message that the Volume appears to be OK. If DU reports at any time that it could not repair then third party utilities may be necessary or, irrespective of the S.M.A.R.T. status report, your HD may be shot. Try the above for starters and report back.
    Best of luck,
    Adrian

  • Problem with ATV refresh rates and frame rates

    I live in Australia and as such I am subject to PAL, so when I set my ATV up I set it to 720P 50Hz, when I purchased a TV season the episodes were running at 25fps and played back flawlessly with no dropped or added frames. My problem occurs when I download movies, all the movies I have bought are running at 24fps and suffer from quite noticeable jitter, almost like the 24th frame is duplicated and added as the 25th frame, I assume it is something like this as the pause happens every second.
    So has anyone had a problem similar to this and if so what do you do about it?
    Does the ATV playback all sources (24/25) smoothly even if it has to convert?
    Could it be caused by my TV?
    Any help to any of these questions would be great.
    Thanks.
    Tim.

    With my particular Apple TV setup and TV combination, I find that setting to 1080p (60hZ) gives my the best all-round round results.
    This does result in -slightly- jerky motion with 25fps material (especially old British TV shows), but it's bearable. It's particularly noticeable with sideways scrolling text and credits.
    The one thing that is peculiar on my setup is if I use 720p (either @60hz or 50hz) and watch an iTunes-purchased HD episode that is encoded at 24fps I get very odd motion effects indeed. Every few seconds the video appears to speed up almost like it is 'catching up' with lost frames - very hard to explain exactly how it looks. Anyway I set to 1080p and this effect is gone completely. It also goes away if I set to 1080i. I think something queer is going on with 720p on the Apple TV (at least with my TV there is). This happens with both HDMI and component outputs.
    It may be worth trying 1080i at either 50 or 60Hz if your set can't do 1080p.
    I would also suggest that 60hz in theory should give a smoother motion for 24fps playback than 50Hz.
    My basic problem with all this is that on even a cheap DVD player if a disk is 50Hz, the player switches to 50Hz output and if it is 60Hz, it will change to 60Hz. The Apple TV stays fixed. It's a shame it can't autoswitch refresh rates.

Maybe you are looking for