Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3097 > unrolled thread
| Started by | "larkmore" <larkmore@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:42 +0000 |
| Last post | 2011-04-27 15:42 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.java.gui
ComponentListener.compone "larkmore" <larkmore@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: ComponentListener.com "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: ComponentListener.com "larkmore" <larkmore@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
| From | "larkmore" <larkmore@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:42 +0000 |
| Subject | ComponentListener.compone |
| Message-ID | <f8121282-3775-4a39-91ee-b8eaf34f7270@f10g2000hsf.googlegroups.com> |
To: comp.lang.java.gui I have a JDialog jd that has a JPanel jp added to its content pane. The JPanel jp has a ComponentListener added to it using the addComponentListener() method but when I call jp.setBounds(x,y,w,h) the componentResized method never get executed! I can see that the setBounds call is working if I override the setBounds method and put in a debug statement it prints out. I even checked to make sure the ComponentListener was properly added and it was. But it doesn't execute. Anyone run into this before? Does this have something to do with the fact that the JPanel is inside of a JDialog??? Failing that, is there a way to draw a JFrame without the top decorations (icon, close/minimize/maximize buttons, etc.) ? I tried using a JWindow originally but ran into trouble getting it to maintain focus for keyboard input, hence the JDialog. ??? :( -Will --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:42 +0000 |
| Subject | Re: ComponentListener.com |
| Message-ID | <47a2ff1c$1@dnews.tpgi.com.au> |
| In reply to | #3097 |
To: comp.lang.java.gui <larkmore@aol.com> wrote in message news:f8121282-3775-4a39-91ee-b8eaf34f7270@f10g2000hsf.googlegroups.com... > I even checked to make sure the ComponentListener was properly added and it was. if the dialog is modal, and the componentListener is coded after setVisible(true), then it has been added incorrectly. how about posting the code? --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "larkmore" <larkmore@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:42 +0000 |
| Subject | Re: ComponentListener.com |
| Message-ID | <d2c97b0d-a19c-4e16-b75b-8be6393e4228@n20g2000hsh.googlegroups.com> |
| In reply to | #3099 |
To: comp.lang.java.gui Thanks for the help guys. I'll try to address everything said so far. Knute Johnson: Yes, I am aware that resized only happens when size changes. I am actually looking for the call the very first time that setBounds() is ever called, so I would assume that counts as a change in size. At least, it works in all my other programs that use a JFrame as the very top level container. I've also run into the componentShown() quirk you mentioned. Bit me when I was trying to use it to trigger setting the focus. I cannot fathom why someone would intentionally name a method like that and then not have it work the first (and every) time that the component was shown... I'll have to try the Frame.setUdecorated(boolean state) method you suggested. Maybe that will fix everything. Michael Dunn: I'm not sure I understand what you said. I have a JDialog that is instantiated by another class that acts as the backend to the system. It takes care of all the behind the scenes control and coordination and talking to serial ports and sockets. The backend then instantiates several classes that extend JPanel, each of which has a custom componentListener added to it as part of its constructor method. The backend then responds to various stimuli by choosing one of the JPanel subclasses and adding it to the JDialog's content pane, after removing any other JPanels that may have been contained by it. As part of the method in the JDialog that adds the panels to the content pane, it also resizes each panel by calling its setBounds() method. The call to setBounds() is working fine, both visually and through println statements inside the setBounds() method, but the componentResized() method of the componentListener never gets called! As of right now I'm manually fetching the component listener for each JPanel and then manually calling its componentResized() method, but that is a really big hack and really shouldn't be necessary! Sorry I can't post any code, it's part of my work and isn't public. -Will --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web