You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: panel_display.m
    path of file: ./repos/brainstorm3/toolbox/gui
    
    the code of the file until where you have to start completion: function varargout = panel_display(varargin)
% PANEL_DISPLAY: Create a panel edit the time-frequency displays.
% 
% USAGE:  bstPanelNew = panel_display('CreatePanel')
%                       panel_display('UpdatePanel')
%                       panel_display('CurrentFigureChanged_Callback', hFig)
%                       panel_display('SetSelectedRowName', hFig, 'uparrow')   : Switch to previous data row
%                       panel_display('SetSelectedRowName', hFig, 'downarrow') : Switch to next data row
%                       panel_display('SetSelectedRowName', hFig, RowName)

% @=============================================================================
% This function is part of the Brainstorm software:
% https://neuroimage.usc.edu/brainstorm
% 
% Copyright (c) University of Southern California & McGill University
% This software is distributed under the terms of the GNU General Public License
% as published by the Free Software Foundation. Further details on the GPLv3
% license can be found at http://www.gnu.org/copyleft/gpl.html.
% 
% FOR RESEARCH PURPOSES ONLY. THE SOFTWARE IS PROVIDED "AS IS," AND THE
% UNIVERSITY OF SOUTHERN CALIFORNIA AND ITS COLLABORATORS DO NOT MAKE ANY
% WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, NOR DO THEY ASSUME ANY
% LIABILITY OR RESPONSIBILITY FOR THE USE OF THIS SOFTWARE.
%
% For more information type "brainstorm license" at command prompt.
% =============================================================================@
%
% Authors: Francois Tadel, 2010-2022
%          Martin Cousineau, 2017-2019

eval(macro_method);
end


%% ===== CREATE PANEL =====
function bstPanelNew = CreatePanel() %#ok<DEFNU>
    panelName = 'Display';
    % Java initializations
    import java.awt.*;
    import javax.swing.*;

    % Create tools panel
    jPanelNew = java_create('javax.swing.JPanel');
    jPanelNew.setLayout(BoxLayout(jPanelNew, BoxLayout.PAGE_AXIS));
    jPanelNew.setBorder(BorderFactory.c
    
function SliderConnect_Callback(varargin)
        % Process slider callbacks only if it has focus
        if jSliderThreshold.hasFocus()
            SetThresholdOptions();
        elseif jSliderPercent.hasFocus()
            SetConnectPercent();
        elseif jSliderMinimumDistance.hasFocus()
            SetDistanceOptions();
        end
    end

    %% ===== CONNECTIVITY DISPLAY CHECKBOX CALLBACK =====
    function CheckDisplay_Callback(varargin)
        if (jToggleOut.hasFocus())
            SetConnectivityDisplayOptions([], 0);
        elseif (jToggleIn.hasFocus())
            SetConnectivityDisplayOptions([], 1);
        elseif (jToggleBoth.hasFocus())
            SetConnectivityDisplayOptions([], 2);
        elseif (jToggleBiDir.hasFocus())
            SetConnectivityDisplayOptions([], 3);
        end
    end

    function ToggleAnatomicalFiltering_Callback(varargin)
        AnatomicalFilter = 0;
        if (jToggleAll.hasFocus())
            AnatomicalFilter = 0;
        elseif (jToggleHemi.hasFocus())
            AnatomicalFilter = 1;
        elseif (jToggleLobe.hasFocus())
            AnatomicalFilter = 2;
        end
        SetAnatomicalFilteringOptions([], AnatomicalFilter);
    end

    function ToggleFiberFiltering_Callback(varargin)
        FiberFilter = 0;
        if (jToggleAllConns.hasFocus())
            FiberFilter = 0;
        elseif (jToggleAnatConsistConns.hasFocus())
            FiberFilter = 1;
        elseif (jToggleAnatInconsistConns.hasFocus())
            FiberFilter = 2;
        end
        SetFiberFilteringOptions([], FiberFilter);
    end
end

%% =================================================================================
%  === EXTERNAL PANEL CALLBACKS  ===================================================
%  =================================================================================
%% ===== COMBOBOX ROW SELECTION =====
function ComboRowsStateChange_Callback(h,ev)
    if (ev.getStateChange() == ev.SELECTED)
        % Update options
        SetDisplayOptions();
    end
end

%% ===== CURRENT FIGURE CHANGED =====
function CurrentFigureChanged_Callback(hFig) %#ok<DEFNU>
    % Select display options (time checkbox...)
    UpdatePanel(hFig);
end
    

%% =================================================================================
%  === TIME-FREQ FUNCTIONS =========================================================
%  =================================================================================

%% ===== UPDATE PANEL =====
function UpdatePanel(hFig)
    global GlobalData;
    % Get panel controls
    ctrl = bst_get('PanelControls', 'Display');
    if isempty(ctrl)
        return;
    end