Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When another thread is running, some codding stops working! #62

Closed
ctoabidmaqbool opened this issue Oct 10, 2022 · 5 comments
Closed

When another thread is running, some codding stops working! #62

ctoabidmaqbool opened this issue Oct 10, 2022 · 5 comments

Comments

@ctoabidmaqbool
Copy link

For example, I am using this code:

MenuItem mnuSoftVersionStatus = new MenuItem(SOFT_VERSION);
trayIcon.addMenuItem(mnuSoftVersionStatus);

mnuSoftVersionStatus.setText(SOFT_VERSION + " : " + "Starting");
new org.hsqldb.Server().start();
mnuSoftVersionStatus.setText(SOFT_VERSION + " : " + "Running");

After this new org.hsqldb.Server().start(); the mnuSoftVersionStatus.setText() is not working?

@ctoabidmaqbool
Copy link
Author

I I use something like this codding, All is working fine

``
`final PopupMenu popup = new PopupMenu();

TrayIcon trayIcon = new TrayIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(ICON)));
trayIcon.setPopupMenu(popup);

final SystemTray tray = SystemTray.getSystemTray();

try {
tray.add(trayIcon);
} catch (AWTException e) {
System.out.println("TrayIcon could not be added." + e.getMessage());
}

MenuItem mnuSoftVersionStatus = new MenuItem(SOFT_VERSION);
popup.add(mnuSoftVersionStatus);

mnuSoftVersionStatus.setLabel(SOFT_VERSION + " : " + "Starting");
new org.hsqldb.Server().start();
mnuSoftVersionStatus.setLabel(SOFT_VERSION + " : " + "Running");

@dustinkredmond
Copy link
Owner

I didn't originally intend for the label text to be changed after the MenuItem was added. I will look into implementing a listener to update this on the Event Dispatch thread when attributes of the MenuItems are changed. Thanks for opening this issue!

dustinkredmond added a commit that referenced this issue Oct 24, 2022
@dustinkredmond
Copy link
Owner

@ctoabidmaqbool I believe I've fixed this with commit 992c9b0. Could you please try your original code again with a copy of the source code before I push another release with the fix. I've written a test class and it appears to work on my end.

@ctoabidmaqbool
Copy link
Author

@dustinkredmond Hi! I have tried source files, and it's actually works as expected. Thanks

I have some other issues too, will put as separate issues.

@dustinkredmond
Copy link
Owner

Glad that fixed it! I will close this issue, review the others, then plan on a minor version release by the end of the week to resolve these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants