def reloadComponent(game,dialog,node): c = None text = node.getAttribute("text") if node.hasAttribute("text") else "" align = int(node.getAttribute("align")) if node.hasAttribute("align") else 0 #Components if node.nodeName=="jpanel": reloadJPanel(game,dialog,node) elif node.nodeName=="jlabel": c = JLabel(text,align) elif node.nodeName=="settingspanel": c = SettingsPanel(game) for g in node.childNodes: if g.nodeName=="group": c.addGroup(int(g.getAttribute("id")),g.getAttribute("label")) for h in g.childNodes: if h.nodeName=="heading": c.addHeading(int(g.getAttribute("id")),h.getAttribute("label")) for s in h.childNodes: if s.nodeName=="setting": #<setting id="1" name="DISPLAY_REAL_WORLD_TIME" type="checkbox" label="Show Real-World Time"></setting> if s.getAttribute("items")!="": c.addSettingWithItems(int(g.getAttribute("id")),int(s.getAttribute("id")),s.getAttribute("label"),s.getAttribute("type"),s.getAttribute("items").split(",")) else: c.addSetting(int(g.getAttribute("id")),int(s.getAttribute("id")),s.getAttribute("label"),s.getAttribute("type")) c.finalizeSettingsPanel() dialog.registerSettingsPanel(int(node.getAttribute("id")),c) elif node.nodeName=="logspanel": c = LogsPanel(game) for g in node.childNodes: if g.nodeName=="group": c.addLog(int(g.getAttribute("id")),g.getAttribute("label")) c.finalizeLogsPanel() dialog.registerLogsPanel(int(node.getAttribute("id")),c) elif node.nodeName=="jbutton": reloadJButton(game,dialog,node,text,align) elif node.nodeName=="nglcanvas": c = NGLCanvas(game,int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height"))) dialog.registerCanvas(int(node.getAttribute("id")),c) #Layout if node.parentNode.getAttribute("layout")=="absolute": c.setBounds(getBounds(game,node)) elif node.parentNode.getAttribute("layout")=="box-y": c.setAlignmentX(Component.CENTER_ALIGNMENT); if node.hasAttribute("width") and node.hasAttribute("height"): c.setPreferredSize(Dimension(int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height")))) if node.hasAttribute("minWidth") and node.hasAttribute("minHeight"): c.setMinimumSize(Dimension(int(node.getAttribute("minWidth")),int(node.getAttribute("minHeight")))) if node.hasAttribute("maxWidth") and node.hasAttribute("maxHeight"): c.setMaximumSize(Dimension(int(node.getAttribute("maxWidth")),int(node.getAttribute("maxHeight")))) elif node.parentNode.getAttribute("layout")=="box-x": c.setAlignmentY(Component.CENTER_ALIGNMENT); if node.hasAttribute("width") and node.hasAttribute("height"): c.setPreferredSize(Dimension(int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height")))) if node.hasAttribute("minWidth") and node.hasAttribute("minHeight"): c.setMinimumSize(Dimension(int(node.getAttribute("minWidth")),int(node.getAttribute("minHeight")))) if node.hasAttribute("maxWidth") and node.hasAttribute("maxHeight"): c.setMaximumSize(Dimension(int(node.getAttribute("maxWidth")),int(node.getAttribute("maxHeight")))) if node.nodeName!="nglcanvas" and node.nodeName!="jpanel" and node.nodeName!="settingspanel": addListeners(game,c,node) return c;
myLabel = JLabel("Isi pesan terenkripsi") myLabel.setFont(specialFont) myLabel.setLocation(642, 91) myLabel.setSize(200, 20) plainText = TextArea("n/a") plainText.setSize(300, 400) plainText.setLocation(642, 114) plainText.setFont(subSpecialFont) # All Labels Belongs Here hackingHeader = JLabel("<html><center>Hacker Form<html>", JLabel.CENTER) hackingHeader.setSize(924, 55) hackingHeader.setFont(formHeaderFont) hackingHeader.setAlignmentY(34) hackingHeader.setLocation(21, 21) # All Form Belong Here mainForm.setContentPane(myPanel) mainForm.locationByPlatform = True # Put Objects Altogether on Panel myPanel.add(alphaTextField) myPanel.add(hackButton) myPanel.add(alphaLabel) myPanel.add(betaLabel) myPanel.add(primaLabel) myPanel.add(betaTextField) myPanel.add(primaTextField) myPanel.add(hackingHeader)
mainForm.dispose() aboutForm.aboutForm.setVisible(True) #form and panel construction mainForm = JFrame("Halaman Utama", size=(987,610), ) myPanel = JPanel() myPanel.setOpaque(True) myPanel.setBackground(Color.WHITE) myPanel.setLayout(None) message = JLabel("<html><center>Teknik Pemecahan Kunci Algoritma ElGamal <br>Dengan Metode Index Calculus<html>", JLabel.CENTER) message.setSize(987, 144) message.setFont(myFont) #message.setAlignmentX(433) message.setAlignmentY(34) mainForm.setContentPane(myPanel) #mainForm.setSize(310, 125) mainForm.locationByPlatform=True mainForm.visible=True #buttons creation button1 = JButton("Naive User", actionPerformed=naiveButton) button1.setSize(233,145) button1.setLocation(226, 233) button1.setFont(myFont) button2 = JButton("Hacker", actionPerformed=hackerButton) button2.setSize(233,145)