Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JApplet containing JTextfields within a JMenubar

 
Sven Farrenkopf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there ...

after finding the actual problem to my symptoms, I'm now completely lost.

I have a JMenuBar in a JApplet.
The menubar contains a menu, which has as submenu and a JTextfield "A".
The submenu has antoher JTextfield "B".

Running the applet in a browser with width and height set to 100%, both Textfields are editable.
Running the applet in a browser with width set to 100% and height set to "45" the textfield in the submenu ("B") is not editable.

The problem occurs with IE6 and JRE 1.6.0_12, with JRE 1.5.0_09 it doesn't.

Any ideas?

Sample-Code



Regards
Sven





 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never tried putting a JTextField in a menu -didn't know that was possible, and am not sure that it's even supposed to work- but the applet width and height parameters are in *pixels*, not *percentages*.
 
Sven Farrenkopf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I can put a JTextfield in a JPopupMenu and it works fine. Putting it in a JMenu in an applet that's large enough seems to be fine too. But this thing drives me crazy. Especially because it works if the Textfield is part of a top-level menu.

Any ideas? Please?

(And why can't I define my applet/object-tag with percentage-values? Is this not specified? It works with IE ...)

Sven
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And why can't I define my applet/object-tag with percentage-values? Is this not specified? It works with IE ...

Umm, are you new to web development? :-) Just because something works in IE does NOT mean that it works anywhere else, nor does it mean that it conforms to any standard (which in this case is set by Sun, not Microsoft).
 
Sven Farrenkopf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I'm into Swing/Applet-Development for some years now, so not actually "new". And I didn't expect it to work on all platforms - but IE is standard in our company, so "%" saves me some scripting. That's why I asked if it was specified this way. Looking it up, I just found suggestions that you shouldn't use it - but no specification. (Which doesn't mean it doesn't exist - I just googled 10mins!)

Anyway ... pixel-sizes don't help - same effect. I'm aware the guys from sun didn't expect developers to put a JTextfield in a JMenu. I even found a posting on sun's Bug-DB (in a different context) where a supporter was totally surprised that people could have such an idea. But browsing swing-codes I can't see why it shouldn't work. Having a JTextfield in a simple JPopupMenu (without JMenu as parent) always works - no matter how big or small the applet is and whether the popup is inside or outside the applet- or browser-area. But that won't solve my problem since I need the JMenu.

Our company can't upgrade to JRE 1.6 unless I either solve this problem or write them a different user-interface (which they have to accept first).

Sven
 
Sven Farrenkopf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For anyone who might have the same problem some day, I reported the bug to sun:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6828208

Sven
 
Sven Farrenkopf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for bringing this up again, but I just tried Java 7 early access ... and the bug is still there. We can't stay on JRE 1.5 forever, so has anybody any idea for a workaround?

Sven
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic