TextArea in Table

Hi!
I am trying to include a textArea as one of the cells in a JTable.
I tried doing this:
public class MyCellRen extends JTextArea implements TableCellRenderer
MyCellRen()
super();
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
setText((value == null) ? "" : value.toString());
return this;
but still when I run it , it doesnt show me the TextArea, and when I clcik it it doesnt let me do anything.
I probably think its cos' I havent created a CellEditor for the TextArea for that cell, but atelast the ren should work.
Am I doing something wrong?
Any ideas?
thanks iin advance

I solved this problem by placing the JTextArea into a JPanel
controlled by GridBagLayout. This appears to correct the
results returned by getPreferrredSize().
public class MultiLineCellRndrr extends DefaultTableCellRenderer
public MultiLineCellRndrr ()
this.myText = new JTextArea();
this.myText.setLineWrap(true);
this.myText.setWrapStyleWord(true);
this.myText.setOpaque(true);
this.myText.setEditable(false);
* Gets the text area component for a cell
* @param table
* The parent table.
* @param value
* The cell value.
* @param isSelected
* Is the cell selected?
* @param hasFocus
* Does the cell have focus?
* @param row
* Current row being rendered.
* @param col
* Current column being rendered.
* @return
* The text area component.
public Component
getTableCellRendererComponent ( JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int col )
JPanel panel = new JPanel ();
panel.setLayout (new GridBagLayout());
panel.add (this.myText,
new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
GridBagConstraints.CENTER,
GridBagConstraints.BOTH,
new Insets(0, 3, 3, 0), 0, 0));
if (isSelected)
this.myText.setForeground(table.getSelectionForeground());
this.myText.setBackground(table.getSelectionBackground());
else
this.myText.setForeground(table.getForeground());
this.myText.setBackground(table.getBackground());
this.myText.setText(value==null?"":(String)value);
int tableRowHeight = table.getRowHeight(row);
// if the current height is different, resize the row height
if ( (tableRowHeight < panel.getPreferredSize().getHeight() ) )
table.setRowHeight(row, (int)(panel.getPreferredSize().getHeight()));
return panel;
//==========================================================================
// Attributes
//==========================================================================
JTextArea myText;
} // end class MultiLineCellRndrr

