Ejemplo n.º 1
0
    def addSection(self, name, fontstyle=None):
        """Creates a new section in the Popup menu."""
        if self.isFirstSection:
            self.isFirstSection = False
        else:
            self.menu.addSeparator()  # menu.add(JSeparator()) ???

        label = JLabel(name)
        label.setLocation(4, 4)
        if fontstyle is not None:
            label.font = fontstyle
        self.applyStyle(label)
        self.menu.add(label)
Ejemplo n.º 2
0
class TextView(core.DataViewComponent):
    def __init__(self,view,name,func,args=(),label=None):
        core.DataViewComponent.__init__(self,label)
        self.view=view
        self.name=name
        self.func=func
        self.show_label=False
        self.update_label()
        self.data=self.view.watcher.watch(name,func,args=args)
        self.text_label=JLabel('',verticalAlignment=JLabel.CENTER,horizontalAlignment=JLabel.CENTER)
        self.text_label.font=Font('SansSerif',Font.BOLD,12)
        self.font_size=12
        self.add(self.text_label)

        self.popup.add(JPopupMenu.Separator())
        self.popup.add(JMenuItem('larger',actionPerformed=self.increase_font))
        self.popup.add(JMenuItem('smaller',actionPerformed=self.decrease_font))

    def increase_font(self,event):
        self.font_size+=2
        self.text_label.font=Font('SansSerif',Font.BOLD,self.font_size)
    def decrease_font(self,event):
        if self.font_size<7: return
        self.font_size-=2
        self.text_label.font=Font('SansSerif',Font.BOLD,self.font_size)


    def paintComponent(self,g):
        core.DataViewComponent.paintComponent(self,g)
        data=self.data.get(start=self.view.current_tick,count=1)[0]
        self.text_label.setSize(self.width,self.height-self.label_offset)
        self.text_label.setLocation(0,self.label_offset)
        self.text_label.text=data


    def save(self):
        info = core.DataViewComponent.save(self)
        info['font_size']=self.font_size
        return info

    def restore(self,d):
        core.DataViewComponent.restore(self,d)
        self.font_size=d.get('font_size',12)
        self.text_label.font=Font('SansSerif',Font.BOLD,self.font_size)
Ejemplo n.º 3
0
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)

showReportButton = JButton("Tampilkan Matriks", actionPerformed=pelapor)
showReportButton.setSize(140, 21)
showReportButton.setLocation(157, 401)
showReportButton.setFont(regFont)

# All Text Fields Belong Here
pemecahanKunci = JLabel("Pemecahan kunci")
pemecahanKunci.setLocation(26, 91)
pemecahanKunci.setSize(130, 21)
pemecahanKunci.setFont(boldenFont)

alphaLabel = JLabel("Kunci publik alpha")
alphaLabel.setLocation(26, 122)  #(26, 91)
Ejemplo n.º 4
0
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)
skripsiLabel.setLocation(0, 80)

logo = JLabel("<html><center></html>", JLabel.CENTER)
logoFakultas = ImageIcon("D:\\logo.jpg")
logo.setIcon(logoFakultas)
logo.setSize(610, 200)
logo.setLocation(0, 145)
#logo.setOpaque(True)

namaLabel = JLabel(
# 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
naiveHeader = JLabel("<html><center>Naive Form<html>", JLabel.CENTER)
naiveHeader.setSize(924, 55)
naiveHeader.setFont(formHeaderFont)
naiveHeader.setLocation(21, 21)
#naiveHeader.setBorder(BorderFactory.createLineBorder(Color.BLACK))

label1 = JLabel("Pembangkitan Kunci")
label1.setFont(specialFont)
label1.setSize(140, 15)
label1.setLocation(21, 91)

#bit Prima
bitPrimaLabel = JLabel("bit Prima")
bitPrimaLabel.setLocation(26, 114)
bitPrimaLabel.setSize(100, 13)
bitPrimaLabel.setFont(regFont)

bitPrima = awt.TextField(10)
bitPrima.setLocation(157, 114)