package SongBook;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
import javax.swing.ImageIcon;
import java.awt.event.WindowEvent;
import java.awt.Window;
import javax.swing.JScrollPane;
import java.awt.Component;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
public class LivingHymns extends JFrame {
/* (non-Javadoc)
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
JTextArea area;
JCheckBox box;
JComboBox songs, fonts, colors;
JScrollPane scrolls, scrolls2;
String[] songNames;
String[] fontTypes;
String[] colorSelector;
JButton copy;
JTextField pageNumber, verseNumber;
JPanel panel;
String Bob;
JFrame frame, frame2;
JRadioButton color, color2, color3, color4, color5, color6, color7, color8, color9, color10,
color11, color12, color13;
ButtonGroup group, group2;
Color red, green, blue, orange, yellow, pink, black, gray, lightGray, darkGray, magenta, cyan,
white;
JLabel background, textBackground, textForeground, pageNum;
JRadioButton color14, color15, color16, color17, color18, color19, color20, color21, color22,
color23, color24, color25, color26;
Choice choice;
Font Aharoni, Andalus, AngsanaNew, AngsanaUPC, ArabicTypesetting, Arial, ArialBlack, ArialNarrow,
ArialUnicodeMS, Batang, BatangChe, BlackadderITC, BookAntiqua, BookmanOldStyle, BookshelfSymbol7,
BradleyHandITC, BrowalliaNew, BrowalliaUPC, Calibri, Cambria, CambriaMath, Candara, Century,
CenturyGothic, ComicSansMS, Consolas, Constantia, CopperplateGothicBold, CopperplateGothicLight,
Corbel, CordiaNew, CordiaUPC, CourierNew, CSD12, CurlzMT, DaunPenh, David, DFKaiSB, Dialog,
DialogInput, DilleniaUPC, DokChampa, Dotum, DotumChe, EdwardianScriptITC, EngraversMT, ErasDemiITC,
ErasLightITC, EstrangeloEdessa, EucrosiaUPC, Euphemia, Eurostile, FangSong, FelixTitling,
FranklinGothicBook, FranklinGothicDemi, FranklinGothicDemiCond, FranklinGothicHeavy, FranklinGothicMedium,
FranklinGothicMediumCond, FrankRuehl, FreesiaUPC, FreestyleScript, FrenchScriptMT, Garamond, Gautami,
Georgia, GiovanniITCTT, Gisha, Gulim, GulimChe, Gungsuh, GungsuhChe, Impact, IrisUPC, IskoolaPota,
JasmineUPC, Jokerman, JuiceITC, KaiTi, Kalinga, Kartika, KodchiangUPC, KristenITC, Latha, Leelawadee,
LevenimMT, LilyUPC, LucidaBlackletter, LucidaBright, LucidaCalligraphy, LucidaConsole, LucidaHandwriting,
LucidaSans, LucidaSansTypewriter, LucidaSansUnicode, MaiandraGD, MalgunGothic, Mangal, Marlett,
MatisseITC, Meiryo, MeiryoUI, MicrosoftHimalaya, MicrosoftJhengHei, MicrosoftSansSerif, MicrosoftUighur,
MicrosoftYaHei, MicrosoftYiBaiti, MingLiU, MingLiUExtB, MingLiU_HKSCS, MingLiU_HKSCSExtB, Miriam, MiriamFixed,
Mistral;
/* All the font types I can possibly use, it'll take a while to add them all in.
1.) Aharoni
2.) Andalus
3.) Angsana New
4.) AngsanaUPC
5.) Arabic Typesetting
6.) Arial
7.) Arial Black
8.) Arial Narrow
9.) Arial Unicode MS
10.) Batang
11.) BatangChe
12.) Blackadder ITC
13.) Book Antiqua
14.) Bookman Old Style
15.) Bookshelf Symbol 7
16.) Bradley Hand ITC
17.) Browallia New
18.) BrowalliaUPC
19.) Calibri
20.) Cambria
21.) Cambria Math
22.) Candara
23.) Century
24.) Century Gothic
25.) Comic Sans MS
26.) Consolas
27.) Constantia
28.) Copperplate Gothic Bold
29.) Copperplate Gothic Light
30.) Corbel
31.) Cordia New
32.) CordiaUPC
33.) Courier New
34.) CSD12
35.) Curlz MT
36.) DaunPenh
37.) David
38.) DFKai-SB
39.) Dialog
40.) DialogInput
41.) DilleniaUPC
42.) DokChampa
43.) Dotum
44.) DotumChe
45.) Edwardian Script ITC
46.) Engravers MT
47.) Eras Demi ITC
48.) Eras Light ITC
49.) Estrangelo Edessa
50.) EucrosiaUPC
51.) Euphemia
52.) Eurostile
53.) FangSong
54.) Felix Titling
55.) Franklin Gothic Book
56.) Franklin Gothic Demi
57.) Franklin Gothic Demi Cond
58.) Franklin Gothic Heavy
59.) Franklin Gothic Medium
60.) Franklin Gothic Medium Cond
61.) FrankRuehl
62.) FreesiaUPC
63.) Freestyle Script
64.) French Script MT
65.) Garamond
66.) Gautami
67.) Georgia
68.) GiovanniITCTT
69.) Gisha
70.) Gulim
71.) GulimChe
72.) Gungsuh
73.) GungsuhChe
74.) Impact
75.) IrisUPC
76.) Iskoola Pota
77.) JasmineUPC
78.) Jokerman
79.) Juice ITC
80.) KaiTi
81.) Kalinga
82.) Kartika
83.) KodchiangUPC
84.) Kristen ITC
85.) Latha
86.) Leelawadee
87.) Levenim MT
88.) LilyUPC
89.) Lucida Blackletter
90.) Lucida Bright
91.) Lucida Calligraphy
92.) Lucida Console
93.) Lucida Handwriting
94.) Lucida Sans
95.) Lucida Sans Typewriter
96.) Lucida Sans Unicode
97.) Maiandra GD
98.) Malgun Gothic
99.) Mangal
100.) Marlett
101.) Matisse ITC
102.) Meiryo
103.) Meiryo UI
104.) Microsoft Himalaya
105.) Microsoft JhengHei
106.) Microsoft Sans Serif
107.) Microsoft Uighur
108.) Microsoft YaHei
109.) Microsoft Yi Baiti
110.) MingLiU
111.) MingLiU-ExtB
112.) MingLiU_HKSCS
113.) MingLiU_HKSCS-ExtB
114.) Miriam
115.) Miriam Fixed
116.) Mistral
117.) Mongolian Baiti
118.) Monospaced
119.) Monotype Corsiva
120.) MoolBoran
121.) MS Gothic
122.) MS Mincho
123.) MS PGothic
124.) MS PMincho
125.) MS Reference 1
126.) MS Reference 2
127.) MS Reference Sans Serif
128.) MS Reference Specialty
129.) MS UI Gothic
130.) MT Extra
131.) MV Boli
132.) Narkisim
133.) NSimSun
134.) Nyala
135.) OCR A Extended
136.) Palatino Linotype
137.) Papyrus
138.) Perpetua
139.) Plantagenet Cherokee
140.) PMingLiU
141.) PMingLiU-ExtB
142.) Poor Richard
143.) Pristina
144.) Raavi
145.) Rockwell
146.) Rockwell Extra Bold
147.) Rod
148.) SansSerif
149.) Segoe Print
150.) Segoe Script
151.) Segoe UI
152.) Serif
153.) Shruti
154.) SimHei
155.) Simplified Arabic
156.) Simplified Arabic Fixed
157.) SimSun
158.) SimSun-ExtB
159.) Sylfaen
160.) Symbol
161.) Tahoma
162.) Tempus Sans ITC
163.) Times New Roman
164.) Traditional Arabic
165.) Trebuchet MS
166.) Tunga
167.) Verdana
168.) Viner Hand ITC
169.) Vivaldi
170.) Vrinda
171.) Webdings
172.) Wingdings
173.) Wingdings 2
174.) Wingdings 3
*/
/**
* @param arg0
*/
/**
*
*/
public LivingHymns() {
setTitle("Living Hymns Song Selection for Shooting Park Road Baptist Church");
Aharoni = new Font("Aharoni", Font.BOLD, 50);
Andalus = new Font("Andalus", Font.BOLD, 50);
frame2 = new JFrame();
colorSelector = new String[13];
colorSelector[0] = "Red";
colorSelector[1] = "Green";
colorSelector[2] = "Blue";
colorSelector[3] = "Orange";
colorSelector[4] = "Yellow";
colorSelector[5] = "Pink";
colorSelector[6] = "Black";
colorSelector[7] = "Gray";
colorSelector[8] = "Light Gray";
colorSelector[9] = "Dark Gray";
colorSelector[10] = "Magenta";
colorSelector[11] = "Cyan";
colorSelector[12] = "White";
colors = new JComboBox(colorSelector);
fontTypes = new String[174];
pageNumber = new JTextField(3);
pageNum = new JLabel("Enter page number");
panel = new JPanel();
pageNum.setVisible(true);
pageNumber.setVisible(true);
panel.add(pageNum);
panel.add(pageNumber);
frame = new JFrame();
background = new JLabel("Set Background Color");
color = new JRadioButton("Red");
color2 = new JRadioButton("Green");
color3 = new JRadioButton("Blue");
color4 = new JRadioButton("Orange");
color5 = new JRadioButton("Yellow");
color6 = new JRadioButton("Pink");
color7 = new JRadioButton("Black");
color8 = new JRadioButton("Gray");
color9 = new JRadioButton("Light Gray");
color10 = new JRadioButton("Dark Gray");
color11 = new JRadioButton("Magenta");
color12 = new JRadioButton("Cyan");
color13 = new JRadioButton("White");
color14 = new JRadioButton("Red");
color15 = new JRadioButton("Green");
color16 = new JRadioButton("Blue");
color17 = new JRadioButton("Orange");
color18 = new JRadioButton("Yellow");
color19 = new JRadioButton("Pink");
color20 = new JRadioButton("Black");
color21 = new JRadioButton("Gray");
color22 = new JRadioButton("Light Gray");
color23 = new JRadioButton("Dark Gray");
color24 = new JRadioButton("Magenta");
color25 = new JRadioButton("Cyan");
color26 = new JRadioButton("White");
group = new ButtonGroup();
group.add(color);
group.add(color2);
group.add(color3);
group.add(color4);
group.add(color5);
group.add(color6);
group.add(color7);
group.add(color8);
group.add(color9);
group.add(color10);
group.add(color11);
group.add(color12);
group.add(color13);
group2 = new ButtonGroup();
group2.add(color14);
group2.add(color15);
group2.add(color16);
group2.add(color17);
group2.add(color18);
group2.add(color19);
group2.add(color20);
group2.add(color21);
group2.add(color22);
group2.add(color23);
group2.add(color24);
group2.add(color25);
group2.add(color26);
background.setVisible(true);
int x = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
int y = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
area = new JTextArea(120, 120);
scrolls = new JScrollPane(area, x, y);
panel.add(scrolls);
scrolls2 = new JScrollPane(panel, x, y);
panel.add(background);
panel.add(color);
panel.add(color2);
panel.add(color3);
panel.add(color4);
panel.add(color5);
panel.add(color6);
panel.add(color7);
panel.add(color8);
panel.add(color9);
panel.add(color10);
panel.add(color11);
panel.add(color12);
panel.add(color13);
panel.setVisible(true);
scrolls.setVisible(true);
scrolls2.setVisible(true);
songNames = new String[835];
box = new JCheckBox("Box");
panel.add(box);
box.setVisible(true);
panel.setVisible(true);
panel.add(scrolls);
// frame.add(scrolls);
panel.setName("Bob");
frame.setTitle("Bob 2");
panel.add(scrolls);
red = Color.RED;
green = Color.GREEN;
blue = Color.BLUE;
orange = Color.ORANGE;
yellow = Color.YELLOW;
black = Color.BLACK;
pink = Color.PINK;
gray = Color.GRAY;
lightGray = Color.LIGHT_GRAY;
darkGray = Color.DARK_GRAY;
magenta = Color.MAGENTA;
white = Color.WHITE;
copy = new JButton("Copy");
panel.add(copy);
copy.setVisible(true);
textBackground = new JLabel("Set Background Color of Text Area");
panel.add(textBackground);
panel.add(color14);
panel.add(color15);
panel.add(color16);
panel.add(color17);
panel.add(color18);
panel.add(color19);
panel.add(color20);
panel.add(color21);
panel.add(color22);
panel.add(color23);
panel.add(color24);
panel.add(color25);
panel.add(color26);
textForeground = new JLabel("Set Color of Text in Text Area");
panel.add(textForeground);
panel.add(colors);
color.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(red);
}
});
color2.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(green);
}
});
color3.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(blue);
}
});
color4.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(orange);
}
});
color5.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(yellow);
}
});
color6.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(pink);
}
});
color7.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(black);
}
});
color8.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(gray);
}
});
color9.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(lightGray);
}
});
color10.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(darkGray);
}
});
color11.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(magenta);
}
});
color12.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(cyan);
}
});
color13.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
panel.setBackground(white);
}
});
color14.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(red);
}
});
color15.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(green);
}
});
color16.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(blue);
}
});
color17.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(orange);
}
});
color18.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(yellow);
}
});
color19.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(pink);
}
});
color20.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(black);
}
});
color21.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(gray);
}
});
color22.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(lightGray);
}
});
color23.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(darkGray);
}
});
color24.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(magenta);
}
});
color25.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(cyan);
}
});
color26.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
area.setBackground(white);
}
});
colors.addItemListener(
new ItemListener() {
public void itemStateChanged(ItemEvent e)
{ // beginning of method
if (e.getSource() == colors)
{ // beginning of if
if (colors.getSelectedItem() == "Red")
{ // beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(red);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Green")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(green);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Blue")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(blue);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Orange")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(orange);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Yellow")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(yellow);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Pink")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(pink);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Black")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(black);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Gray")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(gray);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Light Gray")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(lightGray);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Dark Gray")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(darkGray);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Magenta")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(magenta);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "Cyan")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(cyan);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
if (colors.getSelectedItem() == "White")
{// beginning of if
if(e.getStateChange() == ItemEvent.SELECTED)
{ // beginning of if
area.setForeground(white);
} // end of if
if (e.getStateChange() == ItemEvent.DESELECTED)
{ // beginning of if
// do nothing
} // end of if
} // end of if
} // end of if
}});
panel.setLayout(new BoxLayout(panel, 1));
addWindowListener(
new WindowListener(){
@Override
public void windowActivated(WindowEvent window) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent window) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent window) {
// TODO Auto-generated method stub
Object[] closing= {"Yes" , "No"};
int a = JOptionPane.showOptionDialog(frame2,
"Exit.",
"Are you sure you want to exit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, closing, closing[0]);
if (a == JOptionPane.YES_OPTION)
{
System.exit(0);
}
else if (a == JOptionPane.NO_OPTION)
{ // beginning of else if
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
} // end of else if
}
@Override
public void windowDeactivated(WindowEvent window) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent window) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
String str = "Welcome to the hymn book song selector. Choose from" + "\n" +
" different options to set background color, text area color, font color, and font type." + "\n" +
" Chose the songs from the list or enter page number to get songs. It will show all verses as I don't" + "\n" +
" have time to set it to do it for each verse so you have to scroll down to get to the next verses.";
JOptionPane.showMessageDialog(null, str, "Welcome", JOptionPane.PLAIN_MESSAGE);
}
});
setFocusable(true);
addKeyListener(
new KeyListener() {
@Override
public void keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE)
{
Object[] Esc= {"Yes" , "No"};
int a = JOptionPane.showOptionDialog(frame2,
"Exit.",
"Are you sure you want to exit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, Esc, Esc[0]);
if (a == JOptionPane.YES_OPTION)
{
System.exit(0);
}
else if (a == JOptionPane.NO_OPTION)
{ // beginning of else if
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
} // end of else if
}
}
@Override
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
}
});
getContentPane().add(scrolls2);
// TODO Auto-generated constructor stub
}
public void showGUI2(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300,300);
setLocation(100,100);
setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
LivingHymns hymn = new LivingHymns();
hymn.showGUI2();
}
}
}