function truss_beam_fem_GUI

% ensure only one window opened
aa=findobj('tag','TBFM111');
if(size(aa,1)>0)
    disp('Window is opened');
    msgbox('Window is opened','truss_beam_fem')
    return;
end;

global hMainWindow;
global hFigure;
global hLegend;
global hMessageBardisplace;
global hMessageBarelement;
global hSlider;
global hGraphSelect;
global femSolved;
global hGoButton;
global hOpenMenu;
global LastDir;
% initialize 
LastDir='';
femSolved=false;
% get screen parameters , calc window size and place at center of screen
screen=get(0,'ScreenSize');

rSize=[screen(1,3)*0.85 screen(1,3)*0.85*0.55];
botLeft=[screen(1,3)/2-rSize(1,1)/2 screen(1,4)/2-rSize(1,2)/2];

hMainWindow=figure('Position',[botLeft rSize],...
'MenuBar','none',...
'Name','Truss-Beam Finite Element Analysis',...
'NumberTitle','off',...
'Resize','off',...
'Toolbar','none',...
'DockControls','off',...
'tag','TBFM111');

%Axes for model figure
hFigure=axes('Position',[0.05 0.42 0.8 0.55]);
%Axes for legend
hLegend=axes('Position',[0.05+0.81+0.027 0.45+0.005 0.1 0.04]);
set(hLegend,'Visible','off');
% message bar
uipanel('BorderType','BeveledIn',...
'Units','norm',...
    'Position',[0.05 0.02 0.3 0.25]);
hMessageBardisplace=uicontrol('Style','edit',...
    'Units','norm',...
    'Position',[0.05+0.005 0.02+0.005 0.3-0.01 0.25-0.01],...
    'HorizontalAlignment','left',...
    'Max',100,...
    'String','No file is currently open');

hStaticsText1=uicontrol('Style','Text',...
    'Units','norm',...
    'Position',[0.05+0.005 0.27+0.005 0.3-0.01 0.03],...
    'HorizontalAlignment','left',...
    'Max',100,...
    'String','1.Nodal Displacement  2.Reaction');
% message bar
uipanel('BorderType','BeveledIn',...
'Units','norm',...
    'Position',[0.05+0.32 0.02 0.48 0.25]);
hMessageBarelement=uicontrol('Style','edit',...
    'Units','norm',...
    'Position',[0.32+0.05+0.005 0.02+0.005 0.48-0.01 0.25-0.01],...
    'HorizontalAlignment','left',...
    'Max',100,...
    'String','No result obtained from finite element method');
hStaticsText1=uicontrol('Style','Text',...
    'Units','norm',...
    'Position',[0.32+0.05+0.005 0.27+0.005 0.48-0.01 0.03],...
    'HorizontalAlignment','left',...
    'Max',100,...
    'String','1.Axial force 2.Shearing force 3.Bending Moment 4.Tension and compression stress 5.Maximum Bending Stress');
% Pushbuttons
hGoButton=uicontrol('Style', 'pushbutton',...
    'Units','norm',...
    'Position',[0.88 0.9 0.1 0.04],...  
    'String','Finite Element Analysis',...
    'Callback','onFEA',...
    'Enable','off');


% Radio buttons
uipanel('Title','Display:','Units','Norm',...
    'Position',[0.05+0.8+0.02 0.65-0.1 0.12 0.3]);

hGraphSelect(1)=uicontrol('Style','RadioButton',...
    'Units','norm',...
    'Position',[0.05+0.8+0.027 0.75-0.18+0.22 0.1 0.04],...
    'String','Axial Force','Value',1,...
    'Callback','onSelect(1)',...
    'Enable','off');
hGraphSelect(2)=uicontrol('Style','RadioButton',...
    'Units','norm',...
    'Position',[0.05+0.8+0.027 0.75-0.18+0.17 0.1 0.04],...
    'String','Shearing','Value',0,...
    'Callback','onSelect(2)',...
    'Enable','off');
hGraphSelect(3)=uicontrol('Style','RadioButton',...
    'Units','norm',...
    'Position',[0.05+0.8+0.027 0.75-0.18+0.12 0.1 0.04],...
    'String','Bending Moment','Value',0,...
    'Callback','onSelect(3)',...
    'Enable','off');
hGraphSelect(4)=uicontrol('Style','RadioButton',...
    'Units','norm',...
    'Position',[0.05+0.8+0.027 0.75-0.18+0.07 0.1 0.04],...
    'String','Tension Stress','Value',0,...
    'Callback','onSelect(4)',...
    'Enable','off');
hGraphSelect(5)=uicontrol('Style','RadioButton',...
    'Units','norm',...
    'Position',[0.05+0.8+0.027 0.75-0.18+0.02 0.1 0.04],...
    'String','Max BendStress','Value',0,...
    'Callback','onSelect(5)',...
    'Enable','off');

% Slider
hSlider=uicontrol('Style','Slider',...
    'Units','norm',...
    'Position',[0.05 0.42-0.08 0.8 0.04],...
    'Callback','showModel');
% initialize slider
    set(hSlider,'min',0,'max',100000,'SliderStep',[0.0001 0.0005],'Value',0);
% Main menu
hMainMenu=uimenu('Label','&File');
hOpenMenu=uimenu(hMainMenu,'Label','Open...','CallBack','onFileOpen');
uimenu(hMainMenu,'Label','Exit','CallBack','onFileExit');