Print an object data in Vector to console???

Helo, the belowing code will print the memory address preceded by "Customer".
Actually, I want to print the name, age, and location. But it did other way. Anyone know what's the prob?
Vector v = new Vector();
v.addElement(new Customer("Paul", 29, "CA"));
v.addElement(new Customer("Ton", 21, "LA"));
for (int i=0; i<v.size(); i++){
     System.out.println(closedList.get(i));
}Thank you. :)

U mean i dun need to overwrite the contains, the only
need is just the equals()? I dun know much bout
hashCode()? Which one I should refer?You should override both hashCode() and equals() in your Customer class.
http://java.sun.com/docs/books/tutorial/java/javaOO/objectclass.html
http://developer.java.sun.com/developer/Books/effectivejava/Chapter3.pdf
http://www.javaworld.com/javaworld/jw-01-1999/jw-01-object-p2.html
http://www.javaworld.com/javaqa/2002-06/01-qa-0621-hashtable.html
http://www-106.ibm.com/developerworks/java/library/j-jtp05273.html
http://www.javapractices.com/Topic28.cjp

Similar Messages

  • How to use Iterator correctly to print out object attributes from  Vector ?

    Dear Java People,
    I have no compilation errors but am not getting output.
    I created a CD class and a Vector to hold all the CDs.
    I think perhaps I am using the Iterator incorrectly in the
    toSting() method. Below is the driver and CD class
    Thank you in advance
    Norman
    import java.util.*;
    public class TryCD
       public static void main(String[] args)
         Vector cdVector = new Vector();
         CD cd_1 = new CD("Heavy Rapper", "Joe", true);
         CD cd_2 = new CD("Country Music", "Sam", true);
         CD cd_3 = new CD("Punk Music", "Mary", true);
         cdVector.add(cd_1);
         cdVector.add(cd_2);
         cdVector.add(cd_3);
         Iterator i = cdVector.iterator();
         while(i.hasNext())
           i.next().toString();
    public class CD
       private String item;
       private boolean borrowed = false;
       private String borrower = "";
       private int totalNumberOfItems;
       private int totalNumberOfItemsBorrowed;
       public CD(String item,String borrower, boolean borrowed)
         this.item = item;
         this.borrower = borrower;
         this.borrowed = borrowed;
       public String getItem()
         return item;
       public String getBorrower()
         return borrower;
       public boolean getBorrowed()
         return borrowed;
       public String toString()
          return getItem() + getBorrower();
    }

    Dear InTrueT,
    The problem with trying to use
    System.out.println()is that it returns void and
    toString() requires a String be returned
    the error messaage says:
    "CD.java": Error #: 354 : incompatible types; found:
    void, required: java.lang.String at line 35
    your advice is appreciated
    NormanYou seem to have misunderstood. toString(), as you say, returns a String. System.out.println(), by a wonderful coincidence of design, accepts a String as a parameter. My suggestion was that you pass the output of one as the input to the other, thus displaying your String on the screen, as I had understood this to be your desire.

  • Read data from Vector object serialized in a file issue!!

    Hi all,
    I have two classes :CBase and CHelper class in a package and serializing some information in a file and then reading it. I am facing some problem while reading the data
    which was stored using vector of objects. Below is the detailed problem:::::
    ////////////CHELPER
    public class CHelper implements Externalizable, Cloneable {
    public string szname;
    //..other functions writeexternal read external
    ////////////CBASE
    public class CBase
    implements Externalizable, Cloneable {
    protected boolean bRead;
    protected boolean bWrite;
    protected Vector vData;
    public void addInstance(CHelper obj) {
    vData.addElement(obj);
    //..other functions writeexternal read external
    I am Serializing all the CBase information in a file and trying to read the contents from this serialized file::::
    CBase base = new CBase();
    CHelper obj = new CHelper();
    obj.setName("HELPER");
    base.addInstance(obj); // ADDING THE OBJECT DATA INTO THE VECTOR
    base.bRead = true;
    base.bWrite = true;
    // Writing to the file
    FileOutputStream fs = new FileOutputStream("d:\\temp\\Base.txt");
    ObjectOutputStream os = new ObjectOutputStream(fs);
    os.writeObject(base);
    os.close();
    //reading from the file
    FileInputStream fi = new FileInputStream("d:\\temp\\Base.txt");
    ObjectInputStream oi = new ObjectInputStream(fi);
    CBase read = (CBase) oi.readObject();
    PRINTING THE OUTPUT
    System.out.println("Vector = " + read.vData.firstElement().toString());
    System.out.println("Write = " + read.bRead);
    System.out.println("Read = " + read.bWrite);
    The output is something like:
    Vector = com.sp.CHelper@14b7453 // WHAT IS THIS ?? GARBAGE ?? NOT ABLE TO ANALYSE :(
    Write = true;
    Read = true;************
    MY PROBLEM:
    i.e How to get the information stored in the Vector ? I am getting something "com.sp.CHelper@14b7453 " whereas the expected output should be Vector = HELPER. I am
    writing and reading the vector as follows:
    // CHELPER
    public void writeExternal(ObjectOutput out) throws IOException {
    out.writeUTF(szName.toString());
    public void readExternal(ObjectInput in) throws IOException,
    ClassNotFoundException {
    setName(in.readUTF());
    Externalize in CBase Classs
    out.writeInt(getInstanceCount()); // getting number of objects in the vector
    for (int index = 0; index < getInstanceCount(); index++) {
    out.writeObject((CHelper)vData.get(index));
    out.writeBoolean(bWrite);
    out.writeBoolean(bRead);
    And reading like this::
    int iNumberofInstances; // number of instances
    iNumberofInstances = in.readInt();
    vData.clear();
    // Get the CHelper object and add it into the CFeatureBase vector
    for (int i = 0; i < iNumberofInstances; i++) {
    CHelper objbase = (CHelper)in.readObject();
    vData.add(objbase);
    this.bWrite = in.readBoolean();
    this.bRead = in.readBoolean();
    I suppose that i am correctly WRITING AND READING the data. B/w what can be the problem. All suggestions are welcome/
    Thanks,
    Rohit

    Vector = com.sp.CHelper@14b7453 // WHAT IS THIS ??
    GARBAGE ?? NOT ABLE TO ANALYSE :(
    Write = true;
    Read = true;************
    MY PROBLEM:
    i.e How to get the information stored in the Vector
    ? I am getting something "com.sp.CHelper@14b7453 "
    whereas the expected output should be Vector =
    HELPER.This is perfectly normal behaviour if your CHelper class doesn't override the toString() method. The default toString() method in Object just prints the name of the class and a hex representation of the object's hash code.
    Add a toString() method to CHelper that returns szname and you should see what you are expecting.

  • How do I  print out the attributes of objects from a  Vector?  Help !

    Dear Java People,
    I have created a video store with a video class.I created a vector to hold the videos and put 3 objects in the vector.
    How do I print out the attributes of each object in the vector ?
    Below is the driver and Video class
    Thank you in advance
    Norman
    import java.util.*;
    public class TryVideo
    public static void main(String[] args)
    Vector videoVector = new Vector();
    Video storeVideo1 = new Video(1,"Soap Opera", 20);
    Video storeVideo2 = new Video(2,"Action Packed Movie",25);
    Video storeVideo3 = new Video(3,"Good Drama", 10);
    videoVector.add(storeVideo1);
    videoVector.add(storeVideo2);
    videoVector.add(storeVideo3);
    Iterator i = videoVector.interator();
    while(i.hasNext())
    System.out.println(getVideoName() + getVideoID() + getVideoQuantity());
    import java.util.*;
    public class Video
    public final static int RENT_PRICE = 3;
    public final static int PURCHASE_PRICE = 20;
    private int videoID;
    private String videoName;
    private int videoQuantity;
    public Video(int videoID, String videoName, int videoQuantity)
    this.videoID = videoID;
    this.videoName = videoName;
    this.videoQuantity = videoQuantity;
    public int getVideoID()
    return videoID;
    public String getVideoName()
    return videoName;
    public int getVideoQuantity()
    return videoQuantity;
    }

    Dear Bri81,
    Thank you for your reply.
    I tried the coding as you suggested
    while(i.hasNext())
    System.out.println( i.next() );
    but the error message reads:
    "CD.java": Error #: 354 : incompatible types; found: void, required: java.lang.String at line 35
    Your help is appreciated
    Norman
    import java.util.*;
    public class TryCD
       public static void main(String[] args)
         Vector cdVector = new Vector();
         CD cd_1 = new CD("Heavy Rapper", "Joe", true);
         CD cd_2 = new CD("Country Music", "Sam", true);
         CD cd_3 = new CD("Punk Music", "Mary", true);
         cdVector.add(cd_1);
         cdVector.add(cd_2);
         cdVector.add(cd_3);
         Iterator i = cdVector.iterator();
         while(i.hasNext())
           System.out.println( i.next() );
    public class CD
       private String item;
       private boolean borrowed = false;
       private String borrower = "";
       private int totalNumberOfItems;
       private int totalNumberOfItemsBorrowed;
       public CD(String item,String borrower, boolean borrowed)
         this.item = item;
         this.borrower = borrower;
         this.borrowed = borrowed;
       public String getItem()
         return item;
       public String getBorrower()
         return borrower;
       public boolean getBorrowed()
         return borrowed;
       public String toString()
          return System.out.println( getItem() + getBorrower());

  • How to print the image data stored in object of 'java.io.File' Class in jsp

    I have created a file object for the image file in the system temporary directory.Now I want to display it in my page. please tell,How to print the image data stored in object(in my program it is imgr) of 'java.io.File' Class in jsp

    Create a servlet which gets an InputStream of the file and writes it to the OutputStream of the response and call this servlet in `src` attribute. That's basically all.
    Here's an example which covers the most of the minimum needs: [http://balusc.blogspot.com/2007/04/imageservlet.html].

  • I created a vector and added objects, but the vector is empty

    I created an object called a facility, it accepts 2 strings in the creator but stores the data as a string and a float. as you can see from the code below, i have tried to create a vector object to contain facilitys and named it entries. when i add objects to this vector, the vectors size does not change, and i cannot access elements of it via their index. but when i print the vector out i can see the elements? what is going on here. i am very confused. ps, if it helps i havent worked with vectors much before.
    FacilitysTest.java
    import java.util.*;
    public class FacilitysTest {
         public static void main (String [] args) {
         Facilitys entries = new Facilitys();
         entries.add("Stage","3.56");
         entries.add("kitchen","5.00");
         entries.add("heating","2");
    //     System.out.println(entries.firstElement() );
         System.out.println("printing out entries");
         System.out.println(entries);
         System.out.println();
         System.out.println("There are "+entries.size()+" entries");
         System.out.println();
         System.out.println("modifying entry 2");
         entries.setElementAt(new Facility("lighting","1.34"), 2);
         System.out.println(entries);
         System.out.println();
         System.out.println("deleting entry 1");
         entries.remove(1);
         System.out.println(entries);
    }the following is what happens when i run this code.
    the number (0,1,2) is taken from a unique number assigned to the facility and is not anything to do with the facilitys position in the vector.
    printing out entries
    Facility number: 0, Name: Stage , Cost/Hour: 3.56
    Facility number: 1, Name: kitchen , Cost/Hour: 5.0
    Facility number: 2, Name: heating , Cost/Hour: 2.0
    There are 0 entries
    modifying entry 2
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 >= 0
    at java.util.Vector.setElementAt(Vector.java:489)
    at FacilitysTest.main(FacilitysTest.java:17)
    Press any key to continue . . .
    Facilitys.java
    import java.util.*;
    public class Facilitys extends Vector {
         private Vector entries;
         public Facilitys( ) {
                 entries = new Vector();
        public void add( String name, String price ) {
             entries.add((new Facility( name, price) ));
        public Facility get(int index) {
              return ((Facility)entries.get(index));
         public float total() {
              float total = 0;
              for (int i = 0; i<entries.size();i++) {
                   total = total + ( (Facility)entries.get(i) ).getPricePerHour();
              return total;
        public String toString( ) {
            StringBuffer temp = new StringBuffer();
            for (int i = 0; i < entries.size(); ++i) {
                temp.append( entries.get(i).toString() + "\n" );
            return temp.toString();
    }

    are you reffering to where i have public class
    Facilitys extends Vector {
         private Vector entries;
         public Facilitys( ) {
                 entries = new Vector();
    That's correct. That's your problem.
    i added the extends Vector, because without it i got
    the following errors
    C:\Documents and Settings\george\My
    Documents\University\JavaCode\CM0112\FacilitysTest.jav
    a:14: cannot find symbol
    symbol : method size()
    location: class Facilitys
    System.out.println("There are "+entries.size()+"
    " entries");That's because you haven't implemented a size method in your class.
    ^
    C:\Documents and Settings\george\My
    Documents\University\JavaCode\CM0112\FacilitysTest.jav
    a:17: cannot find symbol
    symbol : method setElementAt(Facility,int)
    location: class Facilitys
    entries.setElementAt(new
    w Facility("lighting","1.34"), 2);That's because you haven't implemented setElementAt in your class.
    C:\Documents and Settings\george\My
    Documents\University\JavaCode\CM0112\FacilitysTest.jav
    a:21: cannot find symbol
    symbol : method remove(int)
    location: class Facilitys
         entries.remove(1);
    ^That's because you haven't implemented remove in your class.
    /Kaj

  • Printing LOGIN ID, DATE, TIME in PDF

    How to automatically print login ID, date, time in PDF

    You can read the 'identity' object in JavaScript but as I said before, it's forbidden to access it from a script inside the PDF file - only during batch, console and application initialization events.

  • Putting a Class Object into a Vector

    HI all
    I need to put a class object into another classes vector, then be able to read it and retrieve data.
    I can put the object into the vector but all i seem to be able to retrieve is data like Account@2343c2.
    Is this some sort of tag? How do i get to the data?
    thankz
    joey

    That's what you get when you print an object which does not have its own toString() method to do anything different - it picks up the Object class's toString method instead. For example:
    System.out.println(new Object());It sounds like you're doing something like this:
    Vector v = new Vector();
    v.add(new Account(42));If you were to do the following, you would see that sort of output:
    System.out.println(v.get(0));The appropriate way to do this would be something like the following:
       // Use a List reference instead of a Vector reference, and create
       // an ArrayList object in preference to a Vector object
       List list = new ArrayList();
       list.add(new Account(42));
       // Iterate through the list of accounts - use an
       // iterator because this prevents off-by-one errors
       // that arise with direct indexing.
       Iterator i = list.iterator();
       while(i.hasNext()) {
          // Cast the reference returned by the iterator from
          // Object to Account so that we can call account-specific
          // methods.
          Account current = (Account)i.next();
          // Call the method specific to the Account class (getBalance
          // is just an example that I made up).
          System.out.println(current.getBalance());
       }

  • Print out a Date in a format I want

    Now if I print out a Date object, I will get something like "Sat Jan 01 00:00:00 CST 2005", but what I want is "1/1/2005". I tried to use the get methods to get the month, day, and year so that I can put them in a format I want. However, all the get methods have been deprecated. What will be a possible(maybe easy as well?) way to do it? Thanks.

    Something like:
    import java.util.Date;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    public class Test {
        public static void main(String[] args) {
            DateFormat df = new SimpleDateFormat("d/M/yyyy");
            Date now = new Date();
            System.out.println(df.format(now));
            // new for Java 5.0 - almost the same format
            System.out.printf("%te/%<tm/%<tY%n", now);
    }Note: If you're using Java 5.0, then you can use the new printf method for PrintWriters. However, this doesn't appear to have a formatting token for single digit months.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#dt
    Cheers, Neil

  • Unexpected behavior when creating Objects in a Vector

    I have a situation where Objects in a Vector appear to be getting corrupted. The context is this: I obtain a ResultSet from a database, create a Vector of Strings for each row, and a Vector of these row vectors for the entire ResultSet. This is passed to a method where a POJO is created for each row. This method returns a Vector of these POJOs. In the Object constructor, a String array of initial values is created and also values are assigned to individual variables. Here is a snippet with the Object constructor
    public class RefAuthorItem {
         private final String refKey;
         private String authorKey, firstName, lastName, itemKey;
         private int authorPosition;
         private boolean isDeleted, isNew;
         // Keep a copy of the original values
         private final String[] oldValues;
          * The constructor for the data object item.
          * @param dataVals     a String array of the data values
          * @param isNewVal     boolean true if this is a new item, false if it is
          *                                              an existing item
         public RefAuthorItem(final String[] dataVals, final boolean isNewVal) {
              oldValues = dataVals;
              authorKey = dataVals[RefQueryBuilder.AUTH_NUM];
              firstName = dataVals[RefQueryBuilder.AUTH_FIRST_NAME];
              itemKey = dataVals[RefQueryBuilder.AUTH_PKEY];
              lastName = dataVals[RefQueryBuilder.AUTH_LAST_NAME];
              refKey = dataVals[RefQueryBuilder.AUTH_REF_FKEY];
              isNew = isNewVal;
              isDeleted = false;
              // the author position integer value is used to sort the display
              authorPosition =
                        Integer.parseInt(dataVals[RefQueryBuilder.AUTH_POS]);
         }It seems the oldValues[] values should be identical to the corresponding individual variable values. When the following code is used to create the objects, they are not.
              final boolean isNew = isNewVal;
              Vector<RefAuthorItem> returnSet = new Vector<RefAuthorItem>();
              final String queryString = QueryBuilder
                   .getRefQuery(keyString, tableName);
              Vector<Vector> dataSet = QueryDB.getResultSet(queryString);
              int columnTot = dataSet.firstElement().size();
                    String[] itemVals = new String[columnTot];
              for (Iterator iter = dataSet.iterator(); iter.hasNext();) {
                   Vector element = (Vector) iter.next();
                   for (int i = 0; i < columnTot; i++) {
                        itemVals[i] = (String) element.get(i);
                   RefAuthorItem item = new RefAuthorItem(itemVals, isNew);
                   returnSet.add(item);
              }What happens is this. I returned four rows from the database and the oldValues[] array for each of the four corresponding objects contains the data from the fourth row. However, when I retrieve the corresponding individual values (e.g., authorLastName) from the Object, it is correct. I checked the object values (oldValues versus individual values retrieved via getters) right after the object is created (the line: RefAuthorItem item = new RefAuthorItem(itemVals, isNew);) and get the correct results. Also, results are correct when the itemVals constructor is moved within the loop, as below
              int columnTot = dataSet.firstElement().size();
              for (Iterator iter = dataSet.iterator(); iter.hasNext();) {
                   Vector element = (Vector) iter.next();
                   String[] itemVals = new String[columnTot];
                   for (int i = 0; i < columnTot; i++) {
                        itemVals[i] = (String) element.get(i);
                   RefAuthorItem item = new RefAuthorItem(itemVals, isNew);
                   returnSet.add(item);
              } There is a problem here. Am I missing a subtle Java issue with instantiating the String array within the loop? Or is there a problem with Vectors? Thanks!

    Dear ejp,
    In the non-working code, I rewrite the itemVals[], create a new RefAuthorItem using the itemVals[] and repeat. I checked the RefAuthorItem immediately after it was created (with println()) and the oldValues and individual String values in the object are concordant. However, after the loop is completed (all RefAuthorItems are created and added to the Vector), the oldValues[] in the objects all have the values from the last row. The individual String variables in the object all have the correct value from the ResultSet row.

  • Print All Objects

    <p>On some of my Analyzer 7.2.5 reports, when I try to print with"Print All Objects", the radio button grays out andfreezes, and I need to kill it through Windows Task Manager.</p><p> </p><p>This has consistently happened to the multiple-object (6objects) reports, but it also inconsistently happened to reportswith 3 objects - it happens to some 3-object reports, but not theother 3-object reports. It seems to work fine with other reportswith 1 single object.</p><p> </p><p>Does anyone know the limit, which it shouldn't, of thefunction?</p><p> </p><p>Thanks.</p>

    Gurram wrote:
    want to read .rex File. The file contains combination of SQL code with table Names, Packages,Functions,There are three basic ways to read an external file.
    You can use UTL_FILE and use standard/basic file I/O calls like fread() and fwrite() - common amongst most (if not all) programming languages.
    You can define an external table for the file, and SQL*Load the contents of the file dynamically via a SQL SELECT statement.
    You can load the file into a CLOB using DBMS_LOB and then process it - quite useful if the text file is XML as the XMLTYPE supports parsing a a CLOB containing XML.
    I want to pick Each object name put in a separate file line by line.That in turn will need to use UTL_FILE to create an external file.
    Keep in mind though that your in a database environment with PL/SQL. The very best place for data is inside the database in SQL tables. Not outside as external files. Thus you need to ask yourself whether dealing this way with external files is the best solution, and a robust and scalable one.
    Granted, many times from the database side we need to deal with external files. The optimal method usually is to load that file's data into a database table as structured data - data that can be accessed via SQL and sorted, filtered, aggregated and analysed.
    To provide a "file" as output - this should ideally be done directly from structured data (SQL tables). And can be done using HTTP (via a web enabled PL/SQL procedure that supplies the file content as a http Mime stream), using FTP (via <i>UTL_TCP</i>) or as a CLOB via a PL/SQL call interface. Using UTL_FILE is not necessarily the only option.

  • Printing graphics object in Landscape or portrait mode

    Hello,
    I have a graphics 2d object (a Tree Diagram) which is inside a JScrollPane,and the JSCrollPane is on a JPanel. it's length and width is more than one page. I am using a printable object to print the object. The task I need to do is,
    (1). compress the width and length of the diagram, so that if can fit into one page, else split the diagram into pages, so that each part of it can be printed on different pages(page size A4) and then later those pages can be merged accordingly.
    I am not able to find, how to split the graphic object(the tree diagram into pages), shoul d I try doing it using x and y co ordinate of the graphic object.

    * PrintUtilities.java
    * Created on January 17, 2007, 7:25 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package action.vector.bam;
    * @author serjith
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    /** A simple utility class that lets you very simply print
    * an arbitrary component. Just pass the component to the
    * PrintUtilities.printComponent. The component you want to
    * print doesn't need a print method and doesn't have to
    * implement any interface or do anything special at all.
    * <P>
    * If you are going to be printing many times, it is marginally more
    * efficient to first do the following:
    * <PRE>
    * PrintUtilities printHelper = new PrintUtilities(theComponent);
    * </PRE>
    * then later do printHelper.print(). But this is a very tiny
    * difference, so in most cases just do the simpler
    * PrintUtilities.printComponent(componentToBePrinted).
    * 7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/
    * May be freely used or adapted.
    public class PrintUtilities implements Printable {
    private Component componentToBePrinted;
    public static void printComponent(Component c) {
    new PrintUtilities(c).print();
    public PrintUtilities(Component componentToBePrinted) {
    this.componentToBePrinted = componentToBePrinted;
    public void print() {
    PrinterJob printJob = PrinterJob.getPrinterJob();
    PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
    PageFormat pgFormat = printJob.pageDialog(set);
    printJob.setPrintable(this,pgFormat);
    //printJob.setPrintable(this);
    if (printJob.printDialog())
    try {
    printJob.print();
    } catch(PrinterException pe) {
    System.out.println("Error printing: " + pe);
    public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
    if (pageIndex > 0) { // requires change since it is bigger than a single page
    return(NO_SUCH_PAGE);
    } else {
    Graphics2D g2d = (Graphics2D)g;
    g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    disableDoubleBuffering(componentToBePrinted);
    int W = componentToBePrinted.getWidth();
    int H = componentToBePrinted.getHeight();
    //Component newComp = componentToBePrinted.getGraphics().clipRect();
    System.out.println("WorkSpace Height "+H+" Width "+W);
    pageFormat.getHeight();
    pageFormat.getWidth();
    pageFormat.setOrientation(PageFormat.LANDSCAPE);
    //componentToBePrinted.paint(g2d);
    componentToBePrinted.printAll(g2d);//.paintAll(g2d);
    enableDoubleBuffering(componentToBePrinted);
    return(PAGE_EXISTS);
    /** The speed and quality of printing suffers dramatically if
    * any of the containers have double buffering turned on.
    * So this turns if off globally.
    * @see enableDoubleBuffering
    public static void disableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(false);
    /** Re-enables double buffering globally. */
    public static void enableDoubleBuffering(Component c) {
    RepaintManager currentManager = RepaintManager.currentManager(c);
    currentManager.setDoubleBufferingEnabled(true);
    =============================================================
    Please find this code, which I am trying to use, here I am passing the JPanel
    try{                   
    PrintUtilities.printComponent(actWorkSpace);
    }catch(Exception ex){
    ex.printStackTrace();
    the actWorkSpace is a JPanel with graphics as mentioned above, which is being passes to PrintUtilities.printComponent();
    the output is only just a single page with just a portion of the graphics on the JPanel, pls help...... it is urgent....

  • Internationalized Object data from database

    Hi...
    I like to know which concepts you use in web application in case you need dynamic object data internationalized. For static web pages I can use ResourceBoundles to get the data but I'm still searching for the ideal way to do this with Object data.
    Let�s say you have a Product object which has a name and description in many different languages.
    Preferably I like to do something like this
    <c:out value="${product.name}"/>
    to display the users preferred (session) language, and for the special case to force a language I might use something like this
    <c:out value="${product.name}" locale="en_US"/>
    Now my big question is how should I implement something like this. Should the product.getName() method include the logic to determine the users session to call something like product.getName(Locale)? Or should I implement a custom tag to handle cases like this?
    What is your preferred way of doing this?
    Thanks,
    Gregor

    How can use hashtable or Vector to create Jtree ?
    the Hashtable's Data or Vector's Data from Database.

  • Can't print OLE objects when 9i report developed in 6i

    Hi,
    I am migrating my reports from 6i to 9i. I just open report in 9i which is already developed in 6i and run the report it don't print OLE objects. It shows when I run report in Designer Preview, but in printing it shows blank
    --Vijay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hello,
    The answer is in the Migration FAQ :
    When I open an Oracle6i Reports Developer report in the Oracle Reports Builder 10g and run my Web layout, I get an empty Web page in my browser.
    http://www.oracle.com/technology/products/reports/htdocs/faq/faq_migration.htm#368
    Regards

  • Putting Resultset objects in an Vector

    Can anybody help me, I have to put all my results from the ResultSet in a Vector.
    But I don't know how.
    Thanx in advance.

    for a vector of vector ....
    public static Vector prepareData(ResultSet rs)
         Object lValue=null;
         Vector returnedVector=new Vector();
         try
              Enumeration lEnum=null;
              rs.beforeFirst();
              while (!rs.isLast())
                   lEnum=this.elements();
                   Vector lLine=new Vector();
                   int i=0;
                   rs.next();
                   while (lEnum.hasMoreElements())
                        lValue=rs.getObject(i);
                        lLine.add(lValue);
                        i++;
                   returnedVector.add(lLine);
         catch (SQLException e)
              e.printStackTrace();
         return returnedVector;          

Maybe you are looking for

  • Mail Won't Open, But it's NOT "not responding"

    This is the strangest thing I have seen. Ok, let me start from the beginning - A few days ago, my hard drive was starting to fail. Time Machine wasn't backing up from before that, even though it was set to run every day. Last backup was done on 30 Ju

  • Installing a generic unix webclient on my MacBook Pro

    Hello, I have a small question. I'm trying to install a webclient on my new Intel based MacBook Pro 2.16 Ghz under X11. When I use :source setupunix_3.0.74.bin.sh the script starts, but at a certain point it says : This application requires a Java Ru

  • Inet4AddressImpl.lookupAllHostAddr(String) hangs/blocks

    I'm experiencing a hang when attempting to establish a socket connection. Debugging indicates the VM is blocked here: Inet4AddressImpl.lookupAllHostAddr(String) line: not available [native method] I'm experiencing this problem during an ANT build. In

  • ORACLE OLAP metadata 10g vs 11g

    Good morning, When we connect to our database AWM 11g, it is possible to choose the type of cube (11g or 10g). What I infer is that the metadata will be type 10g or 11g, correct? What are the major differences in metadata for olap between the type 10

  • WWI report Symbols

    Hi Gurus I am in the process of creating new template for Incident Management. In incident management we have Root Cause hierarchy. In our system we dont have standard symbols for root cause hierarchy. Any idea what are the symbols we need to use for