Greg Reeder

Ranch Hand
+ Follow
since Jun 14, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Greg Reeder

You were absolutely right, although the problem was a little more hidden than I originally thought. This issue was that I have a private method that prepares the JButtons and JPanel that houses them. this method had the ability to be called multiple times depending one what the user did, and upon other factors as well. That meant that more than one action listener was added causing the multiple saves.

Thanks a lot.

Greg

If it helps others, I solved the issue by adding a simple question if (JBtn.getActionListeners().length<1)){//add the listeners}.
12 years ago
upon further testing, that codes sometimes reads that it has 1 actionListener, two, I even got 5 one time. I am highly interested as to the reason why that is. . . . I will prepare code to post tomorrow.
12 years ago
I've checked my code again (with help of the outline), and I only add one action listener to the JButton, I am really confused at the moment how it could be 2, other than the (really likely) possiblitly that the JButton already has one when instantiated.
12 years ago
You're correct, there are two.

Thanks, that is a handy line o' code there.

Greg
12 years ago
Greetings all,

Initially, I am not supplying code because I do not think it will help too much, but if anyone wants to see a bit, I can provide it.

In short, I have a dialog box with a bunch of fields and a save button. the save button implements an action listener that calls the save(). It reads the fields, creates an instance of another class and calls the methods to have it saved to my database. The problem is, that when I click once on button, the save() is called twice. The only thing I can think of is that I should be using a mouseAdapter or mouseListener instead of an actionListener. Can anyone confirm this?


Thanks,
Greg
12 years ago
Thank you all very much. I guess then it is there as a good solution to a few issues that might pop up in the life of a programmer, but it is not a "law of programming" that all strings in a class be externalized.


Thank you!
12 years ago
Hi,

I saw an option in the refractering menu of eclipse that allows a user to externalize strings. That got me wondering, why would a programer wish to have string externalized and placed into a seperate text file? Other than allowing for multiple languages that are easy to check because the are all in one place, I cannot imagine how this could be helpful. Any thoughts?

Greg
12 years ago
Thank you very much, that is exactly it!!! Im using the system's default lookandfeel, so, as you pointed out, it is not garunteed to work 100% of the`time, but i would think it would work for most. Thanks!

Greg
13 years ago
Hello everyone,

At what classes should one look at (research) when trying to change the alignment of the header text for a specific column in a JTable? I figured out how to change the entire JTableHeader text aligment through the getDefaultRenderer(), but I cannot figure out how to make certain column headers to be aligned left, while others are right. Any help would be appreciated.

Greg
13 years ago
that is exactly what is there! It just cannot be started becuase there is no JFrame etc in the code, otherwise, i could copy and paste it into an ide with the proper import fields, and let it run! I explained the problem and put the code that is giving me issues! What is the issue!!!
13 years ago
sometimes that is just extra overhead that takes away from the real issue at hand. Furthermore to post the "rule book" just wastes time. If you dont want to help me, feel free to ignore this thread.
13 years ago
sorry, wrong code:

13 years ago
Hi all,

I have the following issue. I have a JTable inside a JScrollPane. It works great for the height of the table, but for the width, I am having the issue that when the JFrame is resized, the columns are also made smaller, sometimes to the point where you cannot make them out anymore. When I use the code:



I can get the width scrollbar to show once the jframe is made too small.

I do set the minimum width:



it is only as if it means nothing when it is resized. My goal is that all columns remain the same width and that the column with the index 2 gets the remainder width, and when they hit their minimum width, the JScrollPane shows the with scrollbar. Any help would be awesome!!

Greg
13 years ago
Greetings all,

I am wondering if anyone here has any experiance with JOpenDocument. I would like to use this tool to construct .odt files with tables in them. For the life of me, I cannot find an example of how to use the jar. I found the documentation, and I am looking through it, but with limited success. My goal is this: create a document (not a spreadsheet, just a regular word processing file) that has a table in it with information that I programmatically insert into it. Does anyone know where I could find some good examples, or know of a tool where I could better accomplish this?

Thanks

Greg