jython awt demo :

"""\
Create a panel showing all of the colors defined in the pawt.colors module
Display the names of bright colors in black and of dark colors in white
""" from java import awt
from pawt import colors, test
from math import sqrt p = awt.Panel()
for name in dir(colors):
color = getattr(colors, name)
if isinstance(color, awt.Color):
l = awt.Label(name, awt.Label.CENTER, background=color)
intensity = sqrt(color.red**2 + color.green**2 + color.blue**2)/3
if intensity < 90: l.foreground = colors.white
p.add(l) test(p, size=(700,500))

截图:

jython awt demo的更多相关文章

  1. JAVA 画图机制

    java学习脚印:深入java绘图机制 写在前面 封装性越好的类在使用时,只要清楚接口即可,而不应该让程序员了解其内部结构; 对于平常的绘图来讲,java绘图机制无需了解太多,但是朦胧容易产生错误,绘 ...

  2. Atitit.java图片图像处理attilax总结  BufferedImage extends java.awt.Image获取图像像素点image.getRGB(i, lineIndex); 图片剪辑/AtiPlatf_cms/src/com/attilax/img/imgx.javacutImage图片处理titit 判断判断一张图片是否包含另一张小图片 atitit 图片去噪算法的原理与

    Atitit.java图片图像处理attilax总结 BufferedImage extends java.awt.Image 获取图像像素点 image.getRGB(i, lineIndex); ...

  3. awt可视化界面上传数据到mysql,jsp通过jdbc方式查询数据库,并将结果打印在网页上

    今天尝试写一个小demo实现下之前看过的代码,目的了解不同文件的数据访问,掌握如何获取前台数据,如何将数据库的数据在前端页面展示. awt可视化界面可已实现提交数据到数据库,也可查询数据在控制台打印. ...

  4. java or spring +jython +python (Error:python.home,Determine if the following attributes are correct:)

    最近更新 :16年3月10日更 首先你在用JAVA,你需要运行Python,于是你找了Jython,我不介绍什么是Jythyon了 如何在Java中调用Python的方法,一百度一大堆, 如下:是一种 ...

  5. [REST Jersey] @QueryParam Demo

    This demo sourced from the jersey tutor. https://jersey.java.net/documentation/latest/jaxrs-resource ...

  6. JTable demo

    简单讲就是在没有使用layout manager的时候用setSize,在使用了layout manager 的时候用setPreferredSize 并且setPreferredSize通常和set ...

  7. JSplitPane demo

    package example; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; imp ...

  8. 【转】介绍Jython,第一部分:轻轻松松写JAVA程序

    本文转自:http://www.ibm.com/developerworks/cn/education/java/j-jython1/index.html 关于本教程 本教程介绍哪些内容? 这个两部分 ...

  9. 【转】Jython简单入门

    1. 用Jython调用Java类库 第一步.创建Java类 写一个简单的Java类,用Point来示例: import org.python.core.*; public class Point e ...

随机推荐

  1. 洛谷 P1052 过河 (离散化+dp)

    dp非常好想, f[i] = min(f[i-len] + stone[i]) s <= len <= t 然后因为L非常大,所以我就不知道该怎么搞了 我看到m只有100,而L有1e9,我 ...

  2. [MST] Test mobx-state-tree Models by Recording Snapshots or Patches

    Testing models is straightforward. Especially because MST provides powerful tools to track exactly h ...

  3. JBOSS部署项目之后,无法通过IP地址訪问,仅仅能通过localhost或者127.0.0.1訪问

    这几天入职到了一家新的公司,然后第一天就開始搭建各种环境.由于原先一直用的是Tomcat容器,然后也是第一次接触JBOSS容器,搭建完之后,在MyEclipse中启动了JBOSS容器,然后想在浏览器中 ...

  4. leetCode(38):Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BS ...

  5. Pleasant sheep and big big wolf

    pid=3046">点击打开链接 题目:在一个N * M 的矩阵草原上,分布着羊和狼.每一个格子仅仅能存在0或1仅仅动物.如今要用栅栏将全部的狼和羊分开.问怎么放,栅栏数放的最少,求出 ...

  6. 自己封装js组件 - 初级

    2天前抱着试试看的态度注册了此神博,心血来潮呕心沥血写了一篇关于vue 自定义组件的小文章 尼玛果然一个评论的没有!果然毫无人气!(当然了我这文章内容有限和大神们的比起来简直是粗制滥造...)索性我就 ...

  7. node03--http

    form.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  8. WinRar 设置默认的压缩格式为zip

    By default, WinRar uses the RAR archive format for compressing files. You may prefer using the more ...

  9. ELK搭建(filebeat、elasticsearch、logstash、kibana)

    ELK部署(文章有点儿长,搭建时请到官网将tar包下载好,按步骤可以完成搭建使用) ELK指的是ElasticSearch.LogStash.Kibana三个开源工具 LogStash是负责数据的收集 ...

  10. A list is a sequence

    Like a string, a list is a sequence of values. In a string, the values are characters; in a list, th ...