JTable edited cells, in bold text

Hi
I'm using a JTable to edit some data. And just wondering if I can realze the data edited. Putting some text bold, or whatever in the render.
Is it posible to get the component of just a cell and set up some properties?
Thanks in advance.

JLabel can handle some html markup, for example:
JLabel l = new JLabel();
l.setText("<html><i>italics</i> <b>bold</b> <u>underline</u></html>");The default cell render is derived from JLabel, so you can:
1. Contrive to have your data object's toString methods produce such html
2. or subclass DefaultTableCellRenderer and override setValue.
3 etc...

Similar Messages

  • Word 2011 editing results in bold text

    When editing a document in black text, using blue text to edit, sections close to the edit remarks become bold text.
    I also use a checkmark and an * during editing.
    The bold text rhing is crazy-making. Tried deleting Office and Word pref files, and the Normal template. That did not work.
    Any help appreciated.
    Thanks!

    Problem solved.
    Used a small letter, instead of a checkmark and *.

  • Check if a single Text Item in a cell is bold and then grab the string that is bold

    I have written a script that runs through a table and parses out the information I need to create another table with some added information.
    The last piece that I can't seem to figure out is how to check if some text in a cell is bold and then grab said text to put in the new table.
    I will give a small table demo of what I am try to retrieve.
    Table A.
    Column 1
    Description
    123456
    This is a description (This is a note)
    789123
    This is a description (This is note A) (This is note B) (This is more stuff that isn't needed.
    Table B.
    Column 1
    Column 2
    Note
    1
    123456
    (This is a note)
    2
    789123
    (This is note A) (This is note B)
    I can pull all of the other information across that I am trying to get without any issue.
    I can't seem to figure out how to check the formatting of a TextItem to see if it is bold. I have been able to figure out how to check if a cell has bold text in it. using if ((tItems[counterVar].idata & Constants.FTF_WEIGHT) > 0). This ends up not working well because of a few issues. I was wondering if there is any way to check the formatting of a single character?
    I tried something similar to the following:
    prop_Change = tbl_Description_Cell.GetText(Constants.FTI_CharPropsChange);
    txt_String = tbl_Description_Cell.GetText(Constants.FTI_String);
    if (prop_Change.len > 0)
            if((prop_Change[0].idata & Constants.FTF_WEIGHT) > 0)
                    pOffset = prop_Change[0].offset;
                    for (var tbl_tItems = 0; tbl_tItems < txt_String.len; tbl_tItems++)
                            tOffset = txt_String[tbl_tItems].offset
                            if(tOffset == pOffset)
                                    alert(txt_String[tbl_tItems].sdata);
    Thanks,
    Steven

    Depends on your forms-version. If you are using a web-based version, you could have a look at the Java-bean-editor FRITE, it supports such features.

  • Editing cell on JTable (Override text when entering editing cell state)

    Hi, I NEED HELP ... I JUST NEED THIS TO FINISH MY PROGRAM! HEHE
    I need to make the cells on a JTABLE work like this:
    - When the cell is entering the editing state, the old text on that cell is erased. (LIKE EXCEL)
    - If ESC is pressed the old value appear.
    - If ENTER is pressed the new value appear.
    Im working with DefaultTableModel.
    Thanks. Bye.
    Edited by: pedrohrp on Mar 20, 2008 3:06 PM

    http://forum.java.sun.com/thread.jspa?threadID=5277162&tstart=15

  • Displaying bold text in a particular cell in ALV

    Hi,
    I am using cl_salv_table class. My requirement is to display few cells in bold based on some condition,
    we can get the column using      
    gr_p_column ?= gr_p_columns->get_column( 'MENGE' ).
    but how can we set bold text property to the cell?
    Please help me.

    SAMPLES CODES:
    [Refer to this link|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_wiki&query=rajasekhar&searchmode=similar&similardocsuri=/wiki/sdn_wiki/wiki/display/snippets/top%2bof%2bpage%2band%2bend%2bof%2bpage%2bin%2bclass%2bcl_salv_table&start=1]
    Regards,
    Gurpreet

  • How do I edit the font and bold text in the message box in adobe send before sending to client?

    How do I edit the font and bold text in the message box in adobe send before sending to client?

    Hi BRAEWOOD DEVELOPMENTS,
    You can edit the Subject & Message when you've selected Send Personalized Invitations (though you can't change the font or style of the text).
    Best,
    Sara

  • Need help serializing an AbstractTableModel for a JTable with cell editing.

    Fun times are ahead. Here we go!
    I have a JTable that contains data I'd like to serialize out to a file to be restored and viewed later.
    So I tried saving the AbstractTableModel subclass out to a file. Whenever I do this, I get the following error message:
    java.io.NotSerializableException: javax.swing.JTable$CellEditorRemover
    Now I know for fact that serializing an AbstractTableModel that was installed in a JTable without cell editing works just fine (my old code did exactly that). As a result, I think that the code that handles events in the AbstractTableModel contains references back out to the JTable, which causes the JTable to be saved no matter what (even though I'm just interested in saving the TableModel only). It causes a bigger file than normal, but file size is not an issue. The only issue I have is that CellEditorRemover (an undocumented inner class of JTable), which is automatically installed for JTables with editable cells, is not serializable.
    This leads to the following questions:
    1. Is there a way to avoid serialization/deserialization of the CellEditorRemover inner class of JTable?
    2. Is there a way to save an AbstractTableModel without saving all of the event listeners associated with it?
    I think an answer to either of these questions would go a long way towards solving my problem. Otherwise, I'll resign myself to weeping silently in the corner of my office.
    Thanks!

    I would suggest that if you can you only save the
    data... but i would do this by using the
    externalizable interface.
    What you will need to do is have the
    writeExternal(ObjectOutputStream out) and
    readExternal(ObjectOutputStream out) methods in your
    class. These will be responsiable for saving the
    data.
    Here's an example of what you can do in these
    methods... this is just a little tidbit from a program
    i've written.public void writeExternal(ObjectOutput out) throws
    IOException {
              out.writeInt(size);
              out.writeObject(drawName);
              out.writeInt(playersLength);
    for(int i = 0; i < playersLength; i++)
    ) out.writeObject(players);
              out.writeInt(seedsLength);
    for(int i = 0; i < seedsLength; i++)
    ) out.writeObject(seeds[i]);
              out.writeInt(drawLength);
    for(int i = 0; i < drawLength; i++)
    ) out.writeObject(draw[i]);
    public void readExternal(ObjectInput in) throws
    IOException, ClassNotFoundException {
              size = in.readInt();
              drawName = (String)in.readObject();
              playersLength = in.readInt();
    for(int i = 0; i < playersLength; i++) players[i] =
    = (String)in.readObject();
              seedsLength = in.readInt();
    for(int i = 0; i < seedsLength; i++) seeds[i] =
    = (String)in.readObject();
              drawLength = in.readInt();
    for(int i = 0; i < drawLength; i++) draw[i] =
    = (String)in.readObject();
    You can now use your class as you would a Serializable
    class, but it will only save the data
    Hope this helped
    webaf409java
    I forgot to add some critical information in my original post. My apologies. :(
    I've thought about using Externalizable, but am hesitant to use it because the application would no longer be able to read in files using the old save format (ie, AbstractTableModels for JTables without CellEditorRemovers ).  I want to preserve the ability to read the old saved AbstractTableModel formats if possible. 
    Do you know of a way to revert to the default deserialization mechanism from readExternal?  This way, during deserialization, I could do a quick test on the object being read and have the ability to default to the regular deserialization mechanism if the object is of the old type or continue with the new Externalizable stuff if the object is one of the new type.  Maintaining file compatibility is key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • JTable - active cell not highlited when editable

    Hello,
    I'm using JDK 1.4.2_05, and I'm seeing some behavior that seems a bit strange.
    In my JTables, some cells are editable, and others are not. When the user moves the active cell around (with the arrow keys, or TAB and RETURN) the non-editable cells show up with a nice blue color. If a cell is editable, it doesn't change at all, so the user has no idea where the "cursor" (meaning the active cell) is.
    These cells don't have any special renderer or anything. My JTable has these set:
    setRowSelectionAllowed(false);
    setColumnSelectionAllowed(false);
    setCellSelectionEnabled(true);Thanks for any advice!
    --- Eric

    Okay, yeah, I overrode the default renderer, and had it check whether the cell was selected or not, setting the background color appropriately. Duh. --- Eric

  • Keypressed event for a particular  edited cell of jtable

    hi friend,
    how to write the key pressed event for the edited cell of jtable which having focus on that particular cell.
    pls help me out.

    [http://catb.org/~esr/faqs/smart-questions.html]
    [http://mindprod.com/jgloss/sscce.html]
    db

  • Detecting mouse clicks in editable cell of JTable

    Hi everyone :)
    I thought that this question might have been asked before, but I have searched the forums extensively and have not been able to find the solution.
    What I want to achieve is to detect single and double mouse clicks on JTable cells (that are editable).
    For example, I have a JTable and there exists within it an editable cell. If the user clicks on it once then that cell goes into edit mode, and the user can type directly into the cell. I have already successfully implemented this.
    However, what I also want to do is detect a double-click so that I can pop up a dilaog that shows a list of default values that the user can select.
    So here is what I want;
    1. User clicks on the cell once.
    2. Cell moves into edit mode.
    3. If the user clicks again within a certain time interval then cancel edit mode and pop up a dialog containing values that the user can select from.
    I think that to do this I need to be able to detect mouse clicks on the cell that is currently being edited. So far I have been unable to discover how this is done. I have even tried extending JTextField to get what I want, but with no luck.
    Any help would be greatly appreciated.
    Kind regards,
    Ben Deany

    Thanks for the reply.
    Unfortunately, it is not possible to call 'AddMouseListener()' on a cell editor. You are only able to call 'addCellEditorListener()' and that only allows two events to the broadcast (edit cancel, and edit stop).
    Ben

  • Mouse Double Click on an editable cell of JTable

    Hi Pros:
    Maybe this is an old question but no answser from Forum.
    I have a JTable with adding MouseListener. I tried to put double click behavior on nay row in the table. The problem was that this action can obly work on the uneditable cell and do not work on editable cell.
    Anyone have ideas and help me.
    Thank you!

    Hi Wang,
    I have a problem similar to the one you have some time back.
    I have a query for which I need to use PreparedStatement .The query runs likes this :-
    String str = " Select ? , ename from emp where deptno ? ";
    The values of ? need to be assigned dynamically.
    But I cannot create Prepared Statement from this query .
    If you have got answer to your questions can you inform me at
    [email protected]
    Thanks in advance

  • JTable Custom Cell Editor "focus through keyboard" question (SSCCE included

    I was trying to use two components in a table cell. The first was JTextField and second the JButton. Everything works fine, except when it comes to editing the JTextfield using keyboard instead of mouse. When I use tab key to go to the custom cell, I can see that the focus is on the cell (as can be visible from background color). But when I try to edit the cell using F2 or directly entering text, nothing gets entered. If I use the mouse to go to particular cell, it works fine. Here is SSCCE. Try the following.
    1. Use mouse key to select first cell for editing. Edit the cell. Everything normal.
    2. Use the tab key to go to the first cell. Try to edit cell either by entering directly for after using F2. Can't get the typed text into the JTextfield.
    package com.ns;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Point;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JButton;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.UIManager;
    import javax.swing.WindowConstants;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    public class TextButtonCellFrame extends javax.swing.JFrame {
        // Variables declaration - do not modify
        private JScrollPane jScrollPane1;
        private JPanel testPanel;
        private JTable testTable;
        // End of variables declaration
        public TextButtonCellFrame() {
            initComponents();
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            testPanel = new JPanel();
            jScrollPane1 = new JScrollPane();
            testTable = new JTable();
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            testTable.setModel(new DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            testTable.setRowHeight(20);
            testTable.getColumnModel().getColumn(0).setCellRenderer(new MyTableCellRenderer());
            testTable.getColumnModel().getColumn(0).setCellEditor(new MyTableCellEditor());
            testTable.getColumnModel().getColumn(0).setPreferredWidth(200);
            jScrollPane1.setViewportView(testTable);
            testPanel.add(jScrollPane1);
            getContentPane().add(testPanel, BorderLayout.CENTER);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-496)/2, (screenSize.height-330)/2, 496, 330);
        }// </editor-fold>
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TextButtonCellFrame().setVisible(true);
        public class MyTableCellRenderer extends JPanel implements TableCellRenderer {
            Point point;
            JButton button1 = new JButton("Test 1");
            JTextField txtField = new JTextField();
            public MyTableCellRenderer() {
                setLayout(new BorderLayout());
                this.add(button1, BorderLayout.EAST);
                this.add(txtField,BorderLayout.CENTER);
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
                if (isSelected) {
                    txtField.setBackground(testTable.getSelectionBackground());
                    txtField.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
                else {
                    txtField.setBackground(testTable.getBackground());
                    txtField.setBorder(null);
                return this;
        public class MyTableCellEditor extends DefaultCellEditor
                                        implements ActionListener {
            JPanel panel = new JPanel();
            JButton button1 = new JButton ("Test 1");
            JTextField txtField = new JTextField();
            MyTableCellEditor() {
                super (new JTextField());
                button1.addActionListener(this);
                panel.setLayout(new BorderLayout());
                panel.add(button1, BorderLayout.EAST);
                panel.add(txtField,BorderLayout.CENTER);
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() == button1)
                    JOptionPane.showMessageDialog(null, "Action One Successful");
            public Component getTableCellEditorComponent(JTable table, Object value,
                                        boolean isSelected, int row, int column) {
                txtField.requestFocusInWindow();
                return panel;
    }regards,
    nirvan.

    I don't know what's better:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.EventObject;
    import javax.swing.*;
    import javax.swing.table.*;
    public class TextButtonCellFrame extends JFrame {
      JTable testTable = new JTable();
      public TextButtonCellFrame() {
        testTable.setModel(new DefaultTableModel(
          new Object [][] {
            {null, null, null, null},
            {null, null, null, null}
          new String [] { "1", "2", "3", "4" }
        testTable.setRowHeight(20);
        testTable.getColumnModel().getColumn(0).setCellRenderer(
          new MyTableCellRenderer());
        testTable.getColumnModel().getColumn(0).setCellEditor(
          new MyTableCellEditor(new JTextField()));
        testTable.getColumnModel().getColumn(0).setPreferredWidth(200);
        getContentPane().add(new JScrollPane(testTable));
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(480,320);
        setLocationRelativeTo(null);
      public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
            new TextButtonCellFrame().setVisible(true);
      public class MyTableCellRenderer extends JPanel
                    implements TableCellRenderer {
        JButton button1 = new JButton("Test 1");
        JTextField txtField = new JTextField();
        public MyTableCellRenderer() {
          setLayout(new BorderLayout());
          this.add(button1, BorderLayout.EAST);
          this.add(txtField,BorderLayout.CENTER);
        public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
          if (isSelected) {
            txtField.setBackground(testTable.getSelectionBackground());
            txtField.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
          } else {
            txtField.setBackground(testTable.getBackground());
            txtField.setBorder(null);
          txtField.setText(value==null?"":value.toString());
          return this;
      public class MyTableCellEditor extends DefaultCellEditor
                      implements ActionListener {
        JPanel panel = new JPanel(new BorderLayout());
        JButton button1 = new JButton ("Test 1");
        JTextField txtField; // = new JTextField();
        MyTableCellEditor(JTextField txtField) {
          super (txtField);
          this.txtField = txtField;
          button1.addActionListener(this);
          panel.add(button1, BorderLayout.EAST);
          panel.add(txtField,BorderLayout.CENTER);
        public void actionPerformed(ActionEvent e) {
          if (e.getSource() == button1)
            JOptionPane.showMessageDialog(null, "Action One Successful");
        public Component getTableCellEditorComponent(JTable table, Object value,
                      boolean isSelected, int row, int column) {
          txtField.setText(value==null?"":value.toString());
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              txtField.requestFocusInWindow();
          return panel;
    }

  • Cell border and text buttons.

    Dear members:
    I am a beginner and have just started using Dreamweaver.
    After a few attempts and some reading I decided to post a message
    with questions on a couple of problems I haven't been able to find
    answers for.
    The first one relates to table cell formating. I have tried
    to set border properties for individual table cells but haven't
    been able to. I would like to be able to set individual border
    thickness and border color values for different cells in a table.
    How is this done ? I have selected the cells I wish to format but
    the property window shows color but not border thickness value. Any
    ideas ?
    The second issue relates to text rollover buttons. I wish to
    create simple navigational buttons in a web site created from text
    placed in table cells. The text should be created as one color
    (gray) for the "up" state and then change to a different color as
    the state changes to "over" and "down". I have looked at Flash
    buttons but they are not exactly what I want and don't offer the
    option I am looking for. Flash text also doesn't allow me to set
    behaviors as most behaviors appear grayed and non-selectable. How
    can I create rollover buttons from simple text that changes color
    and style (normal, bold, italic) with state changes ?
    Any help will be very appreciated. I apologize if these
    questions seem basic but I am beginning to work with Dreamweaver.
    Thank you in advance,
    Joseph Chamberlain

    These may help -
    http://www.projectseven.com/tutorials/css/qdmacfly/index.htm
    http://www.macromedia.com/devnet/mx/dreamweaver/css.html
    http://www.macromedia.com/devnet/dreamweaver/articles/tableless_layout_dw8.html
    http://www.macromedia.com/devnet/dreamweaver/articles/css_concepts.html
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "FreakyJesus" <[email protected]> wrote in
    message
    news:ec1dq8$gjo$[email protected]..
    > The answer to your table cell borders question is CSS.
    Do you know much
    > about
    > that? It will allow you to define all the cell styles
    you want, and then
    > you
    > apply those styles to the cells in question.
    > Your text question can be done a few ways, but again CSS
    is the answer. If
    > you
    > don't know anything at all about it - go look - you'll
    be using it again
    > and
    > again so it's well worth your time.
    > If you know about css and need help with the specifics,
    then post back and
    > we
    > can try some stuff out.
    >
    > Andy
    >

  • Selective BOLD text in table

    Hi guys,
    I have report on Service Request Active reporting subject area. Standard table view with one additional column with custom text displayed using CASE...WHEN logic. This works perfectly fine.
    What I need is to display the values being pulled to be displayed in BOLD (not the whole field just selective text). for this under column properties in Data Format tab i selected HTML and tried using <bold>text/column formula</bold> or <b'>text/column formula</b"'> or ['b]text[b'] (added a couple of ' here in the post to remove the forum's formatting) but nothing seems to work out. Can someone point out where to place the bold tags and the format so that i can get this working
    *sample logic statement*
    CASE
    WHEN "- Service Request Custom Attributes".PICK_16 = 'Tier 3 Integration'
    THEN 'Issue 1 = ' || "- Service Request Custom Attributes".PICK_16 || ',<br> ' || 'Issue Owner = '|| IFNULL ("- Service Request Custom Attributes".PICK_20, 'NO OWNER ASSIGNED')
    WHEN "- Service Request Custom Attributes".PICK_17 =
    ELSE 'NULL'
    END
    thanks
    Gaurav
    Edited by: Gaurav Shah on Mar 4, 2011 6:56 PM

    How would I use conditional formatting?
    Let's say I've given the field a custom heading of Issue - Owner (combination of values from 2 separate fields based on certain CASE logic). I go to the Properties>Conditional Format tab> I click on Add Condition and it shows the list of columns. I select Issue - Owner. It throws up the combined values as possible answers which would be incorrect.
    The 2 columns used to combine this are not used in the report, so i cannot use that to filter and if i do add those columns then also i do not get the correct filter settings.
    I have a complete sentece displayed in that column - part of it is static text that i have entered and part of it is the column formula which displays various picklist values based on the logic.
    I need some words of the static text and some of the formula highlighted.
    for e.g. this is displayed in the column
    The Issue 1 is Integration and Issue Owner is John Doe
    Issue 1 is static text while John Doe is value returned based on CASE logic
    I need 2 separate types of data displaed in bold

  • Acrobat produces a PDF with bold text redacted

    Printing a Crystal Report from a Citrix server to Acrobat Pro XI on a Windows 7 desktop. Bold text in the report is redacted (black box).
    If I print the same report from my Windows 7 desktop to Acrobat Pro XI then the bold text appears as it should.

    I checked the font used in the Crystal reports (there are hundreds of reports) - the reports use Arial Unicode MS Regular (ARIALUNI.TTF) and the Font embeddability = Editable (whatever that means). The same font is used for bold and normal text - the normal text is fine but the bold text is redacted or blacked out.
    At this point I'm out of my area of expertise.
    I confirmed with my client that they are using pdfFactory and it works well using the same reports - go figure.
    Adobe can't get right with their own PDF files what other parties can

Maybe you are looking for