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. Unity 制作安装程序和卸载程序

    1.最简单的方式通过winrar制作 但是做出来的页面好low的感觉 参考链接:https://www.cnblogs.com/fetty/p/5185913.html 2.通过inno制作安装程序: ...

  2. HDU 4725 The Shortest Path in Nya Graph

    he Shortest Path in Nya Graph Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged o ...

  3. gps 地图

    http://www.cnblogs.com/sylvanas2012/p/5342530.html http://blog.csdn.net/ma969070578/article/details/ ...

  4. MySQL 以及 Python 实现排名窗体函数

    大部分数据库都提供了窗体函数.比方RANK,ROW_NUMBER等等. MySQL 这方面没有直接提供.可是能够变相的实现.我曾经写了row_number 的实现,今天有时间把 rank 的实现贴出来 ...

  5. [Atcoder Grand 006 C] Rabbit Exercise 解题报告 (期望)

    题目链接:https://www.luogu.org/problemnew/show/AT2164 https://agc006.contest.atcoder.jp/tasks/agc006_c 题 ...

  6. Kali linux 2016.2(Rolling)中metasploit的搜集特定网站的目录结构

    不多说,直接上干货! parent directory site: testfire.net 至于这里怎么FQ,很简单,请见我下面的博客! kali 2.0安装 lantern(成功FQ) shado ...

  7. spring boot 集成 mybatis,数据库为mysql

    导入mven工程即可运行,方法不描述了,具体见 https://github.com/davidwang456/spring-boot-mybatis-demo

  8. 求从第一列走到第n列的最短路径

    11 14 23 12 18 21 13 10 28 15 29 17 无 无 25 如上表所示.求从第一列到第n列的最短路径,行数不定,列数不定.这种情况下用什么算法比较好 可能说的不大清楚,例如有 ...

  9. vue中指令写了一个demo

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. C#中Request.Cookies 和 Response.Cookies 的区别分析

    .NET中提供了读写Cookie的多种方法,Request.Cookies 是客户端通过 Cookie 标头形式由客户端传输到服务器的 Cookie:Response.Cookies 在服务器上创建并 ...