Aim of the Exercise

This exercise is designed to evaluate your ability with using the broad spectrum of techniques you have learned this year, including OO techniques, dynamic data structures, event based programming, Swing and using the Java API to discover how to use classes written by other programmers in your applications. Unlike the previous assessed exercise, you are completely free to choose what classes, methods, variables you need to complete the exercise...

Your task is to design and build a java application capable of sending text messages to, and receiving text messages from, other such applications in the 1st year java lab. This application should use a GUI similar to that of a mobile phone.

To give you an idea of what to build, here's a screenshot from one we made earlier... Why not see how close you can get your application to looking like this? But of course, if you think you have a better design for a mobile phone, feel free to indulge yourself... See image.

Introduction

You haven't had the chance to study much computer networking yet, and we don't expect you to be able to write the communications part of an application like this on your own, so we've written it for you. It's called the GSMNetwork package.

The GSMNetwork package was developed here at Lancaster, is written completely in java, and is capable of sending messages to, and receiving messages from java applications. The package is very easy to use, and doesn't employ any techniques you haven't already seen before.

You can download the GSMNetwork.jar file from here the coursework page on LUVLE, and can integrate it into your Eclipse project in the same way as previous exercises (See the Week 12 Solar System exercise for details on how to do this if you’ve forgotten).

To find out more about how to use the GSMNetwork package, consult the GSMNetwork Javadoc documentation, also uploaded onto LUVLE. If you’re still unclear on any aspects, ask you tutor to explain it to you. You’ll find the documentation on LUVLE labelled: GSMNetwork API Documentation.zip

The GSMNetwork package uses something called Java RMI to enable its communications. RMI stands for Remote Method Invocation, and is something beyond the scope of this course (but you will be learning it if you go on to Part II). There is one thing you need to do in order to allow the GSMNetwork package work its magic on your machine though - you need to have a program running in the background called 'rmiregistry'. Before you start programming, you should:

  • Download the rmiregistry.zip file from LUVLE
  • Extract it somewhere on your H:\ drive (but NOT on your desktop – it won’t work there!)
  • Browse into the folder you just extracted and double click the ‘run_rmiregistry’ program. (you’ll need to do this step every time you start a programming session)

The Assigned Tasks

The following sections describe the functionality you should aim to achieve in your application. You needn't do these tasks in any strict order, but they are listed in an order that helps you evolve your program in more manageable pieces. Completing the main parts of Tasks 1 and 2 will be sufficient for a bare pass mark.

Task 1: Sending and Receiving Simple text Messages

The aim of this task is to develop a two very simple applications (no Swing GUI yet!), one of which can send a message, and one which can receive a message. As a guide, each of these applications can be written in around 10 lines of code.

  • Develop a program that can send a text message (say, "Hello World" for example) using the GSMNetwork package.
  • Develop a program that can receive a text message, and display it to the console.
  • Test your two applications together, and see if you can send and receive a message!
  • Also, if any of your colleagues have completed this stage, why not try sending them a message too! You’ll find you can send messages pretty much anywhere on campus..

Task 2: A Graphical Text Messaging Application

Develop the code you wrote above to include a graphical user interface that resembles a telephone. You can try to build one that resembles the picture above, or design one of your own. Integrate code you wrote in task 1, so that your GUI can both send and receive messages.

For extra marks on the GUI:

  • Write your GUI so that the telephone number you want to send a message to can be entered via the numeric keypad on your GUI (not on the PC keyboard in front of you).
  • Develop your application so that the text to send can also be entered via the numeric keypad. (Just like on a real phone, where multiple key presses are used to enter a letter).

Task 3: Saving your Messages

Real mobile telephones store received text messages, so that you can look back at a later time and re- read your messages...

  • Enhance your application so that any messages you received will be stored on a linked list. Feel free to re-use the LinkedList classes supplied previously for the Solar System exercise.
  • Add additional GUI features so you can re-read and delete these messages.

Advanced Features

If you want to experiment with your program just to learn more about Java programming, there many other features you can add to your application, for example:

  • Improve the GSMNetwork so that you can send your phone number along with a text message, so that the receiving application knows where the message came from. HINT: Instances of the TextMessage class are what is sent across the network. Given that you can't edit TextMessage.java, which you can't as I haven't given it to you! :-), how could you make the GSMNetwork package carry more information?
  • If you've managed the concept above, why not try some multimedia messaging - and send an image across the network... (HINT: Maybe an ImageIcon?)
  • Develop an address book for your application, so when sending messages, you can use friendly names rather than numbers. (HINT: perhaps a linked list of objects which hold names and numbers?)
  • Write a T9 interface that can do text input prediction... No need for a full dictionary, but one which learns words entered into the phone would be cool.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.