Why won`t this complie?

I get "Main.java": Error #: 202 : 'class' or 'interface' expected at line 49, column 8.For the setupLoginPanel().
I get "Main.java": Error #: 202 : 'class' or 'interface' expected at line 158, column 18.For the login().
This is for a Certificate project please help me correct these errors.
Thanks!!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
public class Main extends JFrame implements main_interface{
final static String genexception = "GENERAL EXCEPTION";
final static String driver      = "sun.jdbc.odbc.JdbcOdbcDriver";
final static String url      = "jdbc:odbc:AddBKTAFE";
final static String Login      = "LOG-IN";
final static String tab_login      = "Log-in";
final static String relogin      = "Log-in failed! Please relog-in!";
final static String error      = "ERROR";
JPanel panell;
JTabbedPane tpane = new JTabbedPane();
GridBagConstraints constraints = new GridBagConstraints();
GridBagLayout layout = new GridBagLayout ();
Font labelFont = new Font("Arial",Font.PLAIN,12);
Font buttonFont = new Font("Arial",Font.BOLD,13);
JButton btLogin      = new JButton (Login );
JPasswordField jpPassword           = new JPasswordField(10 );
JTextField tfUser           = new JTextField("",10 );
JLabel lbUser           = new JLabel("Enter User ID: " );
JLabel lbPassword           = new JLabel("Enter Password: ");
Main app;
// public Login log = new Login();
JTextField tfUser;
public Main(){
System.out.println("loading.......please wait.");
app.setSize(900,385);
setupLoginPanel();
app.setVisible(true);
app.tfUser.requestFocus();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//--------------------Start main------------------------------------------------>>>
     public static void main(String args[]){
          Main app = new Main();
//--------------------End main-------------------------------------------------->>>
public void setupLoginPanel(){
// set application title
setTitle("Address Book");
// center screen
setLocation((Toolkit.getDefaultToolkit().getScreenSize().width
- getWidth())/2,
(Toolkit.getDefaultToolkit().getScreenSize().height
- getHeight())/2);
String sql = ""; // Used to store sql statements
Container cntr = getContentPane();
JPanel panel1 = new JPanel();
// set screen border
panel1.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(),""));
// add tabbedpane to panel
tpane.addTab(tab_login, panel1);
// add panel to container
cntr.add(tpane);
// setup layout as GridBagLayout
constraints.insets = new Insets(2,2,2,2);
panel1.setLayout(layout);
// setup User ID label in display area
lbUser.setFont(labelFont);
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 0;
constraints.gridy = 0;
constraints.anchor = GridBagConstraints.WEST;
layout.setConstraints(lbUser, constraints);
panel1.add(lbUser);
// setup User ID input field in display area
tfUser.setFont(labelFont);
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 1;
constraints.gridy = 0;
constraints.fill = GridBagConstraints.HORIZONTAL;
layout.setConstraints(tfUser, constraints);
panel1.add(tfUser);
// setup Password label in display area
lbPassword.setFont(labelFont);
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 0;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.WEST;
layout.setConstraints(lbPassword, constraints);
panel1.add(lbPassword);
// setup Password input field in display area
jpPassword.setEchoChar('*');
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 1;
constraints.gridy = 1;
layout.setConstraints(jpPassword, constraints);
panel1.add(jpPassword);
// setup Login button in display area
btLogin.setFont(buttonFont);
constraints.anchor = GridBagConstraints.WEST;
constraints.gridy = 3;
constraints.gridx = 1;
layout.setConstraints(btLogin, constraints);
panel1.add(btLogin);
// setup login button listener
btLogin.addActionListener(new ButtonHandler());
// allow ALT L to press login button
btLogin.setMnemonic('l');
//--------------------End setupLoginPanel()------------------------------------->>
//--------------------Start ButtonHandler--------------------------------------->>>
// Action listener for the buttons on each screen
class ButtonHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
// get the label of the button
String action = e.getActionCommand();
if (action!=null){
if(action==Login){
// call method accessDB()
login();
// if login error, set cursor to user name input field
tfUser.requestFocus();
//--------------------End ButtonHandler----------------------------------------->>>
//--------------------Start login()--------------------------------------------->>>
// Validate user input from the login screen based on information from login
// table (note: manually create/update your login from table LOGIN).
public void login(){
String user = tfUser.getText();
user = user.trim();
String password = jpPassword.getText();
String sql = "SELECT * FROM persons WHERE username='"+
user+"' AND password='"+password+"'";
try{
// load MS Access driver
Class.forName(driver);
}catch(java.lang.ClassNotFoundException ex){
JOptionPane.showMessageDialog(null,ex.getMessage(), error ,
JOptionPane.PLAIN_MESSAGE);
try{
// setup connection to DBMS
Connection conn = DriverManager.getConnection(url);
// create statement
Statement stmt = conn.createStatement();
// execute sql statement
stmt.execute(sql);
ResultSet rs = stmt.getResultSet();
boolean recordfound = rs.next();
if (recordfound){
System.out.println("Login succeeded!");
/*     tpane.removeTabAt(0);
initComboBoxes();
showPane1();
showPane2();
showPane3();
else{
// username/password invalid
JOptionPane.showMessageDialog(null,relogin, error,
JOptionPane.INFORMATION_MESSAGE);
//clear login and password fields
tfUser.setText ("");
jpPassword.setText("");
conn.close();
}catch(Exception ex){
JOptionPane.showMessageDialog(null,ex.getMessage(), genexception,
JOptionPane.INFORMATION_MESSAGE);
//--------------------End login()----------------------------------------------->>>

you had a wrong } at line 47
now it should work :
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
public class Main
extends JFrame
implements main_interface {
final static String genexception = "GENERAL EXCEPTION";
final static String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
final static String url = "jdbc:odbc:AddBKTAFE";
final static String Login = "LOG-IN";
final static String tab_login = "Log-in";
final static String relogin = "Log-in failed! Please relog-in!";
final static String error = "ERROR";
JPanel panell;
JTabbedPane tpane = new JTabbedPane();
GridBagConstraints constraints = new GridBagConstraints();
GridBagLayout layout = new GridBagLayout();
Font labelFont = new Font("Arial", Font.PLAIN, 12);
Font buttonFont = new Font("Arial", Font.BOLD, 13);
JButton btLogin = new JButton(Login);
JPasswordField jpPassword = new JPasswordField(10);
JTextField tfUser = new JTextField("", 10);
JLabel lbUser = new JLabel("Enter User ID: ");
JLabel lbPassword = new JLabel("Enter Password: ");
Main app;
// public Login log = new Login();
JTextField tfUser;
public Main() {
System.out.println("loading.......please wait.");
app.setSize(900, 385);
setupLoginPanel();
app.setVisible(true);
app.tfUser.requestFocus();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//--------------------Start main------------------------------------------------>>>
public static void main(String args[]) {
Main app = new Main();
//--------------------End main-------------------------------------------------->>>
public void setupLoginPanel() {
// set application title
setTitle("Address Book");
// center screen
setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width
- getWidth()) / 2,
(Toolkit.getDefaultToolkit().getScreenSize().height
- getHeight()) / 2);
String sql = ""; // Used to store sql statements
Container cntr = getContentPane();
JPanel panel1 = new JPanel();
// set screen border
panel1.setBorder(BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), ""));
// add tabbedpane to panel
tpane.addTab(tab_login, panel1);
// add panel to container
cntr.add(tpane);
// setup layout as GridBagLayout
constraints.insets = new Insets(2, 2, 2, 2);
panel1.setLayout(layout);
// setup User ID label in display area
lbUser.setFont(labelFont);
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 0;
constraints.gridy = 0;
constraints.anchor = GridBagConstraints.WEST;
layout.setConstraints(lbUser, constraints);
panel1.add(lbUser);
// setup User ID input field in display area
tfUser.setFont(labelFont);
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 1;
constraints.gridy = 0;
constraints.fill = GridBagConstraints.HORIZONTAL;
layout.setConstraints(tfUser, constraints);
panel1.add(tfUser);
// setup Password label in display area
lbPassword.setFont(labelFont);
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 0;
constraints.gridy = 1;
constraints.anchor = GridBagConstraints.WEST;
layout.setConstraints(lbPassword, constraints);
panel1.add(lbPassword);
// setup Password input field in display area
jpPassword.setEchoChar('*');
constraints.ipadx = 2;
constraints.ipady = 2;
constraints.gridx = 1;
constraints.gridy = 1;
layout.setConstraints(jpPassword, constraints);
panel1.add(jpPassword);
// setup Login button in display area
btLogin.setFont(buttonFont);
constraints.anchor = GridBagConstraints.WEST;
constraints.gridy = 3;
constraints.gridx = 1;
layout.setConstraints(btLogin, constraints);
panel1.add(btLogin);
// setup login button listener
btLogin.addActionListener(new ButtonHandler());
// allow ALT L to press login button
btLogin.setMnemonic('l');
//--------------------End setupLoginPanel()------------------------------------->>
//--------------------Start ButtonHandler--------------------------------------->>>
// Action listener for the buttons on each screen
class ButtonHandler
implements ActionListener {
public void actionPerformed(ActionEvent e) {
// get the label of the button
String action = e.getActionCommand();
if (action != null) {
if (action == Login) {
// call method accessDB()
login();
// if login error, set cursor to user name input field
tfUser.requestFocus();
//--------------------End ButtonHandler----------------------------------------->>>
//--------------------Start login()--------------------------------------------->>>
// Validate user input from the login screen based on information from login
// table (note: manually create/update your login from table LOGIN).
public void login() {
String user = tfUser.getText();
user = user.trim();
String password = jpPassword.getText();
String sql = "SELECT * FROM persons WHERE username='" +
user + "' AND password='" + password + "'";
try {
// load MS Access driver
Class.forName(driver);
catch (java.lang.ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage(), error,
JOptionPane.PLAIN_MESSAGE);
try {
// setup connection to DBMS
Connection conn = DriverManager.getConnection(url);
// create statement
Statement stmt = conn.createStatement();
// execute sql statement
stmt.execute(sql);
ResultSet rs = stmt.getResultSet();
boolean recordfound = rs.next();
if (recordfound) {
System.out.println("Login succeeded!");
/* tpane.removeTabAt(0);
initComboBoxes();
showPane1();
showPane2();
showPane3();
else {
// username/password invalid
JOptionPane.showMessageDialog(null, relogin, error,
JOptionPane.INFORMATION_MESSAGE);
//clear login and password fields
tfUser.setText("");
jpPassword.setText("");
conn.close();
catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage(), genexception,
JOptionPane.INFORMATION_MESSAGE);
//--------------------End login()----------------------------------------------->>>

Similar Messages

  • Functions in a For Loop defining objects from an Array. . .Why Won't This Work?!

    I'm trying to put these functions into a Loop to conserve
    space. Why won't this work?
    .

    Yeah, sly one is right. You can not have the "i" inside the
    onRollOver function, what you have to do is: As the movieClip class
    is dynamic you can create a property of the movieClip which stores
    the value if the "i". And then, inside the onRollOver function, you
    have to make reference to that property.
    for (i=0; i<2; i++) {
    this.regArray
    .iterator = i;
    this.regArray.onRollOver = function () {
    showRegion(regArray[this.iterator]);
    this.regArray
    .onRollOut = function () {
    hideRegion(regArray[this.iterator]);

  • Help...Why won't this compile?

    Why won't this compile?
    Here is my code:
    import java.util.Calendar;
    import javax.swing.JOptionPane;
    public class GetAge{
    public static void main(String[] args){
    int month=Integer.parseInt(JOptionPane.showInputDialog
    (null,"Enter what month(MM) you were born:"));
    int day=Integer.parseInt(JOptionPane.showInputDialog
    (null,"Enter what day(dd) you were born:"));
    int year=Integer.parseInt(JOptionPane.showInputDialog
    (null,"Enter what year(yyyy) you were born:"));
    Calendar rightNow = Calendar.getInstance();
    int year2 = rightNow.get(Calendar.YEAR);
    int day2 = rightNow.get(Calendar.DATE);
    int month2 = rightNow.get(Calendar.MONTH)+1;
    int years = year2-year-1;
    int months = month2-month+12;
    if(day2 >= day)
       int days = day2-day;
    else
       days = day-day2+8;
    JOptionPane.showMessageDialog(null,"You are: " + years
    + " years " + months + " months and " + days + " days old.");
    }

    What you're doing is using days after the if statement; without curly braces only a valid statement is allowed.
    But if you add curly braces, days will be available only in the if block.
    So what you should do is:
    import java.util.Calendar;
    import javax.swing.JOptionPane;
    public class GetAge{
    public static void main(String[] args){
    int month=Integer.parseInt(JOptionPane.showInputDialog
    (null,"Enter what month(MM) you were born:"));
    int day=Integer.parseInt(JOptionPane.showInputDialog
    (null,"Enter what day(dd) you were born:"));
    int year=Integer.parseInt(JOptionPane.showInputDialog
    (null,"Enter what year(yyyy) you were born:"));
    Calendar rightNow = Calendar.getInstance();
    int year2 = rightNow.get(Calendar.YEAR);
    int day2 = rightNow.get(Calendar.DATE);
    int month2 = rightNow.get(Calendar.MONTH)+1;
    int years = year2-year-1;
    int months = month2-month+12;
    int days = 0;      //declare here
    if(day2 >= day)
       days = day2-day;  //...and use here
    else
       days = day-day2+8;   //..and here
    JOptionPane.showMessageDialog(null,"You are: " + years
    + " years " + months + " months and " + days + " days old.");
    }

  • I purchased the new gen 7 ipod nano and needed to update itunes to 10.7 but my current software says its up to date and won't download 10.6.8 Currently I have 10.5.8 Why won't this update?

    I purchased the new gen 7 ipod nano and needed to update itunes to 10.7 but my current software says its up to date and won't download 10.6.8 Currently I have 10.5.8 Why won't this update?

    The first generation Intel-based Mac's were released in January 2006.
    Snow Leopard requires an Intel processor:
    General requirements
    Mac computer with an Intel processor
    1GB of memory
    5GB of available disk space
    DVD drive for installation
    Some features require a compatible Internet service provider; fees may apply.
    If you go to the Apple menu & "About this Mac" this will tell you what type of processor you have:

  • Why won't this song play even after I authorized the computer? It says that I need to authorize the computer, then I enter my username and password and it says the computer is already authorized. But then the song still won't play. What do I do?

    Why won't this song play even after I authorized the computer? It says that I need to authorize the computer, then I enter my username and password and it says the computer is already authorized. But then the song still won't play. What do I do?

    Use the Apple ID support -> http://www.apple.com/support/appleid/ - click through the contact information and select the iTunes, etc., hot button. You can have Apple call you or email them.
    Clinton

  • Why won't this code work?

    All I want to do is resize the select panel to the same size as east panel. Why won't it work?
    Space.java_____________________________________________
    import javax.sound.sampled.*;
    import java.awt.*;
    import javax.sound.midi.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    import java.io.*;
    public class Space extends JFrame implements ActionListener, Runnable{
         //Sound
         Sequence currentSound;
         Sequencer player;
         Thread soundCheck;
         boolean check = true;
         public void start(){
              soundCheck = new Thread();
              soundCheck.start();
         public void run(){
              try{
                   File bgsound = new File("Sounds" + File.separator + "Space.mid");
                   currentSound = MidiSystem.getSequence(bgsound);
                   player = MidiSystem.getSequencer();
                   player.open();
                   player.setSequence(currentSound);
                   player.start();
                   checkSound();
              } catch (Exception exc){}
         public void checkSound(){
              while(check){
                   if(!player.isRunning()){
                     run();
                   try{
                        soundCheck.sleep((player.getMicrosecondLength() / 1000)-player.getMicrosecondPosition()); // sleep for the length of the track
                   }catch (InterruptedException IE){}
         //Screen Variables:
         Dimension SCREEN = Toolkit.getDefaultToolkit().getScreenSize();
         final int SCREENWIDTH = SCREEN.width;
         final int SCREENHEIGHT = SCREEN.height;
         //Panels:
         JPanel select, main, north, south, east;
        //Buttons:
         JButton instructB, cheatB, playB, exit, about;
         //Labels:
         JLabel open, cheat1, cheat2, cheatInstruct, i1, i2 , i3, aboutLabel;
         //The container and frame:
         static Space jframe;
         Container content;
         //The Constructor:
         public Space(){
              super("Space");
              //set  container attributes:
              content = getContentPane();
              content.setLayout(new BorderLayout());
              //init panels:
              main   = new JPanel();
              select = new JPanel();
              north  = new JPanel();
              east   = new JPanel();
              south  = new JPanel();
              //set panel attributes:
              select.setLayout(new GridLayout(3,0,10,10));     
              select.setBackground(Color.black);
              main.setBackground(Color.black);
              north.setBackground(Color.black);
              //add panels:
              content.add("West", select);
              content.add("Center", main);
              content.add("North", north);
              content.add("East", east);
              //Image Icons:
              Icon exit1 = new ImageIcon("Images" + File.separator + "exit1.gif");
              Icon exit2 = new ImageIcon("Images" + File.separator + "exit2.gif");
              Icon about1 = new ImageIcon("Images" + File.separator + "about1.gif");
              Icon about2 = new ImageIcon("Images" + File.separator + "about2.gif");
              //init buttons, add their listeners, and set their attributes:
              instructB = new JButton("Instructions", new ImageIcon("Images" + File.separator + "ship.gif"));
              instructB.setContentAreaFilled(false);
              instructB.setForeground(Color.yellow);
              instructB.addActionListener(this);
              select.add(instructB);
              cheatB = new JButton("Cheats", new ImageIcon("Images" + File.separator + "cheat.gif"));
              cheatB.setContentAreaFilled(false);
              cheatB.setForeground(Color.yellow);
              cheatB.addActionListener(this);
              select.add(cheatB);
              playB = new JButton("Play", new ImageIcon("Images" + File.separator + "ship2.gif"));
              playB.setContentAreaFilled(false);
              playB.setForeground(Color.yellow);
              playB.addActionListener(this);
              select.add(playB);          
              exit = new JButton();
              exit.setRolloverEnabled(true);
              exit.setIcon(exit1);
              exit.setRolloverIcon(exit2);
              exit.setBorderPainted(false);
              exit.setContentAreaFilled(false);
              exit.addActionListener(this);
              north.add(exit);
              about = new JButton();
              about.setRolloverEnabled(true);
              about.setIcon(about1);
              about.setRolloverIcon(about2);
              about.setBorderPainted(false);
              about.setContentAreaFilled(false);
              about.addActionListener(this);
             north.add(about);
             //Labels:
             open = new JLabel("", new ImageIcon("Images" + File.separator + "open.gif"), JLabel.CENTER);
              main.add(open);
              cheat1 = new JLabel("<html><h1>tport</h1></html>");
              cheat1.setForeground(Color.red);
              cheat2 = new JLabel("<html><h1>zap</h1></html>");
              cheat2.setForeground(Color.green);
              cheatInstruct = new JLabel("<html><h1>Type a cheat at any time during a game, and press the \"Enter\" key.</html></h1>");
              cheatInstruct.setForeground(Color.blue);     
              i1 = new JLabel("<html><h1>The arrow keys move your ship.</h1></html>");
              i1.setForeground(Color.red);
              i2 = new JLabel("<html><h1>The space-bar fires the gun.</h1></html>");
              i2.setForeground(Color.green);
              i3 = new JLabel("<html><h1>The red circles give upgrades.</html></h1>");
              i3.setForeground(Color.blue);
              aboutLabel    = new JLabel("", new ImageIcon("Images" + File.separator + "aboutImage.gif"), JLabel.CENTER);
              //centerPanel();     
         private void centerPanel(final int width, final int height){
              try{
                   Runnable setPanelSize = new Runnable(){
                        public void run(){
                             east.setPreferredSize(new Dimension(width, height));                    
                   SwingUtilities.invokeAndWait(setPanelSize);
              } catch (Exception e){}
         public void actionPerformed(ActionEvent e){
              //if the play button was pressed do:
              if(e.getSource() == playB){
                  //do something
             //else if the cheat button was pressed do:
              else if(e.getSource() == cheatB){
                   //remove and add components
                   main.removeAll();
                   main.setLayout(new GridLayout(3,0,0,0));
                   main.add(cheat1);
                   main.add(cheat2);
                   main.add(cheatInstruct);
                   main.repaint();
                   main.validate();          
              else if(e.getSource() == instructB){
                   //remove and add components
                   main.removeAll();
                   main.setLayout(new GridLayout(3,0,0,0));
                   main.add(i1);
                   main.add(i2);
                   main.add(i3);
                   main.repaint();
                   main.validate();          
              else if(e.getSource() == exit){
                   jframe.setVisible(false);
                   showCredits();          
              else if(e.getSource() == about){
                   main.removeAll();
                   main.setLayout(new FlowLayout());
                   main.add(aboutLabel);                         
                   main.repaint();
                   main.validate();
         public void showCredits(){
              try{
                   String[] args = {};
                   Credits.main(args);
              }catch (Exception e){}
         public static void main(String args[]){
              jframe = new Space();
              jframe.setUndecorated(true);
              jframe.setBounds(0, 0, jframe.SCREENWIDTH, jframe.SCREENHEIGHT);
              jframe.setVisible(true);
            jframe.show();     
            jframe.setResizable(false);
               jframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
             jframe.centerPanel(jframe.select.getWidth(), jframe.select.getHeight());
             jframe.run(); //start music

    The reason it wasn't working was because you were calling the method after you had set the frame visible, so you saw no change. On top of that, jframe.select.getWidth() only works after the frame is visible in this case. So it's best to set a fixed size for one of them, then use getWidth, or as I did... it's the same thing. I also changed the centerPanel method, I'm not sure if all that's exactly needed, but you can change it back if you think you'll need it.
    import javax.sound.sampled.*;
    import java.awt.*;
    import javax.sound.midi.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    import java.io.*;
    public class Space extends JFrame implements ActionListener, Runnable{
    //Sound
    Sequence currentSound;
    Sequencer player;
    Thread soundCheck;
    boolean check = true;
    public void start(){
    soundCheck = new Thread();
    soundCheck.start();
    public void run(){
    try{
    File bgsound = new File("Sounds" + File.separator + "Space.mid");
    currentSound = MidiSystem.getSequence(bgsound);
    player = MidiSystem.getSequencer();
    player.open();
    player.setSequence(currentSound);
    player.start();
    checkSound();
    } catch (Exception exc){}
    public void checkSound(){
    while(check){
    if(!player.isRunning()){
                run();
    try{
    soundCheck.sleep((player.getMicrosecondLength() / 1000)-player.getMicrosecondPosition()); // sleep for the length of the track
    }catch (InterruptedException IE){}
    //Screen Variables:
    Dimension SCREEN = Toolkit.getDefaultToolkit().getScreenSize();
    final int SCREENWIDTH = SCREEN.width;
    final int SCREENHEIGHT = SCREEN.height;
    //Panels:
    JPanel select, main, north, south, east;
        //Buttons:
    JButton instructB, cheatB, playB, exit, about;
    //Labels:
    JLabel open, cheat1, cheat2, cheatInstruct, i1, i2 , i3, aboutLabel;
    //The container and frame:
    static Space jframe;
    Container content;
    //The Constructor:
    public Space(){
    super("Space");
    //set  container attributes:
    content = getContentPane();
    content.setLayout(new BorderLayout());
    //init panels:
    main   = new JPanel();
    select = new JPanel();
    north  = new JPanel();
    east   = new JPanel();
    south  = new JPanel();
    //set panel attributes:
    select.setLayout(new GridLayout(3,0,10,10));
    select.setBackground(Color.black);
    main.setBackground(Color.black);
    north.setBackground(Color.black);
    //add panels:
    content.add("West", select);
    content.add("Center", main);
    content.add("North", north);
    content.add("East", east);
    //Image Icons:
    Icon exit1 = new ImageIcon("Images" + File.separator + "exit1.gif");
    Icon exit2 = new ImageIcon("Images" + File.separator + "exit2.gif");
    Icon about1 = new ImageIcon("Images" + File.separator + "about1.gif");
    Icon about2 = new ImageIcon("Images" + File.separator + "about2.gif");
    //init buttons, add their listeners, and set their attributes:
    instructB = new JButton("Instructions", new ImageIcon("Images" + File.separator + "ship.gif"));
    instructB.setContentAreaFilled(false);
    instructB.setForeground(Color.yellow);
    instructB.addActionListener(this);
    select.add(instructB);
    cheatB = new JButton("Cheats", new ImageIcon("Images" + File.separator + "cheat.gif"));
    cheatB.setContentAreaFilled(false);
    cheatB.setForeground(Color.yellow);
    cheatB.addActionListener(this);
    select.add(cheatB);
    playB = new JButton("Play", new ImageIcon("Images" + File.separator + "ship2.gif"));
    playB.setContentAreaFilled(false);
    playB.setForeground(Color.yellow);
    playB.addActionListener(this);
    select.add(playB);
    exit = new JButton();
    exit.setRolloverEnabled(true);
    exit.setIcon(exit1);
    exit.setRolloverIcon(exit2);
    exit.setBorderPainted(false);
    exit.setContentAreaFilled(false);
    exit.addActionListener(this);
    north.add(exit);
    about = new JButton();
    about.setRolloverEnabled(true);
    about.setIcon(about1);
    about.setRolloverIcon(about2);
    about.setBorderPainted(false);
    about.setContentAreaFilled(false);
    about.addActionListener(this);
        north.add(about);
        //Labels:
        open = new JLabel("", new ImageIcon("Images" + File.separator + "open.gif"), JLabel.CENTER);
    main.add(open);
    cheat1 = new JLabel("<html><h1>tport</h1></html>");
    cheat1.setForeground(Color.red);
    cheat2 = new JLabel("<html><h1>zap</h1></html>");
    cheat2.setForeground(Color.green);
    cheatInstruct = new JLabel("<html><h1>Type a cheat at any time during a game, and press the \"Enter\" key.</html></h1>");
    cheatInstruct.setForeground(Color.blue);
    i1 = new JLabel("<html><h1>The arrow keys move your ship.</h1></html>");
    i1.setForeground(Color.red);
    i2 = new JLabel("<html><h1>The space-bar fires the gun.</h1></html>");
    i2.setForeground(Color.green);
    i3 = new JLabel("<html><h1>The red circles give upgrades.</html></h1>");
    i3.setForeground(Color.blue);
    aboutLabel    = new JLabel("", new ImageIcon("Images" + File.separator + "aboutImage.gif"), JLabel.CENTER);
    east.setPreferredSize(new Dimension(125, SCREEN.width));
    //centerPanel();
    /*private void centerPanel(final int width, final int height){
    try{
    Runnable setPanelSize = new Runnable(){
    public void run(){
    east.setPreferredSize(new Dimension(width, height));
    SwingUtilities.invokeAndWait(setPanelSize);
    } catch (Exception e){}
    private void centerPanel(final int width, final int height)
         east.setPreferredSize(new Dimension(width, height));
    public void actionPerformed(ActionEvent e){
    //if the play button was pressed do:
    if(e.getSource() == playB){
        //do something
        //else if the cheat button was pressed do:
    else if(e.getSource() == cheatB){
    //remove and add components
    main.removeAll();
    main.setLayout(new GridLayout(3,0,0,0));
    main.add(cheat1);
    main.add(cheat2);
    main.add(cheatInstruct);
    main.repaint();
    main.validate();
    else if(e.getSource() == instructB){
    //remove and add components
    main.removeAll();
    main.setLayout(new GridLayout(3,0,0,0));
    main.add(i1);
    main.add(i2);
    main.add(i3);
    main.repaint();
    main.validate();
    else if(e.getSource() == exit){
    jframe.setVisible(false);
    //showCredits();
    else if(e.getSource() == about){
    main.removeAll();
    main.setLayout(new FlowLayout());
    main.add(aboutLabel);
    main.repaint();
    main.validate();
    /*public void showCredits(){
    try{
    String[] args = {};
    Credits.main(args);
    }catch (Exception e){}
    public static void main(String args[]){
    jframe = new Space();
    //jframe.centerPanel(500, jframe.select.getHeight());
    jframe.setUndecorated(true);
    jframe.setBounds(0, 0, jframe.SCREENWIDTH, jframe.SCREENHEIGHT);
    jframe.setVisible(true);
            jframe.show();
            jframe.setResizable(false);
          jframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //jframe.centerPanel(jframe.select.getWidth(), jframe.select.getHeight());
        jframe.run(); //start music
    }Sorry I lost all the indenting :) I guess you can take a look at the few lines I changed and copy those lines.

  • Why won't this form submit?

    Why won't the form on this page submit?
    www.milesmemorials.com/contact.html
    Php for this form is-
    <?php
    $name = $_POST['name'];
    $visitor_email = $_POST['email'];
    $message = $_POST['message'];
    //Validate first
    if(empty($name)||empty($visitor_email))
        echo "Name and email are mandatory!";
        exit;
    if(IsInjected($visitor_email))
        echo "Bad email value!";
        exit;
    $email_from = "milesmemorials.com";//<== update the email address
    $email_subject = "Message from Miles Memorial contact form";
    $email_body = "Visitors name: $name.\n".
         "Message:\n $message".
    $to = "[email protected]";//<== update the email address
    $headers = 'From: '.$visitor_email."\r\n";
    $headers .='Reply-To:'.$visitor_email."\r\n";
    //Send the email!
    mail($to,$email_subject,$email_body,$headers);
    //done. redirect to thank-you page.
    header('Location: thankyou.html');
    // Function to validate against any email injection attempts
    function IsInjected($str)
      $injections = array('(\n+)',
                  '(\r+)',
                  '(\t+)',
                  '(%0A+)',
                  '(%0D+)',
                  '(%08+)',
                  '(%09+)'
      $inject = join('|', $injections);
      $inject = "/$inject/i";
      if(preg_match($inject,$str))
        return true;
      else
        return false;
    ?>

    >I do apologise if i seem slow, i am still very new to dreamweaver
    Just to be clear, this is not an issue with learning dreamweaver. This is just a lack of understanding of HTML and PHP. You need to learn those first before trying to learn DW.
    You have a form field named 'donorName' but are checking for a field named 'name'.
    $name = $_POST['name'];
    <input name="donerName" type="text"
    You need to rename one or the other.

  • Consolidate Library - why won't this work?

    Hi there,
    I've been using iTunes and my iPod on several iMacs successfully for years - I've just changed to a PC and now I feel like a beginner!
    I can't seem to get iTunes for Windows to seek out all my MP3s and put them in iTunes. The only way I can get iTunes to put them in it's library is to play them - then iTunes recognises then and remebers them. I have tried clicking on consolidate library - nothing. I have tried downloading my new music directly into the iTunes music folder - nothing. I can maunally add the file I download music into, but I don't want to have to do that all the time.
    Why won't iTunes just find my music for me? It does on my iMac!

    I dont know!
    In what way is it not working?

  • Why won't this scriipt work with Firefox? embed src="News2008Fall.pdf" width="615" height="3200" /embed

    Please tell me why this script won't work with Firefox. It works with Safari. Here is the page that includes the script: www.lionsgatehoa.org/newslettertest.html. Thank you. Tom Engleman
    Here is the script in my html document:
    <embed src="News2008Fall.pdf" width="615" height="3200"></embed>
    edit: removed phone #

    Works for me on Linux.<br />
    Your system details list doesn't show the Adobe Reader plugin, so you will have to (re)install that program.
    See:
    *https://support.mozilla.org/kb/Using+the+Adobe+Reader+plugin+with+Firefox
    *http://kb.mozillazine.org/Adobe_Reader
    *http://get.adobe.com/reader/otherversions/

  • Why won't this MERGE statement work?

    I am testing out a MERGE statement, which contains a subquery that will return no rows...on this condition, it should insert a record; however I get 0 records merged. Why is this?
    Ultimately, the hard-coded values will actually be passed in as parameters. If those a record with those four values is not found, then it should insert.
    MERGE INTO tb_slea_election_worksheet A
    USING 
    (SELECT i.slea_year,i.empid,i.bda_sum_sort,i.bda_dtl_sort FROM tb_slea_election_worksheet i
    WHERE  slea_year = '2008'
    AND empid = '6468T'
    AND bda_sum_sort = '30'
    AND bda_dtl_sort = '9999'
    ) B
    ON (A.slea_year = B.slea_year
    AND A.empid =B.empid
    AND A.bda_sum_sort  = B.bda_sum_sort
    AND A.bda_dtl_sort  = B.bda_dtl_sort) 
    WHEN MATCHED THEN
      UPDATE SET A.fa_proj_exp_amt  = 888
    WHEN NOT MATCHED THEN
      INSERT    (slea_year,empid,bda_sum_sort,bda_dtl_sort,act_exp_lst_yr,fa_proj_exp_amt)
      VALUES ( '2008','6468T','30','9999','0','55');

    A merge statement is just a much more efficient way of doing something like this pl/sql block
    DECLARE
       l_n NUMBER;
    BEGIN
       FOR r IN (SELECT pk, col1, col2 FROM source) LOOP
          BEGIN
             SELECT 1 INTO l_n
             FROM target
             WHERE pk = r.pk;
             UPDATE target
             SET col1 = r.col1,
                 col2 = r.col2
             WHERE pk = r.pk;
          EXCEPTION WHEN NO_DATA_FOUND THEN
             INSERT INTO target
             VALUES(r.pk, r.col1, r.col2);
          END;
       END LOOP;
    END;So, if the select from source returns no rows, nothing is going to happen.
    John

  • Why won't this piece of code work?

    Hello all, i am new to HTML and web design and i'm trying to make a website. I created this piece of code so that when the user mouses over one of the links (jpg image) it will change colors ( i have the same image in different color scheme saved in the same folder).
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>XXXXXXXXXX</title>
    </head>
    <body bgcolor="#000000">
    <table width="1050" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><table width="1050" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="_images/XXXXbanner.jpg" width="1050" height="311" alt="banner" /></td>
          </tr>
        </table>
          <table width="901" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="150"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ButtonOne','','_images/home_on.jpg',1)">
                 <img name="ButtonOne" border="0" src="_images/home.jpg" width="150" height="75" alt="home" /></a></td>
              <td width="150"><a href="gallery.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ButtonTwo','','_images/gallery_on.jpg',1)">
                  <img name="ButtonTwo" border="0" src="_images/gallery.jpg" width="150" height="75" alt="gallery" /></a></td>
              <td width="150"><a href="products.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ButtonThree','','_images/product_on.jpg',1)">
                 <img name="ButtonThree" border="0" src="_images/product.jpg" width="150" height="75" alt="products" /></a></td>
              <td width="150"><a href="store.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ButtonFour','','_images/shop_on.jpg',1)">
                 <img name="ButtonFour" border="0" src="_images/shop.jpg" width="150" height="75" alt="store" /></a></td>
              <td width="150"><a href="profile.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ButtonFive','','_images/profile_on.jpg',1)">
                 <img name="ButtonFive" border="0" src="_images/profile.jpg" width="150" height="75" alt="profile" /></a></td>
              <td width="151"><a href="contactus.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ButtonSix','','_images/contact_us_on.jpg',1)">
              <img name="ButtonSix" border="0" src="_images/contact_us.jpg" width="150" height="75" alt="contact" /></a></td>
            </tr>
          </table>
          <table width="1050" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
              <td> </td>
              <td> </td>
            </tr>
          </table>
          <p> </p>
        <p> </p></td>
      </tr>
    </table>
    </body>
    </html>
    the images and banner are showing up fine and i havent mistpyed any of the locations/file names. why doesn't the icon change colors (display the "on" image) when u hover the mouse over it? please help thanks in advance.
    ** i'm using Adobe Dreamweaver CS4

    He's right...
    try instering this into the head tags of your html
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    //-->
    </script>

  • Why Won't This Digital Camera Movie Load Into iPhoto

    I shot 186 photos and 12 movies with my Canon digital camera this past week while my wife and I were on vacation. The photos and 11 movies (all about one minute or less) loaded just fine but my longest one (3 minutes which is the maximum for my digital camera) will not load. Is there a maximum time limit for digital camera movies that I have exceeded with iPhoto?

    Hi David,
    when you say "will not load" do you meant it won't open in Quicktime or it didn't download into iPhoto?
    This is what I do;
    When iPhoto 5 first came out I really think it was programmed to import the smaller 30 sec video clips that cameras were taking at the time. Since then, digital cameras, at least my Canon S2 can take clips as large as your memory card can hold. The first time I tried to download my images and movie clips with my new camera, iPhoto stalled at the movie clips. I wasn't going to take any chances messing up my iPhoto Library so I started using Image Capture to download all my images and Movie clips. I actually like doing it this way a lot better. My movie clips are downloaded into my Movies folder where I then put them in a dated folder.
    My photos are downloaded into my Pictures folder, where I then put them in a dated folder. I import the dated folder into iPhoto. I also keep all dated folders from photo downloads in the Pictures folder till I get enough Movie folders and Photo folders to fill a DVD. I burn them and then delete them from the hard drive.
    This way I have the photos in iPhoto and I also have just the photos backed up to DVD.
    The Movies I keep on the hard drive in their dated folders until I use all the clips for my iMovie projects for the Year. I then make sure they are all burned to DVD, then I delete those from my hard drive.
    Using Image Capture to download images and video clips:
    Open up Image Capture which is found in the Applications folder.
    When it is opened, go to Image Capture/Preferences
    Under the General button choose
    Camera: When a camera is connected, open Image Capture.
    The next time you connect your camera Image Capture will open.
    In the window that opens you will see an Options button. Click on that button to set your options.
    To find out more about Image Capture (it can do a lot more) Click on Help in the menu bar when Image Capture is open.
    iPhoto: How to Change the "Open Automatically" Preference
    If you find you can't change any of Image Captures preferences or can't access any drop down menus or they are greyed out, check to make sure Image Capture is loose in the Applications folder and not within a sub folder.

  • Why won't this show (same) four pages in the Adobe Reader?

    %PDF-1.6
    3 0 obj
    <</Type /Font /BaseFont /Times-Italic /Subtype /Type1 >>
    endobj
    6 0 obj
    <</Length 158 >>
    stream
    1 0 0 1 50 200 cm /X1 Do
    1 0 0 1 0   200 cm /X1 Do
    1 0 0 1 0   200 cm /X1 Do
    1 0 0 1 200 -400 cm /X1 Do
    1 0 0 1 0 200 cm /X1 Do
    1 0 0 1 0 200 cm /X1 Do
    endstream
    endobj
    4 0 obj
    <</Type /XObject /Subtype /Form /BBox [0 0 1000 1000] /Resources <</Font <</F1 3 0 R>> >>
    /Length 77 >>
    stream
    BT /F1 18 Tf 0 0 Td (18 Point) Tj ET
    BT /F1 25 Tf 0 50 Td (25 Point) Tj ET
    endstream
    endobj
    5 0 obj
    <</Type /Page /Parent 2 0 R /Contents 6 0 R /MediaBox [0 0 595.27 841.88] /UserUnit 0.5 /Resources <</XObject <</X1 4 0 R>> >>
    >>
    endobj
    2 0 obj
    <</Type /Pages /Kids [5 0 R 5 0 R 5 0 R 5 0 R ] /Count 4 >>
    endobj
    1 0 obj
    <</Type /Catalog /Pages 2 0 R >>
    endobj
    xref
    0 7
    0000000000 65535 f
    0000000745 00000 n
    0000000667 00000 n
    0000000010 00000 n
    0000000297 00000 n
    0000000517 00000 n
    0000000085 00000 n
    trailer
    <<
    /Root 1 0 R
    /Size 7
    >>
    startxref
    796
    %%EOF
    Works OK with Chrome's reader......

    1. It may surprise you, but more than 50% of the problems which people ask about with PDF generators turn out to be related to the exact byte layout, and disappear (or get worse) with copy/paste. People with tools for PDF examination like to be able to use them and know they are working on the exact/same file.
    "But why can it not do that."
    Because the question is unanswerable. Imagine an API call
    PageObjectGetPageNumber().
    Given object 5 0 R and asking for the page number, what is the correct answer - 1, 2, 3, or 4? This is of more than academic interest. For example, the page object might be the destination of a link, and an interactive viewer needs to know which page to navigate to. So, while a simple PDF viewer could display it, many things might not work.
    ISO 32000-1 doesn't forbid it. But there isn't much mileage in taking the high ground and saying that one is making good files but Acrobat isn't compliant.

  • HELP-Why won't this function return a value

    I want to get this XML data OUT of the function, but it just
    won't work. What I am doing wrong??? Tracing "xmlList" gives me the
    output i want IN the function, but if I can't get it OUT. If i set
    the function to "String", I still can't get the function to return
    a value or anyway to get this data OUT of the function. Please
    help.
    var xml:XML;
    var xmlList:XMLList;
    var xmlLoader:URLLoader = new URLLoader;
    xmlLoader.load(new URLRequest("data/imagesT.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    function xmlLoaded(event:Event):String
    xml = XML(event.target.data);
    xmlList = xml.children()[0].child(2);

    It won't though. Tracing xmlList outside (i.e. after it runs)
    the function produces null with the function set to void. Inside
    the function tracing producing the correct data.

  • Why Won't This AVI File Copy?

    Sometimes I try to copy an AVI file onto an external USB or to my Apple TV. Every once in a while I get one file that starts out copying, but then I get an error message saying it "could not be read or written. (Error code -36)". The file names have no unusual characters in them.
    Anybody have an idea why this is? Thanks.
    By the way I have an iBook and I'm running OS 10.4.11 on it.

    Hi Homer, is this File Transfer being done via SMB, or to an MS-DOs/Fat32 Drive?
    If so there would be a 2 to 4GB file size limit.
    For error -36, might try this...
    http://docs.info.apple.com/article.html?artnum=301580
    Well, in pure Apple File System talk... -36 ioErr I/O error (bummers)
    Not very helpful, but generally means a Drive quit being Readable or Writable since starting the operation...
    http://fuzzy.wordpress.com/2006/12/10/ioerror-36/

Maybe you are looking for

  • Problems with jasper report pdf exporting

    Hello, I coded a simple servlet to view a jasper report (created with iReport) after clicking on the right button in the jsp. Here is the problem: net.sf.jasperreports.engine.JRRuntimeException: Error evaluating expression :      Source text : (java.

  • BB Curve 8330 Ball

    hi, this morning i was moving around on my phone and the ball quit working.  it is not moving to the right at all.  it moves, up, down, and to the left, but i cannot make it move right.  aside from buying a new one, is there anything i can do to fix

  • I have a hp pavilion dv7 notebook pc and i'm get and error message that my integrated camara is off

    i have a hp pavilion dv7 notebook pc and i'm get and error message that my integrated camara is off, and when I go into skype or cyberlink i can not see me

  • Wildcard Certificats and 4400 WLC

    First, I know the 4400 has been EOS. I am planning on replacing this with a new controller next year as part of a larger project. In the meantime, the certificate we have setup on our guest network is due to expire soon. I am pretty familiar with how

  • Seen any good SIP/phone App reviews? fring/nimbuzz/acrobits/bria/Skype/tru/

    Best phone App? SIP (fring v nimbuzz v acrobits v Bria v iStarSip/Wifone/F-Route/iPico/NetDial...) v Skype v Tru I'm trying to use an iPod touch as my main phone, using a MiFi 2200 to provide connectivity wherever. Anyone seen any good SIP/phone App