Win a copy of Raising Young Coders: A Parent’s Guide to Teaching Programming at Home this week in the General Computing forum!
Forums Login/signup

Why is this code taking too long to launch

+Pie Number of slices to send: Send
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?

+Pie Number of slices to send: Send
What are your system specs? On my system the program starts in two seconds.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
I've tried debugging the program, and it seems that is the line causing the slowness. Any ideas?
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
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.

reply
reply
This thread has been viewed 1966 times.
Similar Threads
Runtime Error in Program for Unknown Reasons
Document Listener and/or Ley Listener
coding a texteditor: want to open a separate option window
How to keep formatting while reading files
HeadFirst >>Chapter14:ArrayList Error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jun 27, 2025 08:49:06.