0 Replies Latest reply on Apr 17, 2013 2:46 PM by 1003676

    popupMenuWillBecomeVisible does not work properly with Java Web Start

      I developed a custom implementation of a PopupMenuListener, to make popup large enough to fully display each object of the combo (no horizontal scrollbar should appear). Everything works correctly if the application is launched via any IDE, but does not work if it is started via Java Web Start. The size of the popup is not changed and if the width is not enough, scrollbar appears. Below the code that implements the method popupMenuWillBecomeVisible:
      public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
          JComboBox box = (JComboBox) e.getSource();
          Object comp = box.getUI().getAccessibleChild(box, 0);
          if (!(comp instanceof JPopupMenu)) {
          JList list = ((ComboPopup) comp).getList();
          Dimension popupSize = list.getPreferredSize();
          popupSize.width += 5;
          if (popupSize.height > 500) {  //show scrollbar only if the width is greater than 500
              popupSize.height = 500;
              popupSize.width += 15; // add padding for scrollbar
          JComponent scrollPane = (JComponent) ((Container) comp).getComponent(0);
          if (scrollPane.getPreferredSize().width < popupSize.width) {
      Can someone tell me what's the difference between launching application without Java Web Start and launching it with Java Web Start? Why the first case works properly and the second not?? It seems that in second case the set size methods called on scroolPane object has no effect...

      Thanx ;-)