Help me with this RMI example

For Filetransfering over RMI (with compressing the data on client side and decompressing on server side) :
I have in Server-Side as a remote methode :
public byte[] getFileData(String fileName) {
System.out.println("read : "+fileName);
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
DeflaterOutputStream zipOut = new DeflaterOutputStream(out);
File f=new File(fileName);
BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
int read = 0;
int len = 0;
byte data[] = new byte[8192];
while ((read = in.read(data,0,8192)) != -1) {
zipOut.write(data,0,read);
len += read;
in.close();
zipOut.close();
System.out.println("compress-factor : "+len+" to "+out.size()+" bytes");
return out.toByteArray();
} catch (Exception e) {
System.err.println(e);
return null;
In Client-Side :
... in main programme
ServerImpl rmi = (ServerImpl)Naming.lookup(rmiName);
And i have this methode in client side in order to call the remote methode which is on server
public InputStream getFileData(String fileName) {
try {
ByteArrayInputStream zipIn = new ByteArrayInputStream(rmi.getFileData(fileName));// read file
return new InflaterInputStream(zipIn); // data decompress
} catch(NullPointerException e) {
return null; // file could not be opened
} catch(Exception e) {
return null;
My question is where should i call this method, and should i declare this one Remote methode too.
for using Client-Side i have :
==================
get a property-file :
Properties pConfig = new Properties();
URL f = null;
try {
InputStream fi = clientImpl.getFileData(PROPERTYFILE);
pConfig.load(fi);
fi.close();
} catch (Exception e) {
String err = "Can't open property-file on server : "+PROPERTYFILE+" Exception="+e;
System.out.println(err);
System.exit(1);
I have problem to know where should i put this part of code : on client side in main programe, or on server side as a remote methode wich would be called by the client.
Could some body help me to get organized with thise tree part of code.
Tank's
Astiage.

Here the full sourcecode of my RMI-File-Transfer pattern.
Sorry for the german comment.
File : IServerImpl.java
import java.rmi.RemoteException;
public interface IServerImpl extends java.rmi.Remote {
  public byte[] getFileData         (String pathname) throws RemoteException;
File : ServerImpl.java
/** RMI-Handler */
import java.util.Date;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.util.zip.*;
import java.util.*;
import java.io.*;
import java.net.*;
* alle RMI's f�r den Clients und alle Aufrufe Richtung Clients
* @author Uwe G�nther
* @version 20.10.00
public class ServerImpl extends UnicastRemoteObject implements IServerImpl {
  public ServerImpl(String name) throws RemoteException {
    super();
    try {
      Naming.rebind(name+"/Server_instance",this);
    catch (Exception e) {
      if (e instanceof RemoteException) throw (RemoteException)e;
      else throw new RemoteException(e.getMessage());
   * Ab hier stehen alle Methoden Richtung Server (Aufrufe f�r den Client),
   * jeder Methodenaufruf vom Client bekommt einen eigenen Thread (dank RMI) verpasst,
   * somit k�nnen mehrere Clients eine Methode gleichzeitig aufrufen.
   * -> Nebenl�ufigkeit ist erf�llt,
   *    Methoden k�nnen mehrere Sekunden/Stunden abtauchen ohne andere Clients zu bremsen
   * Client m�chte auf Serverseite eine Datei lesen. Datei wird on-the-fly komprimiert.
   * Vor der �bertragung Richtung Client werden die Daten im DEFLATE-Format komprimiert.
   * Nach der �bertagung auf der Clientseite dekomprimiert.
   * Pfad muss nat�rlich in der Policy-Datei freigegeben sein (mit "read,write,delete").
   * z.B.:
   *  fileName = /usr/share/doc/test/properties/journal.properties
  public byte[] getFileData(String fileName) {
    System.out.println("read : "+fileName);
    try {
      // Daten laden und gleichzeitig zippen
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      DeflaterOutputStream zipOut = new DeflaterOutputStream(out);
      File f=new File(fileName);
      BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
      int read = 0;
      int len = 0;
      byte data[] = new byte[8192];
      while ((read = in.read(data,0,8192)) != -1) {
        zipOut.write(data,0,read);
        len += read;
      in.close();
      zipOut.close();
      System.out.println("compress-factor : "+len+" to "+out.size()+" bytes");
      return out.toByteArray();
    } catch (Exception e) {
      System.err.println(e);
      return null;
File : Server.java
import java.net.*;
import java.io.*;
import java.util.*;
import java.lang.Thread;
import java.rmi.*;
import java.rmi.server.*;
public class Server {
  static String hostName = "localhost";
  private static int hostPort = 1099;
  static ServerImpl rmi;
  public void startHandler() {
    // RMI starten
    String s;
    try {
      if (hostPort!=java.rmi.registry.Registry.REGISTRY_PORT)         // -> es wurde ein anderer Port gew�hlt
        hostName += ":"+hostPort;
      rmi = new ServerImpl("//"+hostName);
      s = "Bindings Finished. My hostname is : "+hostName;
      System.out.println(s);
      s = "Waiting for Client requests on port "+hostPort+" ...";
      System.out.println(s);
    } catch (java.rmi.UnknownHostException uhe) {
      s = "The host computer name you have specified, "+hostName+" does not match your real computer name.";
      System.out.println(s);
      System.exit(1);
    } catch (java.rmi.RemoteException re) {
      s = "Error starting service :"+re;
      System.out.println(s);
      System.exit(1);
  public static void main(String[] args) {
    System.out.println("Server starting ...");
    Server serv = new Server();
    serv.startHandler();
File : ClientImpl.java
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import java.net.*;
import java.io.*;
import java.util.zip.*;
* @author Uwe G�nther
* @version 20.10.00
public class ClientImpl {
  private String rmiName = null;
  private IServerImpl js;
  /** Verbingung zum Server aufbauen */
  public ClientImpl(String host,int port) throws RemoteException {
    rmiName = "//"+host;
    if (port!=1099) rmiName += ":"+port;
    rmiName += "/Server_instance";
    try {
      js = (IServerImpl)Naming.lookup(rmiName);
      return;
    } catch (Exception e) {
      e.printStackTrace();
   * Datei auf Serversteite lesen.
   * Datenstrom ist gezippt und wird hier auch wieder entzippt.
  public InputStream getFileData(String pathFile) {
    while(true) {
      try {
        ByteArrayInputStream zipIn = new ByteArrayInputStream(js.getFileData(pathFile));// Datei laden
        return new InflaterInputStream(zipIn);            // Daten entzippen
      } catch(NullPointerException e) {
        return null;                                      // Datei konnte nicht ge�ffnet werden
      } catch(Exception e) {
        System.out.println(e);
        return null;
File : Client.java
import java.io.*;
import java.net.*;
public class Client {
  private String hostName = "localhost";
  private int hostPort = 1099;
  private ClientImpl rmi;
  public Client() {
    System.out.println("hostname :"+hostName);
    try {
      rmi = new ClientImpl(hostName,hostPort);                        // start RMI
    } catch(Exception e) {
      e.printStackTrace();
      System.exit(1);
    System.out.println("RMI connection successful");
  public static void main(String[] args) {
    Client client = new Client();
    InputStream in = client.rmi.getFileData("text.txt");
    if (in==null) {
      System.out.println("file not found !");
    } else {
      BufferedReader inBuffered = new BufferedReader(new InputStreamReader(in));
      try {
        while (true) {
          String line = inBuffered.readLine();                        // Get next line
          if (line==null) break;
          System.out.println(line);
      } catch(Exception e) {
        e.printStackTrace();
}Uwe G�nther

Similar Messages

  • Help me with this taglib example, thank u!

    First of all, i want to tell u, all the setting,such as web.xml, tld file ,the beans locate are all right.
    Ok, then i will give the source below:
    TagHandler: MapDefineTag.java
    package tags;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.TreeMap;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.tagext.TagSupport;
    * <p>
    * Created to demonstrate the creation of custom tag handlers.
    * Created by Rick Hightower from Trivera Technologies.
    * </p>
    * @jsp.tag name="mapDefine"
    * body-content="JSP"
    * @jsp.variable name-from-attribute="id" class="java.util.Map"
    * scope="AT_BEGIN"
    public class MapDefineTag extends TagSupport {
    public static final String HASH = "HASH";
    public static final String TREE = "TREE";
    private Map map = null;
    private String type = TREE;
    private String id;
    private String scope;
    /* (non-Javadoc)
    * @see javax.servlet.jsp.tagext.Tag#doStartTag()
    public int doStartTag() throws JspException {
    if (type.equalsIgnoreCase(HASH)) {
    map = new HashMap();
    } else if (type.equalsIgnoreCase(TREE)) {
    map = new TreeMap();
    else {
    map = new TreeMap();
    if (scope == null){
    pageContext.setAttribute(id, map);
    }else if("page".equalsIgnoreCase(scope)){
    pageContext.setAttribute(id, map);
    }else if("request".equalsIgnoreCase(scope)){
    pageContext.getRequest().setAttribute(id, map);
    }else if("session".equalsIgnoreCase(scope)){
    pageContext.getSession().setAttribute(id, map);
    }else if("application".equalsIgnoreCase(scope)){
    pageContext.getServletContext().setAttribute(id, map);
    return EVAL_BODY_INCLUDE;
    /** Getter for property type.
    * @return Value of property type.
    * @jsp.attribute
    * required="false"
    * rtexprvalue="false"
    * description="Specifies the type of map
    * valid values are fasttree, fasthash, hash, tree"
    public String getType() {
    return type;
    * @param string
    public void setType(String string) {
    type = string;
    /** Getter for property id.
    * @return Value of property id.
    * @jsp.attribute required="true"
    * rtexprvalue="false"
    * description="The id attribute"
    public String getId() {
    return id;
    * @param string
    public void setId(String string) {
    id = string;
    public Map getMap(){
    return map;
    public void release() {
    super.release();
    map = null;
    type = TREE;
    /** Getter for property scope.
    * @return Value of property scope.
    * @jsp.attribute required="false"
    * rtexprvalue="false"
    * description="The scope attribute"
    public String getScope() {
    return scope;
    * @param string
    public void setScope(String string) {
    scope = string;
    config.tld:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>map</short-name>
    <tag>
    <name>MapDefine</name>
    <tag-class>tags.MapDefineTag</tag-class>
    <body-content>JSP</body-content>
    <variable>
    <name-from-attribute>id</name-from-attribute>
    <variable-class>java.util.Map</variable-class>
    <scope>AT_BEGIN</scope>
    </variable>
    <attribute>
    <name>id</name>
    <required>true</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>type</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>scope</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    the jsp page : taglib.jsp
    <%@taglib uri="map" prefix="map"%>
    <html>
    <head><title>Test Map Define</title></head>
    <body>
    <map:MapDefine id="employee" type="Hash" scope="page">
    The employee is <%=employee%>
    </map:MapDefine>
    </body>
    </html>
    the result:
    The employee is null
    What's wrong with the source? Why the attribute "employee" is null?
    More Strange, when i replace the " The employee is <%=employee%> " with "<%=pageContext.getAttribute("employee") %>
    the result: The employee is {}
    It is not null yet,but it's still empty? Who can help me.

    So, the code you posted so far on this thread, just about exactly copy and pasted, works for me.
    My guess is that you just need to remove the contents of your working directory and restart so as to force Tomcat to re-write/compile the JSP and integrated tags.
    Let me post back exactly as I have it, which works fine:
    //My MapDefineTag
    //Note, I took out the getterMethods, cause they are un-neccesary.
    package tags;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.TreeMap;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.JspWriter;
    import javax.servlet.jsp.JspContext;
    import javax.servlet.jsp.tagext.JspFragment;
    import javax.servlet.jsp.PageContext;
    import javax.servlet.ServletContext;
    import javax.servlet.jsp.tagext.TagSupport;
    public class MapDefineTag extends TagSupport
      protected static final String HASH = "HASH";
      protected static final String TREE = "TREE";
      private Map map = null;
      private String type = TREE;
      private String id;
      private String scope;
      public int doStartTag() throws JspException
        if (type.equalsIgnoreCase(HASH))
          map = new HashMap();
        else
          map = new TreeMap();
        if("request".equalsIgnoreCase(scope))
          pageContext.getRequest().setAttribute(id, map);
        else if("session".equalsIgnoreCase(scope))
          pageContext.getSession().setAttribute(id, map);
        else if("application".equalsIgnoreCase(scope))
          pageContext.getServletContext().setAttribute(id, map);
        else
          pageContext.setAttribute(id, map);
        return EVAL_BODY_INCLUDE;
      public void setType(String string)
        type = string;
      public void setId(String string)
        id = string;
      public void setScope(String string)
        scope = string;
      public void release()
        super.release();
        map = null;
        type = TREE;
    //The map_config.tld.  I put this under /WEB-INF/map/
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
                            "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>map</short-name>
      <tag>
        <name>MapDefine</name>
        <tag-class>tags.MapDefineTag</tag-class>
        <body-content>JSP</body-content>
        <variable>
          <name-from-attribute>id</name-from-attribute>
          <variable-class>java.util.Map</variable-class>
          <scope>AT_BEGIN</scope>
        </variable>
        <attribute>
          <name>id</name>
          <required>true</required>
          <rtexprvalue>false</rtexprvalue>
        </attribute>
        <attribute>
          <name>type</name>
          <required>false</required>
          <rtexprvalue>false</rtexprvalue>
        </attribute>
        <attribute>
          <name>scope</name>
          <required>false</required>
          <rtexprvalue>false</rtexprvalue>
        </attribute>
      </tag>
    </taglib>
    //I made the following addition to my web.xml, so as to point to my .tld
      <jsp-config>
        <taglib>
          <taglib-uri>http://www.thelukes.net/~steven/jsp/maptest</taglib-uri>
          <taglib-location>/WEB-INF/map/map_config.tld</taglib-location>
        </taglib>
      </jsp-config>
    //Then the JSP is as follows:
    <%@taglib uri="http://www.thelukes.net/~steven/jsp/maptest" prefix="map"%>
    <html>
    <head><title>Test Map Define</title></head>
    <body>
      <map:MapDefine id="employee" type="Hash" scope="page">
        The employee is set as <%=employee%> <br />
      </map:MapDefine>
      The employee is set as <%=employee%> <br />
    </body>
    </html>
    //And the HTML output:
    <html>
    <head><title>Test Map Define</title></head>
    <body>
        The employee is set as {}<br />
      The employee is set as {}<br />
    </body>
    </html>
    //And finnally, the view output:
    The employee is set as {}
    The employee is set as {}

  • 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

  • Query Issue in Creating a View....Please help me with this query..

    I would like to create a view on this table with four columns
    1. PN#_EXP_DATE
    2. PN#
    3. PN#_EFF_DATE
    4. PN#
    P_S_C     A_C     P     EXP_DT
    21698     13921     1     5/29/2009 3:15:41 PM     
    21698     13921     1     5/29/2009 3:54:57 PM     
    21698     1716656     4     5/29/2009 3:15:41 PM     
    21698     3217     3     5/29/2009 3:15:40 PM     
    21698     3217     3     5/29/2009 3:54:57 PM     
    21698     60559     2     5/29/2009 3:15:41 PM     
    21698     60559     2     5/29/2009 3:54:57 PM     
    I have a trigger on A, which inserts the DML records into B. (Table A and B structure is the almost the same,
                                       where table B will have one extra column exp_dt)
    NOw Table B can have records with same P_S_C and A_C columns and exp_dt will capture the history.
    for example: from the above sample data, let us take first two records..
    P_S_C     A_C     P     EXP_DT
    21698     13921     1     5/29/2009 3:15:41 PM     --- Record 1
    21698     13921     1     5/29/2009 3:54:57 PM     --- Record 2
    from this..
    Note: 1. Table A and Table C can be joined using A.P_S_C and C.R_C to get the start_date.
    2. PN# comes from table D. It contains numbers for the resp. weeks.
    3. PN#_EFF_DATE is the previous immediate previous date for that record in history table (Table B).
    I wanted the data like..
    ---- this is for the second record in the above..
    PN#_EXP_DATE PN# PN#_EFF_DATE PN#
    5/29/2009 3:54:57 PM     214 5/29/2009 3:15:41 PM     214
    ---- this is for the first record in the above..
    PN#_EXP_DATE PN# PN#_EFF_DATE PN#
    5/29/2009 3:54:41 PM     214 ( for this we should query the table C to get the
                        start_date, for this combinatation of P_S_C and A_C in table B
                             where B.P_S_C = C.A_C
                             and that value should be the EFF_DT for this record)
    Please help me with this....
    Thanks in advance..

    Hi All,
    select d.P# as "PN#_EXP_DATE", exp_date
    from daily_prd d, cbs1_assoc_hist b
    where to_char(d.day_date,'MM/DD/YYYY') = to_char(b.exp_date,'MM/DD/YYYY')
    and d.period_type = 'TIMEREPORT';
    This above query gives the output as follows:
    pn#_exp_date exp_date
    214     5/29/2009 3:15:40 PM
    214     5/29/2009 3:15:41 PM
    214          5/29/2009 3:15:41 PM
    214          5/29/2009 3:15:41 PM
    214          5/29/2009 3:54:57 PM
    214          5/29/2009 3:54:57 PM
    214          5/29/2009 3:54:57 PM
    This below is the data from history table (Table B).
    P_S_C     A_C PLACE EXP_DATE
    21698          3217          3     5/29/2009 3:15:40 PM     
    21698          13921          1     5/29/2009 3:15:41 PM     
    21698          1716656          4     5/29/2009 3:15:41 PM     
    21698          60559          2     5/29/2009 3:15:41 PM     
    21698          13921          1     5/29/2009 3:54:57 PM     
    21698          3217          3     5/29/2009 3:54:57 PM     
    21698          60559          2     5/29/2009 3:54:57 PM     
    I got the pn#_exp_date from the Table 'D', for the given exp_date from Table B.
    My question is again....
    CASE - 1
    from the given records above, I need to look for exp_date for the given same P_S_C and A_C.
    in this case we can take the example...
    P_S_C     A_C PLACE EXP_DATE
    21698          3217          3     5/29/2009 3:15:40 PM
    21698          3217          3     5/29/2009 3:54:57 PM
    In this case, the
    pn#_exp_date exp_date     pn#_eff_date eff_date
    214     5/29/2009 3:15:57 PM     < PN# corresponding to the     5/29/2009 3:15:40 PM
                        eff_date .>
                        <Basically the eff_date is
                        nothing but the exp_date only.
                        we should take the immediate before one.
    In this case, our eff_date is '5/29/2009 3:15:40 PM'.
    but how to get this.
    CASE - 2
    from the above sample data, consider this
    P_S_C     A_C PLACE EXP_DATE
    21698     1716656     4     5/29/2009 3:15:41 PM
    In this case, there is only one record for the P_S_C and A_C combination.
    The expected result :
    pn#_exp_date exp_date               pn#_eff_date eff_date
    214     5/29/2009 3:15:41 PM     < PN# corresponding to the     5/29/2009 3:15:40 PM
                        eff_date .>
                   <Basically the eff_date is
                   nothing but the exp_date only.
                        we should take the immediate before one.
    In this case to get the eff_date, we should query the Table 'C', to get the eff_date, which is START_DT column in this table.
    for this join B.P_S_C and C.R_C.
    Hope I am clear now..
    Thanks in advance.....

  • 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();

  • Hi Everyone...Please help me with this query...!

    Please Help me with this doubt as I am unable to understand the logic...behind this code. It's a begineer level code but I need to understand the logic so that I am able to grasp knowledge. Thank you all for being supportive. Please help me.
    //Assume class Demo is inherited from class SuperDemo...in other words class Demo extends SuperDemo
    //Volume is a method declared in SuperDemo which returns an integer value
    //weight is an integer vairable declared in the subclass which is Demo
    class Example
         public static void main(String qw[])
              Demo ob1=new Demo(3,5,7,9);
    //Calling Constructor of Demo which takes in 4 int parameters
              SuperDemo ob2=new SuperDemo();
              int vol;
              vol=ob1.volume();
              System.out.println("Volume of ob1 is " + vol);
              System.out.println("Weight of ob1 is " + ob1.weight);
              System.out.println();
              ob2=ob1;
    }Can someone please make me understand --- how is this possible and why !
    If the above statement is valid then why not this one "System.out.println(ob2.weight);"
    Thanks Thanks Thanks!

    u see the line wherein I am referencing the objectof
    a subclass to the superclass...right? then why we
    can't do System.out.println(ob2.weight)?You need to distinguish two things:
    - the type of the object, which determines with the
    object can do
    - the type of the reference to the object, which
    determines what you see that you can do
    Both don't necessarily have to match. When you use a
    SuperDemo reference (obj2) to access a Demo instance
    (obj1), for all you know, the instance behind obj2 is
    of type SuperDemo. That it's in reality of type Demo
    is unknown to you. And usually, you don't care -
    that's what polymorphism is about.
    So you have a reference obj2 of type SuperDemo.
    SuperDemo objects don't have weight, so you don't see
    it - even though it is there.So from ur explanation wat I understand is - Even though u reference a subclass object to a superclass, u will only be able to access the members which are declared in the superclass thru the same...right
    ?

  • Help please with this

    Would one of you kind people be able to help me with this. I am almost tearing my hair out.
    This is what i want...
    a small form (table) that states this..
    Description:
    Browse:
    Upload evidence:
    In the description, a small little box so that a user can enter a small note.
    In the browse box, i would like it to go to C:\Program Files\Microsoft Games\Age of Empires II\Screenshots
    and finally, the upload evidence to be uploaded to a part on a ftp server... example /var/www/folder1/folder2
    any help would be amazing!!!!! Thankyou very much

    > even if it is just some kind of HTML code will do.
    Just so i can paste the code in a .txt and save as
    html, and make minor changes to it will do.
    thanks
    If you're looking for someone to write this for you, go here: http://www.rentacoder.com
    If you have a specific, Java-related question about some code you wrote, ask it here.

  • Help me with this logic:

    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Oct 22 14:36:17 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> connect system/abcd
    Connected.
    SQL> select to_date('12-oct','dd') from dual;
    select to_date('12-oct','dd') from dual
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire input string
    Why do I get this error message??
    Do I always have to provide the string in the format 'dd-mon-yyyy' or 'dd-mon-yy'?
    If so then why do I not get the error for something like:
    select to_char(to_date(to_char(sysdate,'dd'),'dd'),'year') from dual;
    Please help me with this........
    I am studying for OCA exam 1Z0-051.....wishing to give the exam early next month

    Hi,
    803030 wrote:
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Oct 22 14:36:17 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> connect system/abcd
    Connected.
    SQL> select to_date('12-oct','dd') from dual;
    select to_date('12-oct','dd') from dual
    ERROR at line 1:
    ORA-01830: date format picture ends before converting entire input string
    Why do I get this error message??
    Do I always have to provide the string in the format 'dd-mon-yyyy' or 'dd-mon-yy'?No, the 1st argument does not always have to be in a particular format. That's what the 2nd argument is for: it says what format the first argument is in.
    It helps if you write the two arguments on separate lines, the 2nd rught below the 1st:
    TO_DATE ( '12-oct'
            , 'dd-mon'
            )and
    TO_DATE ( '12'
            , 'dd'
            )are both okay: the two arguments match.
    The following, however, is wrong:
    TO_DATE ( '12-oct'     -- ERROR!  This is 6 characters
            , 'dd'          --        This is only 2 characters
    If so then why do I not get the error for something like:
    select to_char(to_date(to_char(sysdate,'dd'),'dd'),'year') from dual;If you want to understand a complicated expression, break it down into parts, starting from the inside.
    For example, start with
    SELECT  TO_CHAR (SYSDATE, 'dd')
    FROM    dual;Assuming today is October 22, 2010, this produces the string '22'.
    So if the result of TO_CHAR (SYSDATE, 'dd') is '22', then
    SELECT  TO_DATE ( TO_CHAR (SYSDATE, 'DD')
              , 'DD'
    FROM     dual;is equivalent to
    SELECT  TO_DATE ( '22'
              , 'DD'
    FROM     dual;which returns tHE DATE October 22, 2010, 00:00:00. (When you don't specify the year or month, they default to the current year or month. when you don't specify the hurs, minutes or seconds, they default to 00.)
    So, if d is a DATE, October 22, 2010, 00:00:00, then
    SELECT  TO_CHAR ( d
                    , 'year'
    FROM    dual;returns '2010'.
    Don't take my word for it. Run these querries, and similar ones you think of, yourself.

  • TS2755 Whenever I send a message to another iPhone user via iMessage it is sending my Apple ID instead of my phone number.  Could someone help me with this??

    Whenever I send a message to another iPhone user via iMessage it is sending my Apple ID instead of my phone number. Could someone help me with this???

    Check this article: iOS: About Messages
    Additional Information
    You can change your iMessage Caller ID setting on iOS devices in Settings > Messages > Receive At > Caller ID. Note that the Caller ID setting is used only for new conversations. If you would like to change the address from which messages are sent, first change your Caller ID, and then delete the existing conversation and start a new one.
    iMessage responses will be sent from the address the recipient most recently messaged. For example, on iPhone you can receive messages sent to your Apple ID and phone number. A friend sends you a message to your Apple ID. Responses in this conversation will be sent from your Apple ID, even if your Caller ID is set to your phone number.

  • 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.

Maybe you are looking for