def actionPerformed(self, e): bugs_tab = self.tabbed_panes[self.key].getComponentAt(1) tab_count = str(bugs_tab.getTabCount()) request_tab = self.view.set_request_tab_pane(self.request_response) response_tab = self.view.set_response_tab_pane(self.request_response) bugs_tabbed_pane = self.view.set_bugs_tabbed_pane(request_tab, response_tab) bugs_tab.add(tab_count, bugs_tabbed_pane) index = bugs_tab.indexOfTab(tab_count) panel_tab = JPanel(GridBagLayout()) panel_tab.setOpaque(False) label_title = JLabel(tab_count) # Create a button to close tab button_close = JButton("x") button_close.setToolTipText("Close tab") button_close.setOpaque(False); button_close.setContentAreaFilled(False); button_close.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) button_close.setPreferredSize(Dimension(18, 18)) button_close.setMargin(Insets(0, 0, 0, 0)) button_close.setForeground(Color.gray) panel_tab.add(label_title) panel_tab.add(button_close) bugs_tab.setTabComponentAt(index, panel_tab) button_close.addMouseListener(CloseTab(button_close, bugs_tab))
def reloadJPanel(game,dialog,node): c = JPanel() c.setBackground(Color.BLACK) layout = createLayoutManager(c,node.getAttribute("layout") if node.hasAttribute("layout") else "flow") c.setLayout(layout) c.setOpaque(False) if node.getAttribute("opaque"): c.setOpaque(node.getAttribute("opaque")=="true") if node.getAttribute("background"): if(node.getAttribute("background")=="orange"): c.setBackground(Color.ORANGE) elif(node.getAttribute("background")=="green"): c.setBackground(Color.GREEN) for child in node.childNodes: if child.nodeName!="#text": if node.getAttribute("layout")=="gridbag": c.add(reloadComponent(game,dialog,child),getGridBagConstraints(game,child)) else: c.add(reloadComponent(game,dialog,child))
def actionPerformed(self, e): bugs_tab = self.tabbed_panes[self.key].getComponentAt(1) tab_count = str(bugs_tab.getTabCount()) request_tab = self.view.set_request_tab_pane(self.request_response) response_tab = self.view.set_response_tab_pane(self.request_response) bugs_tabbed_pane = self.view.set_bugs_tabbed_pane( request_tab, response_tab) bugs_tab.add(tab_count, bugs_tabbed_pane) index = bugs_tab.indexOfTab(tab_count) panel_tab = JPanel(GridBagLayout()) panel_tab.setOpaque(False) label_title = JLabel(tab_count) button_close = JButton("x") button_close.setBorder(None) panel_tab.add(label_title) panel_tab.add(button_close) bugs_tab.setTabComponentAt(index, panel_tab) button_close.addActionListener(CloseTab(bugs_tab))
class SourceCellRenderer(TreeCellRenderer): def __init__(self,tree,mapContext): self.tree = tree self.mapContext = mapContext ## Group self.lblFolder = JLabel() self.lblFolder.setBackground(Color(222,227,233)) #.BLUE.brighter()) self.lblFolder.setOpaque(True) self.lblFolder.setText("plddddddddddddddddddddddddddddddddddddddddddddddddddddddd") ### Folder self.pnlFolder = JPanel() self.pnlFolder.setOpaque(False) self.pnlFolder.setLayout(FlowLayout(FlowLayout.LEFT)) self.lblGroup = JLabel() #self.lblGroup.setBackground(Color(222,227,233)) #.BLUE.brighter()) #self.lblGroup.setOpaque(True) self.lblGroup.setText("plddddddddddddddddddddddddddddddddddddddddddddddddddddddd") self.lblGroupPreferredSize = self.lblGroup.getPreferredSize() self.lblGroupIcon = JLabel() self.pnlFolder.add(self.lblGroupIcon) self.pnlFolder.add(self.lblGroup) #self.lblGroup.setBorder( # BorderFactory.createLineBorder(Color(222,227,233).darker(),1) #) #self.lblGroupPreferredSize.setSize(30,200)#self.lblGroupPreferredSize.getHeight()+4, self.lblGroupPreferredSize.getWidth()) ### LAYER self.pnlLayer = JPanel() self.pnlLayer.setOpaque(False) #self.pnlLayer.setBorder(EmptyBorder(2,2,2,2)) self.pnlLayer.setLayout(FlowLayout(FlowLayout.LEFT)) self.chkLayerVisibility = JCheckBox() self.chkLayerVisibility.setOpaque(False) self.pnlLayer.add(self.chkLayerVisibility) self.lblLayerIcon = JLabel() self.lblLayerName = JLabel() self.pnlLayer.add(self.lblLayerIcon) self.pnlLayer.add(self.lblLayerName) #self.tree.setRowHeight(int(self.pnlLayer.getPreferredSize().getHeight())) #+2 self.tree.setRowHeight(int(self.pnlFolder.getPreferredSize().getHeight())) self.lblUnknown = JLabel() def getTreeCellRendererComponent(self, tree, value, selected, expanded, leaf, row, hasFocus): uo = value.getUserObject() if isinstance(uo, DataFolder): #self.lblFolder.setText(uo.getName()) text = "[" + str(value.getChildCount()) +"] " + uo.getName() self.lblFolder.setText(text) self.lblFolder.setPreferredSize(self.lblGroupPreferredSize) if uo.getIcon()!=None: self.lblGroupIcon.setIcon(uo.getIcon()) else: self.lblGroupIcon.setIcon(getIconByName("librarybrowser-folder")) #icon-folder-open")) return self.lblFolder if isinstance(uo, DataGroup): self.lblGroup.setText(uo.getName()) self.lblGroup.setPreferredSize(self.lblGroupPreferredSize) if uo.getIcon()!=None: self.lblGroupIcon.setIcon(uo.getIcon()) else: #import pdb #pdb.set_trace() self.lblGroupIcon.setIcon(getIconByName("librarybrowser-folder")) #icon-folder-open")) return self.pnlFolder if isinstance(uo, DataLayer): layer = uo.getLayer() self.lblLayerName.setText(layer.getName()) self.lblLayerIcon.setIcon(getIconFromLayer(layer)) self.chkLayerVisibility.setSelected(layer.isVisible()) if layer.isWithinScale(self.mapContext.getScaleView()): # and layer.isVisible(): self.chkLayerVisibility.setEnabled(True) else: self.chkLayerVisibility.setEnabled(False) self.lblLayerName.setForeground(Color.BLACK) font = self.lblLayerName.getFont() self.lblLayerName.setForeground(Color.BLACK) if layer.isEditing(): self.lblLayerName.setForeground(Color.RED) if layer.isActive() and font.isBold(): pass elif layer.isActive() and not font.isBold(): newfont = font.deriveFont(Font.BOLD) self.lblLayerName.setFont(newfont) else: newfont = font.deriveFont(Font.PLAIN) self.lblLayerName.setFont(newfont) #self.pnlLayer.repaint() return self.pnlLayer self.lblUnknown.setText("") self.lblUnknown.setPreferredSize(Dimension(0,0)) return self.lblUnknown
timeReporter += "Runtime = " timeReporter += str(hackTimer1 - hackTimer0) timeReporter += " s" JOptionPane.showMessageDialog(mainForm, timeReporter, "Pemberitahuan", JOptionPane.ERROR_MESSAGE) except: JOptionPane.showMessageDialog(mainForm, "Gagal memecahkan kunci", "Pemberitahuan", JOptionPane.ERROR_MESSAGE) mainForm = JFrame("Hacker Form", size=(987, 610)) myPanel = JPanel() myPanel.setOpaque(True) myPanel.setBackground(Color.WHITE) myPanel.setLayout(None) # All Events Belong Here # All Buttons Belong Here hackButton = JButton("Pecahkan Kunci", actionPerformed=react) hackButton.setSize(243, 55) hackButton.setLocation(62, 307) hackButton.setFont(regFont) laporan = JLabel("Laporan Pemecahan Kunci") laporan.setSize(200, 21) laporan.setLocation(26, 376) laporan.setFont(boldenFont)
Created on Sep 23, 2016 @author: win3a1 ''' from javax.swing import JFrame, JLabel, JPanel, ImageIcon from java.awt import Color, Font theFont = Font("Arial", Font.BOLD, 19) elFont = Font("Arial", Font.BOLD, 23) aboutForm = JFrame("About", size=(610, 610)) aboutPanel = JPanel() aboutPanel.setOpaque(True) aboutPanel.setBackground(Color.WHITE) aboutPanel.setLayout(None) judul1Label = JLabel( "<html><center>TEKNIK PEMECAHAN KUNCI ALGORITMA ELGAMAL<br>DENGAN METODE INDEX CALCULUS</html>", JLabel.CENTER) #judul1Label.setOpaque(True) judul1Label.setFont(theFont) judul1Label.setSize(610, 70) judul1Label.setLocation(0, 10) skripsiLabel = JLabel("SKRIPSI", JLabel.CENTER) skripsiLabel.setFont(theFont) skripsiLabel.setSize(610, 50) #skripsiLabel.setOpaque(True)
#white = Color.WHITE() #meinFont.setColor(Color.WHITE) #myICTable = JTable() tabbedPane = JTabbedPane() tabbedPane.setSize(377, 377) tabbedPane.setLocation(15, 5) tabbedPane.setVisible(True) #panel1 p1 = JPanel() p1.setOpaque(True) p1.setBackground(Color.WHITE) p1.setLayout(None) p1.setSize(357, 337) p1.setLocation(0, 0) p1.setVisible(True) generatedMatrix = awt.TextArea("-",7,7) scrollPane1 = JScrollPane(generatedMatrix) try: generatedMatrix.text = string1#myIOControl.derDrucker(gIC, gFB, gGamma) except: print "Gagal melaporkan tahap 1" generatedMatrix.setSize(393, 331) generatedMatrix.setLocation(5, 5)
class SelectionCellRenderer(TreeCellRenderer): def __init__(self, tree, mapContext): self.tree = tree self.mapContext = mapContext self.lblGroup = JLabel() self.lblGroup.setBackground(Color(222, 227, 233)) #.BLUE.brighter()) self.lblGroup.setOpaque(True) self.lblGroup.setText( "plddddddddddddddddddddddddddddddddddddddddddddddddddddddd") self.lblGroupPreferredSize = self.lblGroup.getPreferredSize() #h = self.lblGroupPreferredSize.getHeight() #w = self.lblGroupPreferredSize.getWidth() #self.lblGroupPreferredSize.setSize(h, w) self.pnlLayer = JPanel() self.pnlLayer.setOpaque(False) self.pnlLayer.setLayout(FlowLayout(FlowLayout.LEFT)) self.lblClean = JLabel() self.chkLayerVisibility = JCheckBox() self.chkLayerVisibility.setOpaque(False) self.lblLayerName = JLabel() self.lblLayerIcon = JLabel() self.lblFeatureSelecteds = JLabel() self.pnlLayer.add(self.chkLayerVisibility) self.pnlLayer.add(self.lblClean) self.pnlLayer.add(self.lblFeatureSelecteds) self.pnlLayer.add(self.lblLayerIcon) self.pnlLayer.add(self.lblLayerName) self.tree.setRowHeight( int(self.pnlLayer.getPreferredSize().getHeight()) - 3) self.lblUnknown = JLabel() ## Feature self.lblFeatureIcon = JLabel() self.lblFeatureName = JLabel() i18n = ToolsLocator.getI18nManager() self.lblFeatureName.setText(i18n.getTranslation("_Feature")) self.pnlFeature = JPanel() self.pnlFeature.setOpaque(False) self.pnlFeature.setLayout(FlowLayout(FlowLayout.LEFT)) self.pnlFeature.add(self.lblFeatureIcon) self.pnlFeature.add(self.lblFeatureName) def getTreeCellRendererComponent(self, tree, value, selected, expanded, leaf, row, hasFocus): uo = value.getUserObject() if isinstance(uo, DataGroup): text = "[" + str(value.getChildCount()) + "] " + uo.getName() self.lblGroup.setText(text) self.lblGroup.setPreferredSize(self.lblGroupPreferredSize) return self.lblGroup if isinstance(uo, DataLayer): layer = uo.getLayer() self.lblLayerName.setText(uo.getName()) self.lblLayerIcon.setIcon(getIconFromLayer(layer)) if layer.isVisible(): self.lblLayerName.setEnabled(True) else: self.lblLayerName.setEnabled(False) self.lblClean.setIcon(getIconByName("edit-clear")) self.chkLayerVisibility.setSelected(layer.isVisible()) if layer.isWithinScale( self.mapContext.getScaleView()): # and layer.isVisible(): self.chkLayerVisibility.setEnabled(True) else: self.chkLayerVisibility.setEnabled(False) if layer.getDataStore() != None and layer.getDataStore( ).getSelection() != None and layer.getDataStore().getSelection( ).getSize() != 0: # and layer.isVisible(): self.lblClean.setEnabled(True) self.lblFeatureSelecteds.setText( str(layer.getDataStore().getSelection().getSize())) self.lblFeatureSelecteds.setEnabled(True) else: self.lblClean.setEnabled(False) self.lblFeatureSelecteds.setText("0") self.lblFeatureSelecteds.setEnabled(False) font = self.lblLayerName.getFont() self.lblLayerName.setForeground(Color.BLACK) if layer.isEditing(): self.lblLayerName.setForeground(Color.RED) #if layer.isActive(): if layer.isActive(): # and not font.isBold(): newfont = font.deriveFont(Font.BOLD) self.lblLayerName.setFont(newfont) else: newfont = font.deriveFont(Font.PLAIN) self.lblLayerName.setFont(newfont) return self.pnlLayer if isinstance(uo, FeatureDataLayerNode): self.lblFeatureName.setText(uo.getFeature().toString()) self.lblFeatureIcon.setIcon(getIconByName("edit-clear")) return self.pnlFeature self.lblUnknown.setText("") self.lblUnknown.setPreferredSize(Dimension(0, 0)) return self.lblUnknown
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": c = JPanel() c.setBackground(Color.BLACK) layout = createLayoutManager(c,node.getAttribute("layout") if node.hasAttribute("layout") else "flow") c.setLayout(layout) c.setOpaque(False) if node.getAttribute("opaque"): c.setOpaque(node.getAttribute("opaque")=="true") if node.getAttribute("background"): if(node.getAttribute("background")=="orange"): c.setBackground(Color.ORANGE) elif(node.getAttribute("background")=="green"): c.setBackground(Color.GREEN) for child in node.childNodes: if child.nodeName!="#text": if node.getAttribute("layout")=="gridbag": c.add(reloadComponent(game,dialog,child),getGridBagConstraints(game,child)) else: c.add(reloadComponent(game,dialog,child)) elif node.nodeName=="jlabel": c = JLabel(text,align) elif node.nodeName=="jbutton": c = JButton(text) if node.hasAttribute("enabled"): c.setEnabled(node.getAttribute("enabled")=="true"); 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=="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;
intToPrint += encryptedMessage[i][1] myString += encryptedMessage[i][1] if (i % 5 == 0): intToPrint += "\n" print "ini pesan:", intToPrint pesanTerenkripsi.setText("") pesanTerenkripsi.text = intToPrint except (RuntimeError, TypeError, NameError): print "eror gan" naiveForm = JFrame("Naive Form", size=(987, 610)) naiveFormPanel = JPanel() naiveFormPanel.setLocation(0, 0) naiveFormPanel.setOpaque(True) naiveFormPanel.setBackground(Color.WHITE) naiveFormPanel.setLayout(None) # All Text Fields Belong Here betaTextField = awt.TextField(20) betaTextField.setLocation(454, 278) betaTextField.setSize(233, 13) betaTextField.setFont(regFont) primaTextField = awt.TextField(20) primaTextField.setLocation(454, 325) primaTextField.setSize(233, 34) primaTextField.setFont(regFont) # All Labels Belongs Here
informasi = JFrame("Informasi", size=(610, 610)) informasi.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) informasiPane = JPanel() informasiTabbedPane = JTabbedPane() informasiTabbedPane.setSize(610, 600) informasiTabbedPane.setLocation(0, 0) #global regFont #regFont = awt.Font("Arial", Font.PLAIN, 13) #panel1 mainFormHelper = JPanel() mainFormHelper.setOpaque(True) mainFormHelper.setLayout(None) informasiTabbedPane.addTab("Halaman Utama", mainFormHelper) mainFormHelper.setSize(610, 599) mainFormHelper.setLocation(0, 0) naiveFormHelper = JPanel() naiveFormHelper.setOpaque(True) naiveFormHelper.setLayout(None) informasiTabbedPane.addTab("Naive Form", naiveFormHelper) naiveFormHelper.setSize(610, 599) naiveFormHelper.setSize(0, 0) hackerFormHelper = JPanel() hackerFormHelper.setOpaque(True) hackerFormHelper.setLayout(None)