JCombox does not work under linux (fedora) could you help me???

Hi All,
I am implementing a GUI for a linux application. This GUI works fine under windows system. But the JCombobox does not work under Linux system. Would you help me to solve it? Thank you very much!..
The problem is that I cannot select any other item except the first item in the dropdown box of JCombobox. There is no event generated when I click the combobox, while events are generated for other Buttons.
This problem exists for the following code when I maximize the window. When the window is minimize to some extend in my problem, it is OK.
Here is the simplify code:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.event.ListDataEvent;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.event.*;
import javax.swing.*;
//carmen
import javax.swing.filechooser.*;
import javax.swing.event.*;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.border.*;
//import AlwaysSelectableComboBoxDemo.AlwaysSelectableComboBox;
//import AlwaysSelectableComboBoxDemo.AlwaysSelectableComboBox;
import java.io.*;
import java.util.*;
import java.lang.String.*;
public class Test extends JFrame
     private JComboBox jComboBox1;
     private JComboBox jComboBox2;
     private JPanel contentPane;
     private JTabbedPane jTabbedPane1;
     //Main Tab
     private JPanel Main;
     private JPanel OutputSimSet;
     private JPanel Test;
     private JPanel ScriptGenTab;
     private JPanel ResultTab;
//Result Tab
private JPanel SimResult;
     public Test()
          super();
          //initializeComponent();
          contentPane = (JPanel)this.getContentPane();
          jTabbedPane1 = new JTabbedPane();
          Main = new JPanel();
          OutputSimSet = new JPanel();
          Test = new JPanel();
          ScriptGenTab = new JPanel();
          ResultTab = new JPanel();
          SimResult = new JPanel();
     jComboBox1 = new JComboBox(
                    new String[]{"Item 1","Item 2", "Item 3"});
                    jComboBox1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ae) {
                    System.out.println("Yeah");
     jComboBox2 = new JComboBox(
                              new String[]{"Item 1","Item 2", "Item 3"});
                              jComboBox2.addActionListener(new ActionListener() {
                              public void actionPerformed(ActionEvent ae) {
                              System.out.println("Yeah");
          // jTabbedPane1
          jTabbedPane1.addTab("Main", Main);
          jTabbedPane1.addTab("ScriptGenerator", ScriptGenTab);
          jTabbedPane1.addTab("Simulation Result", ResultTab);
          jTabbedPane1.addChangeListener(new ChangeListener() {
               public void stateChanged(ChangeEvent e)
                    jTabbedPane1_stateChanged(e);
          // contentPane
          contentPane.setLayout(new BorderLayout(0, 0));
          contentPane.add(jTabbedPane1, BorderLayout.CENTER);
          // Main
          //Main.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
          Main.setLayout(new BorderLayout(0, 0));
          Main.add(OutputSimSet,BorderLayout.NORTH);
          OutputSimSet.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
          OutputSimSet.add(Test, 0);
          Test.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
          Test.add(jComboBox1,0);
          //ResultTab
          ResultTab.setLayout(new BorderLayout(0, 0));
          ResultTab.setBorder(new TitledBorder(""));
          ResultTab.add(SimResult, BorderLayout.NORTH);
          SimResult.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
          SimResult.add(jComboBox2,0);
          // Test
          this.setTitle("Test");
          this.setLocation(new Point(0, 0));
          this.setSize(new Dimension(600, 500));
          this.setVisible(true);
     public void initializeComponent()
     /** Add Component Without a Layout Manager (Absolute Positioning) */
     private void addComponent(Container container,Component c,int x,int y,int width,int height)
          c.setBounds(x,y,width,height);
          container.add(c);
     // TODO: Add any appropriate code in the following Event Handling Methods
     private void jTabbedPane1_stateChanged(ChangeEvent e)
          System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");
          // TODO: Add any handling code here
     // TODO: Add any method code to meet your needs in the following area
     // TODO: Add any appropriate code in the following Event Handling Methods
     private void jComboBox1_actionPerformed(ActionEvent e)
          System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");
          Object o = jComboBox1.getSelectedItem();
          System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
          // TODO: Add any handling code here for the particular object being selected
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Create and set up the window.
Test frame = new Test();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}

package oct03_JCBox;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class Test extends JFrame
private JComboBox jComboBox1;
private JComboBox jComboBox2;
private JPanel contentPane;
private JTabbedPane jTabbedPane1;
//Main Tab
private JPanel Main;
//private JPanel OutputSimSet;
//private JPanel Test;
private JPanel ScriptGenTab;
private JPanel ResultTab;
//Result Tab
//private JPanel SimResult;
public Test()
     super();
     //initializeComponent();
     contentPane = (JPanel)this.getContentPane();
     jTabbedPane1 = new JTabbedPane();
     Main = new JPanel();
     ScriptGenTab = new JPanel();
     ResultTab = new JPanel();
//     OutputSimSet = new JPanel();
//     Test = new JPanel();
//     SimResult = new JPanel();
     jComboBox1 = new JComboBox(
     new String[]{"Item 1","Item 2", "Item 3"});
     jComboBox1.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent ae) {
          System.out.println("Yeah");
     jComboBox2 = new JComboBox(
     new String[]{"Item 1","Item 2", "Item 3"});
     jComboBox2.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
               System.out.println("Yeah");
     // Main
     //Main.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
     Main.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
     Main.add(jComboBox1);
     //ResultTab  -----     
     ResultTab.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
     ResultTab.add(jComboBox2);
    //      jTabbedPane1
     jTabbedPane1.addTab("Main", Main);
     jTabbedPane1.addTab("ScriptGenerator", ScriptGenTab);
     jTabbedPane1.addTab("Simulation Result", ResultTab);
     jTabbedPane1.addChangeListener(new ChangeListener() {
          public void stateChanged(ChangeEvent e)
               jTabbedPane1_stateChanged(e);
     // contentPane
     contentPane.setLayout(new BorderLayout(0, 0));
     contentPane.add(jTabbedPane1, BorderLayout.CENTER);
     // Test
     this.setTitle("Test");
     this.setLocation(new Point(0, 0));
     this.setSize(new Dimension(600, 500));
     this.setVisible(true);
     public void initializeComponent()
//     /** Add Component Without a Layout Manager (Absolute Positioning) */
//     private void addComponent(Container container,Component c,int x,int y,int width,int height)
//     c.setBounds(x,y,width,height);
//     container.add(c);
     // TODO: Add any appropriate code in the following Event Handling Methods
     private void jTabbedPane1_stateChanged(ChangeEvent e)
     System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");
     // TODO: Add any handling code here
     // TODO: Add any method code to meet your needs in the following area
     // TODO: Add any appropriate code in the following Event Handling Methods
//     private void jComboBox1_actionPerformed(ActionEvent e)
//     System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");
//     Object o = jComboBox1.getSelectedItem();
//     System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");
//     // TODO: Add any handling code here for the particular object being selected
     * Create the GUI and show it. For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
     private static void createAndShowGUI() {
     //Create and set up the window.
     Test frame = new Test();
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     frame.pack();
     frame.setVisible(true);
public static void main(String[] args) {
     //Schedule a job for the event-dispatching thread:
     //creating and showing this application's GUI.
     javax.swing.SwingUtilities.invokeLater(new Runnable() {
     public void run() {
     createAndShowGUI();
} Try this - you use too many unnecessary JPanels.
Which way you prefer with actionPerformed should work either way.
I think your problem was too many unnecessary Panels and set all attributes before it is added, perhaps,
not add the panel first and then try to set attributes like layout, color, etc...

Similar Messages

  • Runtime.exec() does not work under Linux

    Hi,
    I have a generic application runner class that runs an external
    program and redirects stdout/stderr to a buffer/file.
    While everythings works just fine under Windows, I get the
    following exception under Linux trying to run the Java interpreter
    'java':
    java.io.IOException: "/usr/lib/SunJava2-1.3.1/jre/bin/java": not found
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:139)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:546)
    at java.lang.Runtime.exec(Runtime.java:413)
    I have checked that the file /usr/lib/SunJava2-1.3.1/jre/bin/java
    exists.
    Any help appreciated!
    Marc

    can I ask how you solved it? I am having a problem
    with quotes just now to and it might help me!I simply tested what the current platform is and
    only used quotes under Windows.
    Marc

  • Hello,when i login with the account of my wife it does not unable her music files.could you help me please?

    I have an imac osx 10.9.5 and 3,4GHz intel core i7
    When i login with the account of my wife in itunes, it does not show me the music files from her library,but only the music files from mine.
    What do i have to do?

    i mean log into iTunes Store,but i have solve this issue by myself.
    Thank you for your support.

  • [svn:cairngorm3:] 21174: Landmark does not work under complex situations

    Revision: 21174
    Revision: 21174
    Author:   [email protected]
    Date:     2011-04-29 11:21:00 -0700 (Fri, 29 Apr 2011)
    Log Message:
    Landmark does not work under complex situations
    https://bugs.adobe.com/jira/browse/CGM-39
    Ticket Links:
        http://bugs.adobe.com/jira/browse/CGM-39
    Modified Paths:
        cairngorm3/trunk/libraries/Navigation/src/com/adobe/cairngorm/navigation/core/EnterAndExi tInvoker.as
        cairngorm3/trunk/libraries/Navigation/src/com/adobe/cairngorm/navigation/waypoint/Waypoin tHandler.as

    Hi John,
    1) I like that the new model adds parameterization. It's cleaner than pulling in parameters from pre-set variables. However, the given example didn't actually make much use of it. The only non-constant parameter multiply-used in the example is the "table" variable. Seems like a lot of work for not a lot of gain, at least in this case?
    2) I am cautious that this new template/model condenses the paradigm sooo much, that it is no longer clear where XPath is involved vs straight constant tag names. Yes, Adobe's example is overly-expanded but that's common in code meant to be a demonstration.
    3) I also am cautious that the example intermingles direct node creation into the XPath search/processing chain. I've learned to be VERY careful with this. It only can work when the changes made do not interfere with the rule processing. In my model, I simply avoid it completely (by not making node-position or node-add/remove/move changes until after tree parsing is complete.) This will always be a safe model.
    Bottom line: while I very much appreciate the parameterization and lintability (is that a word? Sure makes sense to me )... I think I would still define each rule separately rather than bring them all together as an inline array in the rule processing call. To me it seems sooo condensed that the XPath meaning can become lost. (Would someone recognize that //para/section-head is actually an XPath statement that could (in another situation) be //para/* or //para/following-siblings::* ... while some of the other strings are exact-match tag names?)
    I realize this is all a matter of style... my preference: clarity for the future reader, particularly when the future reader is me a year later who forgot what all those parameters and embedded methods were all about ...
    Blessings,
    Pete

  • Flash player does not work under one user account.

    Flash player does not work under one of my user accounts.
    My system: I work with a mac mini with Mac OS X 10.6.8.
    What I have done:
    I installed the flash player maybe one year ago under my "first" user account. At that time this user account had had administrator authorization. In the meantime I had to change this "first" user account in an account without administrator authorization and created an administrator user with which I installed different programms. Lately, the message came up that it would be necessary to update the flash player. I did it; under the "first" user account, but of course with the administrator's password for installing. The installation had been "successful" - so I was told. But it did not run. I tried it again and again. Each time with "deinstallation" first. No way; it did not work.
    After asking Adobe for the reason of the problem, they suggested to install the programm directly under the administrator user. I did that (of course after deinstalling under the "first" user account) with the result, that flash player runs under my administrator and my "second" user account, but not under the first user account. There I am always told to update my flash player.
    With this result, I talked to Adobe. So they told me to contact the producer of the operating software, since this would be a mistake of the operating software.
    And here I am - full of hope to get help from you.
    Thanks for reading. And thanks in advance for helping me.
    Nanny FS

    Any update to provide at all here guys?  Again, in my situation, it's very much rights-related as a standard user doesn't even report that the flash player exists when testing it on the Adobe Flash Version Detection website (despite it showing up in Control Panel and under Add/Remove Programs).  I've already tried giving the C:\Windows\System32\Macromed and files/subfolders appropriate permissions for the standard user and still nothing.  If I either give the user in question full local admin rights or logon as the domain admin, then the Adobe Flash Version Detection website says Flash is installed and Flash works fine.
    Thoughts???

  • Nautilus-open-terminal does NOT work under x86_64

    I found the latest nautilus-open-terminal v0.9-1
    http://aur.archlinux.org/packages.php?ID=5224
    does NOT work under x86_64!
    There was no open-terminal menu item in the context menu

    shaohao wrote:I found the latest nautilus-open-terminal v0.9-1
    http://aur.archlinux.org/packages.php?ID=5224
    does NOT work under x86_64!
    There was no open-terminal menu item in the context menu
    I've recompiled almost 40 days ago and i've had no problem at all.
    Have you tried logging out before trying?

  • BUG in iOS7: Post iOS7 upgrade, search option does not work for "Messages". If you want to search a contact name in Messages who is way below the list, the search will not yield any result.

    BUG in iOS7: Post iOS7 upgrade, search option does not work for "Messages". If you want to search a contact name in Messages who is way below the list, the search will not yield any result.

    These are user forums. You are not speaking to Apple here. Report your problem at Apple Feedback.

  • How do I set up a mail group on mac mail?  All the advise on line seems to refer to 'address book' and I only have 'contacts'.  The guidance does not work when using 'contacts' - can anyone help me?

    How do I set up a mail group on mac mail?  All the advise on line seems to refer to 'address book' and I only have 'contacts'.  The guidance does not work when using 'contacts' - can anyone help me?

    Create a group and send mail
    http://www.dummies.com/how-to/content/how-to-create-a-basic-contact-group-in-mac -os-x-li.html
    http://www.macworld.com/article/1165582/how_to_email_groups_with_mail.html
    Best.

  • HT3180 In the middle of the updating, iTV was unplugged. Now it does not work at all. Do you have experience, what to do now?

    In the middle of the updating, iTV was unplugged. Now it does not work at all. Do you have experience, what to do now?

    Ouch.  I am afriad the news is not good.  If there is no longer a working firmware instance on ATV there is nothing you can do.  That's why it has that message about not unplugging it during the update.
    Nothing happens when you plug it in?

  • HT1695 Wi-Fi to your iPhone does not work with the knowledge that I have worked Restart for the same purpose network does not work What is the solution please help as soon as

    Wi-Fi to your iPhone does not work with the knowledge that I have worked Restart for the same purpose network does not work What is the solution please help as soon as

    Okay, the Wi-Fi doesn't work.  Turn it on.
    Beyond that, we cannot offer any other assistance as you've failed to provide useful details of the problem.
    When responding, post in your native language as your English makes very little sense.

  • HT201269 Hi I want to back up my photos from my iPhone 5. How can I do this? I have an iPad mini but cannot sync to an iPhone as iPad does not have USB port. Can you help please x

    Hi I want to back up my photos from my iPhone 5. How can I do this? I have an iPad mini but cannot sync to an iPhone as iPad does not have USB port. Can you help please

    You have to back them up to a computer. You would import them either to iPhoto or to the Photos app in your PC:
    http://support.apple.com/kb/ht4083
    Cheers,
    GB

  • Canon ScanLide 20 does not work under Snowleopard

    I have a Canon ScanLide 20 USB and on the official Canon web site, the driver are not available for Mac OS X 10.6. I finished the complete passage to mac last month with an iMac 21,5" following a Macbook 13,1 unibody, now I am a fully Apple, but now I have some problem with this scanner, the problem with HP laserjet solved reading this forum.
    please help me, I download the driver dor MAC OS X 10.4 and canon scantool box run but not perfectly, and the plug in does not work.
    How can I solve this problem? who have some ideas?
    Thanks in advance for support!
    Stè

    Hello
    My first guess is that an undocumented yet siginifcant change made in 10.6 betrayed your code in open handler.
    Try replacing your open handler with this :
    on open my_files
    repeat with f in my_files
    set f's contents to f as alias
    end repeat
    -- orginal code in open handler here
    end open
    *Replacement code has three-line repeat block at the beginning of open handler to gurantee the received list - my_files - to be an alias list.
    If this change fix the problem, it should be Apple's fault to have let your script fail under new OS.
    (Under every Mac OS prior to 10.6, open handler receives a list of alias object(s) from droplet mechanism, whereas under 10.6, it receives a list of some «class bmrk» object(s) of which details have not been documented (as far as I know). And in certain aspects, «class bmrk» object and alias object behave differently, which can break existing script's functionality.)
    cf.
    Topic : Leopard to Snow Leopard problem
    http://discussions.apple.com/thread.jspa?threadID=2204130
    Good luck,
    H

  • html:link action="" input type="button"... does not work under IE browser

    Greeting,
    I have the following codes in struts1.3.5. It works fine under Firefox, but it does not work at all under Internet Explore (IT) at all. Any clues why under IE it does not work?
    <html:link action="/private/search">
    <input
    type="button"
    value="Search"
    class="search-button">
    </html:link>
    Thanks a lot!

    This would probably generate a HTML in which there will be a button inside anchor tag.
    This is not a standard HTML feature and no wonder this is not supported by IE. I copied the generated html codes into test.html to try on IE, the button does not work at all.
    Firefox is probably lenient here. True. test.html works in Firefox.
    You might want to just have a link or do a form submission on button click.The action designed does not need an actionForm. I updated my code to :<html:button onclick="location.href='processSearch'"
    property ="Search"
    value ="Search">
    </html:button>
    And now both Firefox & IE works fine.
    Thanks a lot!

  • Russell Brown " Image Processor Pro " does not work under CC

    I just switched from Photoshop CS 6 to CC and use Russell Brown "Image Processor Pro". Unfortunately does not work that under CC. I also want to install the fix but we probably only applied to CS6.
    Does anyone have a solution to the problem.
    Here the German error message: https://dl.dropboxusercontent.com/u/12684660/CC_IPP.jpg
    Post translated with google Translater from the German.

    I installed Image Processor Pro quite some time ago. I extracted the extension package and just copied the two files "Image Processor Pro.xml" and "Image Processor Pro.jsx" into Photoshop's versions Presets\Scripts. I normally install things I add to Photoshop into my own folders outside any Adobe installation folder.   Image Processor Pro  is an exception because I did not want to modify X's code.  Image Processor Pro is coded in a way to find which version of Photoshop is being run from and looks for its default xml file in that version Presets\scripts\ folder.
    The script may save your modficaions to its defalt xml file into you user ID application data areas. And you can save you own Image Processor Pro presets configurations.
    I run Windows not Mac though.

  • Does db_hotbackup work under Linux 3.0?

    Does anyone know how to build BDB such that db_hotbackup works under Linux?  I always get
       db_hotbackup: BDB5129 Cannot copy data from a PRIVATE environment
       db_hotbackup: BDB5043 HOT BACKUP FAILED!
    I'm using SUSE Linux 3.0.82-0.7-default, and get the same messages under RedHat 2.6.32-431.17.1.el6.x86_64.  It actually did work under a free EC2 instance running Amazon Linux 3.10.42-52.145.amzn1.x86_64, but I'd love to make it work under SUSE.
    None of the configuration advice in "Chapter 7. Building Berkeley DB for UNIX/POSIX" has worked for me.
    [ This is a follow-on to my question of July 13, 2014: "Linux, want DB_PRIVATE off". ]

    Thanks for the tip.  I had some success, by converting the sample code to "use BerkeleyDB" (instead of "use DB_File") and explicitly creating an environment.  It was tricky to do because it appears that to create an environment deliberately requires initializing both the transaction and memory pool subsystems (is this documented somewhere?).  It finally worked to create the environment with
    my $env = new BerkeleyDB::Env
                    -Home => 'test',
                    -Flags => DB_CREATE | DB_INIT_TXN | DB_INIT_MPOOL,
            or die "No env created";
    The odd thing is that I don't need to create an environment on Solaris, OS X, or Amazon Linux, ie, the DB_File sample code I supplied worked with db_hotbackup.  But I do have to create it explicitly on SLES and RedHat.

Maybe you are looking for