Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Java Architecture and Sub-GUIs

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Java Architecture and Sub-GUIs

    Hi,
    I am new to Java. I am trying to design a GUI using Java Swing that will allow me to configure multiple devices from one GUI.
    Effectively I am trying to create a top level GUI which contains some configuration boxes and a FileChooser which allows me to select various device profiles (which I will create). Each device profile will contain a series of configuration windows which allow me to configure the individual device in question. I would like to add profiles to a directory over time which can then be selected by the main GUI, without needing to recompile the main GUI. I am wondering what the best way to do this would be. I was thinking that each device profile would be its own java GUI .jar file which the main GUI would launch using the configurations entered from the main GUI screen. The device profile GUIs will configure the devices in question via a socket connection. Is this the best way to go? Could/should I use another strategy such as Applets? Any feedback would be greatly appreciated.
    Thank you for your feedback.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,405
    My Mood
    Mellow
    Thanks
    83
    Thanked 473 Times in 464 Posts

    Default Re: Java Architecture and Sub-GUIs

    You didn't give details, but I imagine the settings to be simple "data" that would be loaded into the GUI configuration screen when selected and then applied to the device when an OK, or Apply button is pressed. Each config file may have a name that would be displayed with an indication if the data is modified and prompted to be saved if changed. Pretty basic stuff as I imagine it.

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,545
    Thanks
    24
    Thanked 298 Times in 281 Posts

    Default Re: Java Architecture and Sub-GUIs

    Ok, I am a bit confused too. Is it normal data you are dealing with, or are you attempting to do something like: each device has its own GUI which you want to be able to "plug-in" to the main GUI automatically (without having to make a code-change to the main GUI)? If it is the second: is the device's GUI embedded in the main GUI, or is does it have its own windows and everything?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Junior Member
    Join Date
    Dec 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Architecture and Sub-GUIs

    Quote Originally Posted by aussiemcgr View Post
    Ok, I am a bit confused too. Is it normal data you are dealing with, or are you attempting to do something like: each device has its own GUI which you want to be able to "plug-in" to the main GUI automatically (without having to make a code-change to the main GUI)? If it is the second: is the device's GUI embedded in the main GUI, or is does it have its own windows and everything?
    Thanks for your quick response. Ultimately I am trying to achieve the second instance. Each "sub device GUI" will have its own configuration windows for the device in question. Ideally it will be "plug-in" since device GUIs will be added over time and I would like to provide the user with a new device GUI which can be used with the original main GUI. You could consider the subGUIs as drivers for the device. As an example, you would have an assembly line which would have a GUI which controls the overall assembly of a widget. Part of the assembly line is a device which paints the widget. The widget painting device would have a GUI which allows the user to configure the widget painting device and can interact with the main GUI to perform the assembly of the widget. Over time, this assembly line may use x different widget painting devices and I would like to be able to add a new GUI for each new widget painter without changing the main GUI. (assuming they share common functionality) So, based on this example, would I want to simply create .jar files for each separate device and then have them launched and interact with the main GUI as separate processes? Or does java provide a better way of doing this (such as applets or threading?) Again I am new to Java so any advice is appreciated. I hope this clarifies what I am trying to do.

    --- Update ---

    I should add that if, in the end, it makes more sense to simply have each device GUI as an extension of the main GUI and if a new subGUI is added, I would need to recompile and redistribute the whole platform, then I would consider this solution.
    Thanks again.

  5. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    3,405
    My Mood
    Mellow
    Thanks
    83
    Thanked 473 Times in 464 Posts

    Default Re: Java Architecture and Sub-GUIs

    Aren't the "different widget painting devices" just minor variations of one thing?

  6. #6
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,545
    Thanks
    24
    Thanked 298 Times in 281 Posts

    Default Re: Java Architecture and Sub-GUIs

    If each device has its own window, and you just wanted those windows "launch-able" from the main GUI, you could probably do that a few different ways. Ultimately, the decision will come down to: how do you intend on "finding" the start window for each device? If you have a jar for each device, you will still need to find the start window in the source files. The easiest way would be just to make the device's jar executable and just have the main GUI launch the device's jar. But if you want it all contained into one running java instance, you may need to use a bit of "magic".
    Off the top of my head, these may or may not be do-able, I am just brainstorming (these will probably require some Reflection to initiate the device's start windows):
    1. You could have a manually editable configuration file, which your main GUI would import on startup, which specifies the location (in the device's jar) of the device's start window. This would require very little "magic", but would require you to manually edit the configuration file each time you add a new device. However, it would NOT require you to recompile the main GUI, so there's that.
    2. You could restrict the startup windows to always be under the same package and with the same name for every device jar. This would mean you have less flexibility with renaming the file name for the startup window, but that might not be a big deal. The pros and cons for this one is debatable.
    3. You could have a super-type for all the startup windows (possibly extending JFrame or something) in your main GUI. Every device's start window would inherit from that super class. You could then "crawl" through the device's jar, and look for the class which extends from the super-type. This will require all device jars to have the main GUI's jar as a dependency, but it should probably be that way anyway. This would be the most "automatic" way, although it requires some overhead.

    For 2 and 3, if you have all the device jars in the same folder, you could even do a "crawl" of that folder to automatically find the devices to load (you would set it to load every device whose jar is found in the folder).
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  7. The Following User Says Thank You to aussiemcgr For This Useful Post:

    bytownbrooks (December 19th, 2013)

Similar Threads

  1. Java Security Implementation for Plugin Supported Architecture
    By bgroenks96 in forum Java Theory & Questions
    Replies: 19
    Last Post: November 22nd, 2011, 03:13 PM
  2. Java Architecture help !!
    By java4 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 20th, 2010, 01:11 PM
  3. Replies: 5
    Last Post: June 10th, 2010, 10:19 AM
  4. Help with GUIs please & methods
    By killerknight141 in forum Java Theory & Questions
    Replies: 1
    Last Post: February 2nd, 2010, 06:12 AM
  5. cross platform architecture in Java/J2ee
    By softwarebuzz in forum Web Frameworks
    Replies: 1
    Last Post: January 9th, 2010, 01:43 PM