Similar Messages

  • Help with a Times Table Applet.

    Hey,
    I am a college student and I have been given the task of constructing a times table applet. Basically, I am stuck to the point of where I have no clue of what to do next. Even my college tutor is stuck as to what to do. I was wondering if you could give me any aid in helping me develop this applet fully, so that it is correct and functioning. Here it is:
    import java.io.*;
    import Input.*;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    abstract class TimesTableApplet extends Applet implements ActionListener
         public void initialize();{}
         String message="";
         public void init()
         Button btnClick= new Button("Enter");
    add(btnClick);
              //String line = null;
              float table = 0, range = 0, attempts = 0;
              int count = 1, reply = 1, lines = 1;
    TextArea textone;
         while(reply==1)
                   String line = null;
                   table = 0;
                   range = 0;
                   ClrScr.ClrScr();
                   textone = new TextArea("",10,30+12*lines);
                   lines=1;
              while (( table < 1) || (table > 20) && attempts <3)
                   textone = new TextArea("Input table from 1-20:",10,10);
                   table = Input.readFloat();attempts++;
              attempts = 0;
                   while (( range < 1) || (range > 14) && attempts <3)
                        textone = new TextArea("Input range 1-14:,10,20");
                        range = Input.readFloat();attempts++;
              if (( table >= 1) && (table <= 20))
                   if (( range >= 1) && (range <= 14))
                   while (count<=range)
                        textone = new TextArea(count + "x" + table + "=" + count * table);
                        count++;
                        lines++;
                   count=1;
                   textone = new TextArea("Would you like another go? Type '1' for yes");
                   reply = Input.readInt();
         }//end while reply ==1
         }//end init
         public void paint(Graphics g)
         int count =1;
         while ( count <=80)
         System.out.println();
         count++;
    }

    Ok, why did you post this code? we will not be able to compile it because we are missing
    the Input package not did you mention wich jar to find this (nor did google).
    Syntax error in initialize
    Usage of the unknown object ClrScr (static method ClrScr)
    Usage of the unknown object Input (static method readFloat and readInt)
    If your tutor is stuck he or she should find a new job.
    import java.io.*;
    import Input.*;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    abstract class TimesTableApplet extends Applet implements ActionListener {
         public void initialize(){
         String message = "";
         public void init() {
              Button btnClick = new Button("Enter");
              add(btnClick);
              //String line = null;
              float table = 0, range = 0, attempts = 0;
              int count = 1, reply = 1, lines = 1;
              TextArea textone;
              while (reply == 1) {
                   String line = null;
                   table = 0;
                   range = 0;
                   ClrScr.ClrScr();
                   textone = new TextArea("", 10, 30 + 12 * lines);
                   lines = 1;
                   while ((table < 1) || (table > 20) && attempts < 3)
                        textone = new TextArea("Input table from 1-20:", 10, 10);
                        table = Input.readFloat();
                        attempts++;
                   attempts = 0;
                   while ((range < 1) || (range > 14) && attempts < 3) {
                        textone = new TextArea("Input range 1-14:,10,20");
                        range = Input.readFloat();
                        attempts++;
                   if ((table >= 1) && (table <= 20))
                        if ((range >= 1) && (range <= 14)) {
                             while (count <= range) {
                                  textone = new TextArea(count + "x" + table + "="
                                            + count * table);
                                  count++;
                                  lines++;
                   count = 1;
                   textone = new TextArea(
                             "Would you like another go? Type '1' for yes");
                   reply = Input.readInt();
              }//end while reply ==1
         }//end init
         public void paint(Graphics g) {
              int count = 1;
              while (count <= 80) {
                   System.out.println();
                   count++;
    }

  • Form2mail how do I set up the form to sent to a recipient selected from a drop-down menu?

    I am trying to configure dreamweaver form2mail to be able to send the information submitted to individual employees.  I would like the form to be set up where as you choose the recipient form a drop down menu and the only that recipient would receive the information collected on the form.  I can't seem to find any information on this.  I can only find info on sending to multiple recipients at the same time.  I only want the recipient that is selected to receive the form information.
    Alternatively, can anyone recommend a low cost or FREE form to mail system.
    Thanks in advance for your assistance!

    Jim, That is exactly what I need.  I'm using Form2Mail the Dreamweaver extension for Adobe Dreamweaver.  It only gives me the option to send to one email address or cc to multiple not individual sends.
    Here is the html
    <form action="/HDWForm2Mail/Form2Mail.php" method="post" enctype="multipart/form-data" name="form1" id="form1" accept-charset="iso-8859-1">
            <p>
              <label for="message"></label>
              <textarea name="message2" id="message" cols="50" rows="5"></textarea>
            </p>
            <table width="429">
              <tr>
                <td><strong>Recipient:</strong></td>
                <td><label for="recipient"></label>
                  <select name="recipient" id="recipient">
                    <option value="[email protected]">Mr. Person 1</option>
                    <option value="[email protected]">Mr. Person 2</option>
                    <option value="[email protected]">Mr. Person 3</option>
                  </select></td>
              </tr>
              <tr>
                <td><strong>Your Email Address:</strong></td>
                <td><label for="email"></label>
                  <input type="text" name="email" id="email" /></td>
              </tr>
              <tr>
                <td><strong>Attachment:</strong></td>
                <td><label for="file"></label>
                  <input type="file" name="file" id="file" /></td>
              </tr>
              <tr>
                <td colspan="2"><strong>To Submit your email, click the SEND button:
                  <input name="send" type="submit" id="send" onclick="MM_validateForm('email','','RisEmail','message','','R');return document.MM_returnValue" value="Send" />
                </strong></td>
              </tr>
            </table>
            <input type="hidden" name="hdwemail" id="hdwemail" value="lisa+email.com" />
            <input type="hidden" name="hdwok" id="hdwok" value="http://ricochec.com/thank-you.html" />
            <input type="hidden" name="hdwnook" id="hdwnook" value="http://ricoche.com/error.html" />
          </form>

  • Floating Height of JTextArea (as Renderer/Editor) in a JTable Cell

    Hey Folks,
    I'm kinda struggling with JTextAreas...
    There is this JTable, which consists of three colums (practically there are two - the other one's an ID-Field...) and only one
    of them ist editable für users.
    Left column is a commentary column which has a max of 150 characters - Right column fills automaticly with a user/date stamp.                                                                                                                                                                                    
    The main function is that on showing the table, old comments will be retrieved from database and new ones can be entered.
    This works all fine and is no matter of subject...
    The core of my problem is that there seems to be no straigh-forward way of determine a proper linecount from (a wordwrapped!) JTextArea.
    After a long search in the net, i found this approach:
        private static ArrayList<String> getWrappedLines(JTextArea myTextArea) {
            ArrayList<String> linesList = new ArrayList<String>();
            int length = myTextArea.getDocument().getLength();
            int offset = 0;
            try {
                while (offset < length) {
                    int end = Utilities.getRowEnd(myTextArea, offset);
                    if (end < 0) {
                        break;
                    // Include the last character on the line
                    end = Math.min(end + 1, length);
                    String line =
                        myTextArea.getDocument().getText(offset, end - offset);
                    // Remove the line break character
                    if (line.endsWith("\n")) {
                        line = line.substring(0, line.length() - 1);
                    linesList.add(line);
                    offset = end;
            } catch (BadLocationException e) {
                System.err.println("Bad Location at TextArea");
            return linesList;
        }    This code reads the content of a JTextArea an separates wrapped lines in an array.
    With manual line breaks ("\n") I get Exceptions (Bad Location) which isn't too bad, because
    I was trying to ban manual line breaks anyway...
    The above given method retrieves the lines, while the next sets the new Height (line count multiplied by Font Height) to the row.
        public static void setOptimalRowHeight(JTable table, JTextArea textArea, int row, int column) {
            if (
                row >= 0 &&
                column == VerwaltungsnotizController.IND_VNO_NOTIZ   
                int fontHeight =
                    textArea.getFontMetrics(textArea.getFont()).getHeight();
                ArrayList<String> wrappedLines = getWrappedLines(textArea);
                int nrOfLines = wrappedLines.size();
                int oldSize = table.getRowHeight(row);
                int newSize = (fontHeight * nrOfLines) + 5;
                if (newSize != oldSize) {
                    table.setRowHeight(row, newSize);
         public static void setOptimalRowHeight(JTable table, JTextArea textArea) {
         int row = table.getSelectedRow();
         int column = table.getSelectedColumn();
         if (
              row >= 0 &&
              column == VerwaltungsnotizController.IND_VNO_NOTIZ   
              setOptimalRowHeight(table, textArea, row, column);
         }The above combined Sources are used by two classes, which are "tied" to the table.
    One is the CellEditor (which works almost fine); the other one is the CellRenderer (which fails miserably!)
    CellEditor (with Listener):
    public class VnoCellEditor extends AbstractCellEditor implements TableCellEditor {
        private VnoTextArea textArea;
        private JTable table;
        public VnoCellEditor (JTable table) {
            this.table = table;
            textArea = new VnoTextArea(table);
            textArea.setMaximumInputLength(VerwaltungsnotizController.MAX_INPUT_VNO);
            textArea.addKeyListener(new TextAreaEnterAdapter());
            textArea.setLineWrap(true);
            textArea.setWrapStyleWord(true);
            Document document = textArea.getDocument();
            document.addDocumentListener(new VnoTextAreaDocListener(table, textArea));
        public Component getTableCellEditorComponent(JTable table, Object value,
                                                     boolean isSelected, int row,
                                                     int column) {
            if (value instanceof String) {
                textArea.setText((String)value);
            } else if (value instanceof Integer) {
                Integer intValue = (Integer)value;
                textArea.setText(intValue.toString());
            } else {
                Object objValue = value;
                textArea.setText(objValue.toString());
            System.err.println("Editor - get Component");
            return textArea;
        public Object getCellEditorValue() {
            return textArea.getText();
    public class VnoTextAreaDocListener implements DocumentListener {
        private JTable table;
        private JTextArea textArea;
        public VnoTextAreaDocListener(JTable table, JTextArea textArea) {
            this.table = table;
            this.textArea = textArea;
        public void insertUpdate(DocumentEvent e) {
            VnoTableRowHeightHelper.setOptimalRowHeight(table, textArea);
        public void removeUpdate(DocumentEvent e) {
            VnoTableRowHeightHelper.setOptimalRowHeight(table, textArea);
        public void changedUpdate(DocumentEvent e) {
            //Plain text components don't fire these events
    }As said the editor works almost as planned. On every Keystroke made in Edit-Mode of the table, insertUpdate() or removeUpdate()
    is being called, corresponding to the type of Keystroke ... (duh!)
    The Helpers method is called and the row-height is set real nicely.
    !But!
    when i navigate into an other row, a removeUpdate()-event is beeing thrown and due to the mechanism the cell selection
    gets somehow mixed around and row-heights get switched.
    Maybe this could get improved, but i don't se my error - which wouldn't be nescessary if this event wasn't thrown.
    (for what I don't see a reason anyway ... !)
    CellRenderer:
    public class VnoCellRenderer implements TableCellRenderer {
        private VnoTextArea textArea;
        private int Row = -1;
        private int Column = -1;
        private VnoTableModel jtmVno;
        public VnoCellRenderer(JTable table) {
            this.jtmVno = (VnoTableModel)table.getModel();
            textArea = new VnoTextArea(table);
            textArea.setLayout(new BorderLayout());
            textArea.setLineWrap(true);
            textArea.setWrapStyleWord(true);
        public VnoTextArea getTextArea() {
            return textArea;
        public Component getTableCellRendererComponent(JTable table, Object value,
                                                       boolean isSelected,
                                                       boolean hasFocus, int row,
                                                       int column) {
            Row = row;
            Column = column;
            String tmpValue = null;
            if (value instanceof String) {
                tmpValue = (String)value;
            } else if (value instanceof Integer) {
                tmpValue = ((Integer)value).toString();
            } else {
                tmpValue = value.toString();
            // FARBEN:
            // Normalmodus
            if (jtmVno == null) {
                System.err.println("Table Model noch nicht initialisiert!");
                textArea.setBackground(Color.LIGHT_GRAY);
            } else {
                if (jtmVno.isCellEditable(Row, Column)) {
                    textArea.setBackground(Color.WHITE);
                } else {
                    textArea.setBackground(Color.LIGHT_GRAY);
            textArea.setForeground(Color.BLACK);
            // Für ausgewählte Zeile
            if (isSelected && !hasFocus) {
                textArea.setBackground(CommonConstants.SELECTION_COLOR_BLUE);
                textArea.setForeground(Color.WHITE);
            textArea.setText(tmpValue);
            textArea.setEditable(true);
            if (Column == VerwaltungsnotizController.IND_VNO_NOTIZ) {
                VnoTableRowHeightHelper.setOptimalRowHeight(table, textArea, row, column);
            return textArea;
    }Okay, this is where the shit hits the fan!
    Since with renderers there is no manual content mutation, row-height-settings are not done with listeners.
    I put this at the very end of the getTableCellRendererComponent(), which is called every time a cell gets rendered.
    The main problem here is that at this point my methods can't determine any linewraps at all!
    getWrappedLines() always returns an empty Array (since Utilities.getRowEnd() returns "-1" beforehand...).
    I'm afraid that my methods are called way too early - at a point were the rendering is not completed or has not even started.
    And to accomplish my desired tasks the fully rendered JTextArea would be needed ... ?!
    I have very limited swing experience, so I can only guess about this core features ...
    But i this is the case - my methods should be called later on the rendered cell. But how? from which component?
    Btw: I have written my own JTextArea to limit the input size
    public class VnoTextArea extends JTextArea {
        private JTable table;
        private int _maximumInputLength = 0;
        public VnoTextArea(JTable table) {
            this.table = table;
        public void setMaximumInputLength(int maximumInputLength) {
          if (maximumInputLength != 0) {
            _maximumInputLength = maximumInputLength;
            super.setDocument(new PlainDocument() {
                public void insertString(int offset, String string, AttributeSet attributeSet) throws BadLocationException {
                  StringBuffer buffer = new StringBuffer(string);
                  int size = VnoTextArea.this.getText().length();
                  int bufferSize = buffer.length();
                  if ((size + bufferSize) > _maximumInputLength) {
                    buffer.delete((_maximumInputLength - size), bufferSize);
                  if (size < _maximumInputLength) {
                    super.insertString(offset, buffer.toString(), attributeSet);
                  } else {
                    Toolkit.getDefaultToolkit().beep();
    }I'm sorry for not providing a running example, but it's a pretty huge project...
    Providing all dependencies would go far beyond the scope.
    (and there are many sources which I'm not allowed to post)
    But I hope my examples get down to the core of my problem!
    I also tried different approaches:
    - using getPreferredSize() of the JTextArea (seemed to do nothing useful at all?!)
    - using getLineCount/() of the TextArea (only counts "\n" ...)
    - guessing that every row consist of an average of 20 characters cumpute by myself (low-tech, buggy but fast - unsatisfying)
    With my above mentioned approach I got by far the best results (partially) - but I'm at my wits' end.
    I don't know it any better... And i have tried for days without improvement.
    What would you do?
    vielen Dank im Voraus schon mal für eventuelle Mühen,
    Haye

    no solution - just a couple of comments:
    - never ever change the calling table in a renderer, I mean really NEVER
    - instead, listen to table events and resize the row height as appropriate
    - JTextArea has a somehow weird prefSize calculation (forgot the details, so don't nail me :), so you have to manually set one dimension and then ask the area to calculate the other. In your renderer, you can do something like:
    Component getTableCellRendererComponent(....) {
        int columnWidth = table.getColumnModel().getColumn(column).getWidth();
        textArea.setSize(columnWidth, Short.MAX_VALUE);
        ... here do the normal config
    // then somewhere else, triggered by appropriate change events
    void updateRowHeight(JTable table, int row) {
       int height = table.getRowHeight();
       foreach column {
             TableCellRenderer r = table.getCellRenderer(row, column);
             Component c = table.prepareCellRenderer(r, row, column);
             height = Math.max(height, c.getPreferredSize().height);
       table.setRowHeight(row, height);
    } HTH - ein bißchen wenigstens :-)
    Jeanette

  • JTable's multiLine problem!!!

    I want to use JTextArea as table's editor,but,there are only JtextFiled,JComboBox,Jcheckbox in DefaultCellEditor class ,there is not JTextArea,How to do?please help me!!!thanks!!!

    HI Use this example..
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.awt.*;
    public class JTextAreaTableExample extends JFrame
    public JTextAreaTableExample()
    super( "JTextAreaTableExample Example" );
    DefaultTableModel dtm = new DefaultTableModel()
    // make first cell uneditable
    public boolean isCellEditable(int row, int column)
    return !(column == 0);
    dtm.setDataVector(new Object[][]{{ "JTextArea1", "This is a test\non long lines\n" },
    { "JTextArea2", "Hello, world!" }},
    new Object[]{ "String","JTextArea"});
    JTable table = new JTable(dtm);
    table.getColumn("JTextArea").setCellRenderer(new TextAreaRenderer());
    table.getColumn("JTextArea").setCellEditor(new TextAreaEditor());
    table.setRowHeight(80);
    JScrollPane scroll = new JScrollPane(table);
    getContentPane().add(scroll);
    setSize( 400, 250 );
    setVisible(true);
    public static void main(String[] args) {
    JTextAreaTableExample frame = new JTextAreaTableExample();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    class TextAreaRenderer extends JScrollPane implements TableCellRenderer
    JTextArea textarea;
    public TextAreaRenderer()
    textarea = new JTextArea();
    textarea.setLineWrap(true);
    textarea.setWrapStyleWord(true);
    textarea.setBorder(new TitledBorder("This is a JTextArea"));
    getViewport().add(textarea);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column)
    if (isSelected)
    setForeground(table.getSelectionForeground());
    setBackground(table.getSelectionBackground());
    textarea.setForeground(table.getSelectionForeground());
    textarea.setBackground(table.getSelectionBackground());
    else
    setForeground(table.getForeground());
    setBackground(table.getBackground());
    textarea.setForeground(table.getForeground());
    textarea.setBackground(table.getBackground());
    textarea.setText((String) value);
    textarea.setCaretPosition(0);
    return this;
    class TextAreaEditor extends DefaultCellEditor
    protected JScrollPane scrollpane;
    protected JTextArea textarea;
    public TextAreaEditor()
    super(new JCheckBox());
    scrollpane = new JScrollPane();
    textarea = new JTextArea();
    textarea.setLineWrap(true);
    textarea.setWrapStyleWord(true);
    textarea.setBorder(new TitledBorder("This is a JTextArea"));
    scrollpane.getViewport().add(textarea);
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int row, int column)
    textarea.setText((String) value);
    return scrollpane;
    public Object getCellEditorValue()
    System.out.println("value :"+(String) textarea.getText());
    return textarea.getText();

  • Problem obtaining BitmapData for a canvas via Javascript

    Hi,
    For my web application I have one HTML button, which is outside of flash application shown on the same page. Via Flex application I've declared callback function to be called by Javascript in this way:
    ExternalInterface.addCallback("cbProcessButton", processButton);
    For HTML button I have this:
    <input id="bSave" name="button" type="submit" value="Save" onclick="getSWF('${application}').cbProcessButton();" />
    And inital lines of processButton function (which is Flex function) are defined as this:
              var bitmapData:BitmapData = new BitmapData(canvas.width, canvas.height, false, 0xFFFFFF);
              bitmapData.draw(canvas);
              var jpgEncoder:JPEGEncoder = new JPEGEncoder(85);
              var jpgStream:ByteArray = jpgEncoder.encode(bitmapData);
    Now I have problem here. If I call that processButton in this way for my canvas via Javascript - then I get length of jpgStream as 32654 bytes and after save into a file - that jpg file cannot be shown properly.
    But if I call the same processButton via a Flex button, which is placed inside my Flex - I get jpgStream in my case of length 33074 bytes and after save to a file - could normally show it later.
    I'm using Flex Builder 3 with Flex sdk 3.5.0.12683 installed and later show everything/work via Flash Player v10,1,53,64 installed on WinXP.
    Is it known bug/limitation of BitmapData usage in such Javascript scenario? Or is it bad sdk/Flash Player? Are you able to reproduce such in your environment?
    I'm really going out of my mind to understand why lengths of encoded data in 2 cases are different. Of course I know about that 2176 Error for other situations dealing with Flex UI, but here I don't get it - so I assume my Javascript scenario is allowed by Adobe so far.
    Any help would be highly appreciated.
    Andrejus

    Thanks very much, Everybody. Here is something that works. This is based on all the inputs provided by you guys. Many thanks.
    <table>
    <td width="3%" align=right></td>
    <td align=left valign=top> <b>Existing Notes:</td>
    <TD><textarea name="existing" wrap="hard" cols="70" rows="10" onkeypress
    ="validateSize(this, 2000)" onchange="validateSize(this, 2000)" READONLY>
    <%
    int logSize = actionLog.size();
    if (logSize > 0) {
    for (int j=logSize-1; j >=0; j--){
    DealStatusAction dsa = (DealStatusAction)actionLog.get(j);
    String actionNm = dsa.getActionName();
    String actionDate = dsa.getActionDate().toString() + "";
    String memo = dsa.getMemo();
    String actionPerformer = ((dsa.getLastName() == null || dsa.get
    FirstName() ==null)?"":(dsa.getFirstName() + " " + dsa.getLastName()));
    String datePerf = actionDate + " " + actionPerformer;
    %>
    <%=datePerf%>
    <%=actionNm%>
    <%=memo%>
    <%
    %>
    </textarea>
    </TD>
    </table>

  • How to print the entire contents of JFrame

    hi
    i have frame ....
    which contains textarea,label,table..
    arranged in aspecific order...
    i need to print the data of these components ...
    plz help

    Attach Listeners to those components and implement those interfaces. While implementing get the data entered by user.

  • Multiline Field in a fap

    Hi Guys,
    Can anyone tell me how to implement multiline field in a fap. It wont allow me to add one in a textarea or table. any workaround? This field will be populated through DAL.
    Thanks.
    Edited by: user13484277 on Mar 5, 2013 7:14 PM

    If you create a field, you can select Multiline text as the type. This creates a field that you can map large blocks of (paragraph) data into.
    If you have a "static" text area and are trying to insert a field in the middle where you want to mapped additional data, then you are limited to using a normal Alphanumeric type field inserted into the Text area. This will allow you to map up to the length of the field - where this type of field is limited to 1024 (single-byte) characters. Even though this is a single field, the data will still wrap according to the margins assigned on your Text area paragraph that contains it.
    You cannot insert a MLT field into the middle of a Text Area object. A MLT field contains a text area and cannot live inisde of another text area. So, if you have several paragraphs of content and you want to have a free-form space between paragraphs where additional content can map, you would need to split your static content into two text areas and then insert a MLT field in between those paragraphs.

  • Inputting an excel formula into Dreamweaver CS3

    Hello,
    I am creating a website using Dreamweaver CS3 where people
    will email me their documents and I will check them for errors. I
    will be charging per word. I have a word count feature added to my
    page where people paste their document and it will calculate the
    number of words. I need help adding an excel-like formula which
    will multiply the number of words times however much I will be
    charging per word.
    For instance, a person has 1000 words. I need a way for it to
    automatically calculate 1000*.03 which will input $30 in the box
    for their cost.
    Does anyone know how I can incorporate Excel into
    Dreamweaver, or know of a better way to do this?

    SeanWoods wrote:
    > Bregent,
    >
    > I did not write the Javascript for the wordcount. I
    found it online. I am
    > trying to do what you said where I should modify it to
    multiply the word count
    > by the price. I tried inputting the excel-like formula
    into the script (*.02)
    > and haven't been able to get it to work properly.
    >
    > If you could please tell me what I'm doing wrong I would
    appreciate it.
    >
    > Here is the code for the word count:
    >
    > <form method="POST" name="wordcount">
    > <script language="JavaScript">
    >
    > function countit(){
    >
    > var formcontent=document.wordcount.wordcount2.value
    > formcontent=formcontent.split(" ")
    > document.wordcount.wordcount3.value=formcontent.length
    > }
    > </script>
    <script type="text/javascript">
    function countit(textarea){
    document.wordcount.wordcount3.value=
    (textarea.value.length*.03).toFixed(2)
    </script>
    <textarea rows="12" name="wordcount2" cols="60"
    wrap="virtual" onkeyup="countit(this)"></textarea>
    Mick
    > <table border="0" cellspacing="0" cellpadding="0">
    > <tr>
    > <td width="100%"><textarea rows="12"
    name="wordcount2" cols="60"
    > wrap="virtual"></textarea></td>
    > </tr>
    > <tr>
    > <td width="100%"><div
    align="right"><p><input type="button"
    > value="Calculate Words"
    > onClick="countit()"> <input type="text"
    name="wordcount3" size="20"></p>
    > <div
    align="center"><center><p><font face="arial"
    size="-2">This free
    > script provided by</font>
    > <font face="arial, helvetica" size="-2"><a
    > href="
    http://javascriptkit.com">JavaScript
    > Kit</a></font></p>
    > </center></div></div></td>
    > </tr>
    > </table>
    > </form>
    >

  • What would be the best way to use a list in a textarea to compare to values in a column in a database table?

    I'm trying to move a table from a MS Access database to a datasource online so I don't have to be the only one that can perform a specific task.
    Right now I regularly am having to assess change requests to determine if it impacts the servers my team supports.  Currently I copy and paste the text list into a temporary table in MS Access then hit a button to run a query comparing what was in that list to my server inventory.  Works fine but now I need to move this online so others can do this in a place where we can also keep everyone using the exact same inventory and am planning on using a ColdFusion server.
    So what I believe would be easiest is to create a form that has a textarea where I can just copy and paste what is in the change request and then hit a submit button and go to the next page where it would list all the servers that matched (with all the other info I also need).
    Almost always the info would hit the textarea with a separate row for each server with no other delimiters, etc.
    Example info in textarea:
    servername1
    servername2
    servername3
    What is the best/easiest way in the SQL code on the following page to take the values from the textarea the way they are listed and return results of any that match the server name column from that list?  What CF functions and SQL coding are needed?
    I've done something in the past where I did WHERE Server IN (#PreserveSingleQuotes(Form.ServerList)#)...
    But I had to input 'servername1', 'servername2', 'servername3' in the text box and with how often we'll be copying lists as show above from a text area or from an excel column I'd really like a way to get from the example above to the results I need without having to manipulate.  Sometimes the list I'm comparing against may be 300+ servers and adding that formatting is not desirable.
    Any help would be appreciated.

    So here is a solution I came up with
    <cfoutput>
    <cfset Servers="#StripCR(Form.ServerList)#">
    <cfset Servers2="'#Replace(Servers, "
    ", " ", "All")#'">
    <cfset Servers3="#ToString(Servers2)#">
    <cfset Servers4="#Replace(Servers3, " ", "', '", "All")#">
    </cfoutput>
    Then in the cfquery SQL I used
    WHERE Server IN (#PreserveSingleQuotes(Servers4)#)
    Right now this is working but it seems very cumbersome.  If anyone can come up with a way to simplify this please let me know.

  • Updateble table with HTMLDB_ITEM.TEXTAREA  not save text area field?

    I use
    updateble table with HTMLDB_ITEM.TEXTAREA that does not save text area field?
    select a,b,
    case when cond1 then APEX_ITEM.TEXTAREA(3, A_COLUMN,4,50)
    recards
    Edited by: sak on Dec 21, 2009 4:24 PM

    Sak,
    Unless I'm misunderstanding your situation, you've wandered outside the abilities of the automatic DML process to update your table. As soon as you use APEX_ITEM objects in your SELECT, you need to write your own table insert/update/delete processes to handle the updated values. The Advanced Apex documentation gives some basic examples for this, but I struggled with it the first time (because I was using a checkbox, which is handled differently than the other types).
    For more assistance, try searching this forum for "APEX_ITEM".
    Good luck,
    Stew

  • Table with a textArea editor doesn't stop editing

    I need to have a table with TextArea as editor (to show the information) but it must be changed through a Dialog and return to the render (also a textArea)
    The problem is when after modify the information with the editor I call fireEditingStopped(); and it doesn't return to the render it remains in editor so I can modify the text and when I change of cell It returns to the text put by the editor. I need that the user can't change the text showed in the textArea only be modified through the Dialog.
    In the next code I isolated the problem, so the Editor change the original text with "NEW VALUE" simulating the action of Dialog (which is not included).
    Thanks a lot and thanks for the patience for my bad English.
    public class TableWithTextArea extends javax.swing.JFrame {
        public TableWithTextArea() {
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            getContentPane().setLayout(new java.awt.FlowLayout());
            this.getContentPane().add(new MyTabla());
            pack();
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TableWithTextArea().setVisible(true);
        class MyTabla extends javax.swing.JTable {
            public MyTabla() {
                this.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
                this.setModel(new javax.swing.table.DefaultTableModel(
                        new Object [][] {
                            {"A HOLA MUNDO", "B HOLA MUNDO", "C HOLA MUNDO", "D HOLA MUNDO"},
                            {"E HOLA MUNDO", "F HOLA MUNDO", "G HOLA MUNDO", "H HOLA MUNDO"},
                            {"I HOLA MUNDO", "J HOLA MUNDO", "K HOLA MUNDO", "L HOLA MUNDO"},
                            {"M HOLA MUNDO", "N HOLA MUNDO", "O HOLA MUNDO", "P HOLA MUNDO"}
                        new String [] {
                            "Title 1", "Title 2", "Title 3", "Title 4"
            public javax.swing.table.TableCellEditor getCellEditor(int row, int column) {
                    return new StringEditor(this);
            //CLASS StringEditor
            class StringEditor extends javax.swing.AbstractCellEditor
                                     implements javax.swing.table.TableCellEditor {
                private final static long serialVersionUID = 10092;
                javax.swing.JTable tabla;
                javax.swing.JTextArea editTextArea;
                String theValue = "";
                public StringEditor(MyTabla tabla) {
                    super();
                    this.tabla = tabla;
                    editTextArea = new javax.swing.JTextArea();
                    editTextArea.setLineWrap(true);
                    editTextArea.setWrapStyleWord(true);
                    editTextArea.setAutoscrolls(true);
                @Override
                public Object getCellEditorValue() {
                    return theValue;
                @Override
                public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, Object value, boolean isSelected, int row, int column) {
                    editTextArea.setLineWrap(true);
                    theValue = "NEW VALUE";
                    editTextArea.setText(this.theValue);
                    fireEditingStopped(); //IT'S NOT WORKING
                    return editTextArea;
    }

    Thanks a lot.
    It does just what I need, I read it before but I thought that it wasn't the solution to my problem.
    I'll study your code to understand what I did wrong.

  • How to create pseudo table in TextArea ?

         Hello,
    I want to create pseudo table in spark TextArea: put some information in columns. I want to separate each column by adding tab between them (each "cell" from one column should has got the same width), and I have problem when I measure text width. I use label, and method mesure text, for example:
                   var label:Label = new Label();
                    label.regenerateStyleCache(false);
                    var textMetrics:TextLineMetrics = label.measureText("some text with \t\t "); 
                    var spaceWidth:int = textMetrics.width;
    But this method doesn't work, especially when measured text contain TAB, returned value is incorrect.
    Could anybody help me ?

    Try using Spark RichEditableText which makes use of new Text Layout Framework (TLF) library.
    It supports textFlow property which allows to use some HTML tags like <table>,<tr>,<td>.
    Refer example at http://docs.huihoo.com/flex/4/spark/components/RichEditableText.html
    Regards,
    Tanu

  • TextAreas with diefferent height in a Table cell

    Dear All,
    I want to develop an application with textAreas, each has a different different height according to the streing length in the textArea, does anyone has any idea, how to do it?
    Thanks

    Please ignore the last reply I gave you on the subject.

  • How to use the nl2br() function - or addressing textarea formatting issues

    the textarea does not pass line breaks to mysql - the result in the html output is one long string of text. I would like the user to input into the textarea using the enter key to create new paragraphs.
    I am not a php programmer and rely on the dreamweaver data tools and developer tool kit to create my dynamic content.
    Please send sample code for a form that addresses and corrects this issue. I do not know how/where to modify the code to correct this issue.
    I have searched online but nowhere have I found an example of how to actually write the code. I can do a great deal of manual modification of php code but this one has me stumped for some reason..
    thanks in advance !!!!
    here is the index.php code which contains the form:
    PHP:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO tw_responses (id, tweet, response, permalink) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['id'], "int"),
                           GetSQLValueString($_POST['tweet'], "text"),
                           GetSQLValueString($_POST['response'], "text"),
                           GetSQLValueString($_POST['permalink'], "text"));
      mysql_select_db($database_twitter, $twitter);
      $Result1 = mysql_query($insertSQL, $twitter) or die(mysql_error());
      $insertGoTo = "QA.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses";
    $Recordset1 = mysql_query($query_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?php $rs = mysql_fetch_array($resultsetquery);
    $string = nl2br($rs['response']);
    echo($string); ?>
    FORM:
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
                    <table width="461" align="center" cellpadding="4" cellspacing="4">
                      <tr valign="baseline">
                        <td width="71" align="right" nowrap="nowrap">Question:</td>
                        <td width="360"><input type="text" name="tweet" value="" size="50" /></td>
                      </tr>
                      <tr valign="baseline">
                        <td nowrap="nowrap" align="right" valign="top">Answer:</td>
                        <td><textarea name="response" cols="50" rows="15"></textarea></td>
                      </tr>
                      <tr valign="baseline">
                        <td nowrap="nowrap" align="right"> </td>
                        <td><input type="submit" value="Insert record" />
                        <input type="reset" name="Reset" id="button" value="Reset" /></td>
                      </tr>
                    </table>
                    <input type="hidden" name="id" value="" />
                    <input type="hidden" name="MM_insert" value="form1" />
                  </form>
    Here is QA.php code which contains the output:
    PHP
    <?php require_once('../Connections/twitter.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses ORDER BY id ASC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;$maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses ORDER BY id DESC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    OUTPUT:
    <?php do { ?>
      <table width="95%" border="0" cellpadding="4" cellspacing="2">
        <tr>
          <td><a name="<?php echo $row_Recordset1['id']; ?>"></a></td>
        </tr>
        <tr>
          <td><p><strong><em>Question: </em></strong><a href="http://www.halopets.com/test/admin/QA.php#<?php echo $row_Recordset1['id']; ?>"><?php echo $row_Recordset1['tweet']; ?></a></p></td>
        </tr>
        <tr>
          <td><p><strong><em>Answer: </em></strong><?php echo $row_Recordset1['response']; ?></p></td>
        </tr>
        <tr>
          <td><hr width="95%" size="1" noshade="noshade" /><br /></td>
        </tr>
      </table>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

    twinflame wrote:
    the textarea does not pass line breaks to mysql - the result in the html output is one long string of text. I would like the user to input into the textarea using the enter key to create new paragraphs.
    I am not a php programmer and rely on the dreamweaver data tools and developer tool kit to create my dynamic content.
    Please send sample code for a form that addresses and corrects this issue. I do not know how/where to modify the code to correct this issue.
    http://tinymce.moxiecode.com/

Maybe you are looking for

  • My iPhone 4S is not being recognized by my iTunes version 9.2.1 Are they incompatible?

    I have an old Powerbook and G5 tower that both have the old Power PC chips running Leopard. I got the new iPhone 4S today and am unable to sync. Any way to solve?

  • Roadmap UI  - How to create a simple roadmap?

    Hi, I wonder to know the most simple explanation to create an application that uses a Roadmap UI. For example, a Roadmap with 2 steps, and when I click a button in the first step, go to the second step, using BAPI's to validate each step. Anybody giv

  • Nvidia problem.

    Hi! first thx to all. I have an " nvidia geforce4 integrated GPU" ( nForce2) y currently use "nv" driver in xorg. But when I use "nvidia" drive Xserver delay about 2 minutes to run. I have been testing with an " nvidia geforce " ( externel) and it ru

  • Workflow approval/staging/production howto

    Hi I am trying to setup a workflow where in any page added or edited in site studio designer/contributor will have to be first sent to an approving group, then to a staging environment and only then published. I am going through the workflow administ

  • SALES HEADER TEXT

    Dear SAP EXPERT! I need a solution regarding the accounting document please help. We know that the accounting document is generated automatically when the billing is created. The accounting document has feilds HEADER TEXT and the REFERENCE. Is it pos