Communicating between GUI and controller class using Mediator pattern I am writing a program that allows a user to interact with MIDI-connected devices. Upon connecting a MIDI device, interactions with this device will update a GUI. Updates to the GUI include what keys are being pressed, if the volume is turned up/down, etc. In addition, the user can "request" the status of MIDI components through the GUI (how many MIDI devices are available, opening/closing MIDI devices).

All of this is set up using the Mediator pattern, and I would like to ask you all the best way of sending "requests" to each of these classes; MidiController (controls MIDI-related tasks) and GUI (which shows MIDI-related events).

A button exists on the GUI to search for MIDI-connected devices, upon clicking it, the MidiController will get some message (from the Mediator pattern) to find MIDI-connected devices.

My code currently looks like this for this function:

@Override
public void receive(String message) {
    System.out.println("Message from GUI: " + message);

    switch(message){
    case "FIND_ALL_MIDI_DEVICES":

        devices = MidiSystem.getMidiDeviceInfo();
        break;
    default:            
        break;
    }
}


I've opted to use a switch statement, but I feel there is a better option. I am expecting this class, MidiController to respond to many different messages. Is there a clean way I might communicate sending data / requests / updates between these two classes?
Since you only support a limited subset of messages you might want to consider using an enum to represent the different kinds of messages.

I think you're building yourself a god-class though. Instead of having everything running through the MidiController (which makes the Mediator Pattern basically useless) you could just as well couple GUI and Controller directly. 

Interestingly that's the more often used approach, to have the Controller take the role described as Mediator in the link you provided. This is especially interesting because it is not guaranteed that you have similar "suppliers of information" for your GUI. 

I think the Mediator Pattern overall is the wrong pattern for your situation :/