#16
  1. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    The posted code does NOT execute for me. I get this error:

    Error: Main method not found in class KoneksiKlienServer, please define the main method as:
    public static void main(String[] args)


    How do you execute the code? It does not have a main() method.


    //==========================================

    There are NO JTextFields or JButtons in the posted code so you will never see any of them in the GUI when the code is executed.

    Did you post the correct code? Is there another program that has those components in it?
    Last edited by NormR; July 27th, 2013 at 10:24 AM.
  2. #17
  3. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    The posted code does NOT execute for me. I get this error:

    Error: Main method not found in class KoneksiKlienServer, please define the main method as:
    public static void main(String[] args)


    How do you execute the code? It does not have a main() method.


    //==========================================

    There are NO JTextFields or JButtons in the posted code so you will never see any of them in the GUI when the code is executed.

    Did you post the correct code? Is there another program that has those components in it?
    I use this command to use the code:

    Code:
    class BaruFrame extends KoneksiKlienServer {
    So, how should I change the code?
  4. #18
  5. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    Try to keep the code for testing the techniques for using Sockets as small as possible.
    Do NOT bring in code from the large program you are working on with the DB and the many textfields UNTIL the Socket code is working.
    Work on one thing at a time. When the client/server code with the sockets works, THEN work on merging the code.
  6. #19
  7. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Try to keep the code for testing the techniques for using Sockets as small as possible.
    Do NOT bring in code from the large program you are working on with the DB and the many textfields UNTIL the Socket code is working.
    Work on one thing at a time. When the client/server code with the sockets works, THEN work on merging the code.
    The code itself is working but after I use the previous command, the buttons in other codes that extends the code are not showing, so what should I do? I extends the KoneksiKlienServer and it shows me just the thing that I put in the code but it doesn't show me the thing in other code that extends the KoneksiKlienServer, so what should I do?
    Last edited by Tawijakarta; July 27th, 2013 at 10:55 AM.
  8. #20
  9. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    Do NOT use the other code until all of the testing for the Sockets is working.
    Make a complete small program that compiles, executes and shows what you want to do.
    When you have complete working client/server code, then try to merge the code.
  10. #21
  11. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Do NOT use the other code until all of the testing for the Sockets is working.
    Make a complete small program that compiles, executes and shows what you want to do.
    When you have complete working client/server code, then try to merge the code.
    It works well, so? How should I change the code?
  12. #22
  13. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    It works well
    I can not get the posted code to work for me. You must be working with a different program, not the ones that have been posted.

    Can you post the client code and the server code that works well so that I can see it and test it?
  14. #23
  15. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    I can not get the posted code to work for me. You must be working with a different program, not the ones that have been posted.

    Can you post the client code and the server code that works well so that I can see it and test it?
    It's a long code. BaruProgram and BaruFrame consist of more than 400 lines, do you want me to copy the code to this forum?
  16. #24
  17. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    BaruProgram and BaruFrame consist of more than 400 lines, do you want me to copy the code to this forum?
    No, do not post that code again. It is too long.

    I was talking about the code that uses Sockets. The code that does the following:
    Can I ask the user to click a button or do some things first before I connect him/her to the other computers?
  18. #25
  19. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    No, do not post that code again. It is too long.

    I was talking about the code that uses Sockets. The code that does the following:
    I do not do that. I connect the user to the client after the client request to connect with the code. Just tell me how to make those buttons and JTextFields to show up and work first ok? Exactly I connect the user since the first time the code start. So?
    Last edited by Tawijakarta; July 27th, 2013 at 12:22 PM.
  20. #26
  21. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    how to make those buttons and JTextFields to show up
    You have already written code that adds buttons and JTextFields to a JFrame and are shown in the GUI. Look at how that code worked and copy what it did. It's on the older thread.

    The code on this thread does NOT have any buttons or JTextFields. Change the code that was posted on this thread so that it uses buttons and JTextFields to show the problems you are having.
    You are talking about some other program, not the program that is posted on this thread.
  22. #27
  23. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    You have already written code that adds buttons and JTextFields to a JFrame and are shown in the GUI. Look at how that code worked and copy what it did. It's on the older thread.

    The code on this thread does NOT have any buttons or JTextFields. Change the code that was posted on this thread so that it uses buttons and JTextFields to show the problems you are having.
    You are talking about some other program, not the program that is posted on this thread.
    The other program extends this code:

    Code:
    public class BaruProgram extends BaruFrame {
    Code:
    class BaruFrame extends KoneksiKlienServer {
    see?
    I am trying to merge the code but failed, can you help me? Extending the KoneksiKlienServer does not make the button in the other two codes to show up, how to fix this? I will arrange the other JLabels later. You will just tell me how to show up those button in the other two codes and make the button to work, won't you? I want to get my M. Kom or master degree as fast as possible ok?
    Last edited by Tawijakarta; July 27th, 2013 at 12:31 PM.
  24. #28
  25. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    I am trying to merge the code but failed, can you help me?
    No, I do not want to work with those large programs. The code in those programs is very ugly and poorly written and is very hard to work with.
    They should be broken up into several smaller classes that do not extend each other.
    They should create instances of the each of the subclasses and use them to build the large program.

    If you will work with a few small classes that work on the following problem it will be better:
    user to click a button or do some things first before I connect him/her to the other computers
    If you want to do something else, you can do anything you want and maybe someone else will try to help you.
  26. #29
  27. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Instead of extending it, I was copying it to the BaruFrame and "masuk" and "keluar" button was appearing but they do not work. How to fix that? How to merge this KoneksiKlienServer to the other two codes?
  28. #30
  29. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,714
    Rep Power
    348
    I would rewrite this code so that it was in its own class with methods that could be called from the other classes. I would NOT try to merge this code into the other code.

    You still do NOT have working client/server code that does this:
    user to click a button or do some things first before I connect him/her to the other computers
    I would get the testing program to work completely before trying to merge the code.
    The code that was posted on the other thread is very badly written. I would NOT try to add any more code to it. It should be broken up into smaller classes and those classes used in a main class that builds the GUI, gets user input and connects to a server.

IMN logo majestic logo threadwatch logo seochat tools logo