Following code wont work as i want it to??

Im writing a program which involves drawing several different shapes on a JComponent like JPanel. Im calling paint method of the JPanel casting in an Graphics2D object.
What i want is to be able to draw shapes on the JPanel and after some time i be able to add in more shapes to the JPanel.
This is what ive got so far:
import java.awt.*;
import javax.swing.*;
public class DrawingPanel extends JPanel {
       private Graphics2D g2;
       //constructor
       public DrawingPanel() {
            setBackground(Color.RED);
        * Draws a circle & line on board.
       public void drawMoreShape(){
            //Draws line
            g2.drawLine(30, 10, 24, 57);
            Ellipse2D.Double circle = new Ellipse2D.Double(20,60,30,30);
            g2.setColor(Color.BLUE);
            g2.fill(circle); //Draws a circle
            //Repaints the board...
            repaint();
        * @see javax.swing.JComponent#paint(java.awt.Graphics)
       public void paint(Graphics g) {
              super.paint(g);
              g2 = (Graphics2D) g;
              g2.setColor(Color.BLACK);
              g2.drawLine(10, 20, 14, 47);
                                    g2.drawString("Hello", 20,20);
}                    I want to call the drawMoreShape method during later stages (by another class) so i can add in more shape after i've already drawn initial stuff (the stuff in paint).
This JPanel will ofcourse be embedded inside a JFrame class which has all common swing features such as clicking a button("Add more shapes") which calls that method to add more shapes.
But thats advanced and all i want now is to get the basic of drawing on JPanel & adding more drawings after ive initially drawn something involving the use of Graphics2D object.
The only reason i can think so far is that g2 is null but i've initiated it in paint method.
So can someone tell me whats wrong?
Edited by: Theresonly1 on Jul 31, 2008 9:15 AM

All drawing in Swing should be done in paintComponent function.This is not exactly 100% true. It is okay - in fact good code style - to pass the graphics object from paintComponent to sub-methods, so that you can compartmentalize your painting. Also, if you create an image buffer, you can draw to that from anywhere and just call repaint when your done.
But basically this is right. I was just trying to get @OP up and running as quickly as possible
If you're going to put everything in paintCOmponent, you need to have a boolean flag, like paint2ndPart. Then switch that on when you want to paint the second part.
There is no meaning to drawing inside drawMoreShape and then calling repaint, since repaint will invoke a paint cycle which will delete it.
Read the tutorial: [Performing Custom Painting|http://java.sun.com/docs/books/tutorial/uiswing/painting/]
And this article: [Painting in AWT and Swing|http://java.sun.com/products/jfc/tsc/articles/painting/]

Similar Messages

  • Code wont work when trying to upload image!

    My Code wont work when I try to upload an image to mysql. (Field in mysql is BLOB)
    <!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>insert</title>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <?php require_once('Connections/drama_database.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO databaseimage (name, image) VALUES (%s, %s)",
                           GetSQLValueString($_POST['name'], "text"),
                           GetSQLValueString($_POST['image'], "double"));
      mysql_select_db($database_drama_database, $drama_database);
      $Result1 = mysql_query($insertSQL, $drama_database) or die(mysql_error());
    mysql_select_db($database_drama_database, $drama_database);
    $query_image = "SELECT * FROM databaseimage";
    $image = mysql_query($query_image, $drama_database) or die(mysql_error());
    $row_image = mysql_fetch_assoc($image);
    $totalRows_image = mysql_num_rows($image);
    ?>
    </head>
    <body>
    <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
    Name:  <span id="sprytextfield1">
      <label for="name"></label>
      <input type="text" name="name" id="name" />
      <span class="textfieldRequiredMsg">A value is required.</span></span>
      <p>
        <label for="image"></label>
        <input type="file" name="image" id="image" />
      </p>
      <p>
        <input type="submit" name="Upload" id="Upload" value="Upload" />
      </p>
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    </script>
    </body>
    </html>
    <?php
    mysql_free_result($image);
    ?>
    Any help would be very much appreciated!

    OK, that tutorial is different than what I assume you want. I suspect you want the ability to have users upload images and store the metadata of those images in a database, correct? That tutorial only shows how to upload to a specific location so the image can
    be displayed in an iframe.
    Search for "php file upload scripts" to see how to upload to a file system and store the metadata in the database.
    >and no, mostly i have used the dreamweaver features to avoid it as much as possible
    As you are seeing, DW code is very limited in what it can do. It also generates code that is not up to current standards,and is very difficult to work with if you need to modify it. Basically, it's junk. Forget it and learn how to read and write code. There are tons on tutorials on how to get started with PHP.  DW Server behaviors only seem like a time saver in the beginning. In the end, you'll end up wasting more time using them than learning how to code yourself.

  • HT1689 my security code wont work on my visa

    my visa code wont work from my visa to buy stuff from the store

    Is the address on your iTunes account exactly the same (format and spacing etc) as on your credit card bill : http://support.apple.com/kb/TS1646 ? If it is then you could try what it says at the bottom of that page :
    If the issue persists, contact your credit card company and verify that they and any company they use to process credit card authorizations have the correct information on file.
    And/or try contacting iTunes support : http://www.apple.com/support/itunes/contact/ - click on Express Lane, then iTunes > iTunes Store

  • Digital copy code wont work in itunes

    Hi i have a few dvds which im trying to redeem on itunes from my digital copy but none of the codes are working and itunes keeps saying it can only be redeem through a computer, but i only have an ipad?!
    Please help thank you

    I uninstalled the Power Cinema and it didnt work....then I rechecked and found that I forgot (DUH) to install the MCE driver.....geeze
    It works now.  I believe the earlier problems stem from using Power DVD 5 and the 'old' driver from the CD.  Just to test it, I installed the PowerCinema and it worked also!  I can selectively switch from MCE back to PowerCinema OK.
    It may interest you to know that the PowerCinema detected twice as many HDTV channel (sub-channels) as did the MCE.  Based on what I'm seeing, I question whether I will keep the MCE version.  XP Home/Pro may work just as well with the PowerCinema interface.
    Thanks again.
    Big Al

  • Code not working like I want

    I have two date fields, "StartDate1" and "EndDate1".
    When I make the EndDate1 value less than StartDate1, the "button" remains VISIBLE, but INACTIVE, and I can move on to the next field.
    Why does the button remain visible, why is the button inactive, and how do I force the user to enter an EndDate1 value greater than that of StartDate1?
    Also, in the Validate code, if I remove the line
    " else xfa.host.messageBox("It Works"); "
    then I get a syntax error, which I don't understand.
    Can someone help clean up this mess?
    Thanks,
    Bernie
    ----- F.P1.EndDate1::exit - (FormCalc, client) --------------------
    if ($.isNull ne 1) then
    var nDays = Date2Num($.formattedValue, "MM/DD/YYYY");
    if (nDays <= 0) then
    xfa.host.messageBox("Please enter the date in MM/DD/YYYY format.");
    xfa.host.setFocus($.name);
    endif
    endif
    ----- F.P1.EndDate1::validate - (FormCalc, client) ---------------
    var DCV
    if (HasValue(StartDate1) and HasValue(EndDate1)) then
    DCV = Date2Num(EndDate1, "YYYY-MM-DD") - Date2Num(StartDate1, "YYYY-MM-DD");
    // xfa.host.messageBox (DCV);
    if (DCV<0) then
    xfa.host.messageBox("End Date must be greater than Start Date");
    xfa.host.setFocus($.name);
    else xfa.host.messageBox("It Works");
    endif
    else $ = null
    endif

    Thanks for responding.
    If I rename the back_btn instance to next_btn and the next_btn to back_btn and click the back button, this is the error:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at david_fla::MainTimeline/nextImage()
    Any suggestions?

  • My code wont work

    how do you make this code work
    <!DOCTYPE html>
    <html lang "en">
    <head>
    <body bgcolor="#003366">
    <title>websitename Gallery..</title>
    </head>
    <body>
    <Div id="wrapper">
    <Div class="conatiner">
    </Div>
    </DIv>
    </html>
    </body>
    #wrapper{
    margin-top:65px;
    background-color:#ffffff;
    width:100%;
    height:900px;
    border:10px;
    overflow:hidden;
    .Container{
    background-color:#000000;
    padding:65px;
    width:800px;
    height:820px;
    margin:0 auto;
    everytime i try something the 100% width does not go all the way to the end as it should because it is suppose to look 100%. the code is just their to show you what im trying to work on i know where it actually goes =)

    It's no surprise - you still have some errors!
    <!DOCTYPE html>
    <html lang "en">
    <head>
    <title>websitename Gallery..</title>
    <style type="text/css">
    #wrapper{
    margin-top:65px;
    background-color:#ffffff;
    width:100%;
    height:900px;
    border:10px;
    overflow:hidden;
    .container{
    background-color:#000000;
    padding:65px;
    width:800px;
    height:820px;
    margin:0 auto;
    </style>
    </head>
    <body bgcolor="#003366">
    <Div id="wrapper">
    <Div class="container">
    </Div>
    </DIv>
    </body>
    </html>

  • My calculator code wont work =\

    This is a code i had to use directly from my Java Programming book in my chapter 6, this code does not compile and i cant seem to find my error.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.datatransfer.*;
    import java.text.DecimalFormat;
    import javax.swing.JOptionPane;
    public class Calculator extends Frame implements ActionListener
         private Button keys[];
         private Panel keypad;
         private TextField lcd;
         private double op1;
         private boolean first;
         private boolean foundKey;
         private boolean clearText;
         private int lastOp;
         private DecimalFormat calcPattern;
         public Calculater()
              // create an instance of the menu
              MenuBar mnuBar = new MenuBar();
              setMenuBar(mnuBar);
              // consturct and populate the File menu
              Menu mnuFile = new Menu("File",true);
              mnuBar.add(mnuFile);
                   MenuItem mnuFileExit = new MenuItem("Exit");
                   mnuFile.add(mnuFileExit);
              // construct and populate the Edit menu
              Menu mnuEdit = new Menu("Edit", true);
              mnuBar.add(mnuEdit);
                   MenuItem mnuEditClear = new MenuItem("Clear");
                   mnuEdit.add(mnuEditClear);
                   mnuEdit.insertSeperator(1);
                   MenuItem mnuEditCopy = new MenuItem("Copy");
                   mnuEdit.add(mnuEditCopy);
                   MenuItem mnuEditPaste = new MenuItem("Paste");
                   mnuEdit.add(mnuEditPaste);
              // construct and populate the About menu
              Menu mnuAbout = new Menu("About", true);
                   mnuBar.add(mnuAbout);
                   MenuItem mnuAboutCaluclator = new MenuItem("About Calculator");
                   mnuAbout.add(mnuAboutCalculator);
              // add the ActionListener to each menu item
              mnuFileExit.AddActionlistener(this);
              mnuEditClear.AddActionlistener(this);
              mnuEditCopy.AddActionlistener(this);
              mnuEditPaste.AddActionlistener(this);
              mnuAboutCalculator.AddActionlistener(this);
              // assign an ActionCommand to each menu item
              mnuFileExit.setActionCommand("Exit");
              mnuEditClear.setActionCommand("Clear");
              mnuEditCopy. setActionCommand("Copy");
              mnuEditPaste.setActionCommand("Paste");
              mnuAboutCalculator.setActionCommand("About");
              // construct components and intialize beginning values
              lcd = new TextField(20);
                   lcd.setEditable(false);
              keypad = new Panel();
              keys = new Button[16];
              first = true;
              op1 = 0.0;
              clearText = true;
              lastOp = 0;
              calcPattern = new DecimalFormat("########.########");
              // construct and assign captions to the Buttons
              for (int i=0; i<=9; i++);
                   keys[i] = new Button(String.valueOf(i));
              keys[10] = new Button("/");
              keys[11] = new Button("*");
              keys[12] = new Button("-");
              keys[13] = new Button("+");
              keys[14] = new Button("=");
              keys[15] = new Button(".");
              // set Frame and keypad layout to grid layout
              setLayout(new BorderLayout());
              keypad.setLayout(new GridLayout(4,4,10,10));
              for (int i=7; i<=10; i++) // 7, 8, 9, divide
                   keypad.add(keys);
              for (int i=4; i<=6; i++) // 4, 5, 6
                   keypad.add(keys[i]);
              keypad.add(keys[11]); // multiply
              for (int i=1; i<=3; i++) // 1, 2, 3
                   keypad.add(keys[i]);
              keypad.add(keys[12]); // subtract
              keypad.add(keys[0]); // 0 key
              for (int i=15; i>=13; i--)
                   keypad.add(keys[i]); // decimal point, =, add (+) keys
              for (int i=0, i<keys.length; i++)
                   keys[i].addActionListener(this);
              add(lcd, BorderLayout.NORTH);
              add(keypad, BorderLayout.CENTER);
              addWindowListener(
                   new WindowAdapter()
                             public void widowClosing(WindowEvent e)
                                       System.exit(0);
         } // end of constructor method
         public void actionPerformed(ActionEvent e)
              // test for menu item clicks
              String arg = e.getActionCommand();
              if (arg == "Exit")
                   System.exit(0);
              if (arg == "Clear")
                   clearText = true;
                   first = true;
                   op1 = 0.0;
                   lcd.setText("");
                   lcd.requestFocus();
              if (arg == "Copy")
                   Clipboard cb = Toolkit.getDefaultToolKit().getSystemClipboard();
                   StringSelection contents = new StringSelection(lcd.getText());
                   cb.setContents(contents, null);
              if (arg == ("Paste")
                   Clipboard cb = Toolkit.getDefaultToolKit().getSystemClipboard();
                   Transferable content = cb.getContents(this);
                   try
                        String s = (String)content.getTransferDate(DataFlavor.stringFlavor);
                        lcd.setText(calcPattern.format(Double.parseDouble(s)));
                   catch (Throwable exc)
                        lcd.setText("");
              if (arg == ("About")
                   String message = "Calculator ver.1.0\nOpenExhibit Software\ nCopyright 2007\nAll rights reserved";
                   JOptionPane.showMessageDialog(null, message,"About Calculator", JOptionPane.INFORMATION_MESSAGE);
              // test for button clicks
              foundKey = false;
              // search for the clicked key
              for (int o=0; i<keys.length && !foundKey; i++)
                   if(e.getSource() == keys[i])
                        foundKey = true;
                        switch(i)
                             // number and decimal point buttons
                             case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 15:
                                  if(clearText)
                                       lcd.setText("");
                                       clearText = false;
                                  lcd.setText(lcd.getText() + keys[i].getLabel());
                                  break;
                                  // operator buttons
                                  case 10: case 11: case 12: case 13: case 14:
                                       clearText = true;
                                       if (first) // first operand
                                            if(lcd.getText().length()==0) op1 = 0.0;
                                            else op1 = Double.parseDouble(lcd.getText());
                                            first = false;
                                            clearText = true;
                                            lastOp = i; // save last operator
                                       else // second operand
                                            switch(lastOp)
                                                 case 10: // divide button
                                                 op1 /= Double.parseDouble(lcd.getText));
                                                      break;
                                                 case 11: // multiply button
                                                      op1 *= Double.parseDouble(lcd.getText));
                                                      break;
                                                 case 12: // minus button
                                                      op1 -= Double.parseDouble(lcd.getText));
                                                      break;
                                                 case 13: // plus button
                                                      op1 += Double.parseDouble(lcd.getText));
                                                      break;
                                            } // end of switch(lastOp)
                                            lcd.setText(calcPattern.format(op1));
                                            clearText = true;
                                            if(i==14) first = true; // equal button
                                            else lastOp = i; // save last operator
                                  } // end else
                                  break;
                             } // end of switch (i)
                        } // end of if
                   } // end of for
              } // end of actionPerformed
              public static void main(String args[])
                   // set frame properties
                   Calculator f = new Calculator();
                   f.setTitle("Calculator Application");
                   f.setBounds(200,200,300,300);
                   f.setVisible(true);
                   // set image properties and add to frame
                   Image icon = Toolkit.getDefaultToolKit().getImage("calcImage.gif");
                   f.setIconImage(icon);
         }     // end of main
    } // end of class

    this should work. enjoy.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.datatransfer.*;
    import java.text.DecimalFormat;
    import javax.swing.JOptionPane;
    public class Calculator extends Frame implements ActionListener
        private Button keys[];
        private Panel keypad;
        private TextField lcd;
        private double op1;
        private boolean first;
        private boolean foundKey;
        private boolean clearText;
        private int lastOp;
        private DecimalFormat calcPattern;
        public Calculator()
            // create an instance of the menu
            MenuBar mnuBar = new MenuBar();
            setMenuBar(mnuBar);
            // consturct and populate the File menu
            Menu mnuFile = new Menu("File",true);
            mnuBar.add(mnuFile);
                MenuItem mnuFileExit = new MenuItem("Exit");
                mnuFile.add(mnuFileExit);
            // construct and populate the Edit menu
            Menu mnuEdit = new Menu("Edit", true);
            mnuBar.add(mnuEdit);
                MenuItem mnuEditClear = new MenuItem("Clear");
                mnuEdit.add(mnuEditClear);
                mnuEdit.insertSeparator(1);
                MenuItem mnuEditCopy = new MenuItem("Copy");
                mnuEdit.add(mnuEditCopy);
                MenuItem mnuEditPaste = new MenuItem("Paste");
                mnuEdit.add(mnuEditPaste);
            // construct and populate the About menu
            Menu mnuAbout = new Menu("About", true);
                mnuBar.add(mnuAbout);
                MenuItem mnuAboutCalculator = new MenuItem("About Calculator");
                mnuAbout.add(mnuAboutCalculator);
            // add the ActionListener to each menu item
            mnuFileExit.addActionListener(this);
            mnuEditClear.addActionListener(this);
            mnuEditCopy.addActionListener(this);
            mnuEditPaste.addActionListener(this);
            mnuAboutCalculator.addActionListener(this);
            // assign an ActionCommand to each menu item
            mnuFileExit.setActionCommand("Exit");
            mnuEditClear.setActionCommand("Clear");
            mnuEditCopy. setActionCommand("Copy");
            mnuEditPaste.setActionCommand("Paste");
            mnuAboutCalculator.setActionCommand("About");
            // construct components and intialize beginning values
            lcd = new TextField(20);
                lcd.setEditable(false);
            keypad = new Panel();
            keys = new Button[16];
            first = true;
            op1 = 0.0;
            clearText = true;
            lastOp = 0;
            calcPattern = new DecimalFormat("########.########");
            // construct and assign captions to the Buttons
            for (int i=0; i<=9; i++)
                keys[i] = new Button(String.valueOf(i));
            keys[10] = new Button("/");
            keys[11] = new Button("*");
            keys[12] = new Button("-");
            keys[13] = new Button("+");
            keys[14] = new Button("=");
            keys[15] = new Button(".");
            // set Frame and keypad layout to grid layout
            setLayout(new BorderLayout());
            keypad.setLayout(new GridLayout(4,4,10,10));
            for (int i=7; i<=10; i++) // 7, 8, 9, divide
                keypad.add(keys);
    for (int i=4; i<=6; i++) // 4, 5, 6
    keypad.add(keys[i]);
    keypad.add(keys[11]); // multiply
    for (int i=1; i<=3; i++) // 1, 2, 3
    keypad.add(keys[i]);
    keypad.add(keys[12]); // subtract
    keypad.add(keys[0]); // 0 key
    for (int i=15; i>=13; i--)
    keypad.add(keys[i]); // decimal point, =, add (+) keys
    for (int i=0; i<keys.length; i++)
    keys[i].addActionListener(this);
    add(lcd, BorderLayout.NORTH);
    add(keypad, BorderLayout.CENTER);
    addWindowListener(
    new WindowAdapter()
    public void widowClosing(WindowEvent e)
    System.exit(0);
    } // end of constructor method
    public void actionPerformed(ActionEvent e)
    // test for menu item clicks
    String arg = e.getActionCommand();
    if (arg == "Exit")
    System.exit(0);
    if (arg == "Clear")
    clearText = true;
    first = true;
    op1 = 0.0;
    lcd.setText("");
    lcd.requestFocus();
    if (arg == "Copy")
    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
    StringSelection contents = new StringSelection(lcd.getText());
    cb.setContents(contents, null);
    if (arg == "Paste")
    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
    Transferable content = cb.getContents(this);
    try
    String s = (String)content.getTransferData(DataFlavor.stringFlavor);
    lcd.setText(calcPattern.format(Double.parseDouble(s)));
    catch (Throwable exc)
    lcd.setText("");
    if (arg == "About")
    String message = "Calculator ver.1.0\nOpenExhibit Software\nCopyright 2007\nAll rights reserved";
    JOptionPane.showMessageDialog(null, message,"About Calculator", JOptionPane.INFORMATION_MESSAGE);
    // test for button clicks
    foundKey = false;
    // search for the clicked key
    for (int i=0; i<keys.length && !foundKey; i++)
    if(e.getSource() == keys[i])
    foundKey = true;
    switch(i)
    // number and decimal point buttons
    case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 15:
    if(clearText)
    lcd.setText("");
    clearText = false;
    lcd.setText(lcd.getText() + keys[i].getLabel());
    break;
    // operator buttons
    case 10: case 11: case 12: case 13: case 14:
    clearText = true;
    if (first) // first operand
    if(lcd.getText().length()==0) op1 = 0.0;
    else op1 = Double.parseDouble(lcd.getText());
    first = false;
    clearText = true;
    lastOp = i; // save last operator
    else // second operand
    switch(lastOp)
    case 10: // divide button
    op1 /= Double.parseDouble(lcd.getText());
    break;
    case 11: // multiply button
    op1 *= Double.parseDouble(lcd.getText());
    break;
    case 12: // minus button
    op1 -= Double.parseDouble(lcd.getText());
    break;
    case 13: // plus button
    op1 += Double.parseDouble(lcd.getText());
    break;
    } // end of switch(lastOp)
    lcd.setText(calcPattern.format(op1));
    clearText = true;
    if(i==14) first = true; // equal button
    else lastOp = i; // save last operator
    } // end else
    break;
    } // end of switch (i)
    } // end of if
    } // end of for
    } // end of actionPerformed
    public static void main(String args[])
    // set frame properties
    Calculator f = new Calculator();
    f.setTitle("Calculator Application");
    f.setBounds(200,200,300,300);
    f.setVisible(true);
    // set image properties and add to frame
    Image icon = Toolkit.getDefaultToolkit().getImage("calcImage.gif");
    f.setIconImage(icon);
    } // end of main
    } // end of class

  • My redemption code wont work what can i do?

    i put my redemption code in which was from pc world and my computer crashed and now its saying its already been redeemed please do i need to talk to adobe or pc world?

    Kimmy,
    You may start with Adobe here:
    http://helpx.adobe.com/x-productkb/global/service1.html
    I am afraid the Redemption Code Help is a roundabout way to get back here, as are the other normal help pages right now.

  • HT1212 my pass code wont work

    i just got my iphone 5 today
    i have been using my password all day and now it will not work my phone has been disabled several times.

    If you mean the backup is encrypted and you cannot remember the passcode - or iTunes will not accept it - you have to restore as a new device without using the backup.
    You can sync your content back to the iPad again from iTunes but you will lose your app data and settings - all files as well, unless the files are stored on your computer and you can transfer them back to the iPad.

  • My redeem code wont work!!

    I bought photoshop at walmart, tried to redeem online for a serial number and it says its already been redeemed but i havent redeemed it!

    If you haven't opened the packaging yet, I would for sure take it back to Walmart, and I'd try going back to them even if you have. It might be simpler than trying to deal with Adobe, but if you want to try, start here:
    http://helpx.adobe.com/contact.html?product=photoshop-elements&topic=serial-number-issues- or-activating-my-product
    and use the Chat with an Agent option.

  • I cracked my ipod touch 4g screen really badly and i cant type in my lock screen password because the zero wont work, i dont want to reset  my ipod because i will lose all my music and stuff

    i need help changing my ipod touch 4g lock screen password

    If iTunes is asking you to enter the iPod then yo have to restore and thus erase the iPod after you place the iPod in recovery mode. Otherwise:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        

  • SetAccelerator in Java 6 wont work with invisible JMenuItem

    HI all,
    i have a problem with Java 6.
    I used an invisibleMenuItem to enable some shortkey. it works fine with Java 5.
    while with Java 6, the following methods wont work anymore.
    invisibleMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M,inputEvent.CTRL_MASK));do u have any idea?

    sorry, i still dont figure it out. That was an overlooking.
    i tried to run the binding example with some little modification.
    http://java.sun.com/docs/books/tutorial/uiswing/components/examples/SliderDemo3.java
    original code
      textField.getInputMap().put(KeyStroke.getKeyStroke(
                                            KeyEvent.VK_ENTER, 0),
                                            "check");modified code
    textField.getInputMap().put(KeyStroke.getKeyStroke(
                      KeyEvent.CTRL_MASK, KeyEvent.VK_M),
                                            "check");then it wont listen to ctrl-M event. can anyone help?

  • I want to reset my ipod touch 4th gen but i have forgotten the restrictions passcode and for some reason its not working on my laptop on itunes and the restore thing wont work! any help?

    I want to reset my ipod touch 4th gen but i have forgotten the restrictions passcode and for some reason its not working on my laptop on itunes and the restore thing wont work! any help?

    Make sure you have the Current Version of iTunes Installed on your computer
    iTunes free download from www.itunes.com/download
    Then See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    After you have Recovered your Device...Re-Sync your Content
    Note:
    To remove a forgotten Restrictions passcode you will need to  Restore the Device as New...
    OR... From a Backup created Before the Restrictions Code was set....

  • Mail-form from dB Masters + reCaptcha - Things wont work the way i want.

    I used a mail-form from dB Masters because someone here gave me the tip.
    And its great! But it uses a simplefied Captcha script.
    I tryd to change the code myself and got to this: http://www.wientjesvoegwerk.nl/PHP/form.php
    If you try to send mail it wont work.....
    form.php
    <!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>Email Form</title>
    </head>
    <body>
    <center>
    <form id="form" method="post" action="../formmailer.php" enctype="multipart/form-data">
    <input type="hidden" name="action" value="verify">
    <table cellpadding="4">
    <tr><td  style="text-align: left;" valign=top><font size="2" FACE="Verdana" color="#000000">Uw naam:</font><small><span style="color:#E00000;" title="Required field">*</span></small></td><td align="left">
    <input type="text" name="Naam" value=""/>
    </td></tr>
    <tr><td  style="text-align: left;" valign=top><font size="2" FACE="Verdana" color="#000000">Email:</font><small><span style="color:#E00000;" title="Required field">*</span></small></td><td align="left">
    <input type="text" name="Email" value="" />
    </td></tr>
    <tr><td  style="text-align: left;" valign=top><font size="2" FACE="Verdana" color="#000000">Telefoonnummer:</font><small><span style="color:#E00000;" title="Required field">*</span></small></td><td align="left">
    <input type="text" name="Telefoonnummer" value="" />
    </td></tr>
    <tr><td  style="text-align: left;" valign=top><font size="2" FACE="Verdana" color="#000000">Onderwerp:</font><small><span style="color:#E00000;" title="Required field">*</span></small></td><td align="left">
    <select name="Onderwerp">
        <option value="0">Algemene Informatie</option>
        <option value="1">Offerte</option>
        <option value="2">Overige</option>
        </select>
    </td></tr>
    <tr><td  style="text-align: left;" valign=top><font size="2" FACE="Verdana" color="#000000">Bericht:</font><small><span style="color:#E00000;" title="Required field">*</span></small></td><td align="left">
    <textarea name="Bericht" rows="7" cols="40"></textarea>
    </td></tr>
    <tr><td align=right>CAPTCHA TXT</td>
    <td align="left">
    <form method="post" action="verify.php">
       <?php
         require_once('recaptchalib.php');
         $publickey = "I hide the key on this forum dont know if its ok to show";
         echo recaptcha_get_html($publickey);
       ?>
    </form>
    </td>
    </tr>
    <tr><td></td><td align="left">
    <input type="submit" name="submit" value="Submit" />
    <input type="reset" name="Reset" value="Clear Form" />
    <input type="hidden" name="config" value="0" />
    <input type="hidden" name="nospam" value="" />
    </td></tr>
    </table>
    <div style="height:1px; display: none; visibility: hidden;">
    <input type="text" name="email">
    </div>
    </form>
    </center>
    </body>
    </html>
    formmailer.php
    <?php
    // dB Masters' PHP FormM@iler, Copyright (c) 2007 dB Masters Multimedia
    // http://www.dbmasters.net/
    // FormMailer comes with ABSOLUTELY NO WARRANTY
    // Licensed under the AGPL
    // See license.txt and readme.txt for details
    // General Variables
         $check_referrer="no";
         $referring_domains="www.wientjesvoegwerk.nl";
    // options to use if hidden field "config" has a value of 0
    // recipient info
         $charset[0]="UTF-8";
         $tomail[0]="[email protected]";
         $cc_tomail[0]="";
         $bcc_tomail[0]="";
    // Mail contents config
         $subject[0]="Onderwerp van de Email";
         $reply_to_field[0]="Email";
         $reply_to_name[0]="Naam";
         $required_fields[0]="Naam,Email,Telefoonnummer,Onderwerp,Bericht";
         $required_email_fields[0]="Email";
         $attachment_fields[0]="";
         $return_ip[0]="yes";
         $mail_intro[0]="Er is een bericht gestuurd vanuit Wientjesvoegwerk.nl:";
         $mail_fields[0]="Naam,Email,Telefoonnummer,Onderwerp,Bericht";
         $mail_type[0]="text";
         $mail_priority[0]="1";
         $allow_html[0]="no";
    // Send back to sender config
         $send_copy[0]="yes";
         $copy_format[0]="vert_table";
         $copy_fields[0]="Naam,Onderwerp,Bericht";
         $copy_attachment_fields[0]="";
         $copy_subject[0]="Kopie van uw bericht naar Wientjesvoegwerk.nl";
         $copy_intro[0]="Dank u voor uw bericht!<br />Om veiligheidsredenen is uw email adres en telefoonnummer niet in deze mail te zien.<br /> Het volgende is verstuurd;";
         $copy_from[0]="[email protected]";
         $copy_tomail_field[0]="Email";
    // Result options
         $header[0]="";
         $footer[0]="";
         $error_page[0]="";
         $thanks_page[0]="";
    // Default Error and Success Page Variables
         $error_page_title[0]="Errors:";
         $error_page_text[0]="Ga a.u.b. terug naar de vorige pagina om alle benodigde velden in te vullen.";
         $thanks_page_title[0]="Bericht verzonden.";
         $thanks_page_text[0]="Dank u voor uw bericht!";
    // Antispam Options
         $empty_field[0]="nospam";
         $character_scan[0]="Bericht,Naam,Email,Telefoonnummer,Onderwerp";
         $time_delay[0]="2";
         $captcha_codes[0]="9C2449,EEADC8,77A585,D72838";
         $max_urls[0]="2";
         $max_url_fields[0]="Bericht";
         $flag_spam[0]="";
    // options to use if hidden field "config" has a value of 1
    // recipient info
         $charset[1]="";
         $tomail[1]="";
         $cc_tomail[1]="";
         $bcc_tomail[1]="";
    // Mail contents config
         $subject[1]="";
         $reply_to_field[1]="";
         $reply_to_name[1]="";
         $required_fields[1]="";
         $required_email_fields[1]="";
         $attachment_fields[1]="";
         $return_ip[1]="";
         $mail_intro[1]="";
         $mail_fields[1]="";
         $mail_type[1]="";
         $mail_priority[1]="";
         $allow_html[1]="";
    // Send back to sender config
         $send_copy[1]="";
         $copy_format[1]="";
         $copy_fields[1]="";
         $copy_attachment_fields[1]="";
         $copy_subject[1]="";
         $copy_intro[1]="";
         $copy_from[1]="";
         $copy_tomail_field[1]="";
    // Result options
         $header[1]="";
         $footer[1]="";
         $error_page[1]="";
         $thanks_page[1]="";
    // Default Error and Success Page Variables
         $error_page_title[1]="";
         $error_page_text[1]="";
         $thanks_page_title[1]="";
         $thanks_page_text[1]="";
    // Antispam Options
         $empty_field[1]="bait";
         $character_scan[1]="Naam,Email,Telefoonnummer,Onderwerp,Bericht";
         $time_delay[1]="";
         $captcha_codes[1]="";
         $max_urls[1]="";
         $max_url_fields[1]="";
         $flag_spam[1]="";
    // Don't muck around past this line unless you know what you are doing //
    ob_start();
    $config=$_POST["config"];
    $debug=0;
    $debug_text="";
    // fix for Windows email server security
    ini_set("sendmail_from",$tomail[$config]);
    // email validation regular expression
    $regex = "^[-a-z0-9!#$%&\'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&\'*+/=?^_`{|}~]+)*@(([a-z0-9]([-a-z0-9]*[a-z0-9]+)?){1,63}\.)+([a-z]([-a-z0-9]*[a-z0-9]+)?){2,63}$";
    $header_injection_regex = "(\r|\n)";
    if($header[$config]!="")
         include($header[$config]);
    if($_POST["submit"] || $_POST["Submit"] || $_POST["submit_x"] || $_POST["Submit_x"])
    // begin global functions //
    // get visitor IP
         function getIP()
              if(getenv(HTTP_X_FORWARDED_FOR))
                   $user_ip=getenv("HTTP_X_FORWARDED_FOR");
              else
                   $user_ip=getenv("REMOTE_ADDR");
              return $user_ip;
    // get value of given key
         function parseArray($key)
              $arrayvalue=$_POST[$key];
              $count=1;
              extract($array_value);
              foreach($array_value as $part_value)
                   if($count > 1){$value.=", ";}
                   $value.=$part_value;
                   $count=$count+1;
              return $value;
    // stripslashes and autolink url's
         function parseValue($value)
              $value=preg_replace("/(http:\/\/+.[^\s]+)/i",'<a href="\\1">\\1</a>', $value);
              return $value;
    // html header if used
         function htmlHeader()
              $htmlHeader="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n<html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$charset[$config]."\"></head>\n<body>\n<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"600\">\n";
              return $htmlHeader;
    // html footer if used
         function htmlFooter()
              $htmlFooter="</table>\n</body>\n</html>\n";
              return $htmlFooter;
    // build verticle table format
         function buildVertTable($fields, $intro, $to, $send_ip)
              $message=htmlHeader();
              if($intro != "")
                   $message.="<tr>\n<td align=\"left\" valign=\"top\" colspan=\"2\">".$intro."</td>\n</tr>\n";
              $fields_check=preg_split('/,/',$fields);
              $run=sizeof($fields_check);
              for($i=0;$i<$run;$i++)
                   $cur_key=$fields_check[$i];
                   $curvalue=$_POST[$cur_key];
                   if(is_array($cur_value))
                        $curvalue=parseArray($cur_key);
                   $curvalue=parseValue($cur_value);
                   if($allow_html[$config]=="no")
                        $curvalue=htmlspecialchars(nl2br($cur_value));
                   else
                        $curvalue=nl2br($cur_value);
                   $message.="<tr>\n<td align=\"left\" valign=\"top\" style=\"white-space:nowrap;\"><b>".$cur_key."</b></td>\n<td align=\"left\" valign=\"top\" width=\"100%\">".$cur_value."</td>\n</tr>\n";
              if($send_ip=="yes" && $to=="recipient")
                   $user_ip=getIP();
                   $message.="<tr>\n<td align=\"left\" valign=\"top\" style=\"white-space:nowrap;\"><b>Sender IP</b></td>\n<td align=\"left\" valign=\"top\" width=\"100%\">".$user_ip."</td>\n</tr>\n";
              $message.=htmlFooter();
              return $message;
    // build horizontal table format
         function buildHorzTable($fields, $intro, $to, $send_ip)
              $message=htmlHeader();
              $fields_check=preg_split('/,/',$fields);
              $run=sizeof($fields_check);
              if($intro != "")
                   $message.="<tr>\n<td align=\"left\" valign=\"top\" colspan=\"".$run."\">".$intro."</td>\n</tr>\n";
              $message.="<tr>\n";
              for($i=0;$i<$run;$i++)
                   $cur_key=$fields_check[$i];
                   $message.="<td align=\"left\" valign=\"top\" style=\"white-space:nowrap;\"><b>".$cur_key."</b></td>\n";
              if($send_ip=="yes" && $to=="recipient")
                   $message.="<td align=\"left\" valign=\"top\" style=\"white-space:nowrap;\"><b>Sender IP</b></td>\n";
              $message.="</tr>\n";
              $message.="<tr>\n";
              for($i=0;$i<$run;$i++)
                   $cur_key=$fields_check[$i];
                   $curvalue=$_POST[$cur_key];
                   if(is_array($cur_value))
                        $curvalue=parseArray($cur_key);
                   $curvalue=parseValue($cur_value);
                   if($allow_html[$config]=="no")
                        $curvalue=htmlspecialchars(nl2br($cur_value));
                   else
                        $curvalue=nl2br($cur_value);
                   $message.="<td align=\"left\" valign=\"top\">".$cur_value."</td>\n";
              $message.="</tr>\n";
              $message.="<tr>\n";
              if($send_ip=="yes" && $to=="recipient")
                   $user_ip=getIP();
                   $message.="<td align=\"left\" valign=\"top\">".$user_ip."</td>\n";
              $message.="</tr>\n";
              $message.=htmlFooter();
              return $message;
    // build plain text format
         function buildTextTable($fields, $intro, $to, $send_ip)
              $message="";
              if($intro != "")
                   $message.=$intro."\n\n";
              $fields_check=preg_split('/,/',$fields);
              $run=sizeof($fields_check);
              for($i=0;$i<$run;$i++)
                   $cur_key=$fields_check[$i];
                   $curvalue=$_POST[$cur_key];
                   if(is_array($cur_value))
                        $curvalue=parseArray($cur_key);
                   $curvalue=parseValue($cur_value);
                   if($allow_html[$config]=="no")
                        $curvalue=htmlspecialchars($cur_value);
                   else
                        $curvalue=$cur_value;
                   $message.="".$cur_key.": ".$cur_value."\n";
              if($send_ip=="yes" && $to=="recipient")
                   $user_ip=getIP();
                   $message.="Sender IP: ".$user_ip."\n";
              return $message;
    // get the proper build fonction
         function buildTable($format, $fields, $intro, $to, $send_ip)
              if($format=="vert_table")
                   $message=buildVertTable($fields, $intro, $to, $send_ip);
              else if($format=="horz_table")
                   $message=buildHorzTable($fields, $intro, $to, $send_ip);
              else
                   $message=buildTextTable($fields, $intro, $to, $send_ip);
              return $message;
    // referrer checking security option
         function checkReferer()
              if($check_referrer=="yes")
                   $ref_check=preg_split('/,/',$referring_domains);
                   $ref_run=sizeof($ref_check);
                   $referer=$_SERVER['HTTP_REFERER'];
                   $domain_chk="no";
                   for($i=0;$i<$ref_run;$i++)
                        $cur_domain=$ref_check[$i];
                        if(stristr($referer,$cur_domain)){$domain_chk="yes";}
              else
                   $domain_chk="yes";
              return $domain_chk;
    // checking required fields and email fields
         function checkFields($text_fields, $email_fields, $regex)
               $error_message="";
              if($debug==1)
                   $error_message.="<li>text_fields: ".$text_fields."<br />email_fields: ".$email_fields."<br />reply_to_field: ".$reply_to_field."<br />reply_to_name: ".reply_to_name."</li>";
              if($text_fields != "")
                   $req_check=preg_split('/,/',$text_fields);
                   $req_run=sizeof($req_check);
                   for($i=0;$i<$req_run;$i++)
                        $cur_field_name=$req_check[$i];
                        $cur_field=$_POST[$cur_field_name];
                        if($cur_field=="")
                             $error_message.="<li>You are missing the <b>".$req_check[$i]."</b> field</li>\n";
              if($email_fields != "")
                   $email_check=preg_split('/,/',$email_fields);
                   $email_run=sizeof($email_check);
                   for($i=0;$i<$email_run;$i++)
                        $cur_email_name=$email_check[$i];
                        $cur_email=$_POST[$cur_email_name];
                        if($cur_email=="" || !eregi($regex, $cur_email))
                             $error_message.="<li>You are missing the <b>".$email_check[$i]."</b> field or it is not a valid email address.</li>\n";
              return $error_message;
    // attachment function
         function getAttachments($attachment_fields, $message, $content_type, $border)
              $att_message="This is a multi-part message in MIME format.\r\n";
              $att_message.="--{$border}\r\n";
              $att_message.=$content_type."\r\n";
              $att_message.="Content-Transfer-Encoding: 7bit\r\n\r\n";
              $att_message.=$message."\r\n\r\n";
              $att_check=preg_split('/,/',$attachment_fields);
              $att_run=sizeof($att_check);
              for($i=0;$i<$att_run;$i++)
                   $fileatt=$_FILES[$att_check[$i]]['tmp_name'];
                   $fileatt_name=$_FILES[$att_check[$i]]['name'];
                   $fileatt_type=$_FILES[$att_check[$i]]['type'];
                   if (is_uploaded_file($fileatt))
                        $file=fopen($fileatt,'rb');
                        $data=fread($file,filesize($fileatt));
                        fclose($file);
                        $data=chunk_split(base64_encode($data));
                        $att_message.="--{$border}\n";
                        $att_message.="Content-Type: {$fileatt_type}; name=\"{$fileatt_name}\"\r\n";
                        $att_message.="Content-Disposition: attachment; filename=\"{$fileatt_name}\"\r\n";
                        $att_message.="Content-Transfer-Encoding: base64\r\n\r\n".$data."\r\n\r\n";
              $att_message.="--{$border}--\n";
              return $att_message;
    // function to set content type
         function contentType($charset, $format)
              if($format=="vert_table")
                   $content_type="Content-type: text/html; charset=".$charset."\r\n";
              else if($format=="horz_table")
                   $content_type="Content-type: text/html; charset=".$charset."\r\n";
              else
                   $content_type="Content-type: text/plain; charset=".$charset."\r\n";
              return $content_type;
    // end global functions //
    // begin procedural scripting //
         // anti-spam empty field check
         if($_POST[$empty_field[$config]] != "")
              $empty_message = "<li>This submission failed and was flagged as spam.</li>\n";
         // anti-spam character scan check
         if(strlen($character_scan[$config]) > 0)
              $spam_message="";
              $field_check=preg_split('/,/',$character_scan[$config]);
              $field_run=sizeof($field_check);
              for($i=0;$i<$field_run;$i++)
                   $cur_field_name=$field_check[$i];
                   $cur_field=$_POST[$cur_field_name];
                   if(preg_match("/<(.|\n)+?>/", $cur_field) || preg_match("/\[(.|\n)+?\]/", $cur_field))
                        $spam_message.="<li>This message contains disallowed characters.</li>\n";
         // anti-spam time delay check
         if((strlen($time_delay[$config]) > 0 && strlen($_POST["time"]) > 0) || (strlen($time_delay[$config]) > 0 && (strlen($_POST["time"]) == 0 || !$_POST["time"])))
              if((time() - $_POST["time"]) < $time_delay[$config])
                   $time_message = "<li>This has been stopped by the timer, and is likely spam.</li>\n";
         // anti-spam CAPTCHA check
         if(strlen($captcha_codes[$config]) > 0)
              $captcha_check=preg_split('/,/',$captcha_codes[$config]);
              if(strtolower($_POST["captcha_entry"]) != strtolower($captcha_check[$_POST["captcha_code"]]))
                   $captcha_message = "<li>CAPTCHA test did not match.</li>\n";
         // anti-spam max URL check
         if(strlen($max_url_fields[$config]) > 0)
              $max_url_message="";
              $field_check=preg_split('/,/',$max_url_fields[$config]);
              $field_run=sizeof($field_check);
              for($i=0;$i<$field_run;$i++)
                   $cur_field_name=$field_check[$i];
                   $cur_field=$_POST[$cur_field_name];
                   preg_match_all("/http:/", $cur_field, $matches);
                   if(count($matches[0]) > $max_urls[$config])
                        $max_url_message.="<li>This message contains too many URL's.</li>\n";
         // set anti-spam flagging option
         if(strlen($empty_message.$spam_message.$time_message.$captcha_message.$max_url_message) > 0 && strlen($flag_spam[$config]) == 0)
              $set_flag = 2;
         else if(strlen($empty_message.$spam_message.$time_message.$captcha_message.$max_url_message) > 0 && strlen($flag_spam[$config]) > 0)
              $set_flag = 1;
         else
              $set_flag = 0;
         // header injection check
            $security_filter="";
         if(strlen($_POST[$reply_to_field[$config]]) > 0)
              if(eregi($header_injection_regex,$_POST[$reply_to_field[$config]]))
                   $security_filter.="<li>Header injection attempt detected, mail aborted.</li>\n";
              else
                   $reply_to_field_checked=$_POST[$reply_to_field[$config]];
         if(strlen($_POST[$reply_to_name[$config]]) > 0)
              if(eregi($header_injection_regex,$_POST[$reply_to_name[$config]]))
                   $security_filter.="<li>Header injection attempt detected, mail aborted.</li>\n";
              else
                   $reply_to_name_checked=$_POST[$reply_to_name[$config]];
         // check domain referrer and continue
         $domain_chk=checkReferer();
         if($domain_chk=="yes")
              $error_message=checkFields($required_fields[$config], $required_email_fields[$config], $regex);
              if(strlen($error_message) < 1 && strlen($security_filter) < 1 && $set_flag < 2)
                   // build appropriate message format for recipient
                   $content_type=contentType($charset[$config], $mail_type[$config]);
                   $message=buildTable($mail_type[$config], $mail_fields[$config], $mail_intro[$config], "recipient", $return_ip[$config]);
                   // build header data for recipient message
                   //$extra="From: ".$_POST[$reply_to_field[$config]]."\r\n";
                   $extra="From: ".$reply_to_name_checked." <".$reply_to_field_checked.">\r\n";
                   if($cc_tomail[$config]!="")
                        $extra.="Cc: ".$cc_tomail[$config]."\r\n";
                   if($bcc_tomail[$config]!="")
                        $extra.="Bcc: ".$bcc_tomail[$config]."\r\n";
                   if($mail_priority[$config]!="")
                        $extra.="X-Priority: ".$mail_priority[$config]."\r\n";
                   // get attachments if necessary
                   if($attachment_fields[$config]!="")
                        $semi_rand=md5(time());
                        $border="==Multipart_Boundary_x{$semi_rand}x";
                        $extra.="MIME-Version: 1.0\r\n";
                        $extra.="Content-Type: multipart/mixed; boundary=\"{$border}\"";
                        $message=getAttachments($attachment_fields[$config], $message, $content_type, $border);
                   else
                        $extra.="MIME-Version: 1.0\r\n".$content_type;
                   // send recipient email
                   if($debug==1)
                        if($set_flag == 1)
                             $debug_text.="<p><b>Mail would have sent flagged for spam if not in debug mode.</b></p>";
                        else
                             $debug_text.="<p><b>Mail would have sent if not in debug mode.</b></p>";
                   else if($debug==0)
                        if($set_flag == 1)
                             $subject = $flag_spam[$config]." ".$subject[$config];
                        else
                             $subject = $subject[$config];
                        mail("".$tomail[$config]."", "".stripslashes($subject)."", "".stripslashes($message)."", "".$extra."");
                   // autoresponse email if necessary
                   if($send_copy[$config]=="yes")
                        // build appropriate message format for autoresponse
                        $content_type=contentType($charset[$config], $copy_format[$config]);
                        $message=buildTable($copy_format[$config], $copy_fields[$config], $copy_intro[$config], "autoresponder", $return_ip[$config]);
                        // build header data for autoresponse
                        $copy_tomail=$_POST[$copy_tomail_field[$config]];
                        $copy_extra="From: ".$copy_from[$config]."\r\n";
                        // get autoresponse  attachments if necessary
                        if($copy_attachment_fields[$config]!="")
                             $semi_rand=md5(time());
                             $border="==Multipart_Boundary_x{$semi_rand}x";
                             $copy_extra.="MIME-Version: 1.0\r\n";
                             $copy_extra.="Content-Type: multipart/mixed; boundary=\"{$border}\"";
                             $message=getAttachments($copy_attachment_fields[$config], $message, $content_type, $border);
                        else
                             $copy_extra.="MIME-Version: 1.0\r\n".$content_type;
                        // send autoresponse email
                        if($debug==1)
                             if($set_flag == 1)
                                  $debug_text.="<p><b>Autoresponder would have sent flagged for spam if not in debug mode.</b></p>";
                             else
                                  $debug_text.="<p><b>Autoresponder would have sent if not in debug mode.</b></p>";
                        else if($debug==0)
                             $send_copy = 1;
                             if($copy_tomail=="" || !eregi($regex,$copy_tomail))
                                  $send_copy = 0;
                             if($send_copy == 1)
                                  if($set_flag == 1)
                                       $copy_subject = $flag_spam[$config]." ".$copy_subject[$config];
                                  else
                                       $copy_subject = $copy_subject[$config];
                                  mail("$copy_tomail", "".$copy_subject."", "$message", "$copy_extra");
                   // showing thanks pages from a successful submission
                   if($thanks_page[$config]=="")
                        echo "<h3>".$thanks_page_title[$config]."</h3>\n";
                        echo "<p>".$thanks_page_text[$config]."</p>\n";
                        if(strlen($debug_text) > 0)
                             echo "<p><b><i>".$debug_text."</i></b></p>\n";
                   else
                        header("Location: ".$thanks_page[$config]);
              else
                   // entering error page options from missing required fields
                   if($error_page[$config]=="")
                        echo "<h3>".$error_page_title[$config]."</h3>\n";
                        echo "<ul>\n";
                        echo $security_filter.$empty_message.$error_message.$spam_message.$time_message.$captcha_message.$max_url_message;
                        echo "</ul>\n";
                        echo "<p>".$error_page_text[$config]."</p>\n";
                   else
                        header("Location: ".$error_page[$config]);
         else
              echo "<h3>".$error_page_title[$config]."</h3>\n";
              // message if unauthorized domain trigger from referer checking option
              echo "<p>Sorry, mailing request came from an unauthorized domain.</p>\n";
    // end procedural scripting //
    else
         echo "<h3>Error</h3>";
         echo "<p>No form data has been sent to the script</p>\n";
    if($footer[$config]!="")
         include($footer[$config]);
    ob_end_flush();
    ?>
    verify.php
    <?php
    require_once('recaptchalib.php');
    $privatekey = "i hide this on the forum";
    $resp = recaptcha_check_answer ($privatekey,
                                   $_SERVER["REMOTE_ADDR"],
                                   $_POST["recaptcha_challenge_field"],
                                   $_POST["recaptcha_response_field"]);
    if (!$resp->is_valid) {
       // What happens when the CAPTCHA was entered incorrectly
       die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
            "(reCAPTCHA said: " . $resp->error . ")");
    } else {
       // Your code here to handle a successful verification
    ?>
    We have a saying in the Netherlands; "Not being abled to see the tree's trough the forest"
    Well i dont see it anymore...
    I managed to get it in the code but it doesnt work.
    I hope someone can help me out!

    @Nancy O.
    Thanks for your support i appreciate it that you helped me out a many times.
    However i have read all of the topics you posted.
    I know in the mail form i can disable the "sort of Captcha". I wanted to disable it and insert reCaptcha instead.
    I will re-make the form because like you said (and i already figured it out myself) ;
    "b) Don't modify forms until you get a very basic form working on your server."
    And youre right, im taking too much work at once.
    @CowboyInAZ
    Im a hobbyist that learns really really fast.
    Before March 23 i never used CSS, Javascript and XHTML. And never combined them all together with PHP. (never ever created a php based file from scratch)
    The reason why i use other persons code is because i learn faster with examples, and because i dont need to reinvent the wheel if someone already invented it. The only thing i do with it is learn the workings, customise it and at last, rewrite the code when i understand it.
    If you look at my current site: http://www.wientjesvoegwerk.nl/
    You will notice that the site is validated by W3C with no errors and warnings.
    I think it was Nancy O. that gave me the link to the validator. Thats how i discovered the service.
    You need to know that in 1 day (from 63 errors and 12 warnings) i removed all errors. And i didnt knew much about it, and why errors happend while the site looks fine.
    So im just curious how things work and thats why i "steal" codes and adjust them to learn myself.
    I also want a education like you spoke of, but im interested in a different media.
    I want to be abled to create my dream project wich involves new ways for game studios to earn money.
    This is just a simple start, im also taking tutorials in C#, C++.

  • Abc wont work error code 400-1

    Abc wont work error code 400-1

    Hey xoxokt,
    Thanks for the question. The following resource outlines troubleshooting information for third-party content providers on Apple TV:
    Apple TV: Troubleshooting third-party content providers
    http://support.apple.com/kb/HT200072
    If you have playback issues with a content provider's services
    In most cases, you can isolate playback issues to your home network, your broadband connection, or a possible outage with a content provider. To see if your issue is affecting multiple services or a specific content provider, try another service. For example, play a movie trailer from the main menu.
    - If the issue is affecting multiple services on your Apple TV, see how to troubleshoot playback performance.
    - If the issue is affecting a single content provider on your Apple TV, restart your Apple TV by going to Settings > General > Restart. If the issue continues, you might need to contact the content provider.
    Thanks,
    Matt M.

Maybe you are looking for

  • Selection screen field not working in Query

    Hi Gurus! I have a small problem with one of my query that I just created for finding status of our customers. I have a code section which handles it all . The problem is that I ahve a user field called "Check date" which I ahve used in selection scr

  • IPhone 4S could not be activated because the activation server is temporarily unavailable

    If you got the "scary" message that you could not activate iPhone 4S neither by Wi-Fi or iTunes, I want to share my experience: I decided to reset my iPhone 4S, and used "Erase All Content and Settings" under the reset menu (Settings/General/Reset),

  • IDVD burning - but playback shutters

    Recently I made a quick 8:31 slideshow using iDVD. I added a 3:36 mp3 file for background sound (which will loop). I select the Road Trip template in 4:3 and then completed the slideshow. Burned it and then played it in a DVD player. The sound and sl

  • Best practices for using Query Browser

    Hi, I started getting along with "Query Browser" option to embed data directly from Bex queries to the dashboard. I am looking for the Best practices which are recommended and needs to be followed from performance point of view and from reporting poi

  • In 4.6B me2n for opens , selected we101 , scope list prameter Alv

    Dear Guru,    For open po  using Me2n T code,also selectd the WE101 , and scope list  ALV option menu doen't contain , after taking to excel file its getting irregular coloum wise ? pls guide?