package a;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
public class Main extends JFrame implements ActionListener {
public Main() {
this.add(this.jp());
this.setJMenuBar(this.jmb());
}
public JMenuBar jmb() {
JMenuBar jmb = new JMenuBar();
JMenuItem jmi = new JMenuItem("圣经目录");
jmi.addActionListener(this);
jmb.add(jmi);
return jmb;
}
private JPanel jp = new JPanel();
public JPanel jp() {
GridLayout gl = new GridLayout(11, 6);
jp.setLayout(gl);
String[] s = { "创世记", "出埃及记", "利未记", "民数记", "申命记", "约书亚记", "士师记", "路得记", "撒母耳记上", "撒母耳记下", "列王纪上", "列王纪下",
"历代志上", "历代志下", "以斯拉记", "尼希米记", "以斯帖记", "约伯记", "诗篇", "箴言", "传道书", "雅歌", "以赛亚书", "耶利米书", "耶利米哀歌", "以西结书",
"但以理书", "何西阿书", "约珥书", "阿摩司书", "俄巴底亚书", "约拿书", "弥迦书", "那鸿书", "哈巴谷书", "西番雅书", "哈该书", "撒迦利亚书", "玛拉基书",
"马太福音", "马可福音", "路加福音", "约翰福音", "使徒行传", "罗马书", "哥林多前书", "哥林多后书", "加拉太书", "以弗所书", "腓立比书", "歌罗西书",
"帖撒罗尼迦前书", "帖撒罗尼迦后书", "提摩太前书", "提摩太后书", "提多书", "腓利门书", "希伯来书", "雅各书", "彼得前书", "彼得后书", "约翰壹书", "约翰贰书",
"约翰叁书", "犹大书", "启示录" };
JButton[] jb = new JButton[s.length];
for (int i = 0; i < jb.length; i++) {
jb[i] = new JButton(s[i]);
jb[i].addActionListener(this);
if (i < 5) {
jb[i].setBackground(Color.CYAN);
} else if (i < 17) {
jb[i].setBackground(Color.MAGENTA);
} else if (i < 22) {
jb[i].setBackground(Color.YELLOW);
} else if (i < 39) {
jb[i].setBackground(Color.GREEN);
} else if (i < 43) {
jb[i].setBackground(Color.CYAN);
} else if (i < 44) {
jb[i].setBackground(Color.MAGENTA);
} else if (i < 65) {
jb[i].setBackground(Color.YELLOW);
} else if (i < 66) {
jb[i].setBackground(Color.GREEN);
}
jp.add(jb[i]);
}
return jp;
}
public static void main(String[] args) {
Main m = new Main();
m.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
m.setSize(1024, 700);
m.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String s = e.getActionCommand();
if (s.equals("圣经目录")) {
if (this.jp.isShowing()) {
this.jp.setVisible(false);
return;
}
this.jp.setVisible(true);
return;
}
System.out.println("處理數據庫" + s);
this.jp.setVisible(false);
}
}
彩色简单圣经
最新推荐文章于 2024-08-12 16:47:32 发布