Example #1
0
    def __init__(self, title, units, controller):
        self.units = units
        self.controller = controller

        bag = GridBag(self, fill='HORIZONTAL')

        label = awt.Label(title, awt.Label.CENTER)
        bag.addRow(label)

        self.text = awt.TextField('0', 10, actionListener=self)
        bag.add(self.text, weightx=1.0)

        self.chooser = awt.Choice(itemListener=self)
        for name, multiplier in units:
            self.chooser.add(name)
        bag.addRow(self.chooser)

        self.slider = awt.Scrollbar(awt.Scrollbar.HORIZONTAL,
                                    maximum=self.max + 10,
                                    blockIncrement=self.block,
                                    adjustmentListener=self)
        bag.add(self.slider)
Example #2
0
    else:
        return java.lang.Integer.parseInt(t)


def doMath(e):
    n1 = getField(f1)
    n2 = getField(f2)
    sum.setText(repr(n1 + n2))
    diff.setText(repr(n1 - n2))
    prod.setText(repr(n1 * n2))
    quo.setText(repr(n1 / n2))


f = awt.Frame('BSH Calculator (jpython)', windowClosing=exit)

f1 = awt.TextField(20, actionPerformed=doMath)
f2 = awt.TextField(20, textValueChanged=doMath)

p = awt.Panel()
p.setLayout(awt.GridLayout(2, 2))
p.add(awt.Label('Enter Operand'))
p.add(f1)
p.add(awt.Label('Enter Operand'))
p.add(f2)

f.add('North', p)

f.add("Center", awt.Label('Results:'))

p = awt.Panel()
p.setLayout(awt.GridLayout(4, 2))
Example #3
0
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)
alphaLabel.setSize(130, 21)
alphaLabel.setFont(regFont)

alphaTextField = awt.TextField("Alpha", 10)
alphaTextField.setLocation(157, 122)  #(157, 91)
alphaTextField.setSize(140, 21)
alphaTextField.setFont(regFont)

betaLabel = JLabel("Kunci publik beta")
betaLabel.setLocation(26, 159)
betaLabel.setSize(130, 21)
betaLabel.setFont(regFont)

betaTextField = awt.TextField("Beta", 10)
betaTextField.setLocation(157, 159)
betaTextField.setSize(140, 21)
betaTextField.setFont(regFont)

primaLabel = JLabel("Prima")
Example #4
0
        g.drawString("Invalid Expression", x, y)

    def setExpression(self, e):
        "@sig public void setExpression(java.lang.String e)"
        try:
            self.function = eval('lambda x: ' + e)
        except:
            self.function = None
        self.repaint()


if __name__ == '__main__':

    def enter(e):
        graph.setExpression(expression.text)
        expression.caretPosition = 0
        expression.selectAll()

    p = awt.Panel(layout=awt.BorderLayout())
    graph = Graph()
    p.add(graph, 'Center')

    expression = awt.TextField(text='(sin(3*x)+cos(x))/2',
                               actionPerformed=enter)
    p.add(expression, 'South')

    import pawt
    pawt.test(p, size=(300, 300))

    enter(None)
        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
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))