Results 1 to 4 of 4
  1. #1
    kmyr is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default multiple windows and eventlisteners

    Was unsure wether to post this under new or advanced, but this is probably the right place..

    I've got a main window (JFrame with extended JPanel) and I am opening a second one (extends JFrame).
    The second one (referred to henceforth as ColorPicker) basically consists of a buffered image whereas the main window is more complicated.

    The ColorPicker window is created from the main window and is passed the main window's JPanel
    as an argument so as to enable communication back and forth.

    Both windows implement MouseListener, the main one's works but not the ColorPicker's.

    I suspect the problem stems from the ColorPicker not being given focus, but being new to GUI's I haven't a clue how to deal with it.
    I implemented a WindowListener in ColorPicker and it doesn't do anything either. Any assistance will be much appreciated! :)

    [I don't mind posting the code/files if it would simplify matters]

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Well, your "colorchooser" is a dialog and should be a dialog, not a frame. Doing that alone (and making it modal) will probably solve your "problem".

    P.S. You do know about JColorChooser, right?

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  4. #4
    kmyr is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default

    I do know about JColorChooser, I just decided to write my own as it seemed a fun and simple exercise.
    JDialog does look quite promising judging from the api, I should have thought of that myself!
    I'll try it out and swing back round here if it doesn't work :) Thank you!

Similar Threads

  1. netbeans on Windows and Mac os x
    By jetpr in forum NetBeans
    Replies: 4
    Last Post: 01-13-2010, 09:00 PM
  2. Shaped Windows
    By nick2price in forum AWT / Swing
    Replies: 2
    Last Post: 02-12-2009, 08:02 AM
  3. how to do a Windows Explorer
    By Panchitopro in forum AWT / Swing
    Replies: 8
    Last Post: 05-08-2008, 04:31 AM
  4. Opeing multiple pdf files in different acrobat reader windows
    By shweta.ahuja in forum Web Frameworks
    Replies: 2
    Last Post: 05-07-2008, 01:33 PM
  5. swt for windows
    By Gajesh Tripathi in forum SWT / JFace
    Replies: 2
    Last Post: 10-18-2007, 07:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •