Passing text from JFrame

  • (2 Pages)
  • +
  • 1
  • 2

24 Replies - 1191 Views - Last Post: 03 August 2012 - 09:54 AM Rate Topic: -----

#16 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Passing text from JFrame

Posted 03 August 2012 - 08:03 AM

I edited my previous post to explain how to fix that.
Was This Post Helpful? 0
  • +
  • -

#17 synlight  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 582
  • Joined: 14-September 11

Re: Passing text from JFrame

Posted 03 August 2012 - 08:08 AM

Ahh I just saw your edit, thank you!

Our instructor has us use the show() method, but I will switch it, it bugs me to use older methods. He also makes us use String Tokenizer to parse Strings lol.

I thought I had to create instances at the top, I will change that and give it a try.


EDIT: It's running BRILLIANTLY! I can't thank you 2 enough, I have spent a LOT of hours on this and it's wonderful to see it running as it should!!

Now.. off to add more functionality and write a user manual. Hopefully today won't be another 14 hour day.

View PostGregBrannon, on 03 August 2012 - 09:52 AM, said:

So what's not working as you'd like?

I can make a 30-minute call, view the bill, and it's $6.00. I make another 30-minute call, view the bill, and it goes to $12.00. Seems to work fine.

I did notice that the bill window shows up before it should showing a blank total bill, behind the JavaPhone's first menu before there have been any calls, so that needs to be fixed. Close that and proceed as I mentioned above, and that part seems okay.

Let me know what you need help with.

Edit: The reason you're getting an empty BillWindow is because you create the instance of windowBill in your JavaPhone instance variable declarations (lines 21 - 23). Do you need those instances created there?

If you modify the instance variables at the top to:
    SmartPhone myPhone;  // = new SmartPhone();
    InputWindow windowIn; //  = new InputWindow("");
    BillWindow windowBill; // = new BillWindow("");


And then create an instance of myPhone in the JavaPhone constructor:

myPhone = new SmartPhone();

before making it visible, you should be fine.

By the way, JFrame.show() is deprecated. Use JFrame.setVisible( true );

This post has been edited by synlight: 03 August 2012 - 08:13 AM

Was This Post Helpful? 0
  • +
  • -

#18 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1398
  • View blog
  • Posts: 3,097
  • Joined: 05-April 11

Re: Passing text from JFrame

Posted 03 August 2012 - 08:14 AM

Talking about older methods, you should use setBounds instead of reshape since it is deprecated.
Was This Post Helpful? 0
  • +
  • -

#19 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Passing text from JFrame

Posted 03 August 2012 - 08:15 AM

Some instructors . . . don't know what they're thinking.

Quote

I thought I had to create instances at the top

Erase that thought from your mind. Replace it with "Never create instances at the top." There may be rare exceptions, but I can't think of any. If you encounter one of those rare instances, use an initialization block and explain what you're doing and why to make it clear. Other than an initialization block, creating instances of the instance variables is what the constructor and/or other appropriate methods are for.
Was This Post Helpful? 1
  • +
  • -

#20 synlight  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 582
  • Joined: 14-September 11

Re: Passing text from JFrame

Posted 03 August 2012 - 08:23 AM

View PostCasiOo, on 03 August 2012 - 10:14 AM, said:

Talking about older methods, you should use setBounds instead of reshape since it is deprecated.

Omgosh! I'm on my cellphone, and tried to give you plus 1, and I accidentally hit the minus 1 button! I'm so sorry!

When I gey back to my computer I will try to fix it :c
Was This Post Helpful? 0
  • +
  • -

#21 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1398
  • View blog
  • Posts: 3,097
  • Joined: 05-April 11

Re: Passing text from JFrame

Posted 03 August 2012 - 08:27 AM

View Postsynlight, on 03 August 2012 - 03:23 PM, said:

View PostCasiOo, on 03 August 2012 - 10:14 AM, said:

Talking about older methods, you should use setBounds instead of reshape since it is deprecated.

Omgosh! I'm on my cellphone, and tried to give you plus 1, and I accidentally hit the minus 1 button! I'm so sorry!

When I gey back to my computer I will try to fix it :c


=< haha
Was This Post Helpful? 1
  • +
  • -

#22 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2198
  • View blog
  • Posts: 5,226
  • Joined: 10-September 10

Re: Passing text from JFrame

Posted 03 August 2012 - 08:35 AM

Quote

Omgosh! I'm on my cellphone, and tried to give you plus 1, and I accidentally hit the minus 1 button! I'm so sorry!

I guess I should be glad I got nothing.
Was This Post Helpful? 0
  • +
  • -

#23 synlight  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 582
  • Joined: 14-September 11

Re: Passing text from JFrame

Posted 03 August 2012 - 08:38 AM

LOL I was scared to give you any rep after I fatfingered Casi.

I'm still on my phone, and haven't found a way to fix it yet. I'll email the mods if I have to.

View PostGregBrannon, on 03 August 2012 - 10:35 AM, said:

Quote

Omgosh! I'm on my cellphone, and tried to give you plus 1, and I accidentally hit the minus 1 button! I'm so sorry!

I guess I should be glad I got nothing.

Was This Post Helpful? 0
  • +
  • -

#24 synlight  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 89
  • View blog
  • Posts: 582
  • Joined: 14-September 11

Re: Passing text from JFrame

Posted 03 August 2012 - 09:43 AM

View PostCasiOo, on 03 August 2012 - 10:14 AM, said:

Talking about older methods, you should use setBounds instead of reshape since it is deprecated.


Mac upvoted you to counteract the downvote, but there's nothing they can do about removing my downvote.

I'm realllllly sorry CasiOo.. no more rep on my cell phone. >_<
Was This Post Helpful? 0
  • +
  • -

#25 CasiOo  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1398
  • View blog
  • Posts: 3,097
  • Joined: 05-April 11

Re: Passing text from JFrame

Posted 03 August 2012 - 09:54 AM

haha don't worry about it :P it is not a big deal
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2