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)); } } } }
3 Antworten
+ 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
0
Ok but I want to run applet because that code is of my college assignment,so how can I run it?