Help on Vector

hi everyone, i've got 6 textfields, 6 comboBox. i want to use vector to get their texts and itemselected.
any help will be appreciated.

ok, so instead of:
TextField f1 = new TextField(...);
TextField f2 = new TextField(...);
f1.getText();
f2.getText();
do:
Vector textFields = new Vector();
textFields.add(new TextField(...));
textFields.add(new TextField(...));
((TextField) textFields.get(0)).getText();
((TextField) textFields.get(1)).getText(); // or in a loop to get(i)

Similar Messages

  • When I try to open Help in Vector Works 12.5.5, nothing happens. It works fine when I switch to Safari as my browser. I'm running on a 10.5.8 Mac. It worked fine last week. Any ideas?

    When I try to open Help in Vector Works 12.5.5, nothing happens. It works fine when I switch to Safari as my browser. I'm running on a 10.5.8 Mac using Firefox 3.6.3. It worked fine last week. Any ideas?
    == This happened ==
    Every time Firefox opened
    == today

    Wow! You're amazing! It's now ok! Thanks so much!
    I just thought that Rapport will help me to be more secured but I didn't know that it has a side effect. haha!

  • Help using Vectors...

    Hi, I'm learning Java programming.I need help using vectors..
    I have a StructMember which contains {String ID, String Sum} I have a vector which contains 10 StructMember objects. (i.e. each element in my vector will have ID and Sum)
    I need to search the list if it contains the ID and then extract the associated sum value from the vector based on the given Id. How can I do this? Any code snippets would be very helpful..
    Thanks,
    NJU

    You can use an Hashtable (thread safe) to store all your StructMember objects. For example, if you have 3 StructMember like this:
    sm1 = new StructMember("id1", "sum1");
    sm2 = new StructMember("id2", "sum2");
    sm3 = new StructMember("id3", "sum3");Initialise the Hashtable:
    hash.put(sm1.getId(), sm1);
    hash.put(sm2.getId(), sm2);
    hash.put(sm3.getId(), sm3);If you want to retrieve the sum of for the id="id2" then you do:
    ((StructMember)hash.get("id2")).getSum();

  • I need help an urgent help in vectors

    I am comparing the elements of one vector with everyother element of another vector.If a match is found I need to remove the element from the second vector and should obtain the remaining elements of the second vector.Could u please help in this!
    ie)
    Vector v1=new Vector();
    Vector v2=new Vector();
    v1.addElement("apple");
    v1.addElement("grapes");
    v1.addElement("mango");
    v1.addElement("orange");
    v1.addElement("pineapple");
    v1.addElement("banana");
    v2.addElement("cherry");
    v2.addElement("berry");
    v2.addElement("papaya");
    v2.addElement("mango")
    v2.addElement("apple");
    here in this example , if i compare the vectors (v1,v2), the elements in v2(mango and apple) are contained in v1 also.so i need to remove the elements from vector v2 which are common and need to fetch the remaining elements in the v2 vector.so the resulting v2 vector should contain only 'cherry','berry','papaya',and i need to display the content of v2 vector after the removal of similar elements .could u please help me how to do this!!!!!.

    Much easier way, use Vector.removeAll(Collection c).
    As class Vector is an instance of interface Collection, you can pass in a vector.
    i.e.
    import java.util.*;
    public class tester
         public static void main(String[] args)
              tester.refineList();
         public static void refineList()
              Vector v1=new Vector();
              Vector v2=new Vector();
              v1.addElement("apple");
              v1.addElement("grapes");
              v1.addElement("mango");
              v1.addElement("orange");
              v1.addElement("pineapple");
              v1.addElement("banana");
              v2.addElement("cherry");
              v2.addElement("berry");
              v2.addElement("papaya");
              v2.addElement("mango");
              v2.addElement("apple");
              v2.removeAll(v1);
              for(int a = 0; a < v2.size(); a++)
                   System.out.println(v2.elementAt(a).toString());
    }Hope this helps
    D

  • Need help creating Vector table for specific class

    I am trying to create a Vector table of class Node and I think I understand the concept but in practice I am not
    sure why the compiler complains about non-static reference on statement mv.table.add(new Node(names[n]). Please help. I can not get this thing to work.
    import java.util.*;
    class MyVector {
    Vtable table;
    public static void main(String[] args){
    MyVector mv = new MyVector();
    String names[] = {"one","two","three","four","five"};
    for (int n;n<names.length;n++)
    mv.table.add(new Node(names[n])); //<-ERROR
    table.list();
    if (table.del("de")) System.out.println("deleted");
    table.list();
    public MyVector(){
    System.out.println("MyVector_C");
    table = new Vtable();
    public class Node {
    private String name;
    public Node(){name=new String("Null");}
    public Node(String s){name=s;}
    public void setName(String s){name=s;}
    public String getName(){return name;}
    public String toString(){return "[Node:"+name+"]";}
    public class Vtable extends Vector {
    private Vector v;
    public Vtable(){v=new Vector();}
    public void add(Node n){v.add(n);}
    public Node getNode(String s){
    Iterator i=v.iterator();
    while(i.hasNext()){
    Node n;
    n = (Node)i.next();
    if (s.equals((String)n.name))
    return(n);
    return null;
    public void list(){
    Iterator i=v.iterator();
    while (i.hasNext()){System.out.println((Node)i.next());}
    public Boolean del(String s) {
    Iterator i=v.iterator();
    while(i.hasNext()){
    Node n = (Node)i.next();
    if (s.equals((String)n.name)) {
    v.remove(n);
    return(true);
    return(false);
    }

    public class Vtable extends Vector {
    private Vector v;
    public Vtable(){v=new Vector();}
    public void add(Node n){v.add(n);}
    public Node getNode(String s){
    Iterator i=v.iterator();
    while(i.hasNext()){
    Node n;
    n = (Node)i.next();
    if (s.equals((String)n.name))
    return(n);
    return null;
    I get ur problem...
    When VTable extends Vector all u have to do is...
    VTable table=new VTable();
    table.add(new node(..));
    There is no need to get the Vector obj in picture as VTable extends Vector...
    I guess, this helps u.

  • Need help with vectors

    I'm creating Drink objects into my vector (I'm required to use a vector in my program). However everytime a new Drink object is created and added into the vector, the other Drink objects in the previous indexes are somehow made into aliases of the new Drink object. Can anyone help me with this? Here's the case statement in which the program creates a Drink object, parses it with a DrinkParser class, and adds it to the vector:
    case 'A': //Add Drink
                                  drinkInfoPrompt();
                                  drinkList.addElement(DrinkParser.drinkParser(br.readLine()));
                                  break;

    Thank you very much for helping me. Here's my DrinkParser:
    import Drink;
    import java.util.StringTokenizer;
    //=============================//
    //Utility class for creating a //
    //customer from an input string//
    //=============================//
    public class DrinkParser
         static String input, temp;
         static String nameOfDrink; //Drink's Name
         static String typeOfDrink; //Drink's Type
         static double costOfDrink; //Drink's Cost
         static Drink drink = new Drink();
         //Main static method for creating a new customer
         public static Drink drinkParser (String lineToParse)
              input = lineToParse;
              input.trim();
              StringTokenizer tokenizer = new StringTokenizer(input, ":", true);
              //If the first character of the String is not a colon,
              //then program will proceed to tokenizing the first and
              //last name.
              nameOfDrink = tokenizer.nextToken();
              nameOfDrink.trim();
              drink.setDrinkName(nameOfDrink);
              tokenizer.nextToken();//Skips first colon
              typeOfDrink = tokenizer.nextToken();
              typeOfDrink.trim();
              drink.setDrinkType(typeOfDrink);
              tokenizer.nextToken();//Skips second colon
              temp = tokenizer.nextToken();
              temp.trim();
              costOfDrink = Double.parseDouble(temp);
              drink.setDrinkCost(costOfDrink);
              return drink;
         }//end drinkParser method
    }//end class

  • I need help with Vector assignment

    So I am not asking you to do the work unless you really feel giving :)
    This is my task for class..."Redo the programing example Election results so that the names of the candidates and the total votes are stored in Vector objects"
    How do I store them in a vector object. An example would be nice but if you can't help then please keep comments to yourself unless they are constructive.

    public static int binSearch(String[] cNames, String name)
             int first, last;
             int mid = 0;
             boolean found;
             first = 0;
             last = cNames.length - 1;
             found = false;
             while (first <= last && !found)
                mid = (first + last) / 2;
                if (cNames[mid].equals(name))
                   found = true;
                else if (cNames[mid].compareTo(name) > 0)
                   last = mid - 1;
                else
                   first = mid + 1;
             if (found)
                return mid;
             else
                return -1;
           public static void processVotes(Scanner inp,
                                        String[] cNames,
                                        int[][] vbRegion)
             String candName;
             int region;
             int noOfVotes;
             int loc;
             while (inp.hasNext())
                candName = inp.next();
                region = inp.nextInt();
                noOfVotes = inp.nextInt();
                loc =  binSearch(cNames, candName);
                if (loc != -1)
                   vbRegion[loc][region - 1] =
                          vbRegion[loc][region - 1] + noOfVotes;
           public static void addRegionsVote(int[][] vbRegion,
                                          int[] tVotes)
             int i, j;
             for (i = 0; i < tVotes.length; i++)
                for (j = 0; j < vbRegion[0].length; j++)
                   tVotes[i] = tVotes[i] + vbRegion[i][j];
           public static void printHeading()
             System.out.println("  ---------------Election Results"
                             + "--------------\n");
             System.out.println("Candidate           "
                             + "       Votes");
             System.out.println("Name       Region1 Region2 "
                             + "Region3 Region4  Total");
             System.out.println("----       ------- ------- "
                             + "------- -------  -----");
           public static void printResults(String[] cNames,
                                        int[][] vbRegion,
                                        int[] tVotes)
             int i, j;
             int largestVotes = 0;
             int winLoc = 0;
             int sumVotes = 0;
             for (i = 0; i < tVotes.length; i++)
                if (largestVotes < tVotes)
    largestVotes = tVotes[i];
    winLoc = i;
    sumVotes = sumVotes + tVotes[i];
    System.out.printf("%-11s ", cNames[i]);
    for (j = 0; j < vbRegion[0].length; j++)
    System.out.printf("%6d ", vbRegion[i][j]);
    System.out.printf("%5d%n", tVotes[i]);
    System.out.println("\n\nWinner: " + cNames[winLoc]
    + ", Votes Received: "
    + tVotes[winLoc]);
    System.out.println("Total votes polled: " + sumVotes);

  • Please Help. Vector exporting issues

    Hi
    Im am creating a log for myself using illutrator cc i am new to it but have picked up things very quickly.
    the problem im having is....when i have created my vector logo and expanded everything necessary. Then i export it as a PNG to my desktop then when i view  the image the quality is bad? I thought once you save the logo as a vector the quailty would remain the same no matter how much you zoom in?
    Hope that makes sense, not sure what im doing wrong?
    Look forward to your reply
    Many Thanks
    Ryan 

    This would depend on what you are going to do with the exported or saved file.
    Most of the export file types are raster formats. These can be very useful when you want to email your design to a client, or use the file in a web page.
    You need to "save as" in order to produce a vector file. Look at the options:
    .ai is Illustrator format
    EPS is encapsulated postscript, which is vector data plus a raster preview
    PDF is Portable Document Format, but should typically be reserved for sharing a pdf, not so much for depending on the vector info for later use
    SVG Compressed and SVG: short for Scalable Vector Graphics, a file format that enables two-dimensional images to be displayed in XML pages on the Web.
    If you're goiong to place the file in InDesign, .ai is fine.
    If you're going to open the file in Photoshop, ai is fine.
    This also might help you: 
    http://helpx.adobe.com/pdf/illustrator_reference.pdf
    Highly recommended reading.  :+)

  • Please HELP (about vectors).

    I am trying to create a vector by reading some records from a ASCI file. Reading from file works ok, but when adding the records to the vector does not work properly. The last element added covers all the preceding elements. It looks like this:
                    Read Record              First Element in Vector
       phoneNo          2030000001   firstNo          2030000001
       phoneNo          2030000002   firstNo          2030000002
       phoneNo          2030000003   firstNo          2030000003
       phoneNo          2030000004   firstNo          2030000004
       phoneNo          2030000005   firstNo          2030000005
       phoneNo          2030000006   firstNo          2030000006
       phoneNo          2030000007   firstNo          2030000007
       phoneNo          2030000008   firstNo          2030000008
       phoneNo          2030000009   firstNo          2030000009
    And the vector:
    2030000010
    2030000010
    2030000010
    2030000010
    2030000010
    2030000010
    2030000010
    2030000010
    2030000010 Can anybody help?
    Here is the listing:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.text.*;
    public class NPhone extends javax.swing.JFrame
        public  SumFone sumf;
        public  String fileN;
        public NPhone(String fileN)
            this.fileN = fileN;
            initComp();
            getData();
        private void initComp() {
            pSummary = new javax.swing.JPanel();
            bSummRefNum = new javax.swing.JButton();
            getContentPane().setLayout(null);
            setTitle("NPhone");
            setMaximizedBounds(new java.awt.Rectangle(0, 0, 500, 500));
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            pSummary.setLayout(null);
            pSummary.setBackground(new java.awt.Color(200, 200, 225));
            pSummary.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
            pSummary.setFocusable(false);
            pSummary.setMinimumSize(new java.awt.Dimension(400, 400));
            pSummary.setPreferredSize(new java.awt.Dimension(400, 400));
            pSummary.setAutoscrolls(true);
            bSummRefNum.setBackground(new java.awt.Color(0, 153, 255));
            bSummRefNum.setFont(new java.awt.Font("Dialog", 1, 18));
            bSummRefNum.setForeground(new java.awt.Color(255, 255, 0));
            bSummRefNum.setMnemonic('P');
            bSummRefNum.setText("Phone Numbers");
            bSummRefNum.setToolTipText("s");
            bSummRefNum.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
            bSummRefNum.setSelected(true);
            bSummRefNum.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    bSummRefNumActionPerformed(evt);
            pSummary.add(bSummRefNum);
            bSummRefNum.setBounds(10, 10, 430, 30);
            getContentPane().add(pSummary);
            pSummary.setBounds(20, 260, 995, 450);
            pack();
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setSize(new java.awt.Dimension(500, 500));
            setLocation((screenSize.width-1028)/2,(screenSize.height-732)/2);
        private void bSummRefNumActionPerformed(java.awt.event.ActionEvent evt) {
              JList phoneL = new JList();
              String title = " PHONES ";
              int[] bounds = { 10, 50, 500, 600};
              String header = " PHONE NUMBER ";
              phoneList(phoneL);
              showList(title, bounds, header, phoneL);
        void getData()
              bSummRefNum.requestFocus();
              JList phoneL = new JList();
              getPhoneVector();
         public void getPhoneVector()
              String result;
              sumf = new SumFone();
              sumf.openFin(fileN);
              phoneVector = new Vector();
              int numOfPhone = 0;                            
              sumf = sumf.getSumfRec();
              while (numOfPhone < 9)   
                        phoneVector.addElement(sumf);
                        System.out.println(
                        "   phoneNo          " + sumf.phoneNo +
                        "   firstNo          " + ((SumFone)phoneVector.firstElement()).phoneNo);                          
                        numOfPhone++;
                        sumf = new SumFone();
                        sumf = sumf.getSumfRec();
         public void phoneList(JList dataList)
              Font   courierB15 = new Font("Courier", 1, 15);
              Vector v = new Vector();
              String result;
              int numOfPhone = phoneVector.size();                            
              for (int i = 0; i < numOfPhone; i++)   
                   sumf = (SumFone)phoneVector.get(i);
                   result = " " + sumf.phoneNo;                                     
                   System.out.println(result);
                   v.add(result);                                                   
              dataList.setListData (v);
              dataList.setFont(courierB15);
              dataList.setFixedCellHeight(18);
              dataList.setFocusable(true);
         public void showList (String title, int[] bounds, String header, JList dataList)
              Font courierB15 = new Font("Courier", 1, 15);
              jFrTx = new JFrame();
               jFrTx.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
               jFrTx.setTitle(title);
              JLabel listTitle;
              listTitle = new JLabel (header);
              listTitle.setForeground(Color.blue);
              listTitle.setBackground(Color.blue);
              listTitle.setFont(courierB15);
              jFrTx.getContentPane().add(listTitle, BorderLayout.NORTH);
              jsp = new JScrollPane();
              jsp.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
              jsp.setPreferredSize(new java.awt.Dimension(100, 50));
              jsp.setAutoscrolls(true);
              jsp.getViewport().add(dataList);
              jFrTx.getContentPane().add("Center", jsp);
              jFrTx. pack();
              jFrTx.setVisible(true);
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
            class SysWindow extends WindowAdapter
               public void windowClosing( WindowEvent we )
                           setVisible(false);
                           dispose();
        public static void main(String args[])
            new NPhone("phone.txt").show();
        private javax.swing.JButton bSummRefNum;
        private javax.swing.JPanel pSummary;
        public  JFrame jFrTx;
        public  JList dataList;
        public  JScrollPane jsp;
        public  JLabel listTitle;
        protected Vector phoneVector;                       
    And here is the object SumFone:
    import java.io.*;
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    class SumFone
         static public String      phoneNo;  // [10]                                                                           
         public  static RandomAccessFile fin;
         public  static long       fpos = 0;
         private static long       spos = -1;
         private static long       epos = -1;
         private static int        bufsize = 256;
         private static byte       inbuf[];
         public SumFone() {}
         public SumFone(String  phoneNo)                              
              this.phoneNo = new String(phoneNo);
        public static void openFin (String finName)
            File file = new File (finName);
            try {
                  fin = new RandomAccessFile(finName, "r");
                } catch (FileNotFoundException e) {
                   errorMsg("File: " + finName + "Not Found\n" + e);
            inbuf = new byte[bufsize];
         public static SumFone getSumfRec()                              
                   String  phoneNo = getString(0, 10);
                   return new SumFone (phoneNo);
        public static String getString(int start, int length)
          int c;
          byte buf[] = new byte[length];
          String str = new String();
          for (int i = 0; i < length; i++)
              c = readFin();
              fpos++;
              buf[i] = (byte)c;
          str = new String (buf, 0, length);
          return str;
        public static int readFin()
         if (fpos < spos || fpos > epos)
            long bufstart = (fpos / bufsize) * bufsize;
            int n;
            try {
                 fin.seek(bufstart);
                 n = fin.read(inbuf);
                catch (IOException e) {
                  return -1;
            spos = bufstart;
            epos = bufstart + n - 1;
            if (fpos < spos || fpos > epos)
              return -1;
          int b = inbuf[(int)(fpos - spos)];
          return b;
        static void errorMsg(String errormsg)
              Toolkit.getDefaultToolkit().beep();
              JOptionPane.showMessageDialog(null, errormsg,
                            "Error Message", JOptionPane.ERROR_MESSAGE);
              System.exit(-1);
    }And the content of phone.txt file is:
    2030000001203000000220300000032030000004203000000520300000062030000007203000000820300000092030000010
    The problem appears to be in getPhoneVector() method in NPhone class.
    Any idea what I am doing wrong?
    Thanks.

    Well, it's just a lot more complicated than it needs to be.
    Use a BufferedReader or FileInputStream instead of the random access file class. Assuming you'll always be reading in order.
    Try to use "static" as sparingly as possible; it will cause things to break when you create more than one instance of them.
    Try to use the collection classes wherever possible. The Vector is ok, but there are better ones, and if you do this:
    List numbers = new Vector(); Then assuming all your code uses the List interface to access the data, it is easy to substitute an ArrayList, or LinkedList or something else later on without having to change anything else.
    While we're on the subject, use iterators to manipulate your list. For example:
    List textList = ... // Populate with strings somehow
    Iterator i = textList.iterator();
    while(i.hasNext())
       System.out.println((String)i.next());
    }That probably looks more ungainly, but it avoids the "fencepost errors" that tend to crop up. For example this situation obviously can't arise:
    List textList = ... // Populate with strings somehow
    // Oops, used <= instead of ==
    for(int i = 0; i <= textList.size(); i++ )
       System.out.println((String)i.next());
    }Don't get me wrong, your code isn't awful. And you had most of the problem sussed. But if you're planning on doing a lot of Java then avoiding some of these bad habits will save you a whole heap of pain !
    Cheers,
    D.

  • Need help about Vector class in java

    Hello,
    I have some questions about Vector class. Please see this short code:
    Vector v = new Vector();
    v.add(New Integer(5));
    Is this the only way to add int value into vector? Performance wise, is this slow? And are there any better and faster way to add/get int element fro vector?
    Thank you very much in advance.

    Normally (up to Java version 1.4), that's the only way you can add an int to a Vector. The thing is that Vector can only contain Objects, and an int is a primitive, not an object. So you have to wrap the int in an Integer object.
    However, Java 5 has a new feature, called autoboxing, which means that the compiler automatically wraps primitive values into objects, so that you can program it like this:
    Vector v = new Vector();
    v.add(5);Note, this will not make your program faster or more efficient, because the compiler translates this automatically to:
    Vector v = new Vector();
    v.add(new Integer(5));So in the end, the same bytecode will be produced. Autoboxing is just a feature to make life more convenient for the programmer.

  • Need help with Vector problem

    I'm creating a vector from a recordset, which i will use for paging purposes. I searched the posts for this but didn't find any good answers. Anyway, here's what I have. It's all in the JSP page (at least for now):
         Vector dataVector = new Vector();
         Vector rowVector;
         ResultSetMetaData rsmd = rset.getMetaData();
              int count = rsmd.getColumnCount();
                   while (rset.next() ) {
                        rowVector = new Vector();
                        for (int i = 1; i <= count ; i++) {
                             rowVector.addElement(rset.getObject(i));
                   dataVector.addElement(rowVector);
    %>
    // HTML STUFF
    <%
    for(int a = 0; a <= dataVector.size(); a++) { %>
    <p> <%= dataVector.elementAt(a) %> </p>
    <% } %>
    And I get the following error:
    java.lang.ArrayIndexOutOfBoundsException: 2 >= 2
         at java.util.Vector.elementAt(Vector.java:417)
         at org.apache.jsp.untitled$jsp._jspService(untitled$jsp.java:116)
         at
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107........
    I'm selecing 3 columns from the DB table, for a total of 2 records pulled (It's a test platform). So, any ideas?
    Thanks
    Mike Gernhardt

    size will return the total number of objects within the vector and not the max index of the vector.
    a <= dataVector.size(); a++) { %>
    will obviously throw a runtime exception(
    java.lang.ArrayIndexOutOfBoundsException)
    making it a<dataVector.size(); a++) { %> will take care of the problem.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

  • Help with vector

    I am creating a scrabble game application for a project.
    I have a method, adding letters in a vector as i drop them on the game board, but when i get the toString output of the vector it is not in the proper form.
    e.g if i form the word "Education", it prints as [e,d,u,c,a,t,i,o,n] please any suggestions on how to print them as a whole word?
    Codes:
    private void getwordsRight() {
    try {
    for (int i = newPos; i < cell.length; i++) {
    Component b = cell.getComponent(0);
    if (b instanceof JLabel) {
    kl = (letterTile) b;
    words.add(kl.getLetter());
    } catch (Exception e) {
    public String getWord() {
    String word = "";
    return
    word = (String)words.toString();

    Hi,
    I don't know if I understand you right.But I assume by proper form you mean Education.
    This is just a demo - HIH
    import java.util.*;
    public class WordTest
         Vector<Character> v= new Vector<Character>();
         public WordTest()
              v.add('E');
              v.add('d');     
              v.add('u');
              v.add('c');
              v.add('a');
              v.add('t');
              v.add('i');
              v.add('o');
              v.add('n');
         public void displayWord()
              for(int i=0;i<v.size();i++)
                 String s= v.get(i).toString();
                 System.out.print(s);
                   System.out.println();
         public static void main(String[] args)
            WordTest  wt=new WordTest();      
              wt.displayWord();
    }Output:
    Education
    Regards,
    Swapnaja

  • I need help with vector shapes

    I have created a shape with the pen tool in CS6, I have multiple shapes that I have built into what should be a single shape. Although when the path tool is not on I can see the single shape I can't seem to set a stroke to it which is an important part of the image design. Can anyone help please

    bolo121 wrote:
    I Don't want to path showing in the final visual but I do want the shape to appear as one hole shape and not look like its made up do different parts.
    If you can upload your PSD file and post a link to it so we can get what you have now. We can download it a show you what can be done.  You see a path that has multiple closed sub paths is like a layer stack. Each segment is like a layer in a stack of layers and each layer has a mixing mode. Changing modes and order can radically change shapes the path will produce. Herr you see 5 paths all have the same sub paths but not not all have the same order and modes. The paths look different in the Path palette and the shape made with the are quite different.
    How Photoshop stroke a shape often baffles me Sometime I feel the segment are missing or are extra and should not be there. Its most likely the stacking order and modes. I just can not seem to get a good mind's eye on the stack an modes. I know my brain must be defective in the perfect world how can that be????
    Where is my stroke in this one I sure can not see it. All modes are subtract so Adobe subtracted the stroke I would guess...
    Message was edited by: JJMack

  • Use of Vector in undo operation ?

    Hello,
    I am developing simple paint program. And want to use undo redo operation for drawing in drawing canvas. Actually I have done it with the help of Vector. But the problem is that it is not working properly. The first drawn shape is not removing with this operation and also the problem is that When i am using CTRL+Z for undoing last drawing. It is not removing last drawn shape with first undo operation. Let me know that what is the exact problem in my coding. I am not fully java programmer. So please tell me what to do for that. I want to draw n level of drawing on drawing canvas and also want to perform n level (first drawn shape) undo actions. And also want to know how to make redo button for same coding only use of Vector or ArrayList.
    My code is here:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    import java.util.*;
    public class PaintUndo extends JFrame
         Display pan = new Display();
    public PaintUndo()
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         getContentPane().add("Center",pan);
           setBounds(1,1,600,400);
         JMenuBar  menu = new JMenuBar();;
         JMenu     submenu;
         JMenuItem item, redo;
         submenu = new JMenu("Edit");     
         item = new JMenuItem("UnDo");
        item.setMnemonic(KeyEvent.VK_Z);
            item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, ActionEvent.CTRL_MASK));
         item.addActionListener((ActionListener)pan);
         submenu.add(item);   
         menu.add(submenu);
         getContentPane().add("North",menu);
         setVisible(true);
    public class Display extends JComponent implements MouseMotionListener, MouseListener, ActionListener
         Vector   saves = new Vector();
         BufferedImage image = null;
         Graphics ig;
         Graphics pg;
         Point point;
        int x1=0;
        int y1=0;
    public Display()
         setBackground(Color.pink);
         addMouseMotionListener(this);
        addMouseListener(this);
    public void paintComponent(Graphics g)
         if (image == null)
              image = (BufferedImage) createImage(800,600);
              ig = image.createGraphics();
              ig.setColor(Color.white);
              ig.fillRect(0,0,800,600);
              ig.setColor(Color.blue);
              pg = getGraphics();
              pg.setColor(Color.blue);
         g.drawImage(image,0,0,this);
    public void mouseDragged(MouseEvent e)
            int x2 = e.getX(); int y2 = e.getY();
                Graphics gr = image.getGraphics();
                   gr.drawLine(x1, y1, x2, y2);
                repaint();
                x1 = x2; y1 = y2;
    public void mouseMoved(MouseEvent e)
    public void actionPerformed(ActionEvent a)
         if (a.getActionCommand().equals("UnDo") && saves.size() > 0)
              ig.drawImage((Image)saves.remove(saves.size()-1),0,0,null);
              repaint();
            public void mouseClicked(MouseEvent e) {
                System.out.println("mouse clicked....");
            public void mousePressed(MouseEvent e) {
                System.out.println("mouse pressed....");
                x1 = e.getX();
                   y1 = e.getY();
            public void mouseReleased(MouseEvent e) {
                System.out.println("mouse released....");
               Image tmg = createImage(800,600);
              Graphics tg = tmg.getGraphics();
              tg.drawImage(image,0,0,null);
              saves.add(tmg);
            public void mouseEntered(MouseEvent e) {
            public void mouseExited(MouseEvent e) {
    public static void main (String[] args)
         new PaintUndo();
    }This is complete code for undoing.
    Any help will be appreciated.
    Thanks in advance.
    Manveer

    The example code is set up for a protocol completely different than what you are doing, so you can't simply copy it and hope it works.  The example code expects that the other side will send a 4-byte header containing the number of data bytes that follow, then send the data.  The example code first reads that 4-byte header, casts it to an integer, and reads that number of bytes (the second Bluetooth Read).
    When you run this with your device, the first read gets your 4 bytes - FF FF 22 33 - and converts that to an integer.  0xFFFF2233 is decimal 4294910515.  So you then try to read this huge number of bytes and you get an error - looks like error 1, an input parameter is invalid, because you can't read 4GB at once.  You can probably get your code working with a single Bluetooth Read, with a 1 second timeout (because you have a 1 second delay between packets).  You'll want to wire in some number of bytes to read that is at least the size of the largest packet you ever expect, but don't use a ridiculously huge number that generates an error.  LabVIEW will return as many bytes as are available when the timeout expires, even if it isn't as many as you asked to read (you might also get a timeout error, though, which you'll need to clear).  You can then do whatever you need to do with that data - search for FF FF, typecast anything after that to array of U16, display it. 
    The output of the Bluetooth Read is a string, but it's not text - it's exactly the bytes that were sent.  The Y with the dots over it is the way ASCII 255 (0xFF) displays (at least in that font).  ASCII 34 (0x22) is ", and ASCII 51 (0x33) is the number 3.

  • PS opens vector smart object all pixilated

    I have this problem when using graphics from Illustrator as vector smart objects in Photoshop. I have followed tones of heated discussions on this but I haven't got any further. So here is what I do following the steps on the PS help: I copy graphics in AI and paste them in PS as smart object. A layer will be added that even has the name vector smart object but the graphic itself is all pixilated. Now the size of my PS-file is 150X150 Pixels with a resolution of 300. I need this size because I want to implement the file into my website and the layout requires this size for all my graphics. I would say it doesn't matter much what size the file is anyway since according to the PS help whatever vector smart object I place in Photoshop it won't change image quality when transformed. Therefor I'd say that not even the small file should be a problem here. But obviously there is something not working... because even when, to compare, I paste the graphic as pixel it shows the same result. Strange enough that I have used this vector smart objects before and it worked just fine... So I tried to paste the graphic in different ways, saving it as pdf in AI and then placing it in PS, insert it directly as smart object, making sure the file handling and clipboard references are adjusted, and finally after no success trashing the preferences in both applications. Still not closer to a satisfying result. I attach the graphics (first the AI graphic, then the vector smart object from PS) to show the difference and maybe there is someone out there that can tell what I am doing wrong. By the way I just converted the files to jpegs to post them here so the sizes might not match on the screen...

    One other thing to check...
    Are you viewing the display at 100%?
    Photoshop's OpenGL-based image resizing algorithms are smoother and fuzzier than they used to be (or than they are with OpenGL disabled).  What I'm getting at is that you may be perceiving fuzziness in the display that's not really there in the image.
    How does the fuzziness look if you zoom in a lot?
    -Noel

Maybe you are looking for

  • Safari is slooowwww after HD upgrade

    I just upgraded my 400mHz Pismo to a 100 Gb Hard drive with a 16 MB cache. It spent a few weeks in an external Firewire enclosure - being partitioned, having Tiger installed and transferring settings, folders, files, etc. I was able to boot from it,

  • Error Message when I try to update my iPod and Nano

    HELP! I am suddenly getting an error message when I try to update both my iPod and Nano that states "...certain songs could not be added because I am not authorized to play them on this computer..." Any thoughts???

  • Latest releng ISO's

    Ok i really didn't know where or even if i should post this but i just wanted to thanks the releng devs for their work. I had some problems in the past but the latest releases really seem to shape up nicely. The latest 2011.05.12 ISO especially  (fou

  • I accidentally deleted my Creative Suite 5.1  application

    I accidentally deleted my Creative Suite 5.1  Which download do I use that matches my license

  • Password manager apps?

    I hope it's okay to ask this here. If not, I apologize. I'm looking for a password manager app and am finding so many I can't dig my way through them. I'm hoping someone might have a recommendation. In addition to the usual account name, username and