• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Why is this code taking too long to launch

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the code for a simple text editor in Java. The GUI components are from the swing library; however, the program takes around 10 seconds to start up! Does anybody know why this is happening?

 
Ranch Hand
Posts: 67
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are your system specs? On my system the program starts in two seconds.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not saying that it's the cause of the slow startup, but in general you should always construct and manipulate Swing components only on the EDT and not in the main thread.Also, by convention all Java class names start with an uppercase letter.
 
Amr Hesham
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried debugging the program, and it seems that is the line causing the slowness. Any ideas?
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Amr Hesham wrote:I've tried debugging the program, and it seems that is the line causing the slowness. Any ideas?


??
I don't see that line of code anywhere in your posted program.
 
Amr Hesham
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I meant


I've also noted that


was making the program's launch slow (with the panel.add(scroller) commented out), but I managed to fix that by removing this line and adding the initialization to the variable declaration before main.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!