Casting Arrays

Is there anything particularly bad with casting Arrays? For convenience, I store some instances of a class in a LinkedList. Now, when I want to get them in a nice Array, I tried this:
("Creature" being a class of mine)
Creature[] creatureArray = (Creature[]) CreatureList.toArray();That resulted in a splendid ClassCastException.
However, this works:
Object[] creatureArray = CreatureList.toArray();
for (int i = 0; i < creatureArray.length; i++)
    Creature name = (Creature) creatureArray;
So, is there generally a problem with casting Arrays or is there something else that might be the problem?
Thank you for any suggestions!

This may be more be more efficient:
Creature [] array = (Creature[]) creatureList.toArray( new Creature[creatureList.size()] );

Similar Messages

  • Consume web service I get an unable to cast array error?????

    Hi All,
    I do not know what I have done but I am getting the following error?
    Error(24,30): cannot cast array webserviceproj2.proxy.Employee[] to interface java.util.List&lt;webserviceproj2.proxy.Employee&gt;
    Here is my Scenario
    Project 1
    I have a Project which contains One class that was generated by Toplink "Employees" I have a Map with a few queries
    I Create a Java Service Facade to test and everything works fine...
    I create a session bean with a Remote, Local and Web service endpoint which generates the deploy file for me.
    I Deploy to Oracle AS 10.1.3 and test the web service. Again all is working so far.
    Project 2
    I Create an empty project and add a web service proxy, I use the WSDL from the deployed Session Bean to generate all the files. So far I have added no code.
    I create a test class. One of the methods should get a list of Employees from the web service so I can loop through the list to prove it's working, this is where it fails. For some reason findEmployees is returning a type of Employee[] rather than a List&lt;Employee&gt; which is what should be returned?
    Can anyone please help????
    List&lt;Employee&gt; emps = (List&lt;Employee&gt;)port.findEmployeesByName("Jeremy","");
    for(Iterator i = emps.iterator(); i.hasNext();)
    Employee emp = (Employee)i.next();
    System.out.println(emp.getFirstName());

    JungleTaxi Cabbie wrote:
    Csound1: iCloud: Configuring Mail with Mac OS X v10.6 or iOS 4
    Enter your Incoming Mail Server, User Name, and Password using the following settings:
    Incoming Mail Server: mail.me.com
    User Name: Your iCloud email address (excluding @me.com)
    Password: Your password
    Last Modified: Jun 27, 2013
    Maybe you should test these things before calling people out, because these settings do function perfectly well.
    iCloud is not supported on Snow Leopard or lower, why bother to mention it?
    The OP has an iCloud account, and that can not be opened without Lion or Mountain Lion (on a Mac), IOS5 or 6 (on an iPhone/iPad)
    The document I linked to is Apples documentation for iCloud on current devices,I don't care whether you believe that you know better than they do, but it will affect the people who follow your advice as it won't work
    JungleTaxi Cabbie wrote:
    Also, if you're not running Lion or Mountain Lion, there is no "Mail, Contacts & Calendars" prefpane.
    I never said that there was, perhaps you imagined it.

  • Casting arrays from double to float

    Hi, wonder if anyone can help.
    I have a method of a class that creates two double arrays (the value pointed to is a double type)
    x[][]
    y[][]
    they are essentially co-ordinates. The first dimension of the array holds the polygon number, the second the point on that polygon for the x and y respectivly.
    This method is called from (and therefore the arrays returned to) a class in an applet i am designing.
    I now have to get these co-ords into a general path for display. A general path only takes float values. I have tried all the normal casting tricks to try to convert these doubles into floats and nothing is working. Do you have to do anything special because they are in arrays.
    Any help would be appriciated.

    There is nothing special about array except that you cannot cast them.
    Instead you need to create a new set of arrays and copy/cast each value individually.

  • Cast array issue?

    Can Java Array Object be cast to another type? For example:
    Vector<MyClass> vector = new Vector<MyClass>();
    MyClass []mc = (MyClass[])vector.toArray();The last line can't worked.

    SteveLam wrote:
    MyClass[] mc = new MyClass[vector.size()];
    vector.toArray(mc);and it can pass.Strictly speaking your last line should be this:
    mc = vector.toArray(mc);While all the implementations I've seen use the array, if its of the correct size, the specification does not require that. A call toArray() can return a new array, as long as it's of the same type as the parameter.

  • Type casting arrays

    i m reading an array of int from ObjectOutPutStream. can any body tell how do we type cast an object to array ??

    karansha:
    I'm sure you mean you're trying to read in an int[] from an ObjectInputStream that was written to an ObjectOutputStream since you can't read from an OutputStream. Use something like this:
    ObjectInputStream in = <whatever>;
    int[] intArray = (int[])in.readObject();adramolek:
    Why should you use an Integer[] instead of an int[] for serialization? All arrays of primitives -- boolean[], byte[], double[], float[], int[], long[], short[] -- are serializable as is; there is no need to convert them to arrays of their wrapper types simply to serialize them.
    In fact, the output from the following piece of code shows exactly which interfaces are implements by an int[]:
    Class cls = int[].class;
    Class[] interfaces = cls.getInterfaces();
    for (int i = 0; i < interfaces.length; i++) {
        System.out.println(interfaces.getName());
    The output is:
    java.lang.Cloneable
    java.io.SerializableThe output is identical for each of boolean[], byte[], double[], float[], int[], long[], and short[], showing that each type is both serializable [i]and cloneable.
    Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I want to cast Array to double[]

    I make an windowsForm class for draw graph.
    It has an input param
    public FormGraph(string title, string name1, Array data1)
    I need data of double[] type for draw graph. But I think users are want to input double[] or int[] ect...
    So I try to get data as Array type and cast it to double[].
    double[] series1 = (double[])data1;
    But it throw exception about fail to cast.
    How can I cast variable type of array to double[]?

    Another option is to combine Generics with this.
    You can use generics to allow the users to pass different types of data to a method, but type specific in a different way.
    public FormGraph<T>(string title, string name1, IEnumerable<T> data1)
    var series1 = data1.Select(x => Convert.ToDouble(x)).ToArray();
    Muthukrishnan Ramasamy
    net4.rmkrishnan.net
    Use only what you need, Reduce global warming

  • How can i cast array of string to int ?

                       while(st.hasMoreTokens()){
                                  test[count] = st.nextToken();
                                  count++;
                          }Since token deal with string, i have to pass them into String of array, but how can i convert all of them to int to perform arithmetic operation?

         public static void main (String[] args) throws IOException{
               DataInputStream dis = null;
                 String dbRecord = null;
                 int tokenCount = 0;
                 int numOfQuestion = 0;
                 int questionnAireNum = 0;
                 int postCode = 0;
                 int age = 0;
                 int gender = 0;
                 String [] response = new String[10];
                    File f = new File("polldata.txt");
                    FileInputStream fis = new FileInputStream(f); 
                    BufferedInputStream bis = new BufferedInputStream(fis); 
                    dis = new DataInputStream(bis);
                    // read the first record of the database
                    while ( (dbRecord = dis.readLine()) != null) {
                       StringTokenizer st = new StringTokenizer(dbRecord, ",");
                       tokenCount = st.countTokens();
                       numOfQuestion = tokenCount-4;
                       String rquestionNum = st.nextToken();
                       questionnAireNum = Integer.parseInt(rquestionNum);
                       String rpostCode = st.nextToken();
                       postCode = Integer.parseInt(rpostCode);
                       String rAge  = st.nextToken();
                       age = Integer.parseInt(rAge);
                       String rGender = st.nextToken();
                       gender = Integer.parseInt(rGender);
                       for(int i=0; i<numOfQuestion;i++){
                            response[i] = st.nextToken();
                       }hi how come when i cast the string as int it prompt me error as shown below ? I wonder what causes this because this is normally how i cast string to int, somehow it won work this way with token.
    Exception in thread "main" java.lang.NumberFormatException: For input string: " 3"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
         at java.lang.Integer.parseInt(Integer.java:447)
         at java.lang.Integer.valueOf(Integer.java:553)
         at test.main(test.java:43)

  • Type cast array to cluster

    Is there any real difference between the 'array to cluster' function and simply type casting to a cluster?  The image below shows a simple example.  Aside from providing the names of each cluster element, the type cast function automatically sets the cluster size, which is a nice feature when working with a typedef.  I am really wondering whether there is any downside to type casting when the array and cluster elements are the same data type.
    Thanks in advance.
    Solved!
    Go to Solution.

    Type Cast man knows where I live, so my opinion is biased.  When I have to make such a conversion, which is practically never, but not equal to never, then I go with the Type Cast.  You hit the biggest points, meaningful labels and the ease of going from six to seven to eleven elements with the Type Def.  When I do this conversion it is typically because I need to do some property magic which arrays do not allow (all elements must share properties except value).  Creating a control from the Array to Cluster function is let's say a Clusterflop, from the Type Cast, exactly what I am looking for.  Besides, that Array to Cluster function obfuscates code, is always left at 9 elements, and otherwise needs to go away, or at least do this:
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Remove-Default-Behavior-from-Array-To-Cluster/idi-p/17...
    First of all, ask yourself if you really should be doing this, if the answer is yes then I say Type Cast.

  • What this problem? table(cast(array))

    exits in databse one type
    " type InNumberTab is table of number;"
    declare
    v_tbseq_trans:= InNumberTab(null);
    select count(*) into v_cont
    from dados_propriedade dp
    where dp.num_pessoa=p_num_pessoa
    group by num_nirf;
    v_tbseq_trans.EXTEND(SQL%ROWCOUNT);
    v_cont:=0;
    for v_cs in
    (select to_number(replace(dp.num_nirf,'-','')) nirf, max(dp.seq_transacao) seq_transacao
    from dados_propriedade dp
    where dp.num_pessoa=p_num_pessoa
    group by dp.num_nirf) loop
    v_tbseq_trans(v_cont):=v_cs.seq_transacao;
    v_cont:=v_cont+1;
    END LOOP;
    open p_cursor_prop for
    select
    from dados_propriedade dp
    where dp.seq_transacao in (SELECT column_value FROM TABLE(CAST(v_tbseq_trans as InNumberTab)));

    I'll try to guess what you mean.
    If you need to use object or collection type in SQL query you should declare in in SQL server not in PL/SQL code:
    SQL> declare
      2   type na is table of number;
      3   nat na := na(1,2,3);
      4  begin
      5   for x in (select column_value y from table(cast(nat as na))) loop
      6     dbms_output.put_line(x.y);
      7   end loop;
      8  end;
      9  /
    for x in (select column_value y from table(cast(nat as na))) loop
    ERROR at line 5:
    ORA-06550: line 5, column 56:
    PL/SQL: ORA-00902: invalid datatype
    ORA-06550: line 5, column 11:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 6, column 25:
    PLS-00364: loop index variable 'X' use is invalid
    ORA-06550: line 6, column 4:
    PL/SQL: Statement ignored
    SQL> set serveroutput on
    SQL> create type na is table of number;
      2  /
    Type created.
    SQL> declare
      2   nat na := na(1,2,3);
      3  begin
      4   for x in (select column_value y from table(cast(nat as na))) loop
      5     dbms_output.put_line(x.y);
      6   end loop;
      7  end;
      8  /
    1
    2
    3
    PL/SQL procedure successfully completed.Is it your problem ?
    Rgds.

  • Array Casting in java

    Hi,
    I am new to java.Last day Can I cast an arrays in java?For example casting an Object array to a String array or an integer array to a long one.If yes, then what are the rules and restrictions for casting arrays.I tried to google it, but I could not find any useful material.Could any one give me some links where I can get some useful material,books,mock tests etc. regarding preparation for SCJP 1.6?.Please help.
    Thanks in advance

    This is the Berkeley DB, Java Edition forum, and you should post only post questions about that product here. I think you may be looking for basic Java language information, and there are many other websites that can give you that information.

  • How to cast an array object to array of string

    * Can someone please tell me why SECTION 3 causes a cast
    * exception?
    * What I am really trying to do is put Strings into a vector and
    * return them as an array of String with a line like:
    *     return (String[])myVector.toArray();
    * How to do this?
    * Thank You!
    public class CastArrayTest
         public static void main(String args[]){
              //SECTION 1: This works
              String[] fruits = {"apple", "banana"};
              Object[] objs = (Object[])fruits;
              String[] foods = (String[])objs;
              for (int i = 0 ; i < foods.length ; i++){
                   System.out.println(foods);
              //SECTION 2: this works too
              Object anObj = new Object();
              String aString = "ok";
              anObj = aString;
              String anotherString = (String)anObj;
              System.out.println("word for single obj is " + anotherString);
              //SECTION 3: this causes cast exception at line
              // String[] strings = (String[])stuff
              Object[] stuff = new Object[2];
              String a = "try";
              String b = "this";
              stuff[0] = a;
              stuff[1] = b;
              String[] strings = (String[])stuff;
              for (int x = 0 ; x < strings.length ; x++){
                   String s = strings[x];
                   System.out.println("the string is " + strings[x]);

    I understand all replies so far, but from my
    understanding, objects are passed by reference No, they're not. Rather, object references are passed by value.
    Object obj = new Object();
    String a = "pass me by reference";
    Object anotherObj = (Object)a; // this explicit cast is not necessary
    String anotherString = (String)anotherObj; // this cast works because the object in question is a String
    There's no passing in that code, so I'm not sure where that even came from. However, that works because it's all legal casting.
    works as I think it should, and does, and futhermore
    String[] cast to Obj[] cast to String[] works also...Because the object you're casting actually is a String[].
    so why not if Obj[] to String[] Because String[] is not a subclass of Object[]. That's just how the language is specified.
    futhermore if they are
    all string...Again, this has no bearing on the type of the array object.
    I saw hot to cast array to String[] and wondered if
    this is real cast or calls the toString method...It's a real cast.
    but most importantly, does this mean if I have a
    vector of Strings and want to get them as an array of
    strings, I have to loop through the Obj[] (or vector)
    and cast each to (String)...just to get them as an
    array of String[]....No, zparticle's code can do that.

  • How to cast object type to integer type?

    Hi,
    Object [] temp;
    Int [] value;
    How can I assign temp to value? (value = temp?)
    In other words how to cast array of type object to array of type integer?
    Thanks a lot.

    Hi,
    Object [] temp;
    Int [] value;
    How can I assign temp to value? (value = temp?)
    In other words how to cast array of type object to
    array of type integer?
    Thanks a lot.That my friend, is (sometimes) illegal. other times use
    value = (Integer[]) temp;
    Pray that temp is holding an Integer array so that you dont throw a runtime exception.
    I am assuming you know the diff between "int" and "Integer".

  • Sql query to list 1..25 numbers.

    Hi all,
    How could I write a query (not pl/sql) to generate a series fo numbers.
    Don't take any dependent tables, meant if i have a table with more than 100 rows then by writing "select rownum from mytable where rownum<101; will gives the results what i required.
    But I am looking for a query which is indipendet of other tables , ofcourse you can use DUAL or any standard functions.
    Thanks in advance,
    Khaleel.

    Ultimately, queries can only be run against tables. Of course, Oracle has developed somewhat, and those "tables" can now be CAST arrays or in-line SELECT statements as well as views, but there has to be something in the FROM clause that is either a table or somehow maps to a table.
    Your best bet for a schema independent solution is to use ALL_OBJECTS, as even in the meanest system that should offer every user a few thousand rows.
    SELECT rownum my_number FROM all_objects WHERE rownum < 26;You can't do it a simple PL/SQL function, because the function gets called for each row.
    SQL> create or replace function my_num return number is
      2  i number := 0;
      3  begin
      4  i := i+1;
      5  return i;
      6  end;
      7  /
    Function created.
    SQL> select my_num from  all_objects where rownum < 5
      2  /
        MY_NUM
             1
             1
             1
             1
    SQL>
    [/code]
    However, packages don't re-initialise variables with each call, sp you could do this:
    [code]
    SQL> CREATE OR REPLACE PACKAGE num_test AS
      2    FUNCTION my_num return NUMBER;
      3  END;
      4  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY num_test AS
      2   i NUMBER;
      3   FUNCTION my_num return NUMBER IS
      4   BEGIN
      5      i:=i+1;
      6      RETURN i;
      7      END;
      8  BEGIN
      9   i:=0;
    10  END;
    11  /
    Package body created.
    SQL> select num_test.my_num from  all_objects where rownum < 5
      2  /
        MY_NUM
             1
             2
             3
             4
    SQL>
    [/code]
    Bear in mind that if you go down this route you will need to add a method to re-initialise the count, because the variables retain their value within the session:
    [code]
    SQL> select num_test.my_num from  all_source where rownum < 5
      2  /
        MY_NUM
             5
             6
             7
             8
    SQL>
    [/code]
    Rgds, APC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • C++ stack overflow on desctruction of Set::View

    Hi,
    I've encountered a problem when querying large sets of data from coherence.
    Gven the following code;
              // load cache with a large data set
              char buff[128] = {0};
              for( int i = 0; i < 100000; ++i )
                   sprintf_s(buff,128,"key%05d",i);
                   // random binary data
                   int len = 128 + rand() % 512;
                   Array<octet_t>::Handle hab = Array<octet_t>::create(len);
                   hCache->put(String::create(buff),hab);
            // query the cache, and print the results
              struct tmpIt
                   Filter::View          vAll;
                   Set::View               vSetResult;
              tmpIt *t = new tmpIt;
              t->vAll = AlwaysFilter::create();
                    t->vSetResult = hCache->entrySet(t->vAll);
              // iterate over the results
              int ncount = 0;
            for (Iterator::Handle hIter = t->vSetResult->iterator(); hIter->hasNext(); )
                Map::Entry::View vEntry = cast<Map::Entry::View>(hIter->next());
                   String::View     vKey   = cast<String::View>(vEntry->getKey());
                Object::View     vValue = vEntry->getValue();
                   Array<octet_t>::Handle dt = cast<Array<octet_t>::Handle>(vEntry->getValue());
                   ncount++;
                   if( (ncount % 2000) == 0 )
                        std::cout << ncount << std::endl;
              // delete the struct, thus forcing the destruction of vSetResult
              delete t;On deleting the struct 't' causes a stack overflow deep within coherence. I'm guessing there's some kind of recursive delete that works on smaller data sets.
    Can you please advise me on what to do in this situation, as this has put a halt to my coherence integrartion :)
    Cheers
    Rich
    Edited by: user9929344 on 22-Oct-2008 01:57

    Hi Rich,
    I've tried your test out in a few environments using both debug and release builds and have not been able to reproduce the issue. My guess is that it may have something to do with your build settings. Can you try building it using the build.cmd script which we ship with the product. This can be done by creating a new subdirectory under examples for your test, for instance "overflow", place you source code in that directory and then from the examples directory run "build overflow". You can then run the test by executing "run overflow". This is how I've tested an all seems to be ok. Assuming this resolves the issues on your side, you can have a look at the compiler/linker settings used in the build.cmd script and try applying them to your build process. If this does not resolve the issue, it would be useful if you could send us a fully buildable example (and build script) which reproduces it. Also if you could include the OS and compiler versions that would help.
    In testing your source code I ran into a few small things I thought I should point out to you.
    - while loading if you batch your puts into a local HashMap and then do periodic hCache->putAll() operations loading will be faster:
         // load cache with a large data set
            char buff[128] = {0}; 
            Map::Handle hMapBatch = HashMap::create();
              for( int i = 0, c = atoi(argv[2]); i < c; ++i )
                   sprintf(buff,"key%05d",i);
                   // random binary data
                   int len = 128 + rand() % 512;
                   Array<octet_t>::Handle hab = Array<octet_t>::create(len);
                   hMapBatch->put(String::create(buff),hab);
                   if ((i % 2000) == 0)
                        hCache->putAll(hMapBatch);
                        hMapBatch->clear();
                        std::cout << "loaded " << i << std::endl;
            hCache->putAll(hMapBatch);
            hMapBatch->clear(); - During iteration you should not cast the values back to Handles, but rather only to Views. It is not guaranteed that the cache will return non-const references to the data.
    I did validate that the test did not fail prior to making the above modifications.
    thanks,
    mark

  • How to retrieve parameters from API

    Hi Gurus,
    I have to call an API in the loop as i need to pass more then one values of Route ID. How to do that thing in loop??
    And that API will return me values of operation IDs which i need to display on other page... Can u please help me with that.
    I am using this below mentioned code,,but it is giving me some errors.
    Method in AMImpl
    public Serializable[] Merge()
    OAViewObject vo =(OAViewObject)getRoutesTabVO1();
    if (vo!= null)
    Row[] arow = vo.getFilteredRows("Select","Y");
    int len = arow.length;
    System.out.print("Length is "+len);
    HashMap querySql = new HashMap(1);
    //String[] querySql = new String[];
    if(arow!= null && arow.length>0)
    for(int i=0;i<arow.length;i++)
    System.out.println("Value of i is"+i);
    String RouteId = (String)arow.getAttribute("RouteId");
    OADBTransaction txn =(OADBTransaction)getDBTransaction();
    OracleCallableStatement cs = (OracleCallableStatement)txn.createCallableStatement("begin apps.apps.xxgahl_get_unq_opr_id(:1, :2); end;",1);
    try
    cs.setString(1, RouteId);
    cs.registerOutParameter(2, Types.VARCHAR, 0, 2000);
    cs.execute();
    querySql[i] = cs.getString(2);
    cs.close();
    catch (SQLException sqle)
    try
    cs.close();
    catch(Exception e)
    return querySql;
    In Controller PFR
    if (pageContext.getParameter("Merge")!=null)
    Serializable[] parms = (Serializable[])am.invokeMethod("Merge");
    String[] temp = (String[])parms[1];
    pageContext.putSessionValue("NRParams", (String)temp);
    pageContext.setForwardURL("OA.jsp?page=kal/oracle/apps/xxgahl/ump/webui/OPERATIONS_ROUTES_PG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    false, // Retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_YES, // Show breadcrumbs
    OAWebBeanConstants.IGNORE_MESSAGES);
    But when i m compiling it is giving me 4 errors
    Error(47,27): method does not return a value
    Error(70,19): array type required but class com.sun.java.util.collections.HashMap found
    Error(84,25): incompatible types; found: class com.sun.java.util.collections.HashMap, required: array java.io.Serializable[]
    Error(68,59): cannot cast array java.lang.String[] to class java.lang.String
    Please help me with that as it is very urgent...

    Thank you very much. it is true that basic are vey
    important but as i can say books like all this are
    very limited resources. It would be better if i can
    learn how to implement the method in there. Haha.
    Please don't feel offended if i am say something
    wrong.You don't need to implement the methods listed in the API. They already are implemented. It tells you how to use them.

Maybe you are looking for

  • Cannot open transferred .doc files on my BB Curve 8520

    I am a new user and have just bought a BB Curve 8520. Carrier is Virgin Media; OS is V4.6.1.314 (platform 4.2.0.135); Desktop Manager Version is 5.0.1.2.8 I have transferred photos, music and some documents from my PC successfully to my BB using Desk

  • Acrobat Pro upgrade path 9.0.0 to 9.4.6 on MacOS

    I've already googled adobe cumulative update, etc, but all I can find are the incremental updates. I work in a small company and have been tasked with updating all our Acrobat Pro 9.0.0 users to 9.4.6. So far the only way I've found to do this is to

  • Setting up an EOIO interface

    Hello, I am currently transferring one of our interfaces from EO to EOIO (exactly once in order) queue processing. The sender and the receiver systems are both R/3 systems. The aim is to ensure that the messages are arriving in the receiving system i

  • MG5220

    I have a Canon PIXMA MG5220 printer, and it will not print correctly after installing ALL new cartridges.  I have tried cleaning the printheads, regular cleaning and deep cleaning them, and it still wont print correctly.  Thanks, Sarah

  • How to add attributed string to JTextPane

    Hi all, Could you tell me how to add an attributed string into a Textpane. Textpane only takes a styledDocument. Is there any way to convert attributed string into a styled document. Are there any components , which we can include attributed string ,