Trying to get attention to a component

Discussion in 'Java' started by tiewknvc9, Aug 9, 2006.

  1. tiewknvc9

    tiewknvc9 Guest

    Hi!

    I have an image in my java application that I would like to bring the
    users attention to...

    dropping this - What I was thinking was to put a JPanel behind the
    image, just extending beyond the borders, and change the color of it
    constantly, BUT this winds up screwing up my application because it
    makes the rest of my application stop working --- things like I must
    drag my mouse over the buttons to make the buttons appear. I dont know
    why, but I cant get it to work the way I want it to.

    So I was wondering if anyone had any ideas for me? Basically I just
    want the user to be walked through a simple operation when they first
    enter my application. Kind of like a brief tutorial for clueless
    users...

    Whatever I do, I know that I must make it obvious what they should do
    next. You know, hit button A, enter in data in table B, hit tab. that
    kind of stuff.

    Thanks for the advice!
     
    tiewknvc9, Aug 9, 2006
    #1
    1. Advertising

  2. tiewknvc9

    Lionel Guest

    tiewknvc9 wrote:
    > Hi!
    >
    > I have an image in my java application that I would like to bring the
    > users attention to...
    >
    > dropping this - What I was thinking was to put a JPanel behind the
    > image, just extending beyond the borders, and change the color of it
    > constantly, BUT this winds up screwing up my application because it
    > makes the rest of my application stop working --- things like I must
    > drag my mouse over the buttons to make the buttons appear. I dont know
    > why, but I cant get it to work the way I want it to.


    Have a look at/try calling validate() or validateTree() methods in
    JPanel (it's defined in Container or something higher up).

    Lionel.
     
    Lionel, Aug 9, 2006
    #2
    1. Advertising

  3. tiewknvc9

    Lionel Guest

    Lionel wrote:
    > tiewknvc9 wrote:
    >> Hi!
    >>
    >> I have an image in my java application that I would like to bring the
    >> users attention to...
    >>
    >> dropping this - What I was thinking was to put a JPanel behind the
    >> image, just extending beyond the borders, and change the color of it
    >> constantly, BUT this winds up screwing up my application because it
    >> makes the rest of my application stop working --- things like I must
    >> drag my mouse over the buttons to make the buttons appear. I dont know
    >> why, but I cant get it to work the way I want it to.

    >
    > Have a look at/try calling validate() or validateTree() methods in
    > JPanel (it's defined in Container or something higher up).


    Oh, and use it on your JPanel that contains all the buttons etc.
     
    Lionel, Aug 9, 2006
    #3
  4. tiewknvc9 wrote:
    (snip 'was that a question?')
    ....
    > So I was wondering if anyone had any ideas for me? Basically I just
    > want the user to be walked through a simple operation when they first
    > enter my application. Kind of like a brief tutorial for clueless
    > users...
    >
    > Whatever I do, I know that I must make it obvious what they should do
    > next. You know, hit button A, enter in data in table B, hit tab. that
    > kind of stuff.


    JOptionPanes implemented as a Wizard should
    do the trick ( at least, those two - combined with
    clear instructions to the user - so it had better be
    more clear than the opening paragraphs ;).

    Andrew T.
     
    Andrew Thompson, Aug 9, 2006
    #4
  5. tiewknvc9

    Guest

    tiewknvc9 wrote:
    > Hi!
    >
    > I have an image in my java application that I would like to bring the
    > users attention to...
    >
    > dropping this - What I was thinking was to put a JPanel behind the
    > image, just extending beyond the borders, and change the color of it
    > constantly, BUT this winds up screwing up my application because it
    > makes the rest of my application stop working --- things like I must
    > drag my mouse over the buttons to make the buttons appear. I dont know
    > why, but I cant get it to work the way I want it to.


    You haven't provided any source code, so it's hard to locate the
    problem. However, it sounds like you are trying to flip the colors in
    the Swing event thread. Swing is single-threaded so doing this
    operation in the event thread will hose the rest of your painting/event
    handling code. If this is indeed the problem, try using a swing Timer
    to fire the color flip change at desired intervals. See
    http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html for
    info on how to use timers. See also
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html for
    tips on how to make your app multithreaded.

    If all of this was totally off target, I apologize in advance ;-)

    Regards,
    Daniel Sjöblom
     
    , Aug 9, 2006
    #5
  6. tiewknvc9

    tiewknvc9 Guest

    bingo.

    I didnt realize that the jpanel would just take over the entire thread
    with the color changes.

    I put the jpanel updates into a timer, and just surrounded the button
    with 4 jpanels, this worked.

    Thanks for the tips!

    wrote:
    > tiewknvc9 wrote:
    > > Hi!
    > >
    > > I have an image in my java application that I would like to bring the
    > > users attention to...
    > >
    > > dropping this - What I was thinking was to put a JPanel behind the
    > > image, just extending beyond the borders, and change the color of it
    > > constantly, BUT this winds up screwing up my application because it
    > > makes the rest of my application stop working --- things like I must
    > > drag my mouse over the buttons to make the buttons appear. I dont know
    > > why, but I cant get it to work the way I want it to.

    >
    > You haven't provided any source code, so it's hard to locate the
    > problem. However, it sounds like you are trying to flip the colors in
    > the Swing event thread. Swing is single-threaded so doing this
    > operation in the event thread will hose the rest of your painting/event
    > handling code. If this is indeed the problem, try using a swing Timer
    > to fire the color flip change at desired intervals. See
    > http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html for
    > info on how to use timers. See also
    > http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html for
    > tips on how to make your app multithreaded.
    >
    > If all of this was totally off target, I apologize in advance ;-)
    >
    > Regards,
    > Daniel Sjöblom
     
    tiewknvc9, Aug 9, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGlmZmlkZW50?=

    Attention MVP's: I have an issue

    =?Utf-8?B?RGlmZmlkZW50?=, May 25, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    426
    =?Utf-8?B?RGlmZmlkZW50?=
    May 26, 2005
  2. John
    Replies:
    2
    Views:
    803
  3. Al
    Replies:
    0
    Views:
    854
  4. Isaac Grover
    Replies:
    148
    Views:
    2,690
    Mark Parnell
    May 4, 2004
  5. Cal Who
    Replies:
    1
    Views:
    445
    Alexey Smirnov
    May 18, 2010
Loading...

Share This Page