Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

empty Jframe

 
Tom Grant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey im quite new to java (and this forum)and this is a class for an IRC bot i am experimenting with using the pircbotx 1.6 api. I have a frame from another class that opens and gets disposed before this is called. When this frame opens it is just an empty frame that you cant see have i done something wrong in the code or is this caused by something else?
Here is the class (I put it on pastebin as it is 258 lines long): Display.class
Also i originally had it without the JTabbedPane (still the problem mentioned above) have i added it correctly as i have never used it before?
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

I suggest you strip out any non-UI code and turn it into an SSCCE (<= link), then post it here. If it's 258 lines with all the client code it should definitely be small enough as an SSCCE to post here.
 
Tom Grant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Welcome to the Ranch!

I suggest you strip out any non-UI code and turn it into an SSCCE (<= link), then post it here. If it's 258 lines with all the client code it should definitely be small enough as an SSCCE to post here.


this good?

 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom Grant wrote:
Rob Spoor wrote:Welcome to the Ranch!

I suggest you strip out any non-UI code and turn it into an SSCCE (<= link), then post it here. If it's 258 lines with all the client code it should definitely be small enough as an SSCCE to post here.


this good?

Nope. Did you go through the SSCCE page? The idea is that we can copy your code into a file, compile and run it to see where the problem might be.

Uncompilable snippets rarely reveal the problem; in fact, we often see here that the root cause of the stated problem was in code not initially posted.
 
Tom Grant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Tom Grant wrote:
Rob Spoor wrote:Welcome to the Ranch!

I suggest you strip out any non-UI code and turn it into an SSCCE (<= link), then post it here. If it's 258 lines with all the client code it should definitely be small enough as an SSCCE to post here.


this good?

Nope. Did you go through the SSCCE page? The idea is that we can copy your code into a file, compile and run it to see where the problem might be.

Uncompilable snippets rarely reveal the problem; in fact, we often see here that the root cause of the stated problem was in code not initially posted.

oh i see now sorry :
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> oh i see now sorry :

do yourself a favor - create another class file, copy/paste your latest code and try to compile,
just as if you were someone else reading this thread.

most people, seeing the resulting error message/s, are likely to just click 'next', ignoring your problem.

I don't know what is supposed to show up, but if it is the buttons, this line won't help
for(i=0;i>button.length;i++){

as for the rest of the code, unless you've a career in code obfuscation, it's a shocker
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code is quite bad to read. I suggest you completely rework it:
1) Do not use static variables for your components.
2) Give the components better names. I have no idea what field should be placed where and what its purpose it.
 
Tom Grant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:> oh i see now sorry :

do yourself a favor - create another class file, copy/paste your latest code and try to compile,
just as if you were someone else reading this thread.

most people, seeing the resulting error message/s, are likely to just click 'next', ignoring your problem.

I don't know what is supposed to show up, but if it is the buttons, this line won't help
for(i=0;i>button.length;i++){

as for the rest of the code, unless you've a career in code obfuscation, it's a shocker


hey i made a new class that i ran and it all displayed fine so i think there is a problem in the code i removed from it... am also trying to clean it up a bit before i post it (if i dont find the problem myself)
 
Tom Grant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey i worked out this is the bit of code causing me the problem any ideas? it works fine if i dont run the Tick()


this code also doesnt work
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
never, ever have this in Swing
Thread.sleep(25);

it blocks painting and events.

separate thread, or better yet, use a Timer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic