Focus problem when JPopupMenu is shown

I have compiled and ran the following 'JPopupTest.java' in JDK 1.4.1 on Windows. Kindly conduct the two tests as given below
First Test :
============
The class shows an editable JComboBox and a JButton when visible. Now click the down-arrow button of the JComboBox and make the drop-down popup visible. Then click on the "OK" button while the popup is visible. The popup gets hidden and a dialog is displayed as it should be.
Second Test :
=============
Run the appilcation again. This time type something in the editable textfield of the JComboBox. A custom JPopupMenu with the text "Hello World" would be visible. Then click on the "OK" button while the popup is visible. The expected dialog is not shown. The custom JPopupMenu gets hidden. Now click on "OK" button again. The dialog is visible now.
My Desire :
===========
When I click on the "OK" button in the "Second Test" the JPopupMenu should get hidden and the dialog gets displayed (as it happens for the "First Test") in one click.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.plaf.basic.*;
import java.util.*;
public class JPopupTest extends JPanel implements DocumentListener, ActionListener
     JButton button;
     Vector vec;
     JComboBox jcombobox;
     JPopupMenu jpopupmenu;
     BasicComboBoxEditor _bcbe;
     JTextField jtextfield;
     public JPopupTest()
        vec = new Vector();
           vec.addElement("One");
        vec.addElement("Two");
        vec.addElement("Three");
        vec.addElement("Four");
        vec.addElement("Five");
        vec.addElement("Six");
        vec.addElement("Seven");
        vec.addElement("Eight");
        vec.addElement("Nine");
        vec.addElement("Ten");
        jcombobox = new JComboBox(vec);
        jcombobox.setEditable(true);
        _bcbe = ((BasicComboBoxEditor) jcombobox.getEditor());
        jtextfield = ((JTextField) _bcbe.getEditorComponent());
        jtextfield.getDocument().addDocumentListener(this);
        add(jcombobox);
        button = new JButton("OK");
        button.addActionListener(this);
        add(button);
        jpopupmenu = new JPopupMenu();
        jpopupmenu.add("Hello World");
     public void insertUpdate(DocumentEvent e)  {changedUpdate(e);}
     public void removeUpdate(DocumentEvent e)  {changedUpdate(e);}
        public void changedUpdate(DocumentEvent e)
        if(!jpopupmenu.isVisible())
        jpopupmenu.show(jcombobox, 0, jcombobox.getHeight());
        jtextfield.requestFocus();
     public void actionPerformed(ActionEvent e)
        JOptionPane.showMessageDialog(this, "OK button was pressed");
     public static void main(String[] args)
        JPopupTest test = new JPopupTest();
        JFrame jframe = new JFrame();
        jframe.getContentPane().add(test);
        jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jframe.setSize(200,100);
        jframe.setVisible(true);

