⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appletdemo3.java

📁 java程序设计语言源代码
💻 JAVA
字号:
//Example 3 of Chapter 6

import  java.awt.*;
import  java.awt.event.*;
import  javax.swing.*;
import  java.net.URL;

public  class  AppletDemo3  extends  JApplet
{
	private Image im;
	private ImageIcon ii;
	public  void  init()
	{
		getContentPane().setBackground( Color.white );
		URL url = getDocumentBase();
		im = getImage(url, "funnypig.jpg");
		ii = new ImageIcon( "funnypig.jpg" );
	}
	
	public  void  paint( Graphics  g )
	{
		super.paint( g );
		g.setColor( Color.green );
		g.drawLine( 1 , 1 , 399 , 1 );
		g.setFont( new Font( "Dialog", Font.BOLD, 20 ));
		g.drawString( "A funny little pig" , 110 , 30);
		g.drawOval( 60 , 50 , 80 , 90 );
		g.drawOval( 85 , 110 , 30 , 20 );
		g.fillOval( 90 , 116 , 8 , 8 );
		g.fillOval( 102 , 116 , 8 , 8 );
		g.fillOval( 76 , 90 , 10 , 10 );
		g.fillOval( 116 , 90 , 10 , 10 );
		g.drawArc( 8 , 55 , 57 , 30 , 0 , 180 );
		g.drawArc( 135 , 55 , 57 , 30 , 0 , 180 );
		g.drawArc( 8 , 27 , 70 , 80 , 180 , 120 );
		g.drawArc( 123 , 27 , 70 , 80 , 240 , 120 );
		g.drawLine( 90 , 65 , 110 , 65 );
		g.drawLine( 93 , 70 , 107 , 70 );
		g.drawLine( 88 , 75 , 112 , 75 );
		
		g.drawImage( im , 198 , 50 , this );
		ii.paintIcon( this, g, 300, 50 );
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -