Styled text+Image in JTable

Hi all java guru...
I have a JTable and i would like to add dynamically in any cell styledText (e.g. bold,underline,italics,etc) and image with the features to align styledText on left/right of the image.
I think that i must use CustomTableModel to maintain styledText information and some CustomTableCellRenderer clas that handles my cells. Is this correct? If somebody have already had this problem please can help me? Or drive me in some example that can help me.
Can i realize it using DefaultTableModel only ??
Thanks in advance.
Cheers.

import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class Test extends JFrame {
  public Test() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = getContentPane();
    String[] head = {"One","Two","Three"};
    Font font1 = new Font("TimesRoman", Font.BOLD, 14);
    Font font2 = new Font("SansSerif", Font.ITALIC, 12);
    Font font3 = new Font("Tehoma", Font.PLAIN, 16);
    MyObject[][] data = {{new MyObject("Hello", font1),
        new MyObject("There", font2),new MyObject("anti-shock", font3)}};
    JTable jt = new JTable(data,head);
    jt.setDefaultRenderer(Object.class, new MyRenderer());
    content.add(new JScrollPane(jt), BorderLayout.CENTER);
    setSize(300, 300);
    setVisible(true);
  public static void main(String[] args) { new Test(); }
class MyObject {
  String str;  Font font;
  public MyObject (String s, Font f) { str=s; font=f; }
  public String toString() { return str; }
  public Font getFont() { return font; }
class MyRenderer extends DefaultTableCellRenderer {
  Font defaultFont = new Font( "Dialog" , Font.PLAIN, 12);
  public Component getTableCellRendererComponent(JTable table, Object value,
                                                 boolean isSelected,
                                                 boolean hasFocus,
                                                 int row, int column) {
    Component c = super.getTableCellRendererComponent(table,value,
        isSelected,hasFocus,row,column);
    if (value instanceof MyObject) c.setFont(((MyObject)value).getFont());
    else c.setFont(defaultFont);
    return c;
}

Similar Messages

  • AWT only canvas - styled text, images, word wrap and url posting.. how???

    Wassup people!
    Ive created a java chat client which uses the JTextPane to post messeges, emoticons and styled text. But the main problem here is that the majority of web browsers only support awt. Telling the users to download the latest jre with swing is long and most would rather go to another site, so i have reprogrammed the whole client in awt apart from the textpane. I now face the problem of creating a canvas that supports styled text, images, word wrap and url posting.
    I am only a beginner in java and the initial client was quite easy to do using swing, but to program an efficient canvas that supports this has proved to be quite challenging. would anyone beable to show me the best way of doing this? or refer me onto a library that already supports this? or is there even an awt version of the JTextPane somewhere which would save alot of time? any help would be most appreciated.
    Thanks

    I've seen a few APIs that are 100% pure java in 1.1 that implement a styled text area. They aren't free though and I'm pretty sure someone made some money off of the fact that java 1.1 didn't implement a styled text area.
    I understand the problem you are having. Before the days of swing styled text was something you wished you had. Just so you know, there is no easy way of doing this. You could always paint it yourself with a canvas in a scroll pane but then you get to the point where, unless you did some serious mouse handling, highlighting text becomes very difficult.

  • Please Help.JTable insert styled text

    Hi all java guru,
    on post http://forum.java.sun.com/thread.jsp?forum=57&thread=485469 i've depicted my scenario in which i have a JTable where i want to add styled text.
    i've implemented a CustomTableModel that maintains information about text style, in such way that when renderer cell, i can rebuild exact text with its style....same method is adopted for CellEditor.
    It is possible to have more than one JTable in my application....then to correctly handle all JTables ' put them in a vector and during editing and rendering i find current focusable/selected JTable and edit/render it.
    Clearly i maintain information about style of text when i insert it, that is when i insert text, i update my CustomTableModel...same thing must be done when i delete text from JTable...that is, i must update CustomTableModel too in this case.
    Because my CellEditor is a JEditorPane component (extend it) i've registered document associated to it to a DocumentListener that notify every time that a remove operation is happens.
    What is the problem now???problem is that when i finish to edit a cell and click on another cell i've got a removeUpdate(DocumenEvent e) event, and i can't distinguish it.....it seems a real remove event....
    In this case(when i change cell) the code that is executes returns wrong result and invalidate all the rest.
    I think error is where i register celleditor , now i do it in CustomCellRenderer class that extend JEditorPane and implements TableCellRenderer.
    Please help me...this is a great trouble that invalidate all my work :(
    Any new idea is welcome.
    regards,
    anti-shock

    Hi stanislav, of course i can...you're a myth :)
    public class CustomCellEditor extends AbstractCellEditor implements TableCellEditor {
           CellEditor cellArea;
         JTable table;
         public CustomCellEditor(JTable ta) {
              super();
              table = ta;
              // this component relies on having this renderer for the String class
              MultiLineCellRenderer renderer = new MultiLineCellRenderer();
              table.setDefaultRenderer(String.class,renderer);
         public Object getCellEditorValue() {
              return cellArea.getText();
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,     int row, int column) {
              int start = 0;
              int end = 0;
                                               // Get current selected table
              TableEditor tb = (TableEditor) TableEditor.getSelectedTable();
              TableModel model = (TableModel) tb.getModel();
              Vector fontInfo = model.getFontFor(row,column);
              CellEditor cellArea = (CellEditor) ((CustomCellEditor)tb.getCellEditor (row,column)).getCellEditor();
              Document doc = cellArea.getDocument();
              String content = tb.getValueAt(row,column).toString();     
              if (doc!=null && fontInfo.size()>0 && !content.equals("")) {
                                                     // This method reads from model and get right style info
                                                     // for current text, and restore them
                                                     restoreFontWithAttributes(doc,fontInfo,content);
              else
                   cellArea.setText(tb.getValueAt(row,column).toString());
              cellArea.rowEditing = row;
              cellArea.columnEditing = column;
              cellArea.lastPreferredHeight = cellArea.getPreferredSize().height;
              return cellArea;
          * @return
         public CellEditor getCellEditor() {
              return cellArea;
         public class CellEditor extends JEditorPane {
              private CellStyledEditorKit k;
              public CellEditor() {
                    super("text/plain","");
                    k = new CellStyledEditorKit();
                    setEditorKit(k);
                    // I tried to add document here, but i have had wrong behavior
                   doc = new DocumentListener() {
                   public void removeUpdate(DocumentEvent e) {
                      // Get current selected table
                      TableEditor tb = (TableEditor) TableEditor.getSelectedTable();
                      TableModel model = (TableModel) tb.getModel();
                      model.updateFontInfo();
                   getDocument().addDocumentListener(doc);
    }Ok, stan...this is my CustomCellRenderer class....as i have already said, i have some style text info mainteined by CustomTableModel associated with JTable.
    I update CustomTableModel every time that an insert and remove operation happens.
    If i add a DocumentListener to CellEditor (that rapresents editor cell of my table) happens that, if i remove some character from an editing cell, i got a removeUpdate event.....and this is right!!! But if i change cell (e.g. supposing editing cell(1,1), click on cell(2,1) then stop edit cell(1,1) and start edit cell(2,1)) i got a removeUpdate event, that I don't wait for to me..
    Look at this:
    empty cell | some text
    cell 0 ------- cell1
    supposing you're in cell1 and you have finished to insert "some text".Then click on cell0, that is empty....then document associated with CellArea(extend JEditorPane) before of the click on cell0 had some text, but after click have no text, then for it a removeUpdate is happens.....and is that one i got..
    it's as if an unique document is associated to all cells, while should be one document for each cell (i hope this is right).
    Clearly, i've same code for renderer, in such way that i can restore style of text on rendering.
    Hope is clear....if U have any idea or suggestion please give to me.
    Tnx a lot Stanislav..
    regards,
    anti-shock

  • Perform Save for Styled Text and images

    I have build a text editor
    I am using a JTextPane
    but facing a problem with saving and opening the files with Styled text and images.
    Can any body help me out with a sample code
    Thank you

    Hi,
    If you want to save the file so that only your application can read the contents back, then you can serialize the Document of the JTextPane to the file and then read it back. This is the simplest approach.
    Serialize myTextPane.getDocument(); and while opening do
    Deserialize Document
    StyledDocument myDocument = stream.readObject();
    myTextPane.setDocument(myDocument);
    and you are done, irrespective of whether text pane contains only text or images or any other combination.
    Regards,
    [email protected]

  • Styled Text in Table Cell

    Hi,
    I've got this problem: I'd like to insert a styled text in some cells of a JTable.
    The text should be composed of two kinds of Font, to emphasize some characters in it.
    Suppose I've done a class Test, that extends JPanel. In this class I've done a method appendChar(String c, boolean bol). With this method I can add a JLabel with only a single char (String of length 1) at a time. If bol is true, it emphasizes the char; if false, it uses the "default" font. For example:
    "this is an example"
    This class works fine, but I don't have any idea on how I could be able to insert a Test instance in a JTable cell.
    I think I should create a class that implements TableCellEditor, or extends DefaultCellEditor.. but I don't know how this should be done.
    If there is some other way to have some styled text in a table cell, tell me!

    Hi,
    AFAIK, the default renderer for a table cell is a JLabel in which you can display styled text using html. You would need to provide a custom editor only if the default textfield doesn't fulfil your needs. For rendering, you need to override the renderer.
    Cheers,
    vidyut

  • Images in JTable

    Hi,
    The Problem:
    Instead of the Image i see the image's filename.
    The Question:
    Which is the simplest way to display an Image in a JTable?

    Hi.. mathuoa
    You can set the row height as:
    table.setRowHeight(300);
    Here's the abstract table model implementaion e.g.
    * Implementation of abstract table model for displaying Image(s) in table
    * Cell grid.
    * @version 1.0 10 Sep 2002
    * @author Md. Ash-Shakur Rahaman (mailto: [email protected])
    class GridImageTableModel extends AbstractTableModel{
    /** Number of rows */
    static int rows;
    /** Number of columns*/
    static int cols;
    /** table data */
    public static Object[][] rowData;
    /**column names */
    String[] colNames;
    * Constructor
    * @param     rd     row data as 2D Object array
    * @param     cn     column names as 1D String array
    public GridImageTableModel(Object[][] rd, String[] cn){
    this.rowData = rd;
    this.colNames = cn;
    * gets the number of rows available of the table
    * @param     nothing no parameter is required
    * @return rows     returns the rows count as int
    public int getRowCount(){
    this.rows = rowData.length;
    return rows;
    * gets the number of columns available of the table
    * @param     nothing     no parameter is required
    * @return cols     returns the column count as int
    public int getColumnCount(){
    this.cols = colNames.length;
    return cols;
    * gets the data at particular row & column
    * @param     row     at which row
    * @param     col     at which column
    * @return rowData the data as 2D Object array
    public Object getValueAt(int row, int col){
    return rowData[row][col];
    * gets the class name of a particular column
    * @param     c     column number for which the class names is to be determined
    * @return     class     returns the class name of the column
    public Class getColumnClass(int c){
    return getValueAt(0,c).getClass();
    * gets the column cell editable or non editable
    * @param row     which row
    * @param col     which column
    * @return editable true if editable;
    * false otherwise     
    public boolean isCellEditable(int row, int col){
    return true;
    * sets the value at particular row-column
    * @param value     value to be inserted
    * @param row     at which row
    * @param col     at which column
    * @return nothing
    public void setValueAt(Object value, int row, int col){
    rowData[row][col] = value;
    fireTableCellUpdated(row,col);
    * Implementation of Default table column model for displaying Image(s) in table
    * Cell grid.
    * @version 1.0 10 Sep 2002
    * @author Md. Ash-Shakur Rahaman (mailto: [email protected])
    class GridImageTableColModel extends DefaultTableColumnModel{
    /**column names*/
    String [] colNames;
    /**column counter*/
    static int counter=0;
    * GridImageTableColModel constructor with column names
    * @param cn coumn names as 1D String array
    public GridImageTableColModel(String[] cn){
    this.colNames = cn;
    * adds column to the table
    * @param tc table column
    * @return nothing
    public void addColumn(TableColumn tc){
    // if counter is equal to the number of column then reset counter to zero
    if (counter == 1) counter=0;
    tc.setHeaderValue(DataStoreUnit.grdimgColumnNames[counter]);
    tc.setResizable(false);
    super.addColumn(tc);
    counter+=1;
    Use this as follwoung manner:
    //Grid Image Table Implementation
    final static String[] grdimgColumnNames = {"Image(s)"};
    // Initial data to be displayed in the table
    final Object[][] grdimgData = {{""}};
    //Grid Image Table Model: Table to display the data
    TableModel grdimgTableModel = new GridImageTableModel(grdimgData,grdimgColumnNames);
    //Grid text Table Header
    JTableHeader grdimgTableHeader = new JTableHeader();
    // Grid image Column Model
    TableColumnModel grdimgTableColumnModel = new GridImageTableColModel(grdimgColumnNames);
    // Grid Image Table
    JTable grdimgtable = new JTable(grdimgTableModel);
    JScrollPane jspGridImageTable = new JScrollPane();
    int tab = grdimgtable.AUTO_RESIZE_ALL_COLUMNS;
    grdimgTableHeader.setResizingAllowed(false);
    grdimgTableHeader.setBackground(new Color(0, 0, 239));
    grdimgTableHeader.setForeground(Color.white);
    grdimgTableHeader.setFont(font);
    grdimgTableHeader.setColumnModel(grdimgTableColumnModel);
    grdimgtable.setTableHeader(grdimgTableHeader);
    grdimgtable.createDefaultColumnsFromModel();
    grdimgtable.sizeColumnsToFit(tab);
    grdimgTableHeader.setReorderingAllowed(false);
    grdimgtable.setRowHeight(300);
    /**render the first cell in the table*/     
    grdimgTableCellRender(grdimgtable.getColumnModel().getColumn(0));
    grdimgtable.setPreferredSize(new Dimension(32767,32767));
    jspGridImageTable.getViewport().add(grdimgtable, null);
    grdimgtable.setBorder(new LineBorder(Color.blue));
    I think now you can work...Go ahead..
    Rana

  • Styled Text in JClient

    Hi
    My clients needed browse and edit styled text (or RTF) and store content in database.
    Site java.sun.com presents many primers text editors with RTF, HTML, styled content.
    But as save this into database?
    Default binding JTextPane to ClobDomain store only text, without styles, images and others elements of the styled text :-(
    Please help!

    Hi,
    AFAIK, the default renderer for a table cell is a JLabel in which you can display styled text using html. You would need to provide a custom editor only if the default textfield doesn't fulfil your needs. For rendering, you need to override the renderer.
    Cheers,
    vidyut

  • Strange behaviour when scaling GREP styled text.

    In the quest for the perfect scaling script I am running into another problem. I tried to scale my GREP styled text, and it came out like this:
    Notice the "$" and "cents" are too small - whereas it should look like this:
    Sorry I used a slightly larger image and different value, but I don't that is an issue with respect to this problem.
    So on the desktop, I decide to check preference>general tab> when scaling> "apply to content" was checked.
    I changed it to "adjust scaling percentage" and my $249.99 came out perfectly proportional to the original set text, (let pretend there is a 2 in front of the $49.99)
    So I upload the template to the server and proceed to scale it and I get this:
    In this example, the decimal has not scaled and thus allowing the "cents" to jam into the dolllar value. I am also unable to reproduce this error on the desktop.
    Can anyone explain what is happening or how to compensate for these errors? Thanks for your help! My script is below:
    function myTransform(myPage, myRectangle, myScaleMatrix)
         app.transformPreferences.whenScaling = WhenScalingOptions.APPLY_TO_CONTENT;
        var everything;
        var origin;
        if ( ssize > 1.0 )
           //origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
           origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES);
            myPage.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
            everything = myRectangle.everyItem();
            //origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
            everything.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
        else
            everything = myRectangle.everyItem();
            origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
            everything.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
            myPage.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);

    var myDocument = app.documents.item(0);
    var myPages = myDocument.pages;
    var myRectangle = myDocument.pages.item(0).pageItems;
    var ssize = 2;
    //Scale a page around its center point.
    var myScaleMatrix = app.transformationMatrices.add({horizontalScaleFactor:ssize,  verticalScaleFactor:ssize});
    var idx;
    for(idx = 0; idx < app.documents.item(0).pages.length; idx++)
        myTransform(myPages.item(idx), myDocument.pages.item(idx).pageItems, myScaleMatrix);
    // if you want to export a pdf, uncomment
    //myPDFExport ();
    function myTransform(myPage, myRectangle, myScaleMatrix)
         app.transformPreferences.whenScaling = WhenScalingOptions.APPLY_TO_CONTENT;
        var everything;
        var origin;
        if ( ssize > 1.0 )
           //origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
           origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES);
            myPage.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
            everything = myRectangle.everyItem();
            //origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
            everything.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
        else
            everything = myRectangle.everyItem();
            origin = myPage.resolve(AnchorPoint.CENTER_ANCHOR,CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
            everything.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
            myPage.transform(CoordinateSpaces.PASTEBOARD_COORDINATES,origin,myScaleMatrix);
    function myPDFExport()
            //Basic PDF output options.
            pageRange = PageRange.allPages;
            acrobatCompatibility = AcrobatCompatibility.acrobat8;
            exportGuidesAndGrids = false;
            exportLayers = false;
            exportNonPrintingObjects = false;
            exportReaderSpreads = false;
            generateThumbnails = false;
            try
                ignoreSpreadOverrides = false;
            catch(e) {}
            includeBookmarks = false;
            includeHyperlinks = false;
            includeICCProfiles = true;
            includeSlugWithPDF = true;
            includeStructure = false;
            interactiveElementsOption = InteractiveElementsOptions.doNotInclude;
            //Setting subsetFontsBelow to zero disallows font subsetting;
            //set subsetFontsBelow to some other value to use font subsetting.
            subsetFontsBelow = 0;
            //Bitmap compression/sampling/quality options.
            colorBitmapCompression = BitmapCompression.none;
            //colorBitmapQuality = CompressionQuality.eightBit;
            colorBitmapSampling = Sampling.none;
            //thresholdToCompressColor is not needed in this example.
            //colorBitmapSamplingDPI is not needed when colorBitmapSampling
            //is set to none.
            grayscaleBitmapCompression = BitmapCompression.none;
            //grayscaleBitmapQuality = CompressionQuality.eightBit;
            grayscaleBitmapSampling = Sampling.none;
            //thresholdToCompressGray is not needed in this example.
            //grayscaleBitmapSamplingDPI is not needed when grayscaleBitmapSampling
            //is set to none.
            monochromeBitmapCompression = BitmapCompression.none;
            monochromeBitmapSampling = Sampling.none;
            //thresholdToCompressMonochrome is not needed in this example.
            //monochromeBitmapSamplingDPI is not needed when
            //monochromeBitmapSampling is set to none.
            //Other compression options.
            compressionType = PDFCompressionType.compressNone;
            compressTextAndLineArt = true;
            cropImagesToFrames = true;
            optimizePDF = true;
            //Printers marks and prepress options.
            //Get the bleed amounts from the document's bleed.
    //~         bleedBottom = myDocument.documentPreferences.documentBleedBottomOffset;
    //~         bleedTop = myDocument.documentPreferences.documentBleedTopOffset;
    //~         bleedInside = myDocument.documentPreferences.documentBleedInsideOrLeftOffset;
    //~         bleedOutside = myDocument.documentPreferences.documentBleedOutsideOrRightOffset;
    //~         //If any bleed area is greater than zero, then export the bleed marks.
    //~         if(bleedBottom == 0 && bleedTop == 0 && bleedInside == 0 && bleedOutside == 0)
    //~         {
    //~             bleedMarks = true;
    //~         }
    //~         else
    //~        {
    //~             bleedMarks = false;
    //~        }
    //~        colorBars = false;
            colorTileSize = 128;
            grayTileSize = 128;
            cropMarks = false;
            omitBitmaps = false;
            omitEPS = false;
            omitPDF = false;
            pageInformationMarks = false;
            pdfColorSpace = PDFColorSpace.unchangedColorSpace;
            //Default mark type.
            pdfMarkType = 1147563124;
            printerMarkWeight = PDFMarkWeight.p125pt;
            registrationMarks = false;
            try
                simulateOverprint = false;
            catch(e) {}
            useDocumentBleedWithPDF = false;
            viewPDF = false;
        //Now export the document.
        var thisDocument = app.documents.item(app.documents.length-1);
        var fullname = app.scriptArgs.getValue("OutputFileName");
        var idx = fullname.indexOf("_");
        var shortname = fullname.substring(0, idx);
        //thisDocument.exportFile(ExportFormat.pdfType, app.scriptArgs.getValue("OutputFolder") + shortname + ".pdf");
        thisDocument.exportFile(ExportFormat.pdfType, "c:\boosttest.pdf");

  • Insert an image in JTable

    hi all
    how can i insert an image in JTable instead of text in a row?
    angela

    Hi
    I am sending u two bits of codes
    execute these and let me know
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    public class FrozenTable extends JScrollPane {
    public FrozenTable()
    TableModel tableModel = new AbstractTableModel()
    public String getColumnName(int col) { return "Column " + col; }
    public int getColumnCount() { return 20; }
    public int getRowCount() { return 40;}
    public Object getValueAt(int row,int col) { return new Integer(row * col); }
    JTable table1 = new JTable(tableModel);
    JTable table2 = new JTable(tableModel);
    TableColumnModel columnModel = table1.getColumnModel();
    TableColumnModel columnModel2 = new DefaultTableColumnModel();
    TableColumn col1 = columnModel.getColumn(0);
    TableColumn col2 = columnModel.getColumn(1);
    columnModel.removeColumn(col1);
    columnModel.removeColumn(col2);
    columnModel2.addColumn(col1);
    columnModel2.addColumn(col2);
    for(int i = 0; i < 2; i++)
    TableColumn col = columnModel2.getColumn(i);
    col.setWidth(80);
    col.setMinWidth(80);
    table2.setColumnModel(columnModel2);
    table2.setPreferredScrollableViewportSize(table2.getPreferredSize());
    table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table1.getTableHeader().setUpdateTableInRealTime(false);
    table2.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table2.getTableHeader().setUpdateTableInRealTime(false);
    table2.getColumnModel().getColumn(0).setCellRenderer( new ColorRenderer(0) );
    table2.setBorder(new CompoundBorder(new MatteBorder(0,0,0,1,Color.black), table2.getBorder()));
    setViewportView(table1);
    setRowHeaderView(table2);
    setCorner(JScrollPane.UPPER_LEFT_CORNER, table2.getTableHeader());
    public static void main(String[] args)
    JFrame frame = new JFrame();
    JPanel panel = new JPanel();
    FrozenTable table = new FrozenTable();
    panel.setLayout(new GridLayout(1,1));
    panel.add(table);
    frame.getContentPane().add(panel);
    frame.setSize(500,250);
    frame.setVisible(true);
    class yourClass extends JLabel implements TableCellRenderer
         int selectedRow = 0;
         public yourClass ()
              super();
              setOpaque(true);
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
              try
                   setIcon(new ImageIcon("image.gif") );          
              }catch(Exception e) {  }
              return this;
    Cheers :)
    Nagaraj

  • More information re my problem with text image

    Hi All
    I have designed some text headings (which are in colour) with a transparent background  in fireworks and exported it (gif) to Dreamweaver. That is all good. But when I place the text image (as a background image) in Dreamweaver the text has (in places) white edges which I dont want. Any ideas why this is happening???
    Any advice
    Paul

    Just a quick update. There's good news from my side. :-)
    Thanks to the Oracle support, with the help from Metalink team, this problem has been resolved now.
    Here's what BEFOREPARAMFORM trigger contained:
    BEFORE (Original code)
    ===========
    :P_START := TRUNC(SYSDATE);
    AFTER (Modified code)
    ===========
    IF :P_START IS NULL THEN
    :P_START := TRUNC(SYSDATE);
    END IF;
    The justification for adding IF statement in BEFOREPARAMFORM trigger has been explained in the following link:
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/triggers/tr_before_param_form.htm
    Cheers
    Mayur
    PS : One thing that I had forgotten to mention about this problem in my original post was that I was facing this problem ONLY when I call the report from Forms using Run_Report_Object method.
    But if I run the report directly from the browser by entering the URL (for e.g. http://wt0001:8889/reports/rwservlet?server=my_repsrv&report=report1.rdf&desformat=pdf&destype=cache&userid=user1/pwd1@db1&paramform=yes) into the address field, the report was working fine, which means that the initial values are populated into the parameters on the parameter form and then later by changing the values in these parameters (text item), the report displays the results correctly.
    So this problem was only occuring when I tried to run the report through Forms by creating the REPORT_OBJECT in the Form and using RUN_REPORT_OBJECT to generate the report and then using WEB.SHOW_DOCUMENT to publish the report in the browser.

  • TS2755 After updating to IOS 7.0.6 I can no longer send or receive text images!!! I have tried everything I could find. It is driving me crazy I need to send images for work! I am using a 4S, had NO PROBLEMS until I upgraded the software!!!!

    I have tried everything I could locate. I am using a 4S and had not a problem prior to updating the software!!! I need to text images alot due to my job. I am going crazy!!!! Any suggestions????

    SMS is a carrier feature, what did your phone carrier say when you contacted them about your issue?
    Double check you have MMS turn on in message settings.

  • I would like to create a custom datagridview column containing text images and MS Word OLE objects

    I am an old time LabView programmer going back to 2.0.  But moved on with my career several years ago.  But here I am back attempting a custom column in dataviewgrid control.  .NET is hard.  My goal is to read in an MS Word document and parse it out to a custom column.  The column will contain regular old text, images and MS Word objects, sometimes called OLE objects.
    There is scant information on creating .NET and labview when it comes to form manipulation.  I have stuggled through the learning curve and now able to insert a text box column into a datagridview and add it to the form container and actually size it to the datagridview control.  I've added a menu, but still figuring out the layout class.  Did I say .NET is hard?
    I know there must be a custom column created and even found a C# example, sorta.  Trouble is the example uses easy stuff like override and private.  It will take me another 3 weeks for that, darnit I'm getting lazy.
    Does anybody out there have some example of a custom column in the datagridview?
    If you ask to post code.  I have nothing I would be proud to show.
    The sorta go by: http://www.codeproject.com/Articles/31823/RichTextBox-Cell-in-a-DataGridView

    This is what the progress looks like so far.  I broke the tasks down in sub VIs.  One to create a custom cell so I can add it to the column CellTemplate.  The other to add the column to the control.  My limited knowledge of .NET and the implementation in LV causes me to question the value of LV .NET.
    The coding to create a TextBoxCell override with ImageCell CellTemplate.  Honestly I'm guessing what to do, because the LV documentation on inheritance and overriding is poor at best.
    The column coding to add the cell to the custom column.
    Probe 19 always comes up with an error.  The error is the standard 1172 with no clue what is causing it.  The "index" will work on 0 or 1, I suspect bc the two cell types are 0 and 1 but nothing tells me that, just guessing.

  • How to copy/paste texts/images from webpages in iBooks Author?

    Hi,
    I want to copy/paste text/image contents from webpages with iBooks Author, somehow images can't be copied, only texts can be copied with copy/paste editing. Wonder if there are any ways to include images with simple copy/paste?
    Tried to search iBooks Author help, could not find answers. Please help.
    Thanks

    Perhaps the people who spent a lot of time and money to produce the websites.....and who own copyright ...don't want anybody using their work without payment or credits. Have you contacted the websites owners to ask permission? 
    IF any person(s)  use anything from websites without permission apart from being to lazy to email to request permission....could face a legal action if and when the sites owners fins out. 
    There is another her misconception that "free" websites and content on "social media" such as the dreaded FaceBook....can be used without consequence. Almost all "free" websites are common licence material - which requires permission and those who give permission do so only for personal or none profit reproduction.
    i Use a blocking script on my websites which apart from preventing a right click...those who try are whisked off  my website to the the UK copyright website page which explains my rights! 
    You may wish to check out your iBooks contract with Apple and read their warnings on use of others copyright material. 
    You could ..and should contact the websites...explain what you want to use and why....and ask them if they can supply media.

  • How can I copy and paste (styled) text in JTextPane/JEditorPane?

    I have a styled text in my editor and I use the copy and the paste action in JTextPane, but i am not able to paste again with previous text formatting(it inserts same text, but with logical attributes - formatting at caret/inserted/ position)
    I use RTFEditor kit.
    Is it possible to put information about styled text into clipboard and paste it back? Shall I simulate clipboard somehow?
    Please help
    Thanks for any suggestion
    Vity

    This [url http://forum.java.sun.com/thread.jsp?forum=57&thread=197091]thread contains a discussion on this topic with a few suggestions. I haven't tried them so I don't know how they work. I found the thread by searching the forum with the keywords "+copy +style +jtextpane".

  • How to show $ sign alongwith the value in message styled text field.

    Hi,
    How to show $ sign alongwith the value in message styled text field.
    The value is coming from the table column in VO.
    I am working on OAF R12.

    Hi,
    Resolved.
    I used the below code in CO for the solution.
    Formatter currencyFormatter = new OADecimalValidater("$#,##0.00;($#,##0.00)",
    "$#,##0.00;($#,##0.00)");
    OAMessageStyledTextBean msrpField = (OAMessageStyledTextBean)webBean.findChildRecursive("MSRP11");
    msrpField.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, currencyFormatter);

Maybe you are looking for

  • Leopard re installation on new hard drive issue.

    Hello, Recently my girlfriend and myself took a vacation so we had to bring the Macbook of hers...  Unfortunately the laptop fell out of the luggage and landed FLAT on the bottom.  Looking at the Macbook we got the dreaded gray question mark of death

  • Different between SSO using X.509 and Kerberos

    Dear Experts, When trying to decide which route to go for SSO X.509 certificate or Kerberos token for SAP Abap system only , I am a bit confused. These are the main steps for using X.509. All the documents I found only talk about installing Secure Lo

  • How to bind register in Popup/Dialog to be filtered by ID

    Hello all, we use Oracle JDeveloper 11.1.2.3.0 and I'm relatively new to this development tool. We currently open a dialog from a table (bound to DataControl). The dialog is opened with a common ShowPopupBehavior on a commandImageLink and already sho

  • What is logical data base and how it is differfrom DDIC AND DATABASE

    HI , CAN ANY BODY HELP ME TO FIND THIS

  • Not fully qualified BEx URLs

    Hi, how can I use a portal wich is not in a domain? The BI Postinstallation will have a domain but we didn't have one for this server. I can not execute without give a domain. When I set a domain name which is not right, the Postinstallation is execu