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

📄 jappletwithbuttons.java

📁 java编程开发技巧与实例的编译测试通过的所有例程
💻 JAVA
字号:
import java.net.*;
import java.awt.event.*;
import java.awt.FlowLayout;
import javax.swing.*;

public class JAppletWithButtons extends JApplet implements ActionListener
{
	JButton windLook	=	new JButton("Windows");
	JButton unixLook	=	new JButton("Unix");
	JButton javaLook	=	new JButton("Java");
	JLabel label	=	new JLabel("Welcome to swing", SwingConstants.CENTER);
	
	public void init()
	{
		try
		{
			URL windURL	=	new URL(getCodeBase(), "Icons/windows.gif");
			URL unixURL	=	new URL(getCodeBase(), "Icons/xwin.gif");
			URL javaURL	=	new URL(getCodeBase(), "Icons/java.gif");
			URL newURL	=	new URL(getCodeBase(), "Icons/new.gif");
			windLook.setIcon(new ImageIcon(windURL));
			unixLook.setIcon(new ImageIcon(unixURL));
			javaLook.setIcon(new ImageIcon(javaURL));
			label.setIcon(new ImageIcon(newURL));
		}
		catch	(MalformedURLException murle)
		{
			System.err.println("error loading button images: " + murle);
		}
		getContentPane().setLayout(new FlowLayout());
		getContentPane().add(label);
		getContentPane().add(windLook);
		getContentPane().add(unixLook);
		getContentPane().add(javaLook);
	}
	public void actionPerformed(ActionEvent ae)
	{
		
	}
}

⌨️ 快捷键说明

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