import javax.swing.*; import java.awt.event.*; import java.awt.*; public class ClickyLatinHelp extends JFrame implements ActionListener, KeyListener { final int xpad = 10; final int ypad = 15; final int ydown = 20; final int xeng = 380; int x = 0; int y = 0; int listnumber = 0; int arraylistindex = 0; int arrayelement = 0; boolean showeng = true; char key = 'a'; String[] greeting = {"Why, Hello there!","Welcome.","blah blah blah","more useless crap"}; JButton List1Button = new JButton("List 1"); JButton List2Button = new JButton("List 2"); JButton List3Button = new JButton("List 3"); JButton List4Button = new JButton("List 4"); JButton List5Button = new JButton("List 5"); JButton List6Button = new JButton("List 6"); JButton List7Button = new JButton("List 7"); JButton List8Button = new JButton("List 8"); JButton List9Button = new JButton("List 9"); JButton List10Button = new JButton("List 10"); public ClickyLatinHelp() { super("Welcome to Latin Help"); setBounds(50, 20, 750, 700); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DrawingArea canvas = new DrawingArea(); JPanel ButtonBanner = new JPanel(); setLayout(new BorderLayout()); List1Button.addActionListener(this); List2Button.addActionListener(this); List3Button.addActionListener(this); List4Button.addActionListener(this); List5Button.addActionListener(this); List6Button.addActionListener(this); List7Button.addActionListener(this); List8Button.addActionListener(this); List9Button.addActionListener(this); List10Button.addActionListener(this); canvas.setFocusable(true); ButtonBanner.add(List1Button); ButtonBanner.add(List2Button); ButtonBanner.add(List3Button); ButtonBanner.add(List4Button); ButtonBanner.add(List5Button); ButtonBanner.add(List6Button); ButtonBanner.add(List7Button); ButtonBanner.add(List8Button); ButtonBanner.add(List9Button); ButtonBanner.add(List10Button); add(ButtonBanner,BorderLayout.NORTH); add(canvas,BorderLayout.CENTER); setVisible(true); } public class DrawingArea extends JPanel { public void paintComponent(Graphics comp) { super.paintComponent(comp); Graphics2D comp2D = (Graphics2D) comp; comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font font = new Font("Arial", Font.BOLD, 12); comp2D.setFont(font); Color background = new Color(240, 0, 0); Lists listhi = new Lists(); x = xpad; y = ydown; arrayelement = 0; comp2D.setColor(Color.black); while (listhi.ListArrays[listnumber][arrayelement] != null) { comp2D.drawString(listhi.ListArrays[listnumber][arrayelement], x, y); y = y + ypad; arrayelement++; } x = xeng; y = ydown; arrayelement = 0; if (showeng == true){ while (listhi.EnglishArrays[listnumber][arrayelement] != null) { comp2D.drawString(listhi.EnglishArrays[listnumber][arrayelement], x, y); y = y + ypad; arrayelement++; } } else if (showeng == false){comp2D.setColor(background); comp2D.fillRect(375, 3, 370, 650); } } } public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source == List1Button){ listnumber = 1;} else if (source == List2Button){ listnumber = 2;} else if (source == List3Button){ listnumber = 3;} else if (source == List4Button){ listnumber = 4;} else if (source == List5Button){ listnumber = 5;} else if (source == List6Button){ listnumber = 6;} else if (source == List7Button){ listnumber = 7;} else if (source == List8Button){ listnumber = 8;} else if (source == List9Button){ listnumber = 9;} else if (source == List10Button){ listnumber = 10;} repaint(); } public void keyPressed(KeyEvent event) { if (event.getKeyChar() == 'a'){ showeng = !showeng; repaint(); } } public void keyReleased(KeyEvent event){} public void keyTyped(KeyEvent event){} public static void main(String[] arguments) { ClickyLatinHelp TLH = new ClickyLatinHelp(); } }