Solved

making a GUI

Posted on 1998-02-18
1
197 Views
Last Modified: 2010-04-16
I am trying to figure out the correct method to tie my GUI to the main program.  So far all I have is a GUI class that creates all the components.  Now I am trying to figure out the proper way to link the GUI to the main program.  I assume there is someway to create an instance of the GUI which will call methods in the class that instantiated it when an event is generated by the GUI, or something to
that effect.  Most of the examples I have seem seem to tie the GUI to the class that is using it, which to me seems like bad programming practice.  I should be able to let any class use the GUI and not require any changes to the GUI?


Most of the examples I have found seem to be very simple and just lump the functionality of the program and the GUI into a single class.

Would it be possible to give a simple example of how this is done?
0
Comment
Question by:micah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
jhance earned 100 total points
ID: 1233138
Well, I think you are right in a sense that making a GUI and making the program functionality should be separated.  The problem is that it causes extra overhead since you must establish some sort of protocol and communication method between the GUI class and the main program.  An example of this in the Windows programming world would be OLE/COM where you can completely separate different functions and tie them together via the COM protocol.  It's very clean and portable but there is overhead in Windows for making it all work together.

As far as your system, if you really want to separate the GUI and main program, you could implement them as a client/server setup and have the two talk some protocol you define through some link.  For example, you could have the main program setup a listing Socket object and wait for incoming commands from the GUI.  The GUI would open a Socket to the main program and send/receive data based on the users input and feedback from the main program.  An advantage to this approach would be that the GUI and main wouldn't even have to run on the same computer.  The main drawback (except for added coding complexity) would be the overhead of a "network" linkup between the two processes.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question