Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to add multiple jTables (components) to jTextPane or JEditorPane

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to add multiple jTables (components) to jTextPane or JEditorPane

    JTable jj=new JTable(); //1
    tabobj2=datadisplay.table; //2
    ImageIcon icon = new ImageIcon("C:\\Users\\Public\\Pictures\\Sample Pictures\\hello.jpg"); //3
    jEditorPane1.setText("Name:Sandeep Singh\n Id:A2345\n Locationelhi\n Designation: Manager\n"); //4
    jEditorPane1.insertComponent(tabobj2); //5
    int h=jTextPane1.getText().length(); //6
    jTextPane1.setCaretPosition(h); //7
    insertComponent(datadisplay.table); //8
    int h=jTextPane1.getText().length(); //9
    jTextPane1.setCaretPosition(h); //10
    jTextPane1.insertComponent(datadisplay.table); //11
    int n=jEditorPane1.getLocation().x; //12
    jTextPane1.setLocation(n, n); //13
    jTextPane1.insertcomponent(tabobj2); //14
    jTextPane1.add(tabobj2,-1); //15
    This is the code: I am nog able to shift caret to some other position 'h' so that i can add another component at end of file, or suggest me some solution to add multiple jTables to jTextPane and some string above and below the tables.
    Looking forward to here solution from you.
    Thanks in Advance


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: How to add multiple jTables (components) to jTextPane or JEditorPane

    When posting code, please post it in the form of an SSCCE with the highlight tags.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Displaying Multiple jTables in JTestArea
    By anchal87mca@gmail.com in forum AWT / Java Swing
    Replies: 1
    Last Post: August 23rd, 2013, 01:58 AM
  2. make object and add components
    By viper_pranish in forum AWT / Java Swing
    Replies: 3
    Last Post: July 23rd, 2013, 09:17 AM
  3. Sync changing column widths across multiple JTables
    By eewill in forum AWT / Java Swing
    Replies: 1
    Last Post: January 17th, 2012, 10:42 AM
  4. Components I add to JApplet won't appear!
    By austin.rose94 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 6th, 2012, 11:47 AM
  5. Need help with setting multiple font styles in jTextPane
    By jch02140 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 23rd, 2010, 06:16 AM