See the code below with auto complete of text. When button is pressed, still TF gets focus after JOptionPane dialog is closed.
-Pratap
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.basic.*;
public class JPopupTest extends JPanel implements ActionListener {
     JButton button;
     Vector vec;
     JComboBox jcombobox;
     BasicComboBoxEditor _bcbe;
     JTextField jtextfield;
     MyComboUI comboUi = new MyComboUI();
     public JPopupTest() {
          vec = new Vector();
          vec.addElement("One");
          vec.addElement("Two");
          vec.addElement("Three");
          vec.addElement("Four");
          vec.addElement("Five");
          vec.addElement("Six");
          vec.addElement("Seven");
          vec.addElement("Eight");
          vec.addElement("Nine");
          vec.addElement("Ten");
          jcombobox = new JComboBox(vec);
          jcombobox.setEditable(true);
          jcombobox.setUI(comboUi);
          add(jcombobox);
          button = new JButton("OK");
          button.addActionListener(this);
          add(button);
          _bcbe = ((BasicComboBoxEditor) jcombobox.getEditor());
          jtextfield = ((JTextField) _bcbe.getEditorComponent());
          jtextfield.addCaretListener(new CaretListener() {
                    public void caretUpdate(CaretEvent e) {
                         if (!jcombobox.isPopupVisible() && jtextfield.isShowing() &&
                                   jtextfield.hasFocus()) {
                              jcombobox.showPopup();
                         String text = jtextfield.getText().toLowerCase();
                         int index = -1;
                         for (int i = 0; i < jcombobox.getItemCount(); i++) {
                              String item = ((String) jcombobox.getItemAt(i)).toLowerCase();
                              if (item.startsWith(text)) {
                                   index = i;
                                   break;
                         if (index != -1) {
                              comboUi.getList().setSelectedIndex(index);
                         } else {
                              comboUi.getList().clearSelection();
               jtextfield.addKeyListener(new KeyAdapter() {
                    public void keyPressed(KeyEvent e) {
                         if (e.getKeyCode() == e.VK_ENTER) {
                              Object value = comboUi.getList().getSelectedValue();
                              jcombobox.setSelectedItem(value);
                              jcombobox.hidePopup();
     public void actionPerformed(ActionEvent e) {
          JOptionPane.showMessageDialog(this,"OK button was pressed");
          jtextfield.requestFocus();
     public static void main(String[] args) {
          JPopupTest test = new JPopupTest();
          JFrame jframe = new JFrame();
          jframe.getContentPane().add(test);
          jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          jframe.setSize(200,100);
          jframe.setVisible(true);
     public class MyComboUI extends BasicComboBoxUI {
          public JList getList() {
               return listBox;

Similar Messages

  • Focus problem in 1.4_2 after JPopupMenu show

    Hi, there:
    I have an application, with a JTextField when that textfield gained focus, a popup menu is shown, and when it lost focus, the popup menu is hidden.
    My focus listener class is listed below, where popup is JPopupMenu, and function displayPopup() is just to call show() in JPopupMenu:
         class MyFocusListener extends FocusAdapter {
              public void focusGained(FocusEvent e) {
                   System.out.println("focus gained.............");
                   displayPopup();
              public void focusLost(FocusEvent e) {
                   System.out.println("focus lost ..............");
                   popup.setVisible(false);
         }Everything works fine in jdk 1.3 version. In jdk1.4_2 version, I met following issues:
    1. whenever the text field gained the focus, the application keeps calling "focusGained()", and "focusLost()" functions endlessly (it seems the system keeps sending those focus events endlessly);
    2. if I removed that "popup.setVisible(false)" in focusLost, then, it seems no other component can gain the focus anylonger.
    So, very appreciated if anyone can give me some help, is that a bug in 1.4.2 or is there any way to work around?
    Thanks a lot
    David

    The reason is that in 1.4.2 each time you show a popup over a text field, it trades focus back and fourth with the text field a few times (2-3 times) before it is fully shown.
    That means you gain focus... diaplay a popup -> which fires 2-3 more gain/lost focus -> and on each of those, you show a popup -> infinite loop.
    Here is the overall tip: Don't try to show/hide popups based on foucs events. Make them controlled by something else, like clicking events.
    If you must do this, you can use a timer to avoid the issue. Just make sure you are using showPopup(Component,x,y) in your displayPopup() method!
    class MyFocusListener extends FocusAdapter {
      long lastTimeGainedFocus = -1L;
      public void focusGained(FocusEvent e) {
        long currentTime = System.getCurrentTimeMilliseconds();
        if(lastTimeGainedFocus == -1L || currentTime - lastTimeGainedFocus > 100) {
          displayPopup();
        lastTimeGainedFocus = currentTime;
      public void focusLost(FocusEvent e) {
         // do nothing here... popup should hide itself
    }

  • I have a problem when I loading application. It shown your payment method was declined due to last payment problem which I've already  paid.

    I have a problem when I loading application.
    It shown your payment method was declined due to last payment problem
    which I've already  paid.

    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • Listbox focused row when more items selected

    Hi, I have following problem. I'm using ListBox with multiple rows selection enabled. I want to identify the row that's focused even when it's not selected. It's shown on attached pictures.
    I'll appreciate any kind of help
    Bye
    jochynator
    LV 8.0.1, WinXP Pro
    Attachments:
    active_row.vi ‏10 KB
    active_row_example.PNG ‏3 KB
    active_row_example2.PNG ‏3 KB

    Hi Andy,
    I want to know which item was selected as last to draw the correct datafile - last chosen. It would be easy when having ListBox allowing to select only one row, but I want to have opportunity to select more items, when I want to delete more datafiles from memory.
    jochynator
    LV 8.0.1, WinXP Pro
    Attachments:
    ListBox_chose_item.vi ‏18 KB

  • Firefox gets problems when 2,7 GB of memory is used by Firefox

    Firefox gets problems when 2,7 GB of memory is used by Firefox. Or more. Like 2,8 GB.
    It started when I read jpost.com with tens of tabs open. I don't remember how many. But I know there was more than 40.
    On the tab I that I was reading, the page turned completely black. Pitch black with nothing else, not even the Firefox interface. It was actually a pitch black shape that looked like a web page in shape. The blackness quickly disappeared and the page was normally readable again. But then it happened again - the page turned black again.
    The same page turns black happened again later.
    One of my browsing sessions had Firefox slow down so much that you could see scrolling happening when I used scrolling.
    Still another time I had 60 tabs open and Firefox worked completely fine without freezes, slowdowns, or black shapes. I could close Firefox by just pressing the red X in the title bar.
    Yesterday, I had 50 tabs open and I experienced a slowdown when I looked at the Breaking News headlines. The headlines would show slower than usual. The Breaking News headlines at jpost.com show the headlines a few words at a time until the headline is completely shown. Then the headline disappears and the next starts showing a few words at a time. And speed in general was not what you normally have with a computer that has 8 GB of memory. And a Core i5 processor. I opened two more tabs from the Breaking News section I had opened. After I opened a new window, Firefox froze. I had to close Firefox from the Task Manager by pressing End process. I had used Firefox for 6 hours without ever closing any of the tabs I had opened.
    In all of these cases, more than 40 tabs were open. In all of these cases, the slow down or freeze meant I had to use Task Manager and then press End process on the Processes tab. In all cases except the two I describe in the next paragraph, I never close any tabs after opening them. No problems have ever happened until Firefox started using 2,7 GB of memory. Until that point, everything is normal with no freezes or slowdowns.
    At two times, I tried to reduce memory usage by closing tabs. However, in both cases this would make Firefox freeze. In one of these cases, Firefox would show something bizarre: there would be about 7 tabs, and one of the tabs would be partly shown. Also, Firefox would show the busy cursor. Firefox did not show how many tabs I actually had. The second time, I tried to close the tabs by clicking Close other tabs in the menu that you get when right-click a tab. The tabs would close fine, but I remember that I opened Gmail and then I did this: I clicked on the Promotions tab. Instead of seeing the tab with the Emails, Firefox showed a busy cursor and the title bar said not responding. Firefox froze.
    The reason might be Adblock Plus memory usage. In Adblock Plus home page, developer Wladimir Palant writes in his blog about how Adblock Plus uses a lot of memory: https://adblockplus.org/blog/on-the-adblock-plus-memory-consumption .

    One more bit of information: I have a Geforce 640 GT graphics card. My graphics card drivers are old- version 311.41. The newest version of the drivers is 340.52. Would a new graphics card driver solve the problem?

  • Focus Problem on Solaris with jdk 1.3.1

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

  • Problem when writing a value to an enum

    Hi together,
    I'm facing a problem when using an enum in my state machine.
    From time to time, the value (which represents the next state) which comes from the
    shiftregister, is not stored correctly into my enumvariable.When I probe point "1",
    a different value is shown than the variable "states" contains.
    Does anybody has an idea? Thanks.
    Message Edited by maximint on 02-09-2009 06:20 AM
    Attachments:
    Clipboard-1.png ‏6 KB

    There are other ways to get the string-value of an enum (format into string with a %s formatter for instance).
    But I have no idea what you are seeing.
    However I would not use the enum to string technique chose you have, just add the enum to the 'file' VI as an input.
    And the =0 comparison you have is useless, add the enum to the case structure as the selector.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Problem when creating a Form with Launch Task Form Wizard

    Hi all,
    I'm using jdeveloper 11.1.1.6 over Windows 7 64bits for my BPM project.
    I'm a new with BPM and i have a problem when trying to create a task's Form with the "Launch Task Form Wizard". I'm trying to create my Form based on a custom template, i already have imported the template as a library, now after i have selected the template i follow the wizard and i reach the wizard's rowX-columnX where i should choose the field i want in my form, but the problem is that i don't see any fields in that part of the wizard, the window is empty :(
    I have created a business object based on a XSD, then i created a process data object based on the previous created business object and finally i used this data object as a parameter to the human task.
    What could be my problem ?? :( :(
    Regards
    Carlos

    I have also faced this issue few times. There could be a namespace issue / schema issue. Please check if you are able to see task:task in the schema section anywhere in the .task file you created. If that is not shown, the fields will not appear while creating human task form.
    Thanks
    Ashwini

  • Strange problem when opening new message.

    I have a rather annoying problem when I open a newly received SMS from a particular contact (lets call him Bill).
    When I open the new message from Bill, either by swiping to unlock or touching a banner message at the top of the screen. Instead to being shown the message itself, I will automatically be taken to the 'start new message' screen with none of our message history (i.e. as if I am starting to type an entirely new message to Bill)
    I can then cancel this and return to myself and Bill's normal message stream.
    Any ideas how to get around this annoyance? Thank you.

    I think you have 2 ways to go here. Figure out what html is from wherever weblogic gets it, meaning you have to delve into the docs, snoop
    around in directories and find what it must be sending (This is going to be unavoidable if you are going to change what weblogic is doing.
    Sooner or later you have to try to figure out where it gets this stuff from)
    or
    you can experimentally snoop on your url with a tool like wget or curl. These are fundamental web tools.
    The latter is always a useful thing to be able to do. (you need to formulate a query to get the content-type).
    Whoever managed to get weblogic to serve any files in the first place probably can figure this out.

  • Problems when connecting and disconnecting MBP and TBD

    Hello,
    I have problems with connecting and disconnecting my macbook pro retina 13" to my thunderbolt display. Everytime I disconnect my MBP form my TBD with the lid closed it takes approximately 10 seconds until my MBP has recognized that the TBD is no longer connected and the MBP screens turns on.
    On the other hand I also have a problem when I reconnect my MBP to my TBD. Approximately every second time my MBP does not recognize that the TBD is connected again and neither the MBP nor the TBD turns on. The small light on the power cabel of my TBD does not light up. It is as the TBD would'nt have any power. Pushing buttons on my Apple Bluethooth doesnt help. I have to disconnect and reconnect the thunderbolt and the power connector a coupl of times until the MBP finally recognizes the TBD and turns on. In some cases a different background picture is shown on the TBD than the one I usually have on my MBP.
    The problem is very annoying especially because I connect and disconnect both devices and it really costs time.
    I really hope there's someone who can help with the problem. Do you think this may be hardware problem of my MBP or TBD?
    Thanks in advance for your help.

    HI there,
    The first thing I would recommend is checking for any new software updates while using the display, this will check for any available firmware updates for the display. If you continue to experience issues, then you may want to take a look at the article below for some further troubleshooting steps.
    Apple computers: Troubleshooting issues with video on internal or external displays
    http://support.apple.com/kb/ht1573
    -Griff W.

  • Calling1.4.1 signed applet from Javascript causes keyboard/focus problems

    Pretty sure there's a JRE bug here, but I'm posting to forums before I open one in case I'm missing something obvious :-)
    This issue may be specific to IE, I haven't tested elsewhere yet. Our web application is centered around a signed applet that is initialized with XML data via Javascript. We first noticed the problem when our users started upgrading from the 1.3.x plug-in to the 1.4.x plug-in. The major symptom was that shortcut keys stopped working. I debugged the problem off and on for about a month before I boiled it down to a very simple program that demonstrates the issue (included below). Basically, the program has a function that adds a JButton to a JPanel and registers a keyboard listener (using the new DefaultKeyboardFocusManager class) that prints a message to the console. This function is called by the applet's init() method, as well as by a public method that can be called from Javascript (called callMeFromJavascript()). I also included a very simple HTML file that provides a button that calls the callMeFromJavascript() method. You can test this out yourself: To recreate, compile the class below, JAR it up, sign the JAR, and put in the same dir with the HTML file. Load the HTML file in IE 5.0 or greater, and bring the console up in a window right next to it. Now click the button that says init--you should see the small box appear inside the button that indicates it has the focus. Now press some keys on your keyboard. You should see "KEY PRESSED!!!" appearing in the console. This is proper behavior. Now click the Init Applet from Javascript button. It has removed the button called init, and added one called "javascript". Press this button. Notice there is no focus occurring. Now press your keyboard. No keyboard events are registered.
    Where is gets interesting is that if you go back and make this an unsigned applet, and try it again, everything works fine. This bug only occurs if the applet is signed.
    Furthermore, if you try it in 1.3, signed or unsigned, it also works. So this is almost certainly a 1.4 bug.
    Anyone disagree? Better yet, anyone have a workaround? I've tried everything I could think of, including launching a thread from the init() method that sets up the components, and then just waits for the data to be set by Javascript. But it seems that ANY communication between the method called by Javascript and the code originating in init() corrupts something and we don't get keyboard events. This bug is killing my users who are very reliant on their shortcut keys for productivity, and we have a somewhat unique user interface that relies on Javascript for initialization. Any help or suggestions are appreciated.
    ================================================================
    Java Applet (Put it in a signed JAR called mainapplet.jar)
    ================================================================
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MainApplet extends JApplet implements KeyEventDispatcher
        JPanel test;
        public void init()
            System.out.println("init called");
            setUp("init");
        public void callMeFromJavascript()
            System.out.println("callMeFromJavascript called");
            setUp("javascript");
        private void setUp(String label)
            getContentPane().removeAll();
            test = new JPanel();
            getContentPane().add( test );
            JButton button = new JButton(label);
            test.add( button );
            test.updateUI();
            DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
        public boolean dispatchKeyEvent(KeyEvent e)
            System.out.println("== KEY PRESSED!!! ==");
            return false;
    }================================================================
    HTML
    ================================================================
    <form>
    <APPLET code="MainApplet" archive="mainapplet.jar" align="baseline" id="blah"
         width="200" height="400">
         No Java 2 SDK, Standard Edition v 1.4.1 support for APPLET!!
    </APPLET>
    <p>
    <input type="button" onClick="document.blah.callMeFromJavascript();" value="Init Applet via Javascript">
    </form>

    I tried adding the requestFocus() line you suggested... Same behavior.
    A good thought, but as I mention in my description, the applet has no trouble gaining the focus initially (when init() is called). From what I have seen, it is only when the call stack has been touched by Javascript that I see problems. This is strange though: Your post gave me the idea of popping the whole panel into a JFrame... I tried it, and the keyboard/focus problem went away! It seems to happen only when the component hierarchy is descended from the JApplet's content pane. So that adds yet another variable: JRE 1.4 + Signed + Javascript + components descended from JApplet content pane.
    And yes, signed or unsigned DOES seem to make a difference. Don't ask me to explain why, but I have run this little applet through quite a few single variable tests (change one variable and see what happens). The same JAR that can't receive keyboard events when signed, works just fine unsigned. Trust me, I'm just as baffled as you are.

  • Focus problem since jre 1.4.2_11

    Hi,
    I have a awkward focus problem with my java applet. Everything is working fine for jre 1.4.2_10 and all older jre.
    The applet is embedded in a large DHTML application running in a shell which uses the internet explorer for rendering. The applet communicates with the sorrounding java script via LiveConnect (JSObjects). We do use the static versioning, in order to determine the adaequate vm version. The controls are all based upon the swing controls, some are a bit modified.
    Since the introduction of jre 1.5 update 6 the static versioning does no longer work properly. So, when I run my applet with 1.4.2_11 and all the predecessors a strange focus problem occurs.
    When I click outside the applet (focus lost) and the click on a jscript control to get back the focus to the applet, the keyboard input does not reach the applet. The comboboxes do not work anymore. A mouse click is recognized, but the data-list which should appear is only flickering for a moment.
    The only way to get the focus back, is to make a mouseclick on a selfmade datepicker (based on swing, implemeted like a popup-window). For sure, the large DHTML application is guilty, but definitely diffrent VM versions do behave differntly.
    Does anyone has an idea, has seen similar effects or knows what has been changed in the jre between 1.4.2_10 and 1.4.2_11 ??
    Any hint is appeciated! I am lost :-(((
    cheers thorsten

    Two things: Is there a document detailing manual removal of this JRE (and indeed others); you mention different 'builds' of the same JRE, this is the first time I have read that there are sub-versions/releases of a JRE. Where do I find out the available builds of this JRE and others and how they differ?

  • Problem when running a lex/yacc parser

    All,
    I am currently seeing a problem when using lex/yacc to generate my parser (I suspect that gcc is the problem), I do not have the same result than the same one I use on my linux box. I am currently using XCode 2.4.
    I have attached below the lexer and yacc file. I use the command line below to generate the C sources from the lex and yacc file, same ones on my Mac and on my linux box:
    yacc -d problem.y
    lex problem.l
    gcc -o problem y.tab.c lex.yy.c
    Normaly, when executing the binary and typing 1minutes, I should have the output below (working on the linux machine) :
    1 seconds (0)
    60 seconds (0)
    ,but on the Mac I have the output shown below with inverted values :
    0 seconds (1)
    0 seconds (60)
    Could someone try to compile the sources on their Mac (I am quite currious to see the result with XCode 2.3).
    ---------------------- problem.l ------------------------
    #include <stdlib.h>
    #include <time.h>
    #include "y.tab.h"
    extern YYSTYPE yylval;
    minutes? { return MINUTE; }
    weeks? { return WEEK; }
    hours? { return HOUR; }
    days? { return DAY; }
    [0-9]+ { yylval.number=strtoull(yytext, NULL, 10); return NUMBER; }
    [ \t\n\r]+ { }
    ---------------------- problem.y ------------------------
    #include <stdio.h>
    #include <string.h>
    #include <time.h>
    int yyparse(void);
    %union
    unsigned long long number;
    %token MINUTE HOUR DAY WEEK MONTH YEAR
    %token <number> NUMBER
    %type <number> time_duration
    %start time_duration
    time_duration:
    NUMBER MINUTE
    /* Convert from minutes to seconds */
    printf("%d seconds (%d)\n\r", $$, $1);
    $$ = $1 * 60;
    printf("%d seconds (%d)\n\r", $$, $1);
    |
    NUMBER HOUR
    /* Convert from hours to seconds */
    $$ = $1 * 60 * 60;
    printf("%d seconds\n\r", $$);
    |
    NUMBER DAY
    /* Convert from days to seconds */
    $$ = $1 * 60 * 60 * 24;
    printf("%d seconds\n\r", $$);
    |
    NUMBER WEEK
    /* Convert from weeks to seconds */
    $$ = $1 * 60 * 60 * 24 * 7;
    printf("%d seconds\n\r", $$);
    void yyerror(const char *str)
    fprintf(stderr, "Error: %s\n", str);
    int yywrap()
    return 1;
    main()
    yyparse();
    PowerBook G4 Mac OS X (10.4.7) Affected with the faulty lower SODIMM (and not in the serial range of the ones recognized with a fau

    Hi,
    yes, you are right .... I have changed %d to %llu and did fix the problem.
    Thanks,
    Emmanuel

  • Problem when I startup

    Hi everybody,
    I have a problem and I will be very happy if you could help me,
    when I startup database the problem is appeared as shown below:
    SQL> STARTUP
    ORACLE instance started.
    Total System Global Area 599785472 bytes
    Fixed Size 1250356 bytes
    Variable Size 192941004 bytes
    Database Buffers 398458880 bytes
    Redo Buffers 7135232 bytes
    Database mounted.
    ORA-16004: backup database requires recovery
    ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
    ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\AHMED\SYSTEM01.DBF'
    before startup the database I was doing standby database,these all the steps I did to create standby database:-
    3.1 Preparing the Primary Database for Standby Database Creation
    3.1.1 Enable Forced Logging
    3.1.2 Create a Password File
    3.1.3 Setting Primary Database Initialization Parameters
    3.1.4 Enable Archiving
    3.2 Creating a Physical Standby Database
    3.2.1 Create a Backup Copy of the Primary Database Datafiles
    3.2.2 Create a Control File for the Standby Database
    3.2.3 Prepare an Initialization Parameter File for the Standby Database
    3.2.4 Copy datafiles and log files from the Primary System to the Standby System
    3.2.5 Set Up the Environment to Support the Standby Database
    Step 1 Create a Windows-based service.
    Step 2 Create a password file.
    Step 3 Configure listeners for the primary and standby databases.
    Step 4 Enable broken connection detection on the standby system
    Step 6 Create a server parameter file for the standby database.
    after all these steps I tried to startup standby database the above error message appeared to me.
    Edited by: [email protected] on Jun 8, 2009 5:59 AM

    Hi DBMS Direct,
    I have a problem and I will be very happy if you could help me,
    when I startup database the problem is appeared as shown below:
    SQL> STARTUP
    ORACLE instance started.
    Total System Global Area 599785472 bytes
    Fixed Size 1250356 bytes
    Variable Size 192941004 bytes
    Database Buffers 398458880 bytes
    Redo Buffers 7135232 bytes
    Database mounted.
    ORA-16004: backup database requires recovery
    ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
    ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\AHMED\SYSTEM01.DBF'
    before startup the database I was doing standby database,these all the steps I did to create standby database:-
    3.1 Preparing the Primary Database for Standby Database Creation
    3.1.1 Enable Forced Logging
    3.1.2 Create a Password File
    3.1.3 Setting Primary Database Initialization Parameters
    3.1.4 Enable Archiving
    3.2 Creating a Physical Standby Database
    3.2.1 Create a Backup Copy of the Primary Database Datafiles
    3.2.2 Create a Control File for the Standby Database
    3.2.3 Prepare an Initialization Parameter File for the Standby Database
    3.2.4 Copy datafiles and log files from the Primary System to the Standby System
    3.2.5 Set Up the Environment to Support the Standby Database
    Step 1 Create a Windows-based service.
    Step 2 Create a password file.
    Step 3 Configure listeners for the primary and standby databases.
    Step 4 Enable broken connection detection on the standby system
    Step 6 Create a server parameter file for the standby database.
    after all these steps I tried to startup standby database the above error message appeared to me.

  • Significant Computer Window Focus Problem With Verizon Access Manager 7.7.1.0 (2707e)

    With the newly released Verizon Access Manager 7.7.1.0 (2707e) there is a significant computer focus problem with it.
    What I mean by this is that if I am using ANY application on my computer with the Verizon Access Manager minimized to the Windows System Tray, something will go on with the Verizon Access Manager and it steals the window focus - I am unable to work in the other application unless I click on the application to use it again.  
    An example of this would be my typing to post a message in this forum.  Something occurs in the Verizon Access Manager and my typing is rendered useless unless I click with my mouse on the browser window to be able to use it again.
    I'm highly suspecting whenever networks are coming and going in the Access Manager is when the problem occurs.
     This problem did not exist in the previous version of the Access Manager I was using.
    This is extremely annoying - please issue a fix for this ASAP!

    I have found by not minimzing the Verizon Access Manager 7.7.1.0 (2707e) the focus problem does not occur - it appears to be a problem when the app is minimzed to the system tray.

Maybe you are looking for

  • OIM11g R1: Error Creating Authorization Policies

    Hi All, While creating custom authorization policies, I am getting a window popup with below error message: files: <OIM_ORACLE_HOME>/server/apps/oim.ear/admin.war/WEB-INF/lib/OESOIMTaskFlows.jar/taskflows/policycreate/DataConstraints.jsff ADF_FACES-6

  • Using Aperture to post to Web Gallery

    I was posting to an answered thread so am reposting, having just tried yet again. I have conncection to the net, aperture correctly 'sees' my .Mac site, I select the images to be uploaded to the WebGallery, I have both used the icon drop down and gon

  • SAP SRM-MDM

    Hello We have read installation guide "SAP Netweaver MDM 5.5 SP05", page 22, we want install MDM Connector and MDM Java API, in "installation procedure", it is indicate 1. Extract the files from the archives. The javadoc folders contain an HTMLbased

  • I was using my iPad this morning and my internal speakers just stopped working when I tried to turn my nighttime playlist on. Does anyone know what I should do?

    I was listening to music this morning and the speakers on my iPad were working perfectly fine. Then I opened my iSleep App and used it to turn on my nighttime playlist and my alarm clock and my speakers weren't working. I tried restarting it (twice)

  • Can't Write To Class 10 Sdhc Card After 4.4.2 Updaye

    I have a SanDisk Class 10  card installed. After updating to 4.4.2 I am unable to write to the the card from any third party apps. I started   getting read and write errors when I try to save files to the card. Writing to the card from the camera sti