-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
303 lines (255 loc) · 7.2 KB
/
Main.java
File metadata and controls
303 lines (255 loc) · 7.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
package project;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.*;
import java.io.File;
import java.util.*;
import javax.swing.*;
import java.util.concurrent.CountDownLatch;
class Node {
String data;
LinkedList<Node> child;
Node(String data){
this.data= data;
}
}
class Tree extends JFrame {
static HashMap<String, String> path = new HashMap<>();
static Scanner sc= new Scanner(System.in);
Node root= new Node("Main Topic");
void add() {
addFrame af = new addFrame(root);
af.setVisible(false);
Node ptr = root;
while (!af.isAdded) {
addFrame n =null;
if (af.userChoice != -1) {
int i = 0;
// n = new addFrame(ptr);
for (Node a : ptr.child) {
System.out.println(a.data);
if (af.userChoice == i) {
ptr = a;
af = new addFrame(ptr);
break;
}
i++;
}
}
}
}
static int exp = -1;
static JButton b1;
void display() {
Explore exp= new Explore();
Node ptr = root;
while (true) {
if (ptr.child == null) {
try {
Desktop.getDesktop().open(new File(path.get(ptr.data)));
} catch (Exception obj) {
System.out.println("File Is not Supported");
}
return;
}
displayMenu dm = new displayMenu(ptr.child);
while(dm.isActive()){
}
int index= dm.getIndex();
int idx = 1;
for (Node aa : ptr.child) {
ptr = aa;
if (index == idx) {
break;
}
idx++;
}
System.out.println(idx);
}
//}
}
void addLoop(Node ptr) {
ptr.child = new LinkedList<>();
ptr.child.addLast(new Node("While"));
ptr.child.addLast(new Node("Do while"));
ptr.child.addLast(new Node("For"));
}
void addll(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("Singly Linked List"));
ptr.child.addLast(new Node("Doubly Linked List"));
ptr.child.addLast(new Node("Singly Circular Linked List"));
ptr.child.addLast(new Node("Doubly Circular Linked List"));
}
void addQueue(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("Queue Using Array"));
ptr.child.addLast(new Node("Queue using LinkedList"));
ptr.child.addLast(new Node("Circular Queue"));
}
void adddsa(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("LinkedList"));
ptr.child.addLast(new Node("Stack"));
ptr.child.addLast(new Node("Queue"));
ptr.child.addLast(new Node("Tree"));
ptr.child.addLast(new Node("Graph"));
ptr.child.addLast(new Node("Heap"));
ptr.child.addLast(new Node("Hashing"));
for(Node a: ptr.child ){
if(a.data.equals("LinkedList")) {
addll(a);
}else if(a.data.equals("Tree")) {
addTree(a);
}else if(a.data.equals("Queue")) {
addQueue(a);
}
}
}
void addTree(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("N-ary Tree"));
ptr.child.addLast(new Node("Binary Tree"));
ptr.child.addLast(new Node("Binary Search Tree"));
}
void addarr(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("1-D Array"));
ptr.child.addLast(new Node("2-D Array"));
}
void addOpps(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("Inheritance"));
ptr.child.addLast(new Node("Polymorphism"));
ptr.child.addLast(new Node("Abstraction"));
ptr.child.addLast(new Node("Encapsulation"));
}
void addlink(Node ptr){
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("React js"));
ptr.child.addLast(new Node("Node js "));
}
void addBack(Node ptr){
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("JavaScript "));
ptr.child.addLast(new Node("PHP"));
}
void addFront(Node ptr){
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("Html "));
ptr.child.addLast(new Node("Css"));
}
void addWeb(Node ptr){
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("FrontEnd "));
ptr.child.addLast(new Node("BackEnd"));
ptr.child.addLast(new Node("Linking frontend and Backend"));
for(Node a :ptr.child) {
if(a.data.equalsIgnoreCase("FrontEnd ")) {
addFront(a);
}else if(a.data.equalsIgnoreCase("BackEnd")) {
addBack(a);
}else if(a.data.equalsIgnoreCase("Linking frontend and Backend")) {
addlink(a);
}
}
}
void addProgLang(Node ptr) {
ptr.child=new LinkedList<>();
ptr.child.addLast(new Node("Variables and DataTypes"));
ptr.child.addLast(new Node("Conditional Statements"));
ptr.child.addLast(new Node("Loops "));
ptr.child.addLast(new Node("Recursion "));
ptr.child.addLast(new Node("Array "));
for(Node a :ptr.child) {
if(a.data.equalsIgnoreCase("Loops ")) {
addLoop(a);
}else if(a.data.equalsIgnoreCase("Array ")){
addarr(a);
}
}
}
boolean isTrue(String un,String pwd) {
return un.equals("admin") && pwd.equals("admin@123");
}
void create(Tree t) {
Node ptr= t.root;
ptr.child= new LinkedList<>();
ptr.child.addLast(new Node("Basics of Programming Language"));
ptr.child.addLast(new Node("Web Development"));
ptr.child.addLast(new Node("Data Structures "));
ptr.child.addLast(new Node("OOPS "));
for(Node a : ptr.child){
if(a.data.equalsIgnoreCase("Basics of Programming Language")) {
addProgLang(a);
}else if(a.data.equalsIgnoreCase("Web Development")) {
addWeb(a);
}else if(a.data.equalsIgnoreCase("Data Structures ")) {
adddsa(a);
}else if(a.data.equalsIgnoreCase("OOPS ")) {
addOpps(a);
}
}
path.put("While","While.java");
path.put("Graph","Java Graph.pdf");
path.put("Do while","Do while.pdf");
path.put("For","For.pdf");
path.put("Singly Linked List","Singly.pdf");
path.put("Doubly Linked List","Doubly.pdf");
path.put("Singly Circular Linked List","Circular Singly.pdf");
path.put("Doubly Circular Linked List","Circular Doubly.pdf");
path.put("Queue Using Array","Queue Array.pdf");
path.put("Circular Queue","Circular Queue.pdf");
path.put("1-D Array","1d.pdf");
path.put("2-D Array","2d.pdf");
path.put("Conditional Statements","conditional.pdf");
path.put("Recursion ","recursion.pdf");
path.put("Stack","Java Stack.pdf");
path.put("N-ary Tree","Nary.pdf");
path.put("Binary Tree","Nary.pdf");
path.put("Binary Search Tree","BST.pdf");
path.put("Heap","Java heap.pdf");
path.put("Hashing","Java hashing.pdf");
path.put("Html ","HTML.pdf");
path.put("Css","CSS.pdf");
path.put("JavaScript ","javaScript.pdf");
path.put("PHP","PHP.pdf");
path.put("React js","ReactJS.pdf");
path.put("Node js ","Nodejs.pdf");
path.put("Inheritance","java Inheritance.pdf");
path.put("Polymorphism","Java Polymorphism.pdf");
path.put("Abstraction","java_abstraction.pdf");
path.put("Encapsulation","Java Encapsulation.pdf");
path.put("Variables and DataTypes","Variables.pdf");
}
}
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
Tree t = new Tree();
t.create(t);
while (true) {
Myframe f = new Myframe();
if (Myframe.admn) {
LoginScreen ls = new LoginScreen();
if (LoginScreen.isValid) {
adddelete chosen = new adddelete();
if (chosen.userchoice.equals("add")) {
System.out.println("reached ");
t.add();
}
}
}else {
t.display();
}
ExpMore em = new ExpMore();
if (em.choice == 0) {
continue;
}else {
ThankYou ty = new ThankYou();
break;
}
}
}
}