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

📄 exercise13_1_1.java

📁 一款用java编写的小型数据库管理系统
💻 JAVA
字号:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Exercise13_1_1 extends JFrame{
	protected MessagePanel messagePanel = new MessagePanel("Welcome to Java");
	public Exercise13_1_1(){
		messagePanel.setBackground(Color.gray);
		JButton jb1=new JButton("<=");
		JButton jb2=new JButton("=>");
		JPanel jp=new JPanel();
		jp.add(jb1);
		jp.add(jb2);
		setLayout(new BorderLayout());
		    add(messagePanel, BorderLayout.CENTER);
		    add(jp, BorderLayout.NORTH);

		    jb1.addActionListener(new ActionListener() {
		      public void actionPerformed(ActionEvent e) {
		        messagePanel.moveLeft();
		      }
		    });
		    jb2.addActionListener(new ActionListener() {
		      public void actionPerformed(ActionEvent e) {
		        messagePanel.moveRight();
		      }
    });
	}
	public static void main(String[] args) {
	    Exercise13_1_1 frame = new Exercise13_1_1();
	    frame.setTitle("Exercise13_1");
	    frame.setLocationRelativeTo(null); // Center the frame
	    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	    frame.setSize(500, 200);
	    frame.setVisible(true);
  }
}

⌨️ 快捷键说明

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