Help me with this drawing APPLET!

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
<applet code ='Scribble.java' width=300 height =300>
</applet>
public class Scribble extends Applet
implements MouseListener,ActionListener, MouseMotionListener,ItemListener
Choice shape;
String msg="";
int last_x = 0;
int last_y = 0;
int clickx=0,clicky=0;
public void init()
shape = new Choice();
shape.add("Line");
shape.add("FreeHand");
shape.select("FreeHand");
shape.addItemListener(this);
add(shape);
Button clear = new Button("clear");
add(clear);
addMouseListener(this);
addMouseMotionListener(this);
clear.addActionListener(this);
public void paint(Graphics g)
g.drawString(msg,30,40);
    public void mousePressed(MouseEvent me)
     last_x=me.getX();
     last_y=me.getY();
     clickx=me.getX();
     clicky=me.getY();
     public void mouseEntered(MouseEvent me)
     public void mouseExited(MouseEvent me)
     public void mouseReleased(MouseEvent me)
     public void mouseClicked(MouseEvent me)
     public void mouseMoved(MouseEvent me)
     public void mouseDragged(MouseEvent me)
     //For drawing Freehand
     if(shape.getSelectedItem().equals("FreeHand"))
     Graphics g = getGraphics();
     g.drawLine(last_x,last_y,me.getX(),me.getY());
     last_x = me.getX();
        last_y = me.getY();
     //For Drawing Line
     if(shape.getSelectedItem().equals("Line"))
     Graphics g = getGraphics();
     g.setColor(Color.white);
     g.drawLine(clickx,clicky,last_x,last_y);
     g.setColor(Color.red);
        g.drawLine(clickx,clicky,me.getX(),me.getY());
     last_x = me.getX();
        last_y = me.getY();
          /*For Button*/
     public void actionPerformed(ActionEvent ae)
     String str=ae.getActionCommand();
     if(str.equals("clear"))
     repaint();
     public void itemStateChanged(ItemEvent ie)
}Now my problem is that the thing which I've used for drawing the line...I have erased the previous position of the line by drawing it in WHITE color. But the problem is that if the line was drawn over the existing line then the line which was there before gets erased as the pixel positions are turned to WHITE color. Please help me with this as I want to give the user and idea as to where the line is being drawn like in MS paint.

One way would be to draw to a BufferedImage and then to draw the BufferedImage onto the Component. You can get the BufferedImage's Graphics instance by invoking BufferedImage.getGraphics().

