0 Members and 1 Guest are viewing this topic.
import java.awt.*;import java.awt.event.*;import javax.swing.*;public class moonPhases extends JApplet implements ActionListener { JButton full = new JButton("Full moon"); JButton newmoon = new JButton("New moon"); JButton waxingcrescent = new JButton("Waxing Crescent"); JButton waxinggibbous = new JButton("Waxing Gibbous"); JButton waningcrescent = new JButton("Waning Crescent"); JButton waninggibbous = new JButton("Waning Gibbous"); JButton firstquarter = new JButton("First quarter"); JButton thirdquarter = new JButton("Third quarter"); JLabel label1, label2, label3, label4, label5, label6, label7, label8; Container contentArea; Graphics g; public void init() { contentArea = getContentPane(); contentArea.setBackground(Color.cyan); FlowLayout manager = new FlowLayout(); contentArea.setLayout(manager); full.addActionListener(this); newmoon.addActionListener(this); waxingcrescent.addActionListener(this); waningcrescent.addActionListener(this); waxinggibbous.addActionListener(this); waninggibbous.addActionListener(this); firstquarter.addActionListener(this); thirdquarter.addActionListener(this); full.setEnabled(true); newmoon.setEnabled(false); waxingcrescent.setEnabled(false); waningcrescent.setEnabled(false); waxinggibbous.setEnabled(false); waninggibbous.setEnabled(false); firstquarter.setEnabled(false); thirdquarter.setEnabled(false); contentArea.add(full); contentArea.add(newmoon); contentArea.add(waxingcrescent); contentArea.add(waxinggibbous); contentArea.add(waningcrescent); contentArea.add(waninggibbous); contentArea.add(firstquarter); contentArea.add(thirdquarter); setContentPane(contentArea); } public void actionPerformed(ActionEvent event) { Image fullmoonImg = getImage(getCodeBase(),"full moon.jpg"); ImageIcon pica = new ImageIcon(fullmoonImg); Image newmoonImg = getImage(getCodeBase(),"new moon.png"); ImageIcon picb = new ImageIcon(newmoonImg); Image waxingcrescentImg = getImage(getCodeBase(),"waxing crescent.jpg"); ImageIcon picc = new ImageIcon(waxingcrescentImg); Image waxinggibbousImg = getImage(getCodeBase(),"waxing gibbous.jpg"); ImageIcon picd = new ImageIcon(waxinggibbousImg); Image waningcrescentImg = getImage(getCodeBase(),"waning crescent.jpg"); ImageIcon pice = new ImageIcon(waningcrescentImg); Image waninggibbousImg = getImage(getCodeBase(),"waning gibbous.jpg"); ImageIcon picf = new ImageIcon(waninggibbousImg); Image firstquarterImg = getImage(getCodeBase(),"first quarter moon.jpg"); ImageIcon picg = new ImageIcon(firstquarterImg); Image thirdquarterImg = getImage(getCodeBase(),"third quarter moon.jpg"); ImageIcon pich = new ImageIcon(thirdquarterImg); if(event.getSource()==full) { newmoon.setEnabled(true); label1 = new JLabel(pica); contentArea.add(label1); setContentPane(contentArea); } if(event.getSource()==newmoon) { waxingcrescent.setEnabled(true); label1 = new JLabel(); label2 = new JLabel(picb); contentArea.add(label1); contentArea.add(label2); setContentPane(contentArea); } if(event.getSource()==waxingcrescent) { waxinggibbous.setEnabled(true); label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(picc); contentArea.add(label3); setContentPane(contentArea); } if(event.getSource()==waxinggibbous) { waningcrescent.setEnabled(true); label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(picd); contentArea.add(label4); setContentPane(contentArea); } if(event.getSource()==waningcrescent) { waninggibbous.setEnabled(true); label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(pice); contentArea.add(label5); setContentPane(contentArea); } if(event.getSource()==waninggibbous) { firstquarter.setEnabled(true); label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); label6 = new JLabel(picf); contentArea.add(label6); setContentPane(contentArea); } if(event.getSource()==firstquarter) { thirdquarter.setEnabled(true); label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); label6 = new JLabel(); label7 = new JLabel(picg); contentArea.add(label7); setContentPane(contentArea); } if(event.getSource()==thirdquarter) { label1 = new JLabel(); label2 = new JLabel(); label3 = new JLabel(); label4 = new JLabel(); label5 = new JLabel(); label6 = new JLabel(); label7 = new JLabel(); label8 = new JLabel(pich); contentArea.add(label8); setContentPane(contentArea); } }}
Java Plug-in 1.6.0_26Using JRE version 1.6.0_26-b03 Java HotSpot(TM) Client VMUser home directory = C:\Users\Jacob----------------------------------------------------c: clear console windowf: finalize objects on finalization queueg: garbage collecth: display this help messagel: dump classloader listm: print memory usageo: trigger loggingq: hide consoler: reload policy configurations: dump system and deployment propertiest: dump thread listv: dump thread stackx: clear classloader cache0-5: set trace level to <n>----------------------------------------------------java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Exception: java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Exception: java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Exception: java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source)Exception: java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException at java.awt.LightweightDispatcher$3.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> </head> <body bgcolor="000000"> <center> <applet code = "moonPhases.class" width = "1000" height = "1000" > </applet> </center> </body></html>
edit: Blak, i dont think that has anything to do with it.
java.lang.UnsupportedClassVersionError: moonPhases : Unsupported major.minor version 51.0