Results 1 to 10 of 10
  1. #1
    nwboy74 is offline Member
    Join Date
    Oct 2008
    Posts
    45
    Rep Power
    0

    Question [SOLVED] Swing and Unix

    We use xterm to connect to our UNIX machines at work. When I try to create a JFrame from a java program on the UNIX machine, all open xterminal windows become disrupted (borders, titlebars, menus all disappear) until the java program is exited. Does anyone know why this might occur? We have a version 5 runtime environment available. I basically need to create a user-friendly form that can access the unix file-system from a developer's pc.

  2. #2
    nwboy74 is offline Member
    Join Date
    Oct 2008
    Posts
    45
    Rep Power
    0

    Default

    It may help to see a visual. The top image shows a portion of my desktop before I run a java program that creates a JFrame with a JButton (labeled EXIT). The second image shows what happens when I run it. Any open xterm window loses its border and cannot be accessed while the java program is run. After I click EXIT (which has an event listener to close the program), everything returns to normal (mostly).
    Attached Thumbnails Attached Thumbnails [SOLVED] Swing and Unix-beforecall.jpg   [SOLVED] Swing and Unix-aftercall.jpg  

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  4. #4
    nwboy74 is offline Member
    Join Date
    Oct 2008
    Posts
    45
    Rep Power
    0

    Default

    I can, but that's really not the point. All it takes is for me to create a JFrame or access the default ToolKit and it messes up my xterm windows. I just whipped up the code below to show what happens. There's something going on between the interaction of java and unix terminal emulators.

    Java Code:
    import javax.swing.*;
    import java.awt.event.*;
    
    public class TestMe implements ActionListener {
         private JFrame fr;
         public TestMe() {
              fr = new JFrame("Test");
              JButton exit = new JButton("EXIT");
              exit.addActionListener(this);
              fr.getContentPane().add(exit);
              fr.pack();
              fr.setVisible(true);
         }
         public void actionPerformed(ActionEvent e) {
              fr = null;
              System.exit(0);
         }
         public static void main(String[] args) {
              TestMe tm = new TestMe();
         }
    }

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Seems your code is fine, I just asking because I'm not clear what you have done there. Also it's better if you can think about layouts too.

    Is that you cannot see border and title bar only on the JFrame or all windows in UNIX?

  6. #6
    nwboy74 is offline Member
    Join Date
    Oct 2008
    Posts
    45
    Rep Power
    0

    Default

    Perhaps I compressed the images too much. If you look closely at the first image, you can see that the open xterminal windows have the normal look and functionality of a Microsoft window (blue title bar, minimize/maximize buttons, close button). Then look closely at the second image. The title bars, minimize/close buttons are gone from the windows that were open. In fact, I cannot even type in those windows any more. My java application only shows the button I created. It's also missing title bar, minimize/close buttons.

    I was hoping that someone on here had seen this before and might be able to point me in some direction.

  7. #7
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    I think it is a xterm issue,try to use instead of xterm rxvt,it is the same like xterm or SSH Putty

  8. #8
    nwboy74 is offline Member
    Join Date
    Oct 2008
    Posts
    45
    Rep Power
    0

    Default

    I think you're right. It's probably something to do with the XManager settings or something. Unfortunately, I can't ask everyone in the company to start using a new terminal emulator. Since the end users are all on pc's, is there a way to kick off the application from whatever interface they have to the unix machine, but have it use the native (Windows) system to create the Swing components?

  9. #9
    nwboy74 is offline Member
    Join Date
    Oct 2008
    Posts
    45
    Rep Power
    0

    Default

    The problem was with XManager 2.0. There is a setting that can correct the problem that I found on Netsarang's website.

    1. Select Multiple Window Mode
    2. In Window Mode Settings, change Window Manager to Local Only
    3. Save Settings and restart XManager


    Now when I create a JFrame, everything works great!

  10. #10
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

Similar Threads

  1. JAVA compilation error in UNIX
    By satish kumar in forum Advanced Java
    Replies: 9
    Last Post: 08-08-2008, 07:36 AM
  2. Replies: 0
    Last Post: 06-20-2008, 09:02 AM
  3. Accessing unix system using java
    By abhishek.sinha in forum AWT / Swing
    Replies: 3
    Last Post: 06-19-2008, 08:05 AM
  4. how to run java app on windows in a cron like on unix
    By rockie12 in forum Advanced Java
    Replies: 7
    Last Post: 05-23-2008, 01:39 PM
  5. using java to login to unix
    By dowell in forum Advanced Java
    Replies: 4
    Last Post: 05-23-2008, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •