标签归档:Java

RSS feed of Java

Python与Java的主要区别

原文链接:Python vs Java: Key Differences

Python and Java are two very different programming languages, but both can be useful tools for modern developers. If you are thinking about learning to program for the first time, then you might find ...

继续阅读

Java Swing绘制动态数据折线图

通过Java Swing可以绘制动态数据折线图。

Java Swing Line Chart

调用下面addData()方法向折线图窗口动态地追加数据,参数t为横轴时间,参数v为纵轴数值,运行效果如上图所示:

Java Swing绘制数据折线图的代码如下:


/* DataWindow.java */
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;

import java.text.DateFormat;
import java.util.Date;

/**
 * Create a new window to graph the sensor readings ...

继续阅读

Java获取屏幕截图示例

Java实现屏幕截图获取需要使用java.awt包下的工具类

一个最简单的获取屏幕截图的代码实现如下所示:


import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

public class ScreenshotGetter {
	public BufferedImage getScreenshot() throws AWTException {
		final Robot robot = new ...

继续阅读