Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Dennis Putnam

Ranch Hand
+ Follow
since Feb 03, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
7
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dennis Putnam


"Documentation" to me means the API documentation for the GridBagLayout class.


To me documentation means documentation from all sources. Glad we have that defined now so you will understand what I have looked for.


So once again, if you have a question, try it first, don't assume it doesn't work.


I guess I am unique in that I PLAN before I act.

Since we seem to be having so much difficulty communicating and we are obviously getting irritated with each other, perhaps you should leave answering my questions to others. If I've managed to alienate myself with "others" as well then I apologize and will seek help from other forums.
3 years ago


This implies you have tested code and it doesn't do what you want.


That is an (invalid) assumption on your part. I was referring to what the documentation states. Remember this is a documentation question. My apologies for not stating it suitably to you.

And I have lost track of the number of times I have referred you to the Swing tutorial.


I know I don't always make my questions clear but what part of "I cannot find anything in the documentation" is confusing you?
3 years ago
Seriously??? Why on earth can't you ever read my questions??? I'm not mis-understanding anything, yet. There is no SSCCE to post because I haven't written anything yet. I'm not even sure it is what I want to do. I'm looking for help finding documentation so I CAN write the code if I choose. Where in the documentation does it discuss centering in spanned columns rather than centering in a single column? Why is that so hard to understand?
3 years ago
I have a series of columns in my JDialog and I want to place a JLabel over a subset of them. I am using 'gridwidth=6' to span those columns (2-7). However the JLabel is centered in column 2 rather than centered over the spanned columns. I cannot find anything in the documentation that discusses centering over spanned columns. Can someone point me to the right place in the documentation? TIA.
3 years ago

You can create a class to register text field you want to check and store the text fields in a List. You add a DocumentListener to each text field.


I hadn't thought of that. I'll give it a try. Thanks.
3 years ago
I have a JButton that I want to enable only when 3 specific fields (there are a many other fields) of a JDialog are filled in. What is the best way to do this? I'm thinking I need to check the value of each of those fields each time any one of them is updated but that seems kind of burdensome. Is there some other better way? TIA.
3 years ago
I'm using an ActionListener. I'll look into MouseListener again which I thought was like cracking an egg with a sledghammer for just listening for a click. Thanks.
3 years ago
I take it from your reply that you do not know (without code) if a button is supposed to get focus and execute a listener on a single click. That implies (albiet illogically to me) that whether or not the listener is executed is inconsistent and based on code as it relates to focus.
3 years ago
I am having a problem with a JButton that needs to be clicked twice. Exactly when is the listener for a button invoked? I am guessing that my problem is because the button only gets focus the first time it is clicked and then executes the listener on the second click. If I tab to the button, at which time it has focus, it then works on the first click. Is something required somewhere in the button definition that says to get focus and execute the listener on the same click? Or do I need to look elsewhere because a single click should be getting focus and executing the listener (which makes more logical sense to me)? TIA.
3 years ago
Thanks. That is exactly the kind of answer I am looking for which is not obvious when reading the documentation.
3 years ago
I've said this many times. I don't post my code because it usually takes hundreds of lines and many classes to reproduce the problem. I am not looking for someone to examine my code most of the time. Rather I'm looking for suggestions on how to debug these problems or as in this case whether or not I'm chasing my tail. I agree with Fred because that is usually where I get trapped and why I was looking there to start. My problem with the understanding is that I cannot figure out how, when I am deep in the bowels of my code, to get dialogs onto the EDT.
3 years ago
Just to close this out, I did find the problem. It wasn't too hard once I stopped thinking it was a dispatch problem. I still have a problem with my understanding of when dialogs are displayed or not displayed due to the dispatcher but at least I have what I need now. Thanks again.
3 years ago
I take it from your answer that this is not a dispatch issue so a SwingWorker will not solve my problem. Thanks for that as that will avoid me chasing a red herring. Since this is an intermittent problem (I can run it several times before it fails) an SSCCE would be worthless plus the nature of the code makes an SSCCE that reproduces the problem impossible. I placed a System.out just before the 'ShowMessageDialog' and that gets executed but the dialog just never shows up. I'm not expecting anyone to look at my code and say here is what is wrong but rather I'm hoping for someone to suggest a debug technique. Maybe forcing a traceback at some point might help but where and when?
3 years ago
I seem to have some kind of mental block when it comes to understanding EDT and how to get JOptionPanes to reliably display. I have multiple instances of a class that do various checking when a particular method is called from a running thread. My "main" instantiates a JFrame which is the primary GUI. As part of the GUI initialization a thread is started that queries a web device to obtain data. That thread makes calls to that method in the appropriate instance of the classes. If a certain condition is detected in that method I want to display a JOptionPane. Thus the JOptionPane is not always dispatched so it can display because presumably the EDT never dispatches it. "Never" being the confusing part. Sometimes it displays as expected and other times it never displays. It seems like it should get dispatched eventually but that does not happen. I wonder what happens to that JOptionPane? It just sits in queue forever? In any case I don't know how to get this thing to display reliably. I read about SwingWorkers but either I don't understand them yet or that is not the solution either. Can someone explain why the JOptionPane "never" displays and if a SwingWorker is really the solution or something else. TIA.
3 years ago
Arrgh! I knew it was something stupid. Thanks.
3 years ago