# key not working in linux

Hi
I have been using jbuilder5 in windows and have created an application. It works fine in windows but when i move to linux(SuSe v7.3) the # key does not work. Even in jbuilder the # key does not work.
It is not the keyboard settings as in other non java applications the # key works. I am using the jdk 1.3 and I am using swing to get the text.
Has anyone heard of this problem and do you know how to overcome this.
Thanks

there used to be a bug in JTable - some characters did not work, the most popular being the lower capital "q"; "#" is also part of the game.
check out the following bug in the bug parade which also contains a workaround. I am not sure if it applies to the java version you are using, but you can give it a try.
http://developer.java.sun.com/developer/bugParade/bugs/4233223.html
For those of us who can't wait for "Kestrel" here is a workaround...
public class KeyedTable extends JTable {
    public KeyedTable() {
        patchKeyboardActions();
      * Other constructors as necessary
    private void registerKeyboardAction(KeyStroke ks, char ch) {
        registerKeyboardAction(new KeyboardAction(ks, ch),
            ks,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    private void registerKeyboardAction(char ch) {
        KeyStroke ks = KeyStroke.getKeyStroke(ch);
        registerKeyboardAction(new KeyboardAction(ks, ch),
            ks,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    private void patchKeyboardActions() {
        registerKeyboardAction(KeyStroke.getKeyStroke("Q"), 'q');
        registerKeyboardAction('"');
        registerKeyboardAction('(');
        registerKeyboardAction('$');
        registerKeyboardAction('!');
        registerKeyboardAction('%');
        registerKeyboardAction('&');
        registerKeyboardAction('#');
        registerKeyboardAction('\'');
    private class KeyboardAction implements ActionListener {
        char ch;
        KeyStroke ks;
        public KeyboardAction(KeyStroke ks, char ch) {
            this.ks = ks;
            this.ch = ch;
        public void actionPerformed(ActionEvent e) {
            Component editorComp = getEditorComponent();
            if (isEditing() &&
                editorComp != null &&
                editorComp.isVisible() &&
                SwingUtilities.findFocusOwner(KeyedTable.this) == editorComp)
                return;
            int anchorRow = getSelectionModel().getAnchorSelectionIndex();
            int anchorColumn =
getColumnModel().getSelectionModel().getAnchorSelectionIndex();
            if (anchorRow != -1 && anchorColumn != -1 &&
!isEditing()) {
                if (!editCellAt(anchorRow, anchorColumn)) {
                    return;
                else {
                    editorComp = getEditorComponent();
            if (isEditing() && editorComp != null) {
                if (editorComp instanceof JTextField) {
                    JTextField textField = (JTextField)editorComp;
                    Keymap keyMap = textField.getKeymap();
                    Action action = keyMap.getAction(ks);
                    if (action == null) {
                        action = keyMap.getDefaultAction();
                    if (action != null) {
                        ActionEvent ae = new ActionEvent(textField,
ActionEvent.ACTION_PERFORMED,
                                                         String.valueOf(ch));
                        action.actionPerformed(ae);
}

Similar Messages

  • KeyListener not working in Linux

    Hello guys, I'm having a weird problem I was hoping I could get resolved.
    I finished a Pong applet for my Java class, and it works just fine under Windows and on my Mac.
    But when I run it under Linux, the Applet doesn't work correctly.
    The applet draws, and my timer works, but my KeyListener does not work.
    I believe all of my Java files are updated properly.
    But I do not understand why KeyListener does not work under Linux, but it does in Windows.
    I then made a very basic applet just to test my KeyListener, and it still does not work.
    This is how I was taught to do KeyListeners, but if I'm doing something wrong, please help me out!
    here is the basic program code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JApplet implements KeyListener
    int x = 0;
    int y = 250;
    public void init()
    addKeyListener(this);
    public void paint(Graphics g)
    g.setColor(Color.white);
    g.fillRect(0,0,500,500);
    g.setColor(Color.black);
    g.fillRect(x,y,50,50);
    public void keyPressed(KeyEvent event)
    int keyCode = event.getKeyCode();
    if(keyCode == KeyEvent.VK_RIGHT)
    x += 10;
    public void keyReleased(KeyEvent event)
    public void keyTyped(KeyEvent event)

    What if don't use a KeyListener but instead use key binding? For instance,
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    @SuppressWarnings("serial")
    public class Test2 extends JPanel {
      private static final int DELTA_X = 10;
      private static final int DELTA_Y = DELTA_X;
      private static final Dimension MAIN_SIZE = new Dimension(600, 600);
      enum Arrows {
        LEFT(KeyEvent.VK_LEFT, -DELTA_X, 0),
        RIGHT(KeyEvent.VK_RIGHT, DELTA_X, 0),
        UP(KeyEvent.VK_UP, 0, -DELTA_Y),
        DOWN(KeyEvent.VK_DOWN, 0, DELTA_Y);
        private int keyCode;
        private int deltaX, deltaY;
        private Arrows(int keyCode, int deltaX, int deltaY) {
          this.keyCode = keyCode;
          this.deltaX = deltaX;
          this.deltaY = deltaY;
        public int getDeltaX() {
          return deltaX;
        public int getDeltaY() {
          return deltaY;
        public int getKeyCode() {
          return keyCode;
      int x = 0;
      int y = 250;
      public Test2() {
        setBackground(Color.white);
        setPreferredSize(MAIN_SIZE);
        InputMap inMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
        ActionMap actMap = getActionMap();
        for (Arrows arrow : Arrows.values()) {
          inMap.put(KeyStroke.getKeyStroke(arrow.getKeyCode(), 0), arrow);
          actMap.put(arrow, new MyAction(arrow));
      private class MyAction extends AbstractAction {
        private Arrows arrow;
        public MyAction(Arrows arrow) {
          this.arrow = arrow;
        public void actionPerformed(ActionEvent e) {
          x += arrow.getDeltaX();
          y += arrow.getDeltaY();
          repaint();
      @Override
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.black);
        g.fillRect(x, y, 50, 50);
    import javax.swing.JApplet;
    @SuppressWarnings("serial")
    public class TestApplet extends JApplet {
      public void init() {
        try {
          javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
              createGUI();
        } catch (Exception e) {
          System.err.println("createGUI didn't successfully complete");
      private void createGUI() {
        getContentPane().add(new Test2());
    }

  • Why my RMI is not Working in Linux???

    Hiii how ru?
    I am Rahul here
    Well I have a problem that my RMI in not working on Linux.. so can u tell me the solution to my problem???
    When i am typing following command i am getting exception as RmiNotBoundException
    java -Djava.security.policy=my.policy ChaClient&
    however my Server is Starting normally but client is not connection to server.
    so please tell me the solution to this problem
    U can contact me at
    [email protected]
    [email protected]
    Thank u Very much...

    i ran into the same issue dealing with RMI and Linux. My issue was the the stub that linux was giving you gave in the host field the ip number of "127.0.0.1" which tried to make the client connect to itself. this is how i got around it:
    java -Djava.rmi.server.hostname=<ip that other clients will connect to>
    so, for instance, if on a client you connect to the server with an IP of 10.5.0.1, then when starting up the java vm, you start it
    java -Djava.rmi.server.hostname=10.5.0.1
    hopefully that helps

  • A s d f g keys not working on a wireless Apple keyboard for Imac

    a s d f g keys not working on a wireless Apple keyboard for Imac.
    When I type they on't work.
    *Exmple o complete entence.
    Plee help! Thi i very rutrtin. I on't wnt to ue cut n pte or ome letter.
    Thnk you in vnce.

    Make a Service appointment for the keyboard at your local AASP.
    Apple - Find Locations
    I'm not sure how old it is, but it is covered for 1 full year as long as it didn't take that 19 story dive.

  • Wireless not working in linux, but works fine in windows vista

    Hello!
    I have installed Unbreakable Enterprise Linux 4 in a dual boot config. with Window Vista on a Compaq Presario laptop. After install completed I found that my on board Broadcom Wireless Adapter (Dell 1390 Mini PC card) was not recognized. I have tried installing NDISwrapper versions 1.48 and later 1.47 (after uninstalling 1.48) because everytime I got to the "modprobe ndiswrapper" received a fatal error about an unknown symbol or parameter, and on install I also encountered a "CONFIG_4KSTACKS" error as well. The good part is the light on my laptop for the wireless adapter finally came on and the driver (bcmwl5.inf) appears to be installed and the wireless adapter identified as being present, but it still doesn't show up in the network manager gui interface. So I am out of ideas if any one can give me a suggestion for a solution I would appreciate it.

    Hi there,,,,,
    I have Oracle Enterprise Linux 5 installed and Intel wifi 5100 card installed on my laptop. Wireless card does not work in Linux it works fine with Vista, I have dual boot. I have downloaded and installed the microcode for the wireless card for Linux,,,it is now active but it does not take ip address from dhcp and nor does it connect when i supply manual ip. it does not even scan for any wireless network. I have WEP enabled on my wireless network. It just says disconnected.....
    Please help me.....i have been trying to get this thing work for 3 weeks.
    thanks.

  • Volume and brightness keys not working with new keyboard on imac

    I just purchased a new wired keyboard for imac and brightness and volume control keys not working . i have tried adjusting keyboard settings. I have software version 10.5.8. Do I need to upgrade software. Thank you for any help.

    Do you have "Automatically Adjust Brightness" check box ticked in System Preferences > Displays > Display ? If so, you can't manually adjust brightness.

  • Some keybaord keys not working after suspect virus on Tecra A

    Apostrophe, delete, semicolon and end keys not working after a suspected virus attack. I found record of the same problem on the net but apparently this guy fixed his problem after he found scroll lock or num lock on.
    This is not the case here but there is something going on with numlock - register shows 2 and not 0. change to 0 but when reboot back to 2 again.
    Suspect changed back by bios. I thought i couldnt get to bios because DEL key not working but found ESC works.
    Tried to reset default values for bios but then cannot save and exit as this required the END key to work.
    I was running XP at the time of the (suspected) attack and could not rectify the problem so put the computer back to the OEM status which i hoped would help - it did not, same problem so rather than install all the software on the computer again with XP i upgraded to Windows7 - fresh install.
    Still keys do not work - it was a real pain to start with as my computer was set up to ctl+alt+del to log in and i had to do this with on screen keyboard - XP - this also showed that numlock was on before and after windows boot.
    The reason i suspect a virus - my wife was watching one of her tv shows on line from home country (another toshiba laptop) and i needed to use that laptop for something else so i asked her to use mine - later on we turned the laptops off and in the morning turned tham back on again, the other laptop with AVG virus protection flagged several hits and this one with (FAMOUS and completely up to date) Norton flagged nothing - once i got into it using on screen keyboard.
    Problems with this computer was found after scanning with a different antivirus.
    Anyway - i am left with 4 keys that do not work on my keyboard (actually they did work after i logged into the computer for the first time but i had to hold them in for a long time - and then next time i rebooted, not work at all and havent ever since)
    Any assistance here would be greatly appreciated, i have been working on this all weekend with no joy at all.
    Thanks in advance.

    Thanks Xardas,
    I have essentially done both - tried Toshiba OEM status found on a small partition of the toshi hard drive - no good - then did a fresh install of Windows 7 - still no good
    You know - as cunning as it sounds - i cannot reload the default settings in BIOS as it requires the END key to work so i can Save & Exit - all i can do is Exit Without Save - i sort of feel snookered at the moment.
    Toshiba got back to me today and said that i have tried everything they would have (yeah for sure) and to take my machine into a service centre for a hardware check - yeah right on boys!
    Check out this guys post below found on Kioskea.net - getting close to a year ago...
    ms ml - Nov 10, 2009 12:52am GMT
    Hi there, I was hoping that you might be able to help me with the problem that I seem to be having with my Toshiba Satellite Laptop Keyboard too. For a few days now I havent been able to use a few of the keys on my keyboard, including (1) delete (the backspace key is still working though), (2) colon/semicolon, (3) apostrophe/quotation marks and (4) end (the home and PgUp and PgDn keys are still working though). Any suggestions?
    Identical to my problem....obviously this guy had the same problem as well...see below - same thread.
    yab - Feb 9, 2010 4:47am GMT
    hi did you ever figure this out? i have the same exact problem...
    However, i was not able to solve my problem the way this guy did - my scroll lock is not activated - it seems to work ok (on and off) i tested it using Excel to move around the cells.
    yab ms ml - Feb 9, 2010 7:57am GMT
    Nevermind. For me it was scroll lock. My apostrophe, semicolon, and delete keys are alive and working again. I hope you have the same easy fix.
    Incidently - never hear from the first guy again - probably ended up being his scroll lock.
    all sugestions welcome - sorry my smily face has no eyes -) guess why!

  • Esc key not working in windows 7

    Hi,
    I have a HP Pavilion dv6-4XXX series. It's almost been 2 years I bought this notebook. 
    Recently I faced an issue. The "ESC KEY" has stopped working. However I could find that it's working fine in BIOS but not when I am logged in to windows. I have windows-7 installed.
    Please let me know what could be the issue and the solution for the same.

    Hello siddharthmishra,
    You’re having a problem with the ESC key not working.
    Go to device manager and uninstall the keyboard and restart the computer. This should uninstall and reinstall the driver for the keyboard.
    Here is a link to device manager.
    If the problem has not been happening for very long, you might try a System Restore. This will take the system back to before the problem started happening without affecting any of your files.
    Here is a link to a System Restore.
    Let me know how everything goes.

  • Webutil not working in linux

    Hi all,
    i have insert image using webutil(oracle forms 10g) to database in windows o.s. it was successful.
    but when i have tried it in solaries o.s. .
    It is not working in linux how to do it in solaries o.s.
    when i am clicking on the browse button it is showing pl/sql error how to solve it.
    please guide me ..

    HI Anderas,
    i am using using a demo form of webutil which is available on internet i.e WEBUTIL_DOCS.fmb
    which is working fine on windows sp2(when i am clicking on the browse button)
    but it is not working on linux when i am clicking on the browse button it is showing pl/sql error.
    code in browse butrton
    Declare
         LC$Fichier Varchar2(128 ) ;
    Begin
    LC$Fichier := PKG_FICHIERS.Selection ;
    If LC$Fichier is not null Then
    :TRANSFERTS.FIC_SOURCE := LC$Fichier ;
    End if ;
    End ;
    and the package is
    package specification
    ==================
    PACKAGE PKG_FICHIERS IS
    -- Sélection d'un fichier --
    FUNCTION Selection ( PC$Filtre IN Varchar2 DEFAULT '|All files|*.*|' ) RETURN VARCHAR2 ;
    END;
    package body
    =============
    PACKAGE BODY PKG_FICHIERS IS
    -- Sélection d'un fichier --
    FUNCTION Selection ( PC$Filtre IN Varchar2 DEFAULT '|All files|*.*|' )RETURN VARCHAR2
    IS
    LC$Path Varchar2(128) ;
    LC$Fichier Varchar2(256) ;
    LC$Filtre          Varchar2(100) := PC$Filtre ;
    Begin
         -- Répertoire temporaire --
         LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
    LC$Fichier := WEBUTIL_FILE.FILE_OPEN_DIALOG
         LC$Path,
         LC$Filtre,
         'Select a file to upload'
    Return LC$Fichier ;
    END Selection ;
    END;
    please reply..

  • Command, option, ctrl, fn keys not working

    thanks to a visiting dog who got tangled up the power adapter my laptop ended up on the floor, wide open with the keyboard popped out. I have inspected the connector cable and it looks OK to the naked eye. I disconnected the keyboard cable and re-connected.
    When using an external USB keyboard all keys function normally. When using the built-in keyboard the only keys not working are the command, option, ctrl and fn keys. I have restored modifier keys to default (I had never changed them) but this did not help. I also toggled the "use F1-F12 to control..." option in the keyboard preferences to no avail and have restored keyboard shortcuts to no avail.
    Is my keyboard shot? Is the a pref file I might delete?

    Hi, Mel. If the external keyboard works properly, I'm afraid you have to figure your built-in KB has been dogged to death. I hope the pet owner will do the right thing by you. I also hope the KB is all that was damaged. How are your adapter cord, plug, and DC-In port? Does your battery still charge OK?
    Whenever anything visits my house that's active, inattentive, and built low to the ground, my Powerbook runs on battery power only. I haven't seen one yet, but the new magnetically-connected, easily- and harmlessly-detached MacBook Pro AC adapters sound like a superb idea to me. Too bad our PBs can't use 'em.

  • N95 SHORT CUT KEY NOT WORKING

    Anyone had any problems with there N95 top left shortcut key not working,mine won't do anything when pressed then suddenly has a mind of it's own and keep pressing it's self and sending blank text messages to my first contact in my address book...
    Tried software load,no cure is it back to the shops..

    my daughters as just started doing the same i have updated the software and had buttons changed but still the same

  • Keyboard: some keys not working

    Some keys not working.  Need help/suggestions.  Not great with computers so PLEASE give details/steps re: how to do what you suggest - thanks!
    Details: intel based iMac running snow leopard 10.6.8.  Apple wireless/bluetooth keyboard (came with the iMac).
    Some keys suddenly stopped working:  space, tab, capLock, option key to the right of space bar (one on the left works), down arrow
    The problem happens in various programs (safari, pages, etc)
    The keyboard is fine on another iMac
    A different keyboard is fine on this/the involved iMac
    (nutshell: keyboard works fine - computer works fine, unless they're together)
    Here's what's been tried/checked:
    -checked the settings for universal access ("mouse keys" are off) and checked for any bluetooth keyboard shortcuts.
    -in system preferences "speech" is not set for "speak selected text when the key is pressed" - this is not checked/selected
    -tried creating a new user but had the same issue so it's computer-wide rather than just a user account
    -removed the keyboard and reconnected (using the +/- signs and "disconnect" and putting in a new code of numbers to pair keyboard)
    -language/text is set for english
    -did the keyboard viewer and the keys in question did NOT highlight when pressed (but don't forget the entire keyboard is fine on a different computer so thekeys aren't the issue)
    -"slow keys" is turned off re: keyboard in system preferences.
    Any help is welcomed.  It's frustrating knowing the keyboard works, just not with this computer.  Please help.  Many thanks!

    yes - not sure how this works...if you can see my original post there are a lot of details in there.  If you can't...
    nutshell: the keyboard works on a different iMac
                 a different keyboard works on this/the involved iMac
                 I tried to create a different user and the keyboard still does not work so it is computer-wide
                 I also removed the keyboard from the computer (using the +/- symbols and disconnecting and then repairing it.  The problem remained
    Thanks for any help.  It's crazy that the keyboard is fine and the computer is fine but together, there's the problem.
    Thank you!!!

  • Sound key not working

    volume key not working ofter last update

    Hello Amandodsouza,
    It sounds like you are experiencing some unexpected behaviour with the on screen keyboard after updating to iOS 7.1.1. I would start by closing all the running apps on the phone:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    When you have done that and restart the phone and test the issue again:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • E545 and Function key not working

    Any help here is apprecited. My function (Fn) key is refusing to work at all. None of the special features are able to be used. I've checked all my drivers, and followed the instructions in the User Guide, but some of the options described in the guide are even showing on my computer.
    I'd love for some help on this issue, as the computer is pretty worthless right now.

    Hi Jamesbjenkins,
    Welcome to Lenovo Community!
    As per the query we understood that you are facing issue with keyboard function keys not working on your ThinkPad E545.
    Is the system updated with all the latest drivers and application? To confirm with I request you to run ThinkVantage system update tool. This will search for all the required drivers and application for your system and will update.
    Hope this helps.
    Best regards,
    Hemanth Kumar
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • 2.1 History Shorcut Keys not working

    Hi,
    When I try to retrieve statements stored SQL-history using shortcut keys nothing happens.
    I tried Ctrl-Shift-Down, Ctrl-Shift-Up, Ctrl-Down and Ctrl-Up but in SQL-worksheet but nothing happens.
    I even defined new shortcuts also to no avail.
    Does anybody else face this problem?
    Regards
    Ernst

    Logged
    Bug 9238928 - otn: sql history shorcut keys not working
    -Raghu

Maybe you are looking for