Hi,
I am having this problem in my swing application. On the screen there is a button catalog, sometimes(not every time) when i press that button the next screen comes is gray and it don't display any data. What can be the possible reason for it ?
4 1574
Hi,
I am having this problem in my swing application. On the screen there is a button catalog, sometimes(not every time) when i press that button the next screen comes is gray and it don't display any data. What can be the possible reason for it ?
Almost anything can be the reason but my guess is a thread problem: most
likely you're doing all you processing in the AWT dispatch thread so that it
doesn't have time anymore to do what it was made for: draw your components.
For starters have a look at the SwingUtilities class that can start small
threads for you that are not in the way of the dispatch thread.
kind regards,
Jos
Almost anything can be the reason but my guess is a thread problem: most
likely you're doing all you processing in the AWT dispatch thread so that it
doesn't have time anymore to do what it was made for: draw your components.
For starters have a look at the SwingUtilities class that can start small
threads for you that are not in the way of the dispatch thread.
kind regards,
Jos
Hi,
Thanks ! But this problem is not occuring everytime. It occurs seldom only. My application is vast retail application. Can this be a memory issue or something else apart from coding problem ?
Hi,
Thanks ! But this problem is not occuring everytime. It occurs seldom only. My application is vast retail application. Can this be a memory issue or something else apart from coding problem ?
Are you using Jos' suggestion above already then?
Threading related problems are like that sometimes. i.e Show up sometimes, because threading is partly platform dependent.
Are you using Jos' suggestion above already then?
Threading related problems are like that sometimes. i.e Show up sometimes, because threading is partly platform dependent.
Hi,
Here is the code snippet of my class.
This is how I am enabling the button at one place -
if (reviewMessagesController.getModel() != null) {
-
SwingUtilities.invokeLater(new Runnable() {
-
public void run() {
-
if (customerVO == null) {
-
InvoiceController.this.fldCustomer.requestFocus();
-
} else if (customerVO != null && customerVO.isAuthorizedBuyersOnly()
-
&& invoicePanel.cbAuthorizedBuyer.getSelectedIndex() < 1) {
-
invoicePanel.cbAuthorizedBuyer.requestFocus();
-
} else {
-
invoicePanel.btnPartsPro.setEnabled(true);//This is the button giving problem
-
invoicePanel.btnRecallSavedInvoice.setEnabled(false);
-
invoicePanel.btnMessage.setEnabled(false);
-
invoiceLineEntryController.setPartNumberEnabled(true);
-
invoicePanel.btnRecallSavedInvoice.dispatchEvent(
-
new KeyEvent(invoicePanel.btnRecallSavedInvoice, KeyEvent.KEY_PRESSED,
-
new Date().getTime(), 0, KeyEvent.VK_TAB, '\t'));
-
}
-
}
-
});
-
This is how I am enabling the button at another place -
SwingUtilities.invokeLater(new Runnable() {
-
public void run() {
-
if (customerVO == null) {
-
InvoiceController.this.fldCustomer.requestFocus();
-
} else if (customerVO != null && customerVO.isAuthorizedBuyersOnly()
-
&& invoicePanel.cbAuthorizedBuyer.getSelectedIndex() < 1) {
-
invoicePanel.cbAuthorizedBuyer.requestFocus();
-
} else {
-
invoicePanel.btnPartsPro.setEnabled(true);//This is the button givining problem
-
invoicePanel.btnMessage.setEnabled(false);
-
invoicePanel.btnRecallSavedInvoice.setEnabled(false);
-
invoiceLineEntryController.setPartNumberEnabled(true);
-
invoicePanel.btnRecallSavedInvoice.dispatchEvent(
-
new KeyEvent(invoicePanel.btnRecallSavedInvoice, KeyEvent.KEY_PRESSED,
-
new Date().getTime(), 0, KeyEvent.VK_TAB, '\t'));
-
}
-
}
-
});
-
and this is how I am performing action on the button -
else if (source.getName().equals(InvoicePanel.BTN_PARTS_PRO)) {
-
if (isPreferencePPSE() && ClientApplicationContext.getClientApplicationContext().getPpseCatalogInUse()) {
-
logger.debug("actionPerformed: CatalogButton Pushed: isPreferencePPSE/calling openPPSE");
-
openPPSE();
-
} else {logger.debug("actionPerformed: CatalogButton: preference is NOT PPSE");
-
if (!CatalogBL.verifyDVDServices()) {
-
clientApplicationContext.getMessageMgr().showMessage(invoicePanel, "2208");
-
return;
-
}
-
invoicePanel.setVisible(false);
-
clientApplicationContext.getPointOfSaleEventDispatcher().fireCatalogingOpened(
-
new CatalogEvent(this, null));
-
}
-
Can this code give this kind of problem ? Please give ur valuable suggestions .
Thanks and regards,
Amit.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joseph |
last post by:
hi
1) i plan on having an awt canvas component (to draw graphs) on a JFrame
with other swing components..will this be okay? i've read that swing and
awt aren't compatible..
2)Also, if i...
|
by: stan |
last post by:
I have code that produces 5 boxes across the screen width. So far I
have
only tested it in IE 6 and NS 8. It works in IE, but in NS I am not
able to
fit in the 5th box. I am using two...
|
by: Seanus |
last post by:
Hey all, I've recently started coding a program for my final year project of my uni degree. I am coding in Swing and have a very odd bug.
I'm using TabbedPane for the first time, although I've...
|
by: r035198x |
last post by:
I have put together this article to give people starting Swing an awareness of issues that need to be considered when creating a Swing application. Most of the Swing tutorials that I have seen just...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |