`

The Quintessential Drawing Program:画图程序的精粹

阅读更多
<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>

This example creates a frame and draws an oval within the frame.

//导入awt和swing包,用于创建图形界面

import java.awt.*;

import javax.swing.*;

class BasicDraw extends JComponent {

public void paint(Graphics g) {

//创建一个Graphics2D对象

Graphics2D g2d = (Graphics2D)g;

//画椭圆

g2d.drawOval(0, 0, getSize().width-1,

getSize().height-1);

}

public static void main(String[] args) {

//创建主窗口

JFrame frame = new JFrame();

//添加一个匿名BasicDraw对象

frame.getContentPane().add(new BasicDraw());

int frameWidth = 300;

int frameHeight = 300;

frame.setSize(frameWidth, frameHeight);

frame.setVisible(true);

}

}

分享到:
评论

相关推荐

    The.Quintessential.PIC.Microcontroller.(Computer.Communications.and.Networks).pdf

    The.Quintessential.PIC.Microcontroller.(Computer.Communications.and.Networks).pdf

    Quintessential Media Player v5.0 简中汉化包

    Quintessential Media Player 5.0 简体中文汉化包 1.下载后将文件内Plugins文件夹解压至QMP安装目录内覆盖; 2.打开QMP,在Preferences→User Interface→Language内选择简体中文,保存即可。 本汉化包由[少昊]制作...

    Practical Quantum Computing for Developers

    Write algorithms and program in the new field of quantum computing. This book covers major topics such as the physical components of a quantum computer: qubits, entanglement, logic gates, circuits, ...

    Quintessential Media Player v4.51

    支持大部分主流音乐格式,包括MP3、CD Audio、Ogg Vorbis、WAV、VQF、MP+、Windows Media和流音乐SHOUTcast等,不过有些格式需要另外安装播放插件。

    JSP Simple Examples

    In this program we are going to know how the server determines whether the password entered by the user is correct or not. This whole process is controlled on the server side. Multiple forms in jsp ...

    The.Ultimate.Excel.VBA.Master.rar

    This book is a quintessential material painstakingly compiled to help you master Tips and tricks of Excel VBA programming for effective strategies. It aids your professionalism and bails you out of ...

    jQuery UI Cookbook (pdf + ePub)

    jQuery UI is the quintessential framework for creating professional user interfaces. While jQuery core lays the foundation for interaction with the DOM and handling events, jQuery UI fills in the user...

    Games Diversions and Perl Culture

    No longer in print format, TPJ remains the quintessential spirit of Perl–a publication for and by Perl programmers who see fun and beauty in an admittedly quirky little language. Games, Diversions, ...

    Scala: Guide for Data Science Professionals

    You will learn about Bokeh bindings for exploratory data analysis and quintessential machine learning with algorithms with Spark ML library. You'll get a sufficient understanding of Spark streaming, ...

    Beyond.jQuery.1484222342

    Learn about the most important concepts surrounding web development as the mystic powers of jQuery are explained, allowing you to forgo this seemingly quintessential library in your software projects...

    迷你歌词 (MiniLyrics) 特别版 V6.1.3730

    Winamp,Windows Media Player,Foobar2000,Apple iTunes,RealPlayer,Quintessential Player,Musicmatch Jukebox,MediaMonkey,The KMPlayer,JetAudio,Yahoo! Music Engine,Media Jukebox,BSPlayer 1、...

    Scala Data Analysis Cookbook(PACKT,2015)

    iscover how to program quintessential machine learning algorithms using Spark ML library. Work through steps to scale your machine learning models and deploy them into a standalone cluster, EC2, YARN...

    Beyond jQuery(Apress,2016)

    Learn about the most important concepts surrounding web development as the mystic powers of jQuery are explained, allowing you to forgo this seemingly quintessential library in your software projects...

    Matrix-Chain_JAVA.rar_Matrix-chain java_java programming

    Matrix Chain Multiplication is perhaps the quintessential example of dynamic programming. The problem can be stated as follows: given a chain &lt;A1, A2,..., An&gt; of n matrices, where for i = 1, 2,....

    MiniLyrics 7.5.28

    Winamp、Windows媒体播放器、Foobar2000、Apple iTunes、RealPlayer、VLC Media Player、Songbird、Quintessential Player、Musicmatch Jukebox、MediaMonkey、KMPlayer、JetAudio、Yahoo! Music Engine、J. River ...

    QPlug-ins-开源

    Quintessential Player 的几个有用的插件。 献给我们 Quintessential Player 的所有粉丝。

    Markovify-Piano:马尔可夫链模型产生连贯而合理的钢琴音乐

    马尔可夫钢琴具有马尔可夫链/模型的连贯而合理的钢琴音乐生成基于@jsvine的绝对惊人的markovify软件包:也请检查类似的PLA项目: 您可以使用Quintessential Viterbi为Markov生成的乐曲生成漂亮的伴奏,如下面的漂亮...

Global site tag (gtag.js) - Google Analytics