473,237 Members | 1,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

Swing application screen becoming gray

madhoriya22
252 100+
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 ?
Jun 24 '08 #1
4 1573
JosAH
11,448 Expert 8TB
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
Jun 24 '08 #2
madhoriya22
252 100+
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 ?
Jun 24 '08 #3
r035198x
13,262 8TB
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.
Jun 24 '08 #4
madhoriya22
252 100+
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
Expand|Select|Wrap|Line Numbers
  1. if (reviewMessagesController.getModel() != null) {
  2.                 SwingUtilities.invokeLater(new Runnable() {
  3.                     public void run() {
  4.                         if (customerVO == null) {
  5.                             InvoiceController.this.fldCustomer.requestFocus();
  6.                         } else if (customerVO != null && customerVO.isAuthorizedBuyersOnly()
  7.                                 && invoicePanel.cbAuthorizedBuyer.getSelectedIndex() < 1) {
  8.                             invoicePanel.cbAuthorizedBuyer.requestFocus();
  9.                         } else {
  10.                             invoicePanel.btnPartsPro.setEnabled(true);//This is the button giving problem
  11.                             invoicePanel.btnRecallSavedInvoice.setEnabled(false);
  12.                             invoicePanel.btnMessage.setEnabled(false);
  13.                             invoiceLineEntryController.setPartNumberEnabled(true);
  14.                             invoicePanel.btnRecallSavedInvoice.dispatchEvent(
  15.                                 new KeyEvent(invoicePanel.btnRecallSavedInvoice, KeyEvent.KEY_PRESSED,
  16.                                 new Date().getTime(), 0, KeyEvent.VK_TAB, '\t'));
  17.                         }
  18.                     }
  19.                 });
  20.  
This is how I am enabling the button at another place
Expand|Select|Wrap|Line Numbers
  1. SwingUtilities.invokeLater(new Runnable() {
  2.             public void run() {
  3.                 if (customerVO == null) {
  4.                     InvoiceController.this.fldCustomer.requestFocus();
  5.                 } else if (customerVO != null && customerVO.isAuthorizedBuyersOnly()
  6.                         && invoicePanel.cbAuthorizedBuyer.getSelectedIndex() < 1) {
  7.                     invoicePanel.cbAuthorizedBuyer.requestFocus();
  8.                 } else {
  9.                     invoicePanel.btnPartsPro.setEnabled(true);//This is the button givining problem
  10.                     invoicePanel.btnMessage.setEnabled(false);
  11.                     invoicePanel.btnRecallSavedInvoice.setEnabled(false);
  12.                     invoiceLineEntryController.setPartNumberEnabled(true);
  13.                     invoicePanel.btnRecallSavedInvoice.dispatchEvent(
  14.                         new KeyEvent(invoicePanel.btnRecallSavedInvoice, KeyEvent.KEY_PRESSED,
  15.                         new Date().getTime(), 0, KeyEvent.VK_TAB, '\t'));
  16.                 }
  17.             }
  18.         });
  19.  
and this is how I am performing action on the button
Expand|Select|Wrap|Line Numbers
  1. else if (source.getName().equals(InvoicePanel.BTN_PARTS_PRO)) {
  2.          if (isPreferencePPSE() && ClientApplicationContext.getClientApplicationContext().getPpseCatalogInUse()) {
  3.          logger.debug("actionPerformed: CatalogButton Pushed: isPreferencePPSE/calling openPPSE");
  4.          openPPSE();
  5.          } else {logger.debug("actionPerformed: CatalogButton: preference is NOT PPSE");
  6.              if (!CatalogBL.verifyDVDServices()) {
  7.                  clientApplicationContext.getMessageMgr().showMessage(invoicePanel, "2208");
  8.                  return;
  9.              }
  10.              invoicePanel.setVisible(false);
  11.              clientApplicationContext.getPointOfSaleEventDispatcher().fireCatalogingOpened(
  12.                  new CatalogEvent(this, null));
  13.          }
  14.  
Can this code give this kind of problem ? Please give ur valuable suggestions .

Thanks and regards,
Amit.
Jun 24 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
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...
3
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...
7
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...
6
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.