Loss of keyboard focus in Java appl running under linux

I have a small sample program that replicates my problem. When this program is run a window is created. If you select File->New another instance of the program window is created. Now if you try to go back and bring to front the first window, keyboard focus is not
transferred when run under linux. You can only type in the second window. The expected behavior does happen in Windows.
> uname -a
Linux watson 2.6.20-1.2933.fc6 #1 SMP Mon Mar 19 11:38:26 EDT 2007 i686 i686 i386 GNU/Linux
java -versionjava version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
javac -versionjavac 1.5.0_11
import java.awt.event.*;
import javax.swing.*;
class SwingWindow extends JFrame {
    SwingWindow() {
     super("SwingWindow");
     JMenuBar menuBar = new JMenuBar();     
        JMenu fileMenu = new JMenu("File");
        JMenuItem newItem = new JMenuItem("New");
        newItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
          SwingWindow.createAndShowGUI();
     fileMenu.add(newItem);
        menuBar.add(fileMenu);
        setJMenuBar(menuBar);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);       
     JTextField text = new JTextField(200);
     getContentPane().add(text);
     pack();
     setSize(700, 275);
    public static void createAndShowGUI() {
        JFrame frame = new SwingWindow();
        frame.setVisible(true);
    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

You can implement the FocusListener interface. When
the first JFrame gains focus, call
text.requestFocusInWindow(). I hope this helps.The call requestFocusInWindow is not helping, perhaps even making it worse.
The problem seems to be that I am in the situation where the call
KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner()
is returning the expected Component. The problem is that the KeyListener class that is registered with the Component is not being called when a key is being pressed.
The issue is that I have a component that has the keyboard focus, but the KeyListener class
is not responding.
This seems to be a linux only problem which makes it only mysterious.

Similar Messages

  • Opening a Powerpoint in JSP and run under Linux

    Hi,
    I need to have a JSP page that provides a link to open a powerpoint file and this JSP is to be run under Linux. When I try to click on the link in Linux to open the powerpoint, it gives me a lot of junk characters. Can somebody please help mi, thanks a million!

    You have the mimetype for the HTTP response set to something other than what will make the browser start a powerpoint viewer and direct the content of the HTTP response to it.
    In your jsp use the setHeader(String key,String key) method to set the value of "Content-Type" to the mimetype for powerpoint.
    Of course the users must have browsers that are configured to launch a powerpoint viewer or plug-in. If you provide the correct mimetype and peoples browsers desn't have this, then they will get the "save to file" dialog box.

  • Vhost configuration for Adobe Media Server running under linux.

    Please help me with Vhost configuration for Adobe Media Server running under linux.
    I was running a media sharing website for which I wanted to use Adobe Media Server.
    To use, AMS, I disabled the already installed Apache server and installed AMS along with the built in Apache server. I could successfully install AMS and could login to AMS Admin Console through my IP number.
    My existing website, www.mydomain.com is having its contents located at:
    /home/mydomain/public_html
    (Directory created under the old version of Apache not bundled with AMS)
    Users will be uploading their videos, which will get transcoded and will be delivered to the website visitors in the existing scenario.
    To use this website with AMS, this is what I did:
    I created a folder for my domain, www.mydomain.com as below
    /opt/adobe/ams/conf/_defaultRoot_/www.mydomain.com
    Copied Application.xml and Vhost.xml from /opt/adobe/ams/conf/_defaultRoot_/   and pasted them in /opt/adobe/ams/conf/_defaultRoot_/www.mydomain.com
    In the Application.xml file there are 2 entries:
    <Alias name="mydomain.com"></Alias>
    <AppsDir>${/home/mydomain/public_html}</AppsDir>
    Please help me with further steps to be completed:
    Do I need to create a separate VirtualHost entry in the Apache installed with AMS?
    If yes, can I specify already existing document root for my website (/home/mydomain/public_html) or do I need to create a separate folder under webroot/Apache ?
    If yes to point 2 above, then do I need to copy all the existing contents from /home/mydomain/public_html to the newly created folder ?
    I hope, I can serve all my static contents like html pages and php and media like video/audio. In that case do I need create alias to my Media/Alias folder or AMS will automatically start streaming when a video/audio is requested ?
    What other steps do i need to complete?
    Any help in this regard would be highly appreciated.
    Thanks and Regards

    Dear sir or madam,
    Here is Letswin Technology, which specializes in global servers, web hosting, VPS, VPNj. If anything I can do for you, pls contact us!
    Have a nice day!

  • How to detect loss of keyboard focus?

    I’ve got a numeric input field that must be padded with
    leading zeros to exactly 8 digits. The handler to pad the input is
    trivial and calling the handler on various mouse events is equally
    simple, however, I would also like to call the handler when the
    input field looses keyboard focus by tabbing. Apparently, keyDown
    events are not passed for the tab key when auto tabbing is engaged.
    Anyone know if there is an event triggered by loss of focus?

    There is no onBlur event in Lingo (though something like it
    would be a
    useful addition). You'll need to poll for keyboard focus.

  • Java running under linux with crontab

    I'm having a problem:
    i want to run a java program under linux with crontab.
    my classes are in a directory and aren't in a package. i run em by invoking ./start which is a small script that i wrote. The script is in the same dir as the classes and invokes java by "java Main >>logjava.txt " but this doesn't seem to work all i get is an empty logfile
    i need to run the program every day at 0800 so i inserted the following in crontab:
    0 8 * 1-5 /var/"path"/start > logjava (where path is the path to the classes dir)
    if i run the cmdline from anywhere on the prompt i get the result i want. I think it's because the cron runs it from the root dir thus making java unable to find the classes
    Any suggestions would be welcome. or can some1 tell me how to make linux executables from the java (i usually use jsmooth for the windows exe)

    You can execute several commands in the process started by cron. You separate them using semicolons.
    Have you tried a cron entry like this:
    0 8 * 1-5 cd /var/"path";pwd;echo $PATH; ./start > logjavaOr, you may need to make sure the process started by cron gets the same environment as your interactive shells do, by explicitly loading your setup or .login scripts:
    0 8 * 1-5 . $HOME/.setup;cd /var/"path";pwd;echo $PATH; ./start > logjava

  • Problems running under Linux

    Hi,
    Anyone know why does this message always appear when I run sources which has some awt.* classes in it?
    These runtime messages actually happens in my University machines, which is running Redhat 7.1 with Java version 1.3. It happens also in Mandrake 8.0
    I'm grateful if someone can point to what is wrong. Thank You in advance.
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]

