1

Don't know if it's stupid or reasonable question.

I have methods which returns float/int data (x,y,z positions) of the P5 Glove (if you know it).

I also have update method which responds to the glove pulling.

All i'm having trouble with is creating UI and presenting the data in text area, means every update the text areas presenting the data refreshed and present the data.

Since code isn't that short here are links to the class: Details presentation methods and update

let's say for now I want to present showActiveLedPosX() method which returns the X position as String.

the other classes are glove (using glove methods and creating glove object and UI).

Should I use different class for UI? or should I do it all on ShowGloveValues class

I've never created UI and therefore I'm kinda clueless here, Tried to read about it on numerous resource sites and still couldn't achieve what's needed.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Shahar Galukman
  • 882
  • 3
  • 15
  • 35

1 Answers1

3

1. Keep the UI thread apart from the Non-UI thread.

2. Event Dispatcher Thread is the UI thread, keep this thread to handle your UI only.

3. You can also use SwingWorker for this.

4. Swing is based on Mode View Controller. Moreover its better to divide your app packages also on the basis of MVC.

eg:

  com.vivek.model;    // Class responsible for Business Logic and Data

  com.vivek.view;     // Class responsible for the UI
Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
  • Thanks for the quick response Kumar. Yet, as I said I'm clueless here. I've created UI using Swing class on netbeans, created my components (text areas) how do I link the data coming of ShowGlovValues? should I create ShowGloveValues object on the UI? Should I include the update method in the UI? – Shahar Galukman Aug 16 '12 at 06:45
  • If you need the UI code let me know (it's the code generated when creating swing class) – Shahar Galukman Aug 16 '12 at 06:48
  • 1
    Use the WindowsBuilder Pro, now available for free from Google, use the GroupLayout to design your UI. – Kumar Vivek Mitra Aug 16 '12 at 07:00