Zon Horn

Greenhorn
+ Follow
since Dec 11, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Zon Horn

Here's upgrade to other comments, that seem to me incomplete for the specifics of:
- using a relative "folder" outside .jar file (in the jar's same location).
12 years ago
HAD A SIMILAR PROBLEM:
after adding a new row to mysql database, corresponding combobox list failed to show any contents (several empty rows and any selection results in last list selection), though iterating to system.out.println() showed correct contents of combobox list and it worked correctly after program restart (without list changes).

HOW THIS POST HELPED:
adding fireContentsChanged(this, 0, 0); to the end of Combobox mouseEntered event solved the problem - adding new row is now dynamically shown in Combobox list and can be chosen. Combobox one-by-one removeItem and addItem methods precede fireContentsChanged(this, 0, 0).

ALSO:
solved other similar combobox display problems with a hack: combobox.showPopup; combobox hidePopup; in the same mouseEntered event.

USED:
public class MyComboboxModel extends AbstractListModel implements ComboBoxModel, MutableComboBoxModel, KeyListener, ItemListener
12 years ago
Solved. Was wrong in referencing. Made object reference variable static in OknoAdm class and initialized this reference within main method. Then in birka3D class found this reference in OknoAdm class and used if (SwingUtilities.isLeftMouseButton(e)) {} in mouseExited to detect both dragging and exiting.
12 years ago
Dear pros.

I have a Netbeans origin JFrame class OknoAdm with the main method and some other methods. It manages checkroom tags.

The tag class birka3D draws rectangle and manages its dragging and exiting jpanel:


In OknoAdm class - pressing a Button registers a tag to a name in Combobox:


In OknoAdm class - dragging a visual rectangle out of its Component should unregister the tag:





And here my coding has stuck. I tried it two ways:

1. Currently in b3d class I used a reference to OknoAdm object. This way I try to use in birka3D methods from OknoAdm - udalitBirki that remove tags and obnovitBirki that renews the display. But I doubt that I refer to that same object of OknoAdm that is run from main method, and not create a separate duplicate. Its the first time I try references - maybe I do smth wrong. Compiling this results no compile errors, but wrong behavior: adding new tag replaces existing tag and it is not removed while dragging it outside b3d panel.
2. Before that I tried to add MouseAdapter and MouseListener inside sozdatBirki method and run udalitBirki and obnovitBirki methods from inside of sozdatBirki method. But it resulted in error, because udalitBirki changed map contents while iterating it in sozdatBirki. Using ConcurrentHashmap removed the error but didn't provide the right behavior. Using 2nd way added tags and removed them while dragging outside the panel, but could remove more than needed when dragging or even adding.

Please advice.
12 years ago