Similar Messages

  • I will pay for who can help me with this applet

    Hi!, sorry for my english, im spanish.
    I have a big problem with an applet:
    I�ve make an applet that sends files to a FTP Server with a progress bar.
    Its works fine on my IDE (JBuilder 9), but when I load into Internet Explorer (signed applet) it crash. The applet seems like blocked: it show the screen of java loading and dont show the progress bar, but it send the archives to the FTP server while shows the java loading screen.
    I will pay with a domain or with paypal to anyone who can help me with this problematic applet. I will give my code and the goal is only repair the applet. Only that.
    My email: [email protected]
    thanks in advance.
    adios!

    thaks for yours anwswers..
    harmmeijer: the applet is signed ok, I dont think that is the problem...
    itchyscratchy: the server calls are made from start() method. The applet is crashed during its sending files to FTP server, when finish, the applet look ok.
    The class I use is FtpBean: http://www.geocities.com/SiliconValley/Code/9129/javabean/ftpbean/
    (I test too with apache commons-net, and the same effect...)
    The ftp is Filezilla in localhost.
    This is the code, I explain a little:
    The start() method calls iniciar() method where its is defined the array of files to upload, and connect to ftp server. The for loop on every element of array and uploads a file on subirFichero() method.
    Basicaly its this.
    The HTML code is:
    <applet
           codebase = "."
           code     = "revelado.Upload.class"
           archive  = "revelado.jar"
           name     = "Revelado"
           width    = "750"
           height   = "415"
           hspace   = "0"
           vspace   = "0"
           align    = "middle"
         >
         <PARAM NAME="usern" VALUE="username">
         </applet>
    package revelado;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import java.io.*;
    import javax.swing.border.*;
    import java.net.*;
    import ftp.*;
    public class Upload
        extends Applet {
      private boolean isStandalone = false;
      JPanel jPanel1 = new JPanel();
      JLabel jLabel1 = new JLabel();
      JLabel jlmensaje = new JLabel();
      JLabel jlarchivo = new JLabel();
      TitledBorder titledBorder1;
      TitledBorder titledBorder2;
      //mis variables
      String DIRECTORIOHOME = System.getProperty("user.home");
      String[] fotos_sel = new String[1000]; //array of selected images
      int[] indice_tamano = new int[1000]; //array of sizes
      int[] indice_cantidad = new int[1000]; //array of quantitys
      int num_fotos_sel = 0; //number of selected images
      double importe = 0; //total prize
      double[] precios_tam = {
          0.12, 0.39, 0.60, 1.50};
      //prizes
      String server = "localhost";
      String username = "pepe";
      String password = "pepe01";
      String nombreusuario = null;
      JProgressBar jProgreso = new JProgressBar();
      //Obtener el valor de un par�metro
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
            (getParameter(key) != null ? getParameter(key) : def);
      //Construir el applet
      public Upload() {
      //Inicializar el applet
      public void init() {
        try {
          jbInit();
        catch (Exception e) {
          e.printStackTrace();
      //Inicializaci�n de componentes
      private void jbInit() throws Exception {
        titledBorder1 = new TitledBorder("");
        titledBorder2 = new TitledBorder("");
        this.setLayout(null);
        jPanel1.setBackground(Color.lightGray);
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setBounds(new Rectangle(113, 70, 541, 151));
        jPanel1.setLayout(null);
        jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
        jLabel1.setText("Subiendo archivos al servidor");
        jLabel1.setBounds(new Rectangle(150, 26, 242, 15));
        jlmensaje.setFont(new java.awt.Font("Dialog", 0, 10));
        jlmensaje.setForeground(Color.red);
        jlmensaje.setHorizontalAlignment(SwingConstants.CENTER);
        jlmensaje.setText(
            "Por favor, no cierre esta ventana hasta que termine de subir todas " +
            "las fotos");
        jlmensaje.setBounds(new Rectangle(59, 49, 422, 30));
        jlarchivo.setBackground(Color.white);
        jlarchivo.setBorder(titledBorder2);
        jlarchivo.setHorizontalAlignment(SwingConstants.CENTER);
        jlarchivo.setBounds(new Rectangle(16, 85, 508, 24));
        jProgreso.setForeground(new Color(49, 226, 197));
        jProgreso.setBounds(new Rectangle(130, 121, 281, 18));
        jPanel1.add(jlmensaje, null);
        jPanel1.add(jlarchivo, null);
        jPanel1.add(jProgreso, null);
        jPanel1.add(jLabel1, null);
        this.add(jPanel1, null);
        nombreusuario = getParameter("usern");
      //Iniciar el applet
      public void start() {
        jlarchivo.setText("Start() method...");
        iniciar();
      public void iniciar() {
        //init images selected array
        fotos_sel[0] = "C:/fotos/05160009.JPG";
        fotos_sel[1] = "C:/fotos/05160010.JPG";
        fotos_sel[2] = "C:/fotos/05160011.JPG";
         // etc...
         num_fotos_sel=3; //number of selected images
        //conectar al ftp (instanciar clase FtpExample)
        FtpExample miftp = new FtpExample();
        miftp.connect();
        //make the directory
         subirpedido(miftp); 
        jProgreso.setMinimum(0);
        jProgreso.setMaximum(num_fotos_sel);
        for (int i = 0; i < num_fotos_sel; i++) {
          jlarchivo.setText(fotos_sel);
    jProgreso.setValue(i);
    subirFichero(miftp, fotos_sel[i]);
    try {
    Thread.sleep(1000);
    catch (InterruptedException ex) {
    //salida(ex.toString());
    jlarchivo.setText("Proceso finalizado correctamente");
    jProgreso.setValue(num_fotos_sel);
    miftp.close();
    //Detener el applet
    public void stop() {
    //Destruir el applet
    public void destroy() {
    //Obtener informaci�n del applet
    public String getAppletInfo() {
    return "Subir ficheros al server";
    //Obtener informaci�n del par�metro
    public String[][] getParameterInfo() {
    return null;
    //sube al ftp (a la carpeta del usuario) el archivo
    //pedido.txt que tiene las lineas del pedido
    public void subirpedido(FtpExample miftp) {
    jlarchivo.setText("Iniciando la conexi�n...");
    //make folder of user
    miftp.directorio("www/usuarios/" + nombreusuario);
    //uploads a file
    public void subirFichero(FtpExample miftp, String nombre) {
    //remote name:
    String nremoto = "";
    int lr = nombre.lastIndexOf("\\");
    if (lr<0){
    lr = nombre.lastIndexOf("/");
    nremoto = nombre.substring(lr + 1);
    String archivoremoto = "www/usuarios/" + nombreusuario + "/" + nremoto;
    //upload file
    miftp.subir(nombre, archivoremoto);
    class FtpExample
    implements FtpObserver {
    FtpBean ftp;
    long num_of_bytes = 0;
    public FtpExample() {
    // Create a new FtpBean object.
    ftp = new FtpBean();
    // Connect to a ftp server.
    public void connect() {
    try {
    ftp.ftpConnect("localhost", "pepe", "pepe01");
    catch (Exception e) {
    System.out.println(e);
    // Close connection
    public void close() {
    try {
    ftp.close();
    catch (Exception e) {
    System.out.println(e);
    // Go to directory pub and list its content.
    public void listDirectory() {
    FtpListResult ftplrs = null;
    try {
    // Go to directory
    ftp.setDirectory("/");
    // Get its directory content.
    ftplrs = ftp.getDirectoryContent();
    catch (Exception e) {
    System.out.println(e);
    // Print out the type and file name of each row.
    while (ftplrs.next()) {
    int type = ftplrs.getType();
    if (type == FtpListResult.DIRECTORY) {
    System.out.print("DIR\t");
    else if (type == FtpListResult.FILE) {
    System.out.print("FILE\t");
    else if (type == FtpListResult.LINK) {
    System.out.print("LINK\t");
    else if (type == FtpListResult.OTHERS) {
    System.out.print("OTHER\t");
    System.out.println(ftplrs.getName());
    // Implemented for FtpObserver interface.
    // To monitor download progress.
    public void byteRead(int bytes) {
    num_of_bytes += bytes;
    System.out.println(num_of_bytes + " of bytes read already.");
    // Needed to implements by FtpObserver interface.
    public void byteWrite(int bytes) {
    //crea un directorio
    public void directorio(String nombre) {
    try {
    ftp.makeDirectory(nombre);
    catch (Exception e) {
    System.out.println(e);
    public void subir(String local, String remoto) {
    try {
    ftp.putBinaryFile(local, remoto);
    catch (Exception e) {
    System.out.println(e);
    // Main
    public static void main(String[] args) {
    FtpExample example = new FtpExample();
    example.connect();
    example.directorio("raul");
    example.listDirectory();
    example.subir("C:/fotos/05160009.JPG", "/raul/foto1.jpg");
    //example.getFile();
    example.close();

  • Help me with  this assignment

    can anyone out there help me with this assignment ????? i`ll attach the file to this topic
    In this assignment, you are to write a Java applet, using arrays, to simulate the functions of a drinks-vending machine.
    The assignment requirements described below are broken down into 2 stages of development, described in this document
    as 'Basic Requirements' and 'Additional Features'. You are advised to do your programming progressively in these
    stages. An Activity Plan has also been specified for you to follow. Refer to the 'Grading Criteria' on page 5 to have
    an idea of how the different components are graded.
    1.     1. BACKGROUND
    A company intends to build computerised drinks-vending machines to enlarge its business portfolio. You have been tasked to develop a
    Java applet that simulates the operation of such a machine to determine if it will meet their needs.
    2.     1. BASIC REQUIREMENTS
    The machine should have a wide range of drinks available. A customer can choose a drink according to the following criteria:
    a)     a) Category of Drinks
    �     � Beverages
    �     � Soft Drinks
    (For beverages, there is choice of whether sugar and/or creamer is required, for which there is an additional charge.)
    b)     b) Type of Beverages
    �     � Hot
    �     � Cold
    Once a customer has specified the drink he wants, the amount payable is displayed. The unit prices to be displayed are as follows:
    Drinks     Price per Cup/Packet ($)
    Beverage:     Coffee     1.00
         Tea     1.20
         Milo     1.40
         Horlicks     1.35
         Chrysanthemum     1.00
         Ginger     0.80
    Soft Drinks:     Apple     1.40
         Orange     1.40
         Pineapple     1.50
         Carrot     2.00
         Longan     1.20
         Bandung     1.00
    (For beverages, a request for sugar or creamer attracts an additional charge of $0.10 each. Creamer is not applicable for
    chrysanthemum and ginger.)
    The customer may then confirm his order by entering the amount payable (this symbolises his payment for the drink). Whenever the
    payment input is not correct, an appropriate error message is displayed, whereupon the customer has to re-enter the amount again.
    When the correct amount is paid, the required drink is dispensed.
    For any drink that is out of stock, a message is shown, stating that it is not available. Each time a drink is dispensed, the stock for that
    drink is updated (For beverages, the stock is stored in units of servings for each cup.) To simplify the testing, you may start the simulation
    by setting the stock for each drink to 10 packets or cup-servings.
    3.     2. ADDITIONAL FEATURES
    In addition, the simulator can have the following features:
    a)     a) Smart Graphical User-Interface (GUI)
    You may build upon the basic requirements by recommending alternative drinks of the same category, whenever a requested
    drink is not available (as signified from the stock). In this case, only drinks which are available (i.e., in sufficient stock) are
    displayed for the customer to choose. And if only soft drinks are available, the selections for creamer and sugar should be disabled.
    b)     b) Multiple Orders
    A customer could order more than one drink. The system could allow him to specify as many drinks as he wants, prompting him
    for an appropriate payment, and then dispensing the drinks accordingly, subject to availability. This may also entail the extension
    of the graphical user-interface.
    c)     c) Sales Analysis
    Periodically, the total revenue accumulated since the last collection is printed in descending order of sales for each drink sold,
    together with a grand total. The cash is then cleared from the machine. This feature requires password-protection.
    d)     d) Replenishment of Stock
    Periodically, the stock is checked to determine how much of each drink needs to be replenished. For this purpose, a list of the
    drinks with the corresponding quantity on hand is printed in ascending order of stock level. Drinks with insufficient stock are
    topped up to a level of 10 servings or packets. This feature also requires password-protection.
    e)     e) Any other relevant features
    You are limited only by your creativity. You can add any other relevant features for this project. Please consult your tutor before
    you proceed.
    To qualify for the full marks for this section, you need to implement 2 features, at least one of which must be either (a) or (b) above.
    4.     3. ACTIVITY PLAN
    Suggestions for Getting Started
    There are many ways that you could complete this assignment. The most important part is to think about the entire project first so that
    it is easy to integrate the various pieces. You should also consider what type of graphics you want to incorporate.
    a)     a) Analysis
    1. Understand the program specification and the requirements before attempting the project.
    b)     b) Program Design
    2.     Work out the GUI components (e.g., TextFields, CheckBoxes, ChoiceBoxes, Buttons, etc.) needed to get the user input.
    3.     3. Work out the main logic of the program using modular programming techniques; i.e. use methods appropriately. E.g., tasks that perform
    4.     4. a well-defined function or those that are repeated should be coded as methods. For example, you can write the methods, displayBill(),
    5.     5. makePayment(), computeTotal(), dispenseDrink(), etc. You need to think carefully about the return type and the parameters of each
    6.     6. method.
    7.     7. You are required to use arrays appropriately for this assignment. Marks will be deducted for inefficient use or non-usage of arrays.
    c) Implementation & Testing
    8.     8. Write the method definition of each method ONE at a time.
    9.     9. Test your program logic to make sure that it works. In the interim, you can use �g.drawString(�);� or �System.out.println(�);� to print
    10.     10. out intermediate results so that you can see whether your program is working correctly. You may not want to bother about error-checking
    11.     11. at this point. You should test each method as soon as it is written, as it is much easier to debug your program in this way.
    5.     4. DELIVERABLES
    By Monday, 25th February before 5:00 p.m., hand in the following to the School of ICT Administrative Office at Block 31, level 8:
    �     � A copy of the printout of your .java file.
    �     � A diskette labelled with your name, group, student ID. The diskette should contain ALL the necessary files (.java, .html, and .class)
    to run your applet.
    �     � The above in an envelope topped with the Assignment Completion Report (see pages 6, 7 & 8). Page 6 is for you to paste on top
    of your envelope whilst pages 7 and 8 are for you to document your Test Plan, and write your comments (including any
    special instructions to run your program) - to be inserted into the envelope.
    In your .java program, you are to include a blocked comment at the top stating:
    q     q Your name, group, student ID.
    q     q Assumptions (if any) or any deviations from the specified requirements.
    q     q Any features that you would like to highlight.
    6.     5. WALK-THROUGH OF PROGRAM
    Monday 25th February at 9:30 a.m. SHARP
    In the walk-through, you will be asked to give short, written answers to some questions about your program. These questions will assess
    your basic understanding of the code that you are handing in. If you fail to display adequate understanding of your own program, you can
    be down-graded by up to two letter grades from what you would have normally received. It is also possible that you will be called to
    perform a demonstration cum explanation of your work if it is suspected that you have copied someone else�s work. Lesson: do your own
    work and you will have no problem!
    7.     6. GRADING CRITERIA FOR PROGRAMMING
    Correct and robust implementation of basic features     55 %
    Additional features     20 %
    Programming style:�     � Program design�     � Appropriate use of arrays�     � Appropriate use of variables, methods, and parameters�     � Proper usage of control structures (e.g. if/else, loops)     15 %
    Good programming practice:�     � Meaningful variable names �     � Proper indentations�     � Useful and neat comments     5 %
    Adequate (black-box) testing:�     � Suitably-designed test plan     5 %
    Total:     100 %
    PROBLEM SOLVING & PROGRAMMING II
    (Dip IT/MMC/EI, Year 1, Semester 2)
    Assignment Completion Report (to be attached to cover of envelope)
    Name: ___________________________________ Group: ________
    ID: ___________________ Date & Time submitted: ____________
    Requirements     % Done (0-100)     Remarks
    BASIC FEATURES          
    �     � Can choose category (and select appropriate additives)          
    �     � Can choose drink (with error checking)          
    �     � Can display amount payable          
    �     � Can indicate availability of drink (with error checking)          
    �     � Can accept payment for drink (with error checking)          
    �     � Can dispense drink          
    �     � Can update stock          
    ADDITIONAL FEATURES          
    �     � Smart GUI          
    �     � Multiple Orders          
    �     � Sales Analysis (with password checking)          
    �     � Stock Replenishment(with password checking)          
    �     � Any other relevant features          
    Test Plan
    Using black-box testing, record your test specification and the results according to the following format (the examples here are provided
    for your reference only):
    Test No.     Purpose     Test Shot/Data     Expected Result     Actual Result
    E.g. 1a)     Check whether beverage can be selected      Click on �Chrysanthe-mum� button     Checkbox for �Sugar� but not �Creamer� appear     �Sugar� and checkboxes appeared
    E.g. 1b)     Check whether chrysanthemum with sugar can be ordered      Select sugar and click on �Order� button     Amount payable appears as �$1.10� (i.e., $1.00 + $0.10)     Amount payable shown as $1.10
    E.g. 1c)     Check whether correct payment can be accepted      Enter �1.00� in �Payment� textfield     Error message �Insufficient payment - $0.10 short� appears     Confirmation message �Drink being dispensed� appeared � ERROR!
    E.g. 1d)     Re-test 1c), after amending program      As above     As above     Error message �Insufficient payment - $0.10 short� appeared
    etc.                    
    etc.                    
    Remember to hand in this test plan together with the other deliverables in the envelope.
    Have you�
    1.     1. Checked to make sure program still works properly even with windows resized?
    2.     2. Tested your program thoroughly, as if you're trying to break it?
    Any comments about this assignment? Any special instructions to run your program? Write it here.

    public class testing1 {
    String gg;
    public void testing3() {
    System.out.print(gg); }
    // this is are constructor for the object and method we are going to make
    next code
    class testing {
    public static void main(String[] args) {
    testing1 tes = new testing1();
    tes.gg = "hello there";
    tes.testing3(); //here we have made a object and a method
    hope this helps

  • Can someone pls help me with this code

    The method createScreen() creates the first screen wherein the user makes a selection if he wants all the data ,in a range or single data.The problem comes in when the user makes a selection of single.that then displays the singleScreen() method.Then the user has to input a key data like date or invoice no on the basis of which all the information for that set of data is selected.Now if the user inputs a wrong key that does not exist for the first time the program says invalid entry of data,after u click ok on the option pane it prompts him to enter the data again.But since then whenever the user inputs wrong data the program says wrong data but after displaying the singlescreen again does not wait for input from the user it again flashes the option pane with the invalid entry message.and this goes on doubling everytime the user inputs wrong data.the second wrong entry of data flashes the error message twice,the third wrong entry flashes the option pane message 4 times and so on.What actually happens is it does not wait at the singlescreen() for user to input data ,it straight goes into displaying the JOptionPane message for wrong data entry so we have to click the optiion pane twice,four times and so on.
    Can someone pls help me with this!!!!!!!!!
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    public class MainMenu extends JFrame implements ActionListener,ItemListener{
    //class     
         FileReaderDemo1 fd=new FileReaderDemo1();
         FileReaderDemo1 fr;
         Swing1Win sw;
    //primary
         int monthkey=1,counter=0;
         boolean flag=false,splitflag=false;
         String selection,monthselection,dateselection="01",yearselection="00",s,searchcriteria="By Date",datekey,smonthkey,invoiceno;
    //arrays
         String singlesearcharray[];
         String[] monthlist={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"};
         String[] datelist=new String[31];
         String[] yearlist=new String[100];
         String[] searchlist={"By Date","By Invoiceno"};
    //collection
         Hashtable allinvoicesdata=new Hashtable();
         Vector data=new Vector();
         Enumeration keydata;
    //components
         JButton next=new JButton("NEXT>>");
         JComboBox month,date,year,search;
         JLabel bydate,byinvno,trial;
         JTextField yeartext,invtext;
         JPanel panel1,panel2,panel3,panel4;
         JRadioButton single,range,all;
         ButtonGroup group;
         JButton select=new JButton("SELECT");
    //frame and layout declarations
         JFrame jf;
         Container con;
         GridBagLayout gridbag=new GridBagLayout();
         GridBagConstraints gc=new GridBagConstraints();
    //constructor
         MainMenu(){
              jf=new JFrame();
              con=getContentPane();
              con.setLayout(null);
              fr=new FileReaderDemo1();
              createScreen();
              setSize(500,250);
              setLocation(250,250);
              setVisible(true);
    //This is thefirst screen displayed
         public void createScreen(){
              group=new ButtonGroup();
              single=new JRadioButton("SINGLE");
              range=new JRadioButton("RANGE");
              all=new JRadioButton("ALL");
              search=new JComboBox(searchlist);
              group.add(single);
              group.add(range);
              group.add(all);
              single.setBounds(100,50,100,20);
              search.setBounds(200,50,100,20);
              range.setBounds(100,90,100,20);
              all.setBounds(100,130,100,20);
              select.setBounds(200,200,100,20);
              con.add(single);
              con.add(search);
              con.add(range);
              con.add(all);
              con.add(select);
              search.setEnabled(false);
              single.addItemListener(this);
              search.addActionListener(new MyActionListener());     
              range.addItemListener(this);
              all.addItemListener(this);
              select.addActionListener(this);
         public class MyActionListener implements ActionListener{
              public void actionPerformed(ActionEvent a){
                   JComboBox cb=(JComboBox)a.getSource();
                   if(a.getSource().equals(month))
                        monthkey=((cb.getSelectedIndex())+1);
                   if(a.getSource().equals(date)){
                        dateselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(year))
                        yearselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(search)){
                        searchcriteria=(String)cb.getSelectedItem();
         public void itemStateChanged(ItemEvent ie){
              if(ie.getItem()==single){
                   selection="single";     
                   search.setEnabled(true);
              else if (ie.getItem()==all){
                   selection="all";
                   search.setEnabled(false);
              else if (ie.getItem()==range){
                   search.setEnabled(false);
         public void actionPerformed(ActionEvent ae){          
              if(ae.getSource().equals(select))
                        if(selection.equals("single")){
                             singleScreen();
                        if(selection.equals("all"))
                             sw=new Swing1Win();
              if(ae.getSource().equals(next)){
                   if(monthkey<9)
                        smonthkey="0"+monthkey;
                   System.out.println(smonthkey+"/"+dateselection+"/"+yearselection+"it prints this");
                   allinvoicesdata=fr.read(searchcriteria);
                   if (searchcriteria.equals("By Date")){
                        System.out.println("it goes in this");
                        singleinvoice(smonthkey+"/"+dateselection+"/"+yearselection);
                   else if (searchcriteria.equals("By Invoiceno")){
                        invoiceno=invtext.getText();
                        singleinvoice(invoiceno);
                   if (flag == false){
                        System.out.println("flag is false");
                        singleScreen();
                   else{
                   System.out.println("its in here");
                   singlesearcharray=new String[data.size()];
                   data.copyInto(singlesearcharray);
                   sw=new Swing1Win(singlesearcharray);
         public void singleinvoice(String searchdata){
              keydata=allinvoicesdata.keys();
              while(keydata.hasMoreElements()){
                        s=(String)keydata.nextElement();
                        if(s.equals(searchdata)){
                             System.out.println(s);
                             flag=true;
                             break;
              if (flag==true){
                   System.out.println("vector found");
                   System.exit(0);
                   data= ((Vector)(allinvoicesdata.get(s)));
              else{
                   JOptionPane.showMessageDialog(jf,"Invalid entry of date : choose again");     
         public void singleScreen(){
              System.out.println("its at the start");
              con.removeAll();
              SwingUtilities.updateComponentTreeUI(con);
              con.setLayout(null);
              counter=0;
              panel2=new JPanel(gridbag);
              bydate=new JLabel("By Date : ");
              byinvno=new JLabel("By Invoice No : ");
              dateComboBox();
              invtext=new JTextField(6);
              gc.gridx=0;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(month,gc);
              panel2.add(month);
              gc.gridx=1;
              gc.gridy=0;
              gridbag.setConstraints(date,gc);
              panel2.add(date);
              gc.gridx=2;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(year,gc);
              panel2.add(year);
              bydate.setBounds(100,30,60,20);
              con.add(bydate);
              panel2.setBounds(170,30,200,30);
              con.add(panel2);
              byinvno.setBounds(100,70,100,20);
              invtext.setBounds(200,70,50,20);
              con.add(byinvno);
              con.add(invtext);
              next.setBounds(300,200,100,20);
              con.add(next);
              if (searchcriteria.equals("By Invoiceno")){
                   month.setEnabled(false);
                   date.setEnabled(false);
                   year.setEnabled(false);
              else if(searchcriteria.equals("By Date")){
                   byinvno.setEnabled(false);
                   invtext.setEnabled(false);
              monthkey=1;
              dateselection="01";
              yearselection="00";
              month.addActionListener(new MyActionListener());
              date.addActionListener(new MyActionListener());
              year.addActionListener(new MyActionListener());
              next.addActionListener(this);
              invtext.addKeyListener(new KeyAdapter(){
                   public void keyTyped(KeyEvent ke){
                        char c=ke.getKeyChar();
                        if ((c == KeyEvent.VK_BACK_SPACE) ||(c == KeyEvent.VK_DELETE)){
                             System.out.println(counter+"before");
                             counter--;               
                             System.out.println(counter+"after");
                        else
                             counter++;
                        if(counter>6){
                             System.out.println(counter);
                             counter--;
                             ke.consume();
                        else                    
                        if(!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))){
                             getToolkit().beep();
                             counter--;     
                             JOptionPane.showMessageDialog(null,"please enter numerical value");
                             ke.consume();
              System.out.println("its at the end");
         public void dateComboBox(){          
              for (int counter=0,day=01;day<=31;counter++,day++)
                   if(day<=9)
                        datelist[counter]="0"+String.valueOf(day);
                   else
                        datelist[counter]=String.valueOf(day);
              for(int counter=0,yr=00;yr<=99;yr++,counter++)
                   if(yr<=9)
                        yearlist[counter]="0"+String.valueOf(yr);
                   else
                        yearlist[counter]=String.valueOf(yr);
              month=new JComboBox(monthlist);
              date=new JComboBox(datelist);
              year=new JComboBox(yearlist);
         public static void main(String[] args){
              MainMenu mm=new MainMenu();
         public class WindowHandler extends WindowAdapter{
              public void windowClosing(WindowEvent we){
                   jf.dispose();
                   System.exit(0);
    }     

    Hi,
    I had a similar problem with a message dialog. Don't know if it is a bug, I was in a hurry and had no time to search the bug database... I found a solution by using keyPressed() and keyReleased() instead of keyTyped():
       private boolean pressed = false;
       public void keyPressed(KeyEvent e) {
          pressed = true;
       public void keyReleased(KeyEvent e) {
          if (!pressed) {
             e.consume();
             return;
          // Here you can test whatever key you want
       //...I don't know if it will help you, but it worked for me.
    Regards.

  • I bought a movie the movie Godzilla 2014 recently but it didn't show up in my library. I went check the itunes store and it wants me to buy it again. Please help me with this problem.

    I just bought this movie "Godzilla 2014" but it won't show in my Movie Library. I closed my Itunes and put it back on again but still won't show up. I checked my purchased list and it shows that I recently bought the movie but when I checked the itunes store it wants to buy the movie again. Please help me with this right away Apple.

    Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
    To contact product and tech support: Contacting Apple for support and service - this includes
    international calling numbers..
    For Mac App Store: Apple - Support - Mac App Store.
    For iTunes: Apple - Support - iTunes.

  • HT204146 Good morning.  I just purchased Imatch but cannot download my music from an iphone 5 to IMatch in Icloud.  Can you help me with this?

    Good morning.  I just purchased Imatch but cannot download my music from an iphone 5 to IMatch in Icloud.  Can you help me with this?

    Hi
    Has iTunes completed its scan of your iTunes library on your computer Subscribing to iTunes from an iOS device.
    Jim

  • Iv got a new laptop and i moved all my music though home sharing from my old intunes onto my new one, but my iphone wont sync to the new itunes... could anyone help me with this?

    iv moved all the music over thought home sharing... from the old itunes i was using but i want to be able to sync my iphone with the new itunes on my new machine but its saying saying syncing setp 1 of 1 and nothing happens... could someone please help me with this?

    Copy the entire iTunes folder from the old computer to the new computer.

  • Help needed with this form in DW

    Hi, i have created this form in dreamweaver but ive got this problem.
    In the fields above the text field, the client needs to fill in some info such as name, email telephone number etc.
    But the problem is when ill get the messages. Only the text from the large text field is there.
    What did i do wrong??
    http://www.hureninparamaribo.nl/contact.html
    Thank you
    Anybody??

    Thank you for your response. So what do i have to do to fix this?
    Date: Sun, 20 Jan 2013 07:57:56 -0700
    From: [email protected]
    To: [email protected]
    Subject: Help needed with this form in DW
        Re: Help needed with this form in DW
        created by Ken Binney in Dreamweaver General - View the full discussion
    You have several duplicate "name" attributes in these rows which also appears in the first row
    Telefoon:
    Huurperiode:
    Aantal personen:
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5008247#5008247
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5008247#5008247
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5008247#5008247. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver General by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • "It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!

    "It is formatted incorrectly, or is not a format that iBooks can open". Can anyone help me with this message of a book that I purchased on iBooks, read, highlighted in the book and now I can't open it anymore. Please help!!!

    Mine does the same thing occasionally, is your phone jailbroken? Sometimes it will work if you delete the book and reinstall it or put your phone into airplane mode then turn it back off.

  • I'm using iphoto9.1.3 but now it doesn't seem to work, whenever I try to open it, it just shows loading, but never loads. Can anybody help me with this ?

    I'm using iphoto9.1.3 but now it doesn't seem to work, whenever I try to open it, it just shows loading, but never loads. Can anybody help me with this ?    

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • I can't find the 2G, 3G and LTE options after updating to iOS8.1, can anyone help me with this? I'm using iPhone5s

    I can't find the 2G, 3G and LTE options after updating to iOS8.1, can anyone help me with this? I'm using iPhone5s

    I have check on my service provider about the correct APN settings, but unfortunately doesnt work still..

  • I need to reinstall my operating system for 10.5 after seeing a file folder and question mark flashing on my start up screen. Can anyone help me with this?

    I need to reinstall my operating system for 10.5 after seeing a file folder and question mark flashing on my start up screen. Can anyone help me with this?

    Hello,
    That means it can find the Hard Drive, or can't find the things needed for booting.
    See if DU even sees it.
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    *Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)

  • Hii, i got an iTunes card for $15 and only used $6 in it, but it say I only have $0.37 left. If any one could help me with this, I will be forever grateful.

    Hii, i got an iTunes card for $15 and only used $6 in it, but it say I only have $0.37 left. If any one could help me with this, I will be forever grateful.

    You will need to Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • HT1365 Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?

    Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?

    The figures you mention only make sense on your intranet.  Are you still using the same wireless router.  The verizon one is somewhat limited as far as max wireless-n performace.  For one thing it only has a 2.4 radio.   I like many people who wanted wireless-n performance before they even added a wireless-n gigabit router, have my own handling my wireless-n network.

  • Can somebody help me with this code?

    Can anyone help me with this code? My problem is that i can't
    seem to position this form, i want to be able to center it
    vertically & horizontally in a div either using CSS or any
    other means.
    <div id="searchbar"><!--Search Bar -->
    <div id="searchcart">
    <div class="serchcartcont">
    <form action='
    http://www.romancart.com/search.asp'
    name="engine" target=searchwin id="engine">
    <input type=hidden value=????? name=storeid>
    <input type=text value='' name=searchterm>
    <input type=submit value='Go'> </form>
    </div>
    </div>
    <div class="searchcont">Search For
    Products:</div>
    </div><!-- End Search Bar -->
    Pleasssssseeeeeeee Help
    Thanks

    Hi,
    Your form is defined in a div named "serchcartcont", you can
    use attributes like position and align of the div to do what you
    want to do. But there are two more dives above this dive, you will
    have define the height width of these before you can center align
    the inner most div. If you are not defining the height & width
    then by default it decide it automatically to just fit the content
    in it.
    Hope this helps.
    Maneet
    LeXolution IT Services
    Web Development
    Company

Maybe you are looking for

  • Pages 08

    How do I automate page numbering in Pages 08. Can I do that or must I manually number each page separately. In Adobe InDesign it can be automated.

  • Error propagating servlet user to peer?

    Hello, We currently have a Windows 2003 Server 32bit running ColdFusion 8.01 with 3 instances named: cfusion, Instance1 and Instance2. Instance 1 and Instance 2 are clustered together and serving all our sites in IIS. We're hosting just over 200 site

  • Adding a new user account or just sharing one account?

    Hello - looking for the best practice with this - my wife has an old PC laptop which is nearing the end of its life. She will probably just share my iMac with me. If so, her photos will be imported into iPhoto and her iTunes library will have to be m

  • How do I restore music to my iTunes after new hard drive

    FIrst of all apologies if this is really simple .... I'm a bit rubbish with technology ! My problem is that I have had to have my hard drive replaced in my laptop  . I have reinstalled iTunes & music I have brought from iTunes is back on there but I

  • Table For Header Text Old Value

    Hi, Could Anyone helpme in finding the table for Header text of the PO , as We know  to find the current PO Header Text,by usinf th FM READ_text but i want to to find the header text for the po before Updated , Thanks in advance Regards Priyanka M Ja