views:

9

answers:

1

I have been spending a lot of time on a 3-Color Averager it take the three colors from a JColorChooser instead of letting java create a dialog I made my own, it has the JColorChooser filling everything but the bottom were a single button labeled "OK"

everything works fine except this

I added a Window Listener and under windowClosing I put the same code that is under the Go button.

ok got those facts down?

so, first I select the three colors normally and it displays the color rightfully

but then I try again and click the x-button three times in a row... the panel that displays the color changes

This is not intended

you can see what I mean at http://www.thee-l.netii.net/ I am considering in the windowClosing Listener to just reopen the window but I am looking for a better solution

is there any way to disable the x-button

thanks for any help whatsoever

:)

A: 

I did not figure out why it was changing color but I DID figure out how to disable the x-button

you simply add this code

frameName.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

now when they click it nothing will happen

now they have to click ok

Hope this helps anyone who had the same problem I had... or just needed to disable the close operation

:) Luck

Luck