Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Java GUI programming

Java GUI programming

Scheduled Pinned Locked Moved Java
questionjavasysadminhelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Francesco Fraccaroli
    wrote on last edited by
    #1

    Hi programmers, I'm working on a Java project that has a graphical interface and do some other stuffs, as serial/network communication, calculations, etc. In your experience, what is the right way to start? Start from the GUI and then program all the functions, or create all the backgrounds method and classes and then program the GUI? Another issue: you normally prefer to make some variables public or to pass them all as parameters? I'm a bit confused, expecially for Listeners. Thanks, Francesco

    L R 2 Replies Last reply
    0
    • F Francesco Fraccaroli

      Hi programmers, I'm working on a Java project that has a graphical interface and do some other stuffs, as serial/network communication, calculations, etc. In your experience, what is the right way to start? Start from the GUI and then program all the functions, or create all the backgrounds method and classes and then program the GUI? Another issue: you normally prefer to make some variables public or to pass them all as parameters? I'm a bit confused, expecially for Listeners. Thanks, Francesco

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      If you follow one of the modern patterns (MVC, MVVM etc) your GUI should be separated from your business logic such that you can test the latter even before the GUI is designed. So work on the business side of things first, it's much easier to add or modify the GUI than to rework your classes to match the display. It's generally not good practice to have public variables, as such. Pass them as parameters or use setters and getters[^].

      F 1 Reply Last reply
      0
      • L Lost User

        If you follow one of the modern patterns (MVC, MVVM etc) your GUI should be separated from your business logic such that you can test the latter even before the GUI is designed. So work on the business side of things first, it's much easier to add or modify the GUI than to rework your classes to match the display. It's generally not good practice to have public variables, as such. Pass them as parameters or use setters and getters[^].

        F Offline
        F Offline
        Francesco Fraccaroli
        wrote on last edited by
        #3

        Dear Richard, Thanks for your reply, I'll study about the two patterns you suggested me. For public variables, I show my problem: I want to write data on RS232 port, wait a reply, read data arrived and elaborate them. I create a SerialPort object using RxTx libraries and I setted a Listener to it. In my main class, a method write the data on the serial port and then wait on a Condition variable. The listener have to notify to the waiting method the arrival of the data. The two methods are on completely different classes, so I thought to make the condition variable global. Unfortunately, at now the program doesn't work. What shall be the right way to do solve kind of problem? Francesco

        L 1 Reply Last reply
        0
        • F Francesco Fraccaroli

          Dear Richard, Thanks for your reply, I'll study about the two patterns you suggested me. For public variables, I show my problem: I want to write data on RS232 port, wait a reply, read data arrived and elaborate them. I create a SerialPort object using RxTx libraries and I setted a Listener to it. In my main class, a method write the data on the serial port and then wait on a Condition variable. The listener have to notify to the waiting method the arrival of the data. The two methods are on completely different classes, so I thought to make the condition variable global. Unfortunately, at now the program doesn't work. What shall be the right way to do solve kind of problem? Francesco

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Francesco Fraccaroli wrote:

          Unfortunately, at now the program doesn't work. What shall be the right way to do solve kind of problem?

          Sorry, but that information does not help us to understand what is happening. I suggest you open a new question, and show the part of your program that does not work, and explain exactly what errors you are seeing. Don't forget to add <pre> tags (use the code button above the edit window) around your code so it is readable like:

          // your code snippets here

          1 Reply Last reply
          0
          • F Francesco Fraccaroli

            Hi programmers, I'm working on a Java project that has a graphical interface and do some other stuffs, as serial/network communication, calculations, etc. In your experience, what is the right way to start? Start from the GUI and then program all the functions, or create all the backgrounds method and classes and then program the GUI? Another issue: you normally prefer to make some variables public or to pass them all as parameters? I'm a bit confused, expecially for Listeners. Thanks, Francesco

            R Offline
            R Offline
            Raushank03
            wrote on last edited by
            #5

            http://techgurulab.com/course/java-tutorials/[^] This link is useful to increase your basic concept with respect to your Question.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups