473,405 Members | 2,154 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,405 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 1574
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
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...
0
tracyyun
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...

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.