Question: Help me draw a flowgraph for this code / * package com.mtala 3 t . snake 2 d; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import

Help me draw a flowgraph for this code
/
*
package com.mtala
3
t
.
snake
2
d;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics
2
D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
/
*
*
*
*
@author Mohammed.Talaat
(
mtala
3
t
)
*
@version
1
.
0
*
/
public class MainScreen extends JFrame implements ActionListener
{
private static final long serialVersionUID
=
-
1
2
9
9
3
1
4
4
0
4
8
3
5
6
0
4
8
5
5
L;
JRadioButton levels
[
]
=
new JRadioButton
[
3
]
;
String levelStrings
[
]
=
{
"Easy", "Normal", "Hard"
}
;
MainScreenPanel buttonPanel
=
null;
public MainScreen
(
)
{
buttonPanel
=
new MainScreenPanel
(
)
;
setDefaultCloseOperation
(
JFrame
.
EXIT
_
ON
_
CLOSE
)
;
setBounds
(
3
2
0
,
1
2
7
,
6
0
0
,
4
0
0
)
;
setResizable
(
false
)
;
buttonPanel.setBackground
(
Color
.
BLACK
)
;
for
(
int i
=
0
; i
<
levels.length; i
+
+
)
{
levels
[
i
]
=
new JRadioButton
(
levelStrings
[
i
]
)
;
levels
[
i
]
.
addActionListener
(
this
)
;
levels
[
i
]
.
setBackground
(
Color
.
YELLOW
)
;
levels
[
i
]
.
setBounds
(
2
6
0
,
2
0
0
+
i
*
5
0
,
8
0
,
3
0
)
;
buttonPanel.add
(
levels
[
i
]
)
;
}
buttonPanel.setLayout
(
null
)
;
getContentPane
(
)
.
add
(
buttonPanel
)
;
setVisible
(
true
)
;
}
public void actionPerformed
(
ActionEvent e
)
{
Object obj
=
e
.
getSource
(
)
;
if
(
obj
=
=
levels
[
0
]
)
{
new GameBoardWindow
(
1
)
;
setVisible
(
false
)
;
dispose
(
)
;
}
if
(
obj
=
=
levels
[
1
]
)
{
new GameBoardWindow
(
2
)
;
setVisible
(
false
)
;
dispose
(
)
;
}
if
(
obj
=
=
levels
[
2
]
)
{
new GameBoardWindow
(
3
)
;
setVisible
(
false
)
;
dispose
(
)
;
}
}
@SuppressWarnings
(
"
serial
"
)
class MainScreenPanel extends JPanel
{
MainScreenPanel
(
)
{
}
public void paintComponent
(
Graphics g
)
{
super.paintComponent
(
g
)
;
Graphics
2
D g
2
=
(
Graphics
2
D
)
g;
g
2
.
setColor
(
Color
.
RED
)
;
g
2
.
setFont
(
new Font
(
"
Comic Sans MS
"
,
Font.BOLD,
4
5
)
)
;
g
2
.
drawString
(
"
Snake
2
D Game",
1
3
5
,
8
5
)
;
g
2
.
setColor
(
Color
.
ORANGE
)
;
g
2
.
drawString
(
"
mtala
3
t
"
,
2
1
0
,
1
5
0
)
;
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!