Python java.awt.Dimension() Examples

The following are 18 code examples of java.awt.Dimension(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module java.awt , or try the search function .
Example #1
Source File: test_java_subclasses.py    From CTFCrackTools with GNU General Public License v3.0 6 votes vote down vote up
def test_multiple_inheritance_prohibited(self):
        try:
            class MultiJava(Dimension, Color):
                pass
            self.fail("Shouldn't be able to subclass more than one concrete java class")
        except TypeError:
            pass

        class PyDim(Dimension):
            pass
        class PyDimRun(PyDim, Runnable):
            pass
        try:
            class PyDimRunCol(PyDimRun, Color):
                pass
            self.fail("Shouldn't be able to subclass more than one concrete java class")
        except TypeError:
            pass 
Example #2
Source File: test_jbasic.py    From CTFCrackTools with GNU General Public License v3.0 6 votes vote down vote up
def test_get_set(self):
        d = Dimension(3, 9)
        self.assertEquals(d.width, 3)
        self.assertEquals(d.height, 9)
        d.width = 42
        self.assertEquals(d.width, 42)
        self.assertEquals(d.height, 9)

        try:
            d.foo
        except AttributeError:
            pass
        else:
            raise AssertionError('d.foo should throw type error')

    # Used in test_java_bean_properties. 
Example #3
Source File: test_java_subclasses.py    From CTFCrackTools-V2 with GNU General Public License v3.0 6 votes vote down vote up
def test_multiple_inheritance_prohibited(self):
        try:
            class MultiJava(Dimension, Color):
                pass
            self.fail("Shouldn't be able to subclass more than one concrete java class")
        except TypeError:
            pass

        class PyDim(Dimension):
            pass
        class PyDimRun(PyDim, Runnable):
            pass
        try:
            class PyDimRunCol(PyDimRun, Color):
                pass
            self.fail("Shouldn't be able to subclass more than one concrete java class")
        except TypeError:
            pass 
Example #4
Source File: test_jbasic.py    From CTFCrackTools-V2 with GNU General Public License v3.0 6 votes vote down vote up
def test_get_set(self):
        d = Dimension(3, 9)
        self.assertEquals(d.width, 3)
        self.assertEquals(d.height, 9)
        d.width = 42
        self.assertEquals(d.width, 42)
        self.assertEquals(d.height, 9)

        try:
            d.foo
        except AttributeError:
            pass
        else:
            raise AssertionError('d.foo should throw type error')

    # Used in test_java_bean_properties. 
Example #5
Source File: test_java_integration.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_class_in_failed_constructor(self):
        try:
            Dimension(123, 456, 789)
        except TypeError, exc:
            self.failUnless("java.awt.Dimension" in exc.message) 
Example #6
Source File: test_java_integration.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_awt_hack(self):
        # We ignore several deprecated methods in java.awt.* in favor of bean properties that were
        # addded in Java 1.1.  This tests that one of those bean properties is visible.
        c = Container()
        c.size = 400, 300
        self.assertEquals(Dimension(400, 300), c.size) 
Example #7
Source File: test_java_integration.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_class_in_failed_constructor(self):
        try:
            Dimension(123, 456, 789)
        except TypeError, exc:
            self.failUnless("java.awt.Dimension" in exc.message) 
Example #8
Source File: swing.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test(panel, size=None, name='Swing Tester'):
    f = swing.JFrame(name, windowClosing=lambda event: sys.exit(0))
    if hasattr(panel, 'init'):
        panel.init()

    f.contentPane.add(panel)
    f.pack()
    if size is not None:
        from java import awt
        f.setSize(apply(awt.Dimension, size))
    f.setVisible(1)
    return f 
Example #9
Source File: __init__.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test(panel, size=None, name='AWT Tester'):
    f = awt.Frame(name, windowClosing=lambda event: sys.exit(0))
    if hasattr(panel, 'init'):
        panel.init()

    f.add('Center', panel)
    f.pack()
    if size is not None:
        f.setSize(apply(awt.Dimension, size))
    f.setVisible(1)
    return f 
Example #10
Source File: test_java_integration.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_awt_hack(self):
        # We ignore several deprecated methods in java.awt.* in favor of bean properties that were
        # addded in Java 1.1.  This tests that one of those bean properties is visible.
        c = Container()
        c.size = 400, 300
        self.assertEquals(Dimension(400, 300), c.size) 
Example #11
Source File: SpyDir.py    From SpyDir with MIT License 5 votes vote down vote up
def p_build_ui(self, event):
        """
        Adds a list of checkboxes, one for each loaded plugin
        to the Selct plugins window
        """
        if not self.loaded_p_list:
            self.update_scroll("[!!] No plugins loaded!")
            return

        scroll_pane = JScrollPane()
        scroll_pane.setPreferredSize(Dimension(200, 250))
        check_frame = JPanel(GridBagLayout())
        constraints = GridBagConstraints()
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridy = 0
        constraints.anchor = GridBagConstraints.FIRST_LINE_START

        for plug in self.loaded_p_list:
            check_frame.add(JCheckBox(plug.get_name(), plug.enabled,
                                      actionPerformed=self.update_box),
                            constraints)
            constraints.gridy += 1

        vport = JViewport()
        vport.setView(check_frame)
        scroll_pane.setViewport(vport)
        self.window.contentPane.add(scroll_pane)
        self.window.pack()
        self.window.setVisible(True) 
Example #12
Source File: swing.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test(panel, size=None, name='Swing Tester'):
    f = swing.JFrame(name, windowClosing=lambda event: sys.exit(0))
    if hasattr(panel, 'init'):
        panel.init()

    f.contentPane.add(panel)
    f.pack()
    if size is not None:
        from java import awt
        f.setSize(apply(awt.Dimension, size))
    f.setVisible(1)
    return f 
Example #13
Source File: __init__.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test(panel, size=None, name='AWT Tester'):
    f = awt.Frame(name, windowClosing=lambda event: sys.exit(0))
    if hasattr(panel, 'init'):
        panel.init()

    f.add('Center', panel)
    f.pack()
    if size is not None:
        f.setSize(apply(awt.Dimension, size))
    f.setVisible(1)
    return f 
Example #14
Source File: test_java_subclasses.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_auto_super(self):
        class Implicit(Rectangle):
            def __init__(self):
                self.size = Dimension(6, 7)
        class Explicit(Rectangle):
            def __init__(self):
                Rectangle.__init__(self, 6, 7)
        self.assert_("width=6,height=7" in Implicit().toString())
        self.assert_("width=6,height=7" in Explicit().toString()) 
Example #15
Source File: test_java_integration.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_awt_hack(self):
        # We ignore several deprecated methods in java.awt.* in favor of bean properties that were
        # addded in Java 1.1.  This tests that one of those bean properties is visible.
        c = Container()
        c.size = 400, 300
        self.assertEquals(Dimension(400, 300), c.size) 
Example #16
Source File: test_java_integration.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_class_in_failed_constructor(self):
        try:
            Dimension(123, 456, 789)
        except TypeError, exc:
            self.failUnless("java.awt.Dimension" in exc.message) 
Example #17
Source File: swing.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test(panel, size=None, name='Swing Tester'):
    f = swing.JFrame(name, windowClosing=lambda event: sys.exit(0))
    if hasattr(panel, 'init'):
        panel.init()

    f.contentPane.add(panel)
    f.pack()
    if size is not None:
        from java import awt
        f.setSize(apply(awt.Dimension, size))
    f.setVisible(1)
    return f 
Example #18
Source File: __init__.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test(panel, size=None, name='AWT Tester'):
    f = awt.Frame(name, windowClosing=lambda event: sys.exit(0))
    if hasattr(panel, 'init'):
        panel.init()

    f.add('Center', panel)
    f.pack()
    if size is not None:
        f.setSize(apply(awt.Dimension, size))
    f.setVisible(1)
    return f