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

📄 myapplet.txt

📁 也是一个图片浏览器的源代码,希望可以帮到有需要的人
💻 TXT
字号:
import java.awt.*; 
import javax.swing.*; 
import java.awt.event.*; 
public class MyApple extends JApplet { 

	/** Creates a new instance of MyApplet */ 
	public  void MyApplet() { 
	} 

	public void init(){ 
	myFont = new Font("Dialog",Font.BOLD,16); 


	Bigger = new JButton("放大"); 
	Smaller = new JButton("缩小"); 
	jPanel1 = new JPanel(); 
	jPanel2 = new JPanel(); 
	jLabel1 = new JLabel("123"); 
	jLabel1.setFont(myFont); 

	jPanel1.setLayout(new FlowLayout()); 
	jPanel1.add(Bigger); 
	jPanel1.add(Smaller); 
	jPanel2.add(jLabel1); 

	Container cp= this.getContentPane(); 
	cp.setLayout(new BorderLayout()); 
	cp.add(jPanel1,BorderLayout.SOUTH); 
	cp.add(jPanel2,BorderLayout.CENTER); 

	Bigger.addActionListener(new ActionListener(){ 
	public void actionPerformed(ActionEvent evt) { 
	BiggerActionPerformed(evt); 
	} 
	}); 

	Smaller.addActionListener(new ActionListener(){ 
	public void actionPerformed(ActionEvent evt) { 
	SmallerActionPerformed(evt); 
	} 
	}); 

	this.setVisible(true); 
	} 


	private void BiggerActionPerformed(ActionEvent evt){ 
	int size = myFont.getSize()+2; 
	myFont = new Font("Dialog",Font.BOLD,size); 
	this.jLabel1.setFont(myFont); 
	} 

	private void SmallerActionPerformed(ActionEvent evt){ 
	int size = myFont.getSize()-2; 
	myFont = new Font("Dialog",Font.BOLD,size); 
	this.jLabel1.setFont(myFont); 
	} 

	private JButton Bigger,Smaller; 
	private JPanel jPanel1,jPanel2; 
	private JLabel jLabel1; 
	private Font myFont; 
	} 

⌨️ 快捷键说明

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