How to run applet program of java in sololearn? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to run applet program of java in sololearn?

import java.awt.*; import java.applet.*; /* <applet code="GridLayoutDemo" width=300 height=200> </applet> */ public class GridLayoutDemo extends Applet { static final int n = 4; public void init() { setLayout(new GridLayout(n, n)); setFont(new Font("SansSerif", Font.BOLD, 24)); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { int k = i * n + j; if(k > 0) add(new Button("" + k)); } } } }

4th Aug 2020, 7:55 AM
Barry Allen
2 Answers
+ 1
1. SoloLearn playground cannot run graphical codes, except for web (javascript). You can only use console in Java. 2. Applets are deprecated because of serious security issues, so you should never ever use them. https://stackoverflow.com/questions/45535112/why-were-applets-deprecated-in-jdk-9
4th Aug 2020, 9:03 AM
Tibor Santa
Tibor Santa - avatar
0
Ok but I want to run applet because that code is of my college assignment,so how can I run it?
4th Aug 2020, 9:06 AM
Barry Allen