    This means the specific font type "adobe-fontspecific" is not available in your OS.
    You can either use another font type in your program or install that font type in your OS.

  • What games do you run under Linux?

    Thats it...
    what games do you usually run?
    If using WineX, please include version and PC specs (cpu, memory and video card are enough)

    UnderDog wrote:I used to play The Incredible Machine when I was younger. I was so addicted to that game and I can't find it anymore... hook a brotha up.
    I've never been much of a gamer, but I distinctly remember playing this game too. A couple weeks ago i went and looked for old games like this, and TIM was one of the ones i found. I don't remember where I got it, but I'll put it up here for a day or two so you can grab it (it's abandonware): http://atrum.com/tim/.
    Oh and I came across Legends (mentioned previously) in a slashdot post the other day and the game is gorgeous. I've never played either Tribes game, so I'm still getting used to the controls, but it's fun. Have been looking into contributing to the project. Just too bad they can't release all the sources for it (it uses the Torque engine).
    As for the games I play, the ones I have played have been native to Linux, like Unreal Tournament, Quake 3 and RTCW. Speaking of which, I guess i should try out ET since everyone is raving about it. Now where's that damn CD...
    natael
    LOLOLROLF OMFG OMG N00B HAX WTF 31337 BBQ!!!!!1111

  • Firefox running under Linux Mint (based on Ubuntu) 12 (KDE) won't install extensions for Firefox

    Linux Mint (based on Ubuntu) 12, KDE desktop
    Firefox 10.0
    Started up Firefox right after Mint was installed. On the add-ons page video download helper was shown as a featured extension and I installed it, then rebooted when prompted. After that, Firefox would never install another extension again. Just gives download error.
    I google searched and in a forum I found a post about uninstalling and reinstalling Firefox. I tried it. First time I started it up, it installed video download helper again, but then would not install any other extension after that. I tried numerous extensions I '''KNOW''' are working in Firefox 10.0 because they are working in Firefox over on my Win 7. Everytime I get a download error, either from the addons site or from the Add-ons Manager in Firefox.
    Someone told me on the Mint forums that I needed to add a subdirectory on a certain directory, so I did that. Didn't work.
    It seems Ubuntu disables the root, or cripples it, and I guess Mint does too. You can still use sudo when doing things in Ubuntu (and Mint I would assume, since it's based on Ubuntu) but you can't get true 'superuser' access as I understand it. But, I don't think this would have any bearing on the problem, or my search of the Mint forums would have come up with all kinds of threads screaming about this.

    Problem solved - it was caused by an add-on called "PDF Download 3.0.0.2)
    To fix - in Firefox :
    Click on '''Tools''' command (top of screen)
    Select '''Extensions'''
    click on "'''disable''' button beside '''PDF Download'''
    Close Firefox and restart it.
    Clicking on any pdf file should open a new tab now and the document will appear there.

  • Java Thread run some day then death ,use jstack check it,it  run again, is

    hi all;
    I write a java program run as linux daemon,
    command line is >nohup java myclass &>/dev/null
    it run some day ,then death, ,look like death lock ,but thread not exit
    if i use jstack checke it ,it run again!
    my env is
    Linux version 2.4.20 ,redhat linux
    jstack 14616
    Attaching to process ID 14616, please wait...
    Debugger attached successfully.
    Client compiler detected.
    JVM version is 1.5.0_02-b09
    my program like
    commandline nohuo java StartUp >/dev/null &
    public Class StartUp{
    public static void main(String[] argv){
       Connection con = getDBConnection
         Thread t1 = new Thread(new MyRun(con));
      t1.start();
         Thread t2 = new Thread(new MyRun(con));
      t2.start();
      for(;;){
      Thread.sleep(100);
    public class MyRun implements Runnable{
    Connection con;
    public MyRun(Connection c){con = c;}
    public void run(){
         for(;;){
         object = readData(con);
         process(object);
         log.info("watch info ....");
         Thread.sleep(500);
    }

    Today i found my program hang, i use kill -SIGQUIT to print thead trace
    but i can't find the bug,after send singal ,the thread run again!
    another question
    how to detect a thread is hang?and use another thread restart it?
    thread dump
    Full thread dump Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode, sharing):
    "pool-1-thread-2" prio=1 tid=0x08447858 nid=0x5aa6 waiting on condition [0x4680f000..0x4681021c]
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1772)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:470)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:674)
    at java.lang.Thread.run(Thread.java:595)
    "pool-1-thread-1" prio=1 tid=0x08392740 nid=0x5aa5 waiting on condition [0x4678f000..0x4678ff1c]
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1772)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
    at com.ejet.mms.MmsSend.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    "Low Memory Detector" daemon prio=1 tid=0x080a18b0 nid=0x5a9f runnable [0x00000000..0x00000000]
    "CompilerThread0" daemon prio=1 tid=0x080a0360 nid=0x5a9e waiting on condition [0x00000000..0x417e2c04]
    "Signal Dispatcher" daemon prio=1 tid=0x0809f478 nid=0x5a9d waiting on condition [0x00000000..0x00000000]
    "Finalizer" daemon prio=1 tid=0x080989e8 nid=0x5a9c in Object.wait() [0x413e4000..0x413e441c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x66c18420> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
    - locked <0x66c18420> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=1 tid=0x08097cf8 nid=0x5a9b in Object.wait() [0x41364000..0x4136451c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x66c184a0> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:474)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
    - locked <0x66c184a0> (a java.lang.ref.Reference$Lock)
    "main" prio=1 tid=0x0805ae68 nid=0x5a98 waiting on condition [0xbfffc000..0xbfffc4f8]
    at java.lang.Thread.sleep(Native Method)
    at com.ejet.mms.MmsStartup.main(Unknown Source)
    "VM Thread" prio=1 tid=0x08095218 nid=0x5a9a runnable
    "VM Periodic Task Thread" prio=1 tid=0x080a2d40 nid=0x5aa0 waiting on condition

  • Java appl. with oracle on Linux

    Hello all,
    I would like to ask how to connect my Java application to
    Oracle on Linux. Is there any JDBC driver ?
    null

    Hi Mark,
    I am also running Oracle 8.0.5 in my RD6.0 machine.
    I installed Developer2000 into my win98 machine.
    I tried to login using the developer2000 into the
    oracle running under linux but connection cannot
    go through. I don't know the reason to this. Though
    I can use the SQL*Plus to connect to this database
    from win98, can you figure out what is wrong with
    my setup?
    Thanks,
    -Paul
    Mark Kirkwood (guest) wrote:
    : Hi all,
    : I thought you guys might be interested to know that this stuff
    : is used out there...
    : I work for a Government property management company ( Housing
    : New Zealand ), and they were looking at downsizing their
    systems
    : infrastructure. A subset of the business was picked to pilot a
    : downsized system.
    : We ported from :
    : "thin client" : Citrix Winframe, Developer 2000, HPUX , Oracle
    : 7.3
    : to a :
    : client server : Win95, Developer 2000, RedHat 6.0, Oracle
    8.0.5SE
    : Instead of running 80 users on :
    : 80 P300 PCs, Winframe Client +
    : 1 4xP200 Winframe/NT, Developer 2000 +
    : 1 HP-PA/Risc, HPUX ,Oracle 7.3.3
    : We are running 5 users on :
    : 5 P300 PC Win95, Developer 2000 +
    : 1 P300 PC RedHat 6.0, Oracle 8.0.5, samba
    : ( Obviously this was the pilot subset ! )
    : Although this represents a "step backwards" in deployment
    : architecture ( 3 tier - 2 tier ), it represented a decrease in
    : cost infrastructure per user ( No Winframe/NT License, No
    : expensive Proprietry hardware, only 1 ( Cheap ) propritary o/s
    : Win95 ).
    : We went live with this beast on 1 Aug.
    : The Redhat box has been rebooted once since them - not by us (
    : Power outage at the site ).
    : The server is just idling with 5 concurrent connections.
    : Oracle 8.0.5/Redhat is rock solid as far as we can tell !
    : ( with the right patches ....
    : for those interested they are
    : 8.0.5.1 patchset
    : redo log async write - bug 882446
    : glibc patch
    : setuid security patch
    : Cheers
    : Mark
    null

  • Java applications under Linux

    Hello all
    I want to share my experience with all about programs generated by Oracle Forms and running under Linux and ask for help.
    We are developing systems under Oracle Forms to Windows, but some customers had restrictions with that operational system, then we had implemented IAS to run, under Java, the same applications.
    Under Windows we have no problems, we just install JInitiator to made fast to charge/open the classes.
    Under Linux we had not JInitiator and the solution is to implement a Proxy server.
    In this test the first problem we had was a IP that the system can not resolve, looking for the solution on web, we found that it´s solved inserting this line in java.policy:
    permission java.net.SocketPermission "200.204.0.1:9000-", "resolve";
    But we had not to implemented the proxy server, after implement this other problem just stuck us.
    The system just not show any error message and are not hang, but never open de login dialog.
    Some one already had this kind of problem?
    Could exist a difference between Linux configuration and Windows configuration to Java?
    Well, thanks in advance...
    []´s
    Arthur

    javac -classpath logger.jar:. rootPackage/MainClass.java
    java -classpath logger.jar:. rootPackage.MainClass

  • JAR files don't run on Linux

    Hey All:
    I installed JDK1.3.1(win32) on Windows, double clicked my JAR file (proper manifest and classes within) and it started the swing program just fine.
    I installed JDK1.3.1(linux) on Red Hat 7, double clicked my JAR file, and it wants to know which Fk'n program to open it with! What happened here, I thought java/swing runs on linux?
    The JDK installed java in /usr/java/jdk1.3.1/bin/java, do I somehow need to point linux there for .jar files to execute automatically? What are the commands to do this?
    Thanks in advance,
    Stephan

    As far as I know, the double clicking on a jar file to execute it only works on windoze. On linux, you can can use:
    java -jar foo.jar&
    to execute the jar, assuming you have the main class included in the manifest. I don't know if there are any plans to change this. You should be able to write a script or somesuch which prepends 'java -jar' when you double-click.
    m

  • IO no longer works when running on Linux

    Hi everyone,
    I have some code which was originally developed and running on a Windows environment, now I am trying to get it working under Linux. Some of the JSP file which output data as text files do not display correctly, I assume that if I change the JSP files to the UNIX newline characters this will fix the problem?
    The other issue is that there is some code which saves data to a file, the directory given may be local or on a network. It worked fine under Windows, but throws an Exception below when running under Linux even when using the UNIX like path structure (/machinename/dir/dir/filename). The code is below:
              byte[] data = /*method that gets the data to save*/;
              String fileDir = this.addExtraBackslashes(config.getOutputDirectory()); // getOutputDirectory sets the directory String
              String filePath = fileDir + fileName; // String fileName is set elsewhere in this code
              FileOutputStream fos = null;
              try {
                   fos = new FileOutputStream(filePath);
                   fos.write(data);
              } catch (FileNotFoundException e) {
                   // TODO Auto-generated catch block
                   throw new Exception("Error saving file:-" + filePath +", please check the output path in the configuration", e);
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   throw new Exception("Error saving file:-" + filePath+", please check the output path in the configuration", e);
              } finally {
                   if (fos != null) {
                        try {
                             fos.close();
                        } catch (IOException e) {
                             log.warn("error closing file stream:" + filePath);
         private String addExtraBackslashes(String s) {
              StringBuffer sbRet = new StringBuffer();
              for (int i = 0;i < s.length();i++) {
                   char ch = s.charAt(i);
                   switch (ch) {
                        case '\\':
                             sbRet.append('\\');
                             sbRet.append(ch);
                             break;
                        default:
                             sbRet.append(ch);
                             break;
              return sbRet.toString();
         }Anyone have any ideas of what could be the problem and possible solutions?
    Thanks,

    People would have more of an idea if you posted the full exception text and a clue as to which line it was thrown from.
    Also, WTF is with all the addExtraBackslashes stuff? It looks like it's going through and doubling-up each \ character. I'm guessing this won't do anything on Linux if you've configured your paths to use / instead, but even so, what did it do on Windows?!
    And what are the values of fileDir and filePath? Does fileDir end in a /? Instead of having to worry about that, you could use new File(fileDir, filePath) to construct an abstract path and pass that to your FileOutputStream.

  • OBI SE One can run on Linux OS

    Hello,
    Can OBI SE One run on Linux? as i knew it can run on Windows only. Have any one can help me to answer. Thanks so much....<^_^>

    You can only create a windows executable using the windows version of the application builder.
    It will not run under linux (but might run on a windows emulator.)
    LabVIEW Champion . Do more with less code and in less time .

  • Prevent com.apple.WebKit.WebContent to grab keyboard focus

    When I run XQartz based applications (org.macosforge.xquartz.X11), the com.apple.WebKit.WebContent running for every Tab of Safari steals away the keyboard focus every so often. This interrupts the workflow and is very annoying.
    When using Google Chrome or Firefox this does not happen.
    Does anybody know how to prevent this with Safari (7.0.3 OSX 10.9.2)?

    Do you have the Develop menu enabled?
    If so, click Develop from the Safari menu bar.
    In the drop down menu, if anything is ✔, click once to deselet then quit and relaunch Safari.

Maybe you are looking for