• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about "append"  RSS feed

 
Janeice DelVecchio
Bartender
Posts: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I need to append a lot of text to a textField. This text is generated by a report generator.

I guess my question is,



.... is this the right way to be doing this? My intended outcome is that the runReport method will run and send the text to the textfield.

I'm not quite done with the other part of this application, so there's no way to find out if it will even compile -- let alone run the way I hope it will.

I can post more code if necessary.... the runReport method basically is a whole lot of System.out.println with Strings and values calculated from earlier in the app.

Thanks in advance,
Janeice



 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so there's no way to find out if it will even compile


Sure there is you create a SSCCE.


Its two lines of code wrapped in a main method.

If you need further help then you need to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.
 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:
so there's no way to find out if it will even compile


Sure there is you create a SSCCE.


Its two lines of code wrapped in a main method.

If you need further help then you need to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.


yes indeed. Also know as a prototype. I do this all the time, on a very small scale, to prove a point before pressing ahead with large scaled design.

I'm a little unclear on the append method of the JTextField class though. ;)
 
Janeice DelVecchio
Bartender
Posts: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Won't I have to make a whole new GUI for testing this one line? and a whole new runReport class/method (which can standalone from the part that isn't finished yet)?

Making three new files (including the main) to test this one line seems like a lot of work for little payout, no?

I'll wait til the application is done and repost a thread when I figure out what it does/ doesn't do....

/Janeice/
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Won't I have to make a whole new GUI for testing this one line? and a whole new runReport class/method (which can standalone from the part that isn't finished yet)?


Why would you think you need to create a GUI to test out a single method? A full test might be:



If you really feel you need a GUI then how hard is it to add:



Think about your question, not your entire application.
 
Janeice DelVecchio
Bartender
Posts: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you think you need to create a GUI to test out a single method?


Honestly, I'm pretty new at this.... in order to SEE the textArea (and find out if it's working), don't you need a new frame and panel to add it to? And if you need to find out if another method can be used as a parameter, don't you need a method to USE as a parameter? I guess the gui can be not so bad to make... but I'm not looking forward to making my runReport method standalone.

I'm almost done anyways.... we'll know in a while if it will work.
-Janeice

 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Janeice DelVecchio wrote:
Why would you think you need to create a GUI to test out a single method?


Honestly, I'm pretty new at this.... in order to SEE the textArea (and find out if it's working), don't you need a new frame and panel to add it to? And if you need to find out if another method can be used as a parameter, don't you need a method to USE as a parameter? I guess the gui can be not so bad to make... but I'm not looking forward to making my runReport method standalone.

I'm almost done anyways.... we'll know in a while if it will work.
-Janeice



Everyone has their tricks. I have source files that are bare bones classes that extend JPanel and JFrame. I want to test something I call up the shell classes, save them under a different name. Two minutes to add a JTextArea and a JButton, or a paintComponent method, and you are off to the races.

anyways, here they are if you wanna use em, all ready to go.


 
Janeice DelVecchio
Bartender
Posts: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LOL

I guess it's no surprise that it doesn't work to you guys, huh?

I figured it wasn't going to work when the compiler made me change the method type to a string and make it return something.

It was nice to see my data in the command line window. **sigh**

All right. Lesson learned. I will make a test program next time. I got what I deserved for not listening to the experienced people around here

--Janeice
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!