Help with adding rows to JTable

Could any body help me with the following problem:
I have created form where I use JTable.Initially I should show 5 rows in JTable. User can enter data into the cells.And commit I should store the data in database.
My problem is how to dynamically add rows to JTable as user is entering the data. And how to retain the data in the cells when it is entered.
Right now when user edits a cell and tabs to next one the data in previous cell disappears.
Its Urgent can anybody help me
Thanks in advance
Babu

The number of rows, number of columns, etc, are all determined by the TableModel used in the JTable.
What is the easiest solution is to subclass AbstractTableModel adding methods to support your dynamic row adding/deleting/etc that you need. If you go to the javadoc for JTable, there's a link to a tutorial which contains most of what you need to know.
- David

Similar Messages

  • Help with adding image onclick

    Hey everyone,
    I am making a simple game in AS3 and need help with adding an image once they have click on something.
    On the left of the screen are sentences and on the right an image of a form. When they click each sentence on the left, writing appears on the form. Its very simple. With this said, what I would like to do is once the user click one of the sentences on the left, I would like a checkmark image to appear over the sentence so they know they have already clicked on it.
    How would I go about adding this to my code?
    var fields:Array = new Array();
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
        fields.push(new one_form());
        fields[fields.length-1].x = 141;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);   
        one_btn.removeEventListener(MouseEvent.CLICK, onClick1a);
        one_btn.buttonMode = false;
        //gotoAndStop("one")
    two_btn.addEventListener(MouseEvent.CLICK, onClick2a);
    two_btn.buttonMode = true;
    function onClick2a(event:MouseEvent):void
        fields.push(new two_form());
        fields[fields.length-1].x = 343.25;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);
        two_btn.removeEventListener(MouseEvent.CLICK, onClick2a);
        two_btn.buttonMode = false;
        //gotoAndStop("two")

    I don't know where you're positioning the button that should enable/disable the checkbox but for "one_btn" let's just say it's at position: x=100, y=200. Say you'd want the checkbox to be to the left of it, so the checkbox would be displayed at: x=50, y=200. Also say you have a checkbox graphic in your library, exported for actionscript with the name "CheckBoxGraphic".
    Using your code with some sprinkles:
    // I'd turn this into a sprite but we'll use the default, MovieClip
    var _checkBox:MovieClip = new CheckBoxGraphic();
    // add to display list but hide
    _checkBox.visible = false;
    // just for optimization
    _checkBox.mouseEnabled = false;
    _checkBox.cacheAsBitmap = true;
    // adding it early so make sure the forms loaded don't overlap the
    // checkbox or it will cover it, otherwise swapping of depths is needed
    addChild(_checkBox);
    // I'll use a flag (a reference for this) to know what button is currently pushed
    var _currentButton:Object;
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
         // Check if this button is currently the pressed button
         if (_currentButton == one_btn)
              // disable checkbox, remove form
              _checkBox.visible = false;
              // form should be last added to fields array, remove
              removeChild(fields[fields.length - 1]);
              fields.pop();
              // clear any reference to this button
              _currentButton = null;
         else
              // enable checkbox
              _checkBox.visible = true;
              _checkBox.x = 50;
              _checkBox.y = 200;
              // add form
              fields.push(new one_form());
              fields[fields.length-1].x = 141;
              fields[fields.length-1].y = -85;
              this.addChild(fields[fields.length-1]);
              // save this button as last clicked
              _currentButton = one_btn;
         // not sure what this is
        //gotoAndStop("one")
    I'd also centralize all the click handlers into a single handler and use the buttons name to branch on what to do, but that's a different discussion. Just see if this makes sense to you.
    The jist is a graphic of a checkbox that is a MovieClip symbol in your library exported to actionscript with the class name CheckBoxGraphic() is created and added to the display list.
    I made a variable that points itself to the last clicked button, when the "on" state is desired. If I detect the last clicked button was this button, I remove the form I added and the checkbox. If the last clicked button is not this button, I enable and position the checkbox as well as add the form.
    What is left to do is handle the sitation where multiple buttons are on the screen. When a new button is pushed it should remove anything the previous button added. This code simply demonstrates clicking the same button multiple times to toggle it "on and off".

  • Need help with Pivoting rows to columns

    Hi,
    I need help with pivoting rows to columns. I know there are other posts regarding this, but my requirement is more complex and harder. So, please give me a solution for this.
    There are two tables say Table 1 and Table 2.
    Table1
    name address email identifier
    x e g 1
    f s d 2
    h e n 3
    k l b 4
    Table2
    identifier TRno zno bzid
    1 T11 z11 b11
    1 T12 z12 b12
    1 T13 z13 b13
    2 T21 z21 b21
    2 T22 z22 b22
    As you can see the identifier is the column that we use to map the two tables. The output should be like below
    output
    name address email identifier TRno1 zno1 bzid1 TRno2 zno2 bzid2 TRno3 zno3 bzid3
    x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
    f s d 2 T21 z21 b21 t22 z22 b22
    Also we do not know exactly how many TRno's, zno's, etc each value in the identifier will have. There may be only 1 TRNO, zno and bzid, or there may be four.
    All the values must be in separate columns, and not be just comma delimitted. There are also other conditions that i have to add to restrict the data.
    So, can you please tell me what is should use to get the data in the required format? We are using Oracle 10g. Please let me know if u need any more information

    Something like this ?
    SCOTT@orcl> ed
    Wrote file afiedt.buf
      1  select a.name,
      2  a.address,
      3  a.email,
      4  b.* from (
      5  select distinct identifier
      6  ,max(trno1) trno1
      7  ,max(zno1) zno1
      8  ,max(bzid1) bzid1
      9  ,max(trno2) trno2
    10  ,max(zno2) zno2
    11  ,max(bzid2) bzid2
    12  ,max(trno3) trno3
    13  ,max(zno3) zno3
    14  ,max(bzid3) bzid3
    15  ,max(trno4) trno4
    16  ,max(zno4) zno4
    17  ,max(bzid4) bzid4
    18  from (select identifier
    19  ,decode(rn,1,trno,null) trno1
    20  ,decode(rn,1,zno,null) zno1
    21  ,decode(rn,1,bzid,null) bzid1
    22  ,decode(rn,2,trno,null) trno2
    23  ,decode(rn,2,zno,null) zno2
    24  ,decode(rn,2,bzid,null) bzid2
    25  ,decode(rn,3,trno,null) trno3
    26  ,decode(rn,3,zno,null) zno3
    27  ,decode(rn,3,bzid,null) bzid3
    28  ,decode(rn,4,trno,null) trno4
    29  ,decode(rn,4,zno,null) zno4
    30  ,decode(rn,4,bzid,null) bzid4
    31  from (select identifier,
    32  trno,bzid,zno,
    33  dense_rank() over(partition by identifier order by trno,rownum) rn
    34  from table2)
    35  order by identifier)
    36  group by identifier) b,table1 a
    37* where a.identifier=b.identifier
    SCOTT@orcl> /
    NAME       ADDRESS    EMAIL      IDENTIFIER TRNO1      ZNO1       BZID1      TRNO2      ZNO2       BZID2      TRNO3      ZNO3       BZID3      TRNO4      ZNO4       BZID4
    x          e          g          1          T11        z11        b11        T12        z12        b12        T13        z13        b13
    f          s          d          2          T21        z21        b21        T22        z22        b22
    SCOTT@orcl> select * from table1;
    NAME       ADDRESS    EMAIL      IDENTIFIER
    x          e          g          1
    f          s          d          2
    h          e          n          3
    k          l          b          4
    SCOTT@orcl> select * from table2;
    IDENTIFIER TRNO       ZNO        BZID
    1          T11        z11        b11
    1          T12        z12        b12
    1          T13        z13        b13
    2          T21        z21        b21
    2          T22        z22        b22
    SCOTT@orcl>Regards
    Girish Sharma

  • Help with adding a hyperlink to a button?

    We have a simple little site we built in Catalyst and everything works great. The only problem is that we cannot figure out how to add a hyperlink to one of the buttons in the animation. We simply want to be able to click on the button and go to another site (the client's Facebook page specifically). Can anyone provide some insight? Thanks!

    The message you sent requires that you verify that you
    are a real live human being and not a spam source.
    To complete this verification, simply reply to this message and leave
    the subject line intact.
    The headers of the message sent from your address are shown below:
    From [email protected] Tue Nov 03 19:08:07 2009
    Received: from mail.sgaur.hosted.jivesoftware.com (209.46.39.252:45105)
    by host.pdgcreative.com with esmtp (Exim 4.69)
    (envelope-from <[email protected]>)
    id 1N5TPy-0001Sp-J1
    for [email protected]; Tue, 03 Nov 2009 19:08:07 -0500
    Received: from sgaurwa43p (unknown 10.137.24.44)
         by mail.sgaur.hosted.jivesoftware.com (Postfix) with ESMTP id 946C5E3018D
         for <[email protected]>; Tue,  3 Nov 2009 17:08:03 -0700 (MST)
    Date: Tue, 03 Nov 2009 17:07:49 -0700
    From: Tvoliter <[email protected]>
    Reply-To: [email protected]
    To: Matthew Pendergraff <[email protected]>
    Message-ID: <299830586.358941257293283616.JavaMail.jive@sgaurwa43p>
    Subject: Help with adding a hyperlink to a button?
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="----=_Part_36702_1132901390.1257293269030"
    Content-Disposition: inline
    X-Spam-Status: No, score=-3.4
    X-Spam-Score: -33
    X-Spam-Bar: ---
    X-Spam-Flag: NO

  • Need help with adding emoji to my hubby's phone don't see it when I click on the keyboard tab

    I need help with adding emoji to my hubby's iPhone when I go to settings then the keyboard tab it's not there

    I did that bad it's not there and doesn't give me to option to click on it

  • Need help with inserting rows in ResultSet and JTable

    hello Guru!
    i have inserted a row in my result set and i want that my table shows this row promptly after i have inserted it in my result set...
    but when i use following code for my resultset:
    rs.moveToInsertRow();
    rs.updateInt(1,nr);
    rs.updateString(2, name);
    rs.insertRow();
    Record are inserted in resultset and database but not shown in my JTable??
    Anyone a Clue to without reexecuting the query how can i display inserted row in JTable
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.h
    I have refrered the following links but still clue less help Guruuuuuuu
    i m really in trobble??????

    i am just near by the Solution using the Database Metadata
    by couldn't get the ideaaaa
    ==================================================
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.htm
    Seeing Database Changes Made Internally and Externally
    This section discusses the ability of a result set to see the following:
    its own changes (DELETE, UPDATE, or INSERT operations within the result set), referred to as internal changes
    changes made from elsewhere (either from your own transaction outside the result set, or from other committed transactions), referred to as external changes
    Near the end of the section is a summary table.
    Note:
    External changes are referred to as "other's changes" in the Sun Microsystems JDBC 2.0 specification.
    Seeing Internal Changes
    The ability of an updatable result set to see its own changes depends on both the result set type and the kind of change (UPDATE, DELETE, or INSERT). This is discussed at various points throughout the "Updating Result Sets" section beginning on , and is summarized as follows:
    Internal DELETE operations are visible for scrollable result sets (scroll-sensitive or scroll-insensitive), but are not visible for forward-only result sets.
    After you delete a row in a scrollable result set, the preceding row becomes the new current row, and subsequent row numbers are updated accordingly.
    Internal UPDATE operations are always visible, regardless of the result set type (forward-only, scroll-sensitive, or scroll-insensitive).
    Internal INSERT operations are never visible, regardless of the result set type (neither forward-only, scroll-sensitive, nor scroll-insensitive).
    An internal change being "visible" essentially means that a subsequent getXXX() call will see the data changed by a preceding updateXXX() call on the same data item.
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean ownDeletesAreVisible(int) throws SQLException
    boolean ownUpdatesAreVisible(int) throws SQLException
    boolean ownInsertsAreVisible(int) throws SQLException
    Note:
    When you make an internal change that causes a trigger to execute, the trigger changes are effectively external changes. However, if the trigger affects data in the row you are updating, you will see those changes for any scrollable/updatable result set, because an implicit row refetch occurs after the update.
    Seeing External Changes
    Only a scroll-sensitive result set can see external changes to the underlying database, and it can only see the changes from external UPDATE operations. Changes from external DELETE or INSERT operations are never visible.
    Note:
    Any discussion of seeing changes from outside the enclosing transaction presumes the transaction itself has an isolation level setting that allows the changes to be visible.
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean othersDeletesAreVisible(int) throws SQLException
    boolean othersUpdatesAreVisible(int) throws SQLException
    boolean othersInsertsAreVisible(int) throws SQLException
    Note:
    Explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from this discussion of visibility. For example, even though external updates are "invisible" to a scroll-insensitive result set, you can explicitly refetch rows in a scroll-insensitive/updatable result set and retrieve external changes that have been made. "Visibility" refers only to the fact that the scroll-insensitive/updatable result set would not see such changes automatically and implicitly.
    Visibility versus Detection of External Changes
    Regarding changes made to the underlying database by external sources, there are two similar but distinct concepts with respect to visibility of the changes from your local result set:
    visibility of changes
    detection of changes
    A change being "visible" means that when you look at a row in the result set, you can see new data values from changes made by external sources to the corresponding row in the database.
    A change being "detected", however, means that the result set is aware that this is a new value since the result set was first populated.
    With Oracle8i release 8.1.6 and higher, even when an Oracle result set sees new data (as with an external UPDATE in a scroll-sensitive result set), it has no awareness that this data has changed since the result set was populated. Such changes are not "detected".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException
    It follows, then, that result set methods specified by JDBC 2.0 to detect changes--rowDeleted(), rowUpdated(), and rowInserted()--will always return false with the 8.1.6 Oracle JDBC drivers. There is no use in calling them.
    Summary of Visibility of Internal and External Changes
    Table 12-1 summarizes the discussion in the preceding sections regarding whether a result set object in the Oracle JDBC implementation can see changes made internally through the result set itself, and changes made externally to the underlying database from elsewhere in your transaction or from other committed transactions.
    Table 12-1 Visibility of Internal and External Changes for Oracle JDBC
    Result Set Type Can See Internal DELETE? Can See Internal UPDATE? Can See Internal INSERT? Can See External DELETE? Can See External UPDATE? Can See External INSERT?
    forward-only
    no
    yes
    no
    no
    no
    no
    scroll-sensitive
    yes
    yes
    no
    no
    yes
    no
    scroll-insensitive
    yes
    yes
    no
    no
    no
    no
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    Notes:
    Remember that explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from the concept of "visibility" of external changes. This is discussed in "Seeing External Changes".
    Remember that even when external changes are "visible", as with UPDATE operations underlying a scroll-sensitive result set, they are not "detected". The result set rowDeleted(), rowUpdated(), and rowInserted() methods always return false. This is further discussed in "Visibility versus Detection of External Changes".
    Oracle Implementation of Scroll-Sensitive Result Sets
    The Oracle implementation of scroll-sensitive result sets involves the concept of a window, with a window size that is based on the fetch size. The window size affects how often rows are updated in the result set.
    Once you establish a current row by moving to a specified row (as described in "Positioning in a Scrollable Result Set"), the window consists of the N rows in the result set starting with that row, where N is the fetch size being used by the result set (see "Fetch Size"). Note that there is no current row, and therefore no window, when a result set is first created. The default position is before the first row, which is not a valid current row.
    As you move from row to row, the window remains unchanged as long as the current row stays within that window. However, once you move to a new current row outside the window, you redefine the window to be the N rows starting with the new current row.
    Whenever the window is redefined, the N rows in the database corresponding to the rows in the new window are automatically refetched through an implicit call to the refreshRow() method (described in "Refetching Rows"), thereby updating the data throughout the new window.
    So external updates are not instantaneously visible in a scroll-sensitive result set; they are only visible after the automatic refetches just described.
    For a sample application that demonstrates the functionality of a scroll-sensitive result set, see "Scroll-Sensitive Result Set--ResultSet5.java".
    Note:
    Because this kind of refetching is not a highly efficient or optimized methodology, there are significant performance concerns. Consider carefully before using scroll-sensitive result sets as currently implemented. There is also a significant tradeoff between sensitivity and performance. The most sensitive result set is one with a fetch size of 1, which would result in the new current row being refetched every time you move between rows. However, this would have a significant impact on the performance of your application.
    how can i implement this using
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException

  • [CS3 JS] Help with adding textMacros

    I can get a textMacro added with the following.
    app.textMacros.add("myName", "this is some text")
    What I am having trouble with is having the Remember Text Attributes be grabed or set to true.
    Any one know what the syntax is for setting this during the add()
    also how do you insert a macro via a javascript?
    Mahalo
    David

    These forums are pointless. Adobe must believe that other users will cut the mustard. Absolutely a waste of effort for everyone. Adobe should PAY at least a junior developer involved in the projects to monitor and help with these posts. FLEX rules yeah and thousands more do scripting than develop plug ins...
    Come on Adobe, step up your better than this. Customer Service can be free to the customers ... we are not talking about GET IT ALL FREE, talking about buy it and create a community and support it, but then again LAYERS and INDESIGN SECRETS have people who actually want to help users rather than rabbit hole everything.
    Please join hands and SING...

  • Help With Adding Back Up of Songs & Lists on Re-Installed iTunes v 7.0.2

    I have a portable hard drive with a back up of my 10,000 songs. I have to get my Gateway PC laptop serviced as it continues to crash, and so I will need to re-install iTunes v 7.0.2 and then add back my songs from the portable hard drive.
    I need help with a couple of questions:
    1) Is there a quicker way to add the songs back on to iTunes rather than adding individual files (for songs) and individual folders (for albums)?
    2) I have several song lists (some used to make CD's). How can these lists be backed up as well so that I do not have to re-create these lists?
    Any advice very much appreciated.

    There is a good article on backup here:
    http://discussions.apple.com/thread.jspa?messageID=1522195&#1522195
    If all your music is in the iTunes Music folder and you have room, just copy the iTunes folder to your external drive.
    This will include both your music files and the iTunes library files.
    If you music is stored in other places, you need to backup those too. When you restore you need to ensure the full path name is the same.
    Life is also much easier if you can keep exactly the same account name if you reinsall windows as the account name is part of the path to My Documents.

  • Archive applet. Help with adding files to archive, then show.

    I need help with this applet: http://pastebin.com/589064
    The user is supposed to add, remove and open archives with text in it.
    My problem is now the highlited area in the code (the lines with the @@'s).
    This button should list all files i have added to the archive, however when i press the button, i only get a numberlisting. eg, if i have added 4 files to the archive I get: 0123
    However I want the Joptionpane to show a listing of the files in the archive.
    When I press "open" i can choose a file, press add, then open a new file, press add, and then when i click show archive, the filenames of the two files i added, should list through a Joptionpane..as you can see, i've tried, but i'm very unfamiliar with this.

    OK..i've done it
    check out http://pastebin.com/589268
    however, now i'd like to change the code, so that if i try to add to files with the same filename, the applet should show an error message..
    How do i do that, please? :-)

  • Need help with adding images option

    I was using the add images option a few weeks ago just fine.. using my tablet and uploading the images via usb. then all of the sudden it stopped working.
    please help with this issue.
    Danny

    A few questions. What result are you experiencing? Did PS Touch crash? Have you tried to force quit-and restart PS Touch? -Guido

  • Adding rows to Jtable with spanded cells

    I have a jtable with multiple spanded cells. I am using a custom jtable(the code is in http://www2.gol.com/users/tame/swing/examples/JTableExamples4.html) but i need insert a new row when you click on a button.
    I doing this:
    jtable.getModel().addRow(vector);
    but it throws an exception:
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException: 11 >= 11
    at java.util.Vector.elementAt(Unknown Source)
    at javax.swing.table.DefaultTableModel.getValueAt(Unknown Source)
    at javax.swing.JTable.getValueAt(Unknown Source)
    at javax.swing.JTable.prepareRenderer(Unknown Source)
    at jp.gr.java_conf.tame.swing.table.MultiSpanCellTableUI.paintCell(MultiSpanCellTableUI.java:96)
    at jp.gr.java_conf.tame.swing.table.MultiSpanCellTableUI.paintRow(MultiSpanCellTableUI.java:68)
    at jp.gr.java_conf.tame.swing.table.MultiSpanCellTableUI.paint(MultiSpanCellTableUI.java:39)
    at javax.swing.plaf.ComponentUI.update(Unknown Source)
    at javax.swing.JComponent.paintComponent(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JViewport.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintWithBuffer(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Can anybody help me

    I am using the same code in http://www.codeguru.com/java/articles/139.shtml but it thorws the same exception.
    I need a solution it is urgent

  • Help with multilined cells in JTable?

    Can someone plz help me with this class, I want to make cells multilined. I tried cellrenderer but without succes... :-(
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    public class GK_Styringspunkter extends JFrame
         Container panel = getContentPane();
         JTable tabel;
         DataModel model;
         JScrollPane scroll;
    GK_Styringspunkter()
              model = new DataModel();
              tabel = new JTable(model);
              scroll = new JScrollPane(tabel);
              panel.add("Center",scroll);
              setSize(1024,768);
              setVisible(true);
    class DataModel extends AbstractTableModel
         String hoved[];
         Object data[][];
         DataModel()
              hoved = new String[]{"Processtrin","Kritisk styringspunkt","Risikofaktor","Styrende foranstaltning",
              "Kritisk gr�nse","Overv�gning","Afhj�lpende foranstaltning","Ansvarlig"};
              data = new Object[1][8];
              data[0][0] = "Fiskeafdelingen";
              data[0][1] = "Temperatur";
              data[0][2] = "Opformering af mikroorganismer";
              data[0][3] = "Temperatur kontrol ved modtagelse";
              data[0][4] = "Frisk fisk:2C R�get fisk: 5C";
    void opdater()
    public int getColumnCount()
    return hoved.length;
    public int getRowCount()
    return data.length;
    public String getColumnName(int col)
    return hoved[col];
    public Object getValueAt(int row, int col)
    return data[row][col];
    public boolean isCellEditable(int row, int col)
    return true;
    public void setValueAt(Object value, int row, int col)
    data[row][col] = value;
    fireTableCellUpdated(row,col);      
    public static void main(String[] aslan)
         new GK_Styringspunkter();
    }

    sorry my fault... but when I try like this am still not getting the multilines in cells?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.border.*;
    public class GK_Styringspunkter extends JFrame
         Container panel = getContentPane();
         JTable tabel;
         DataModel model;
         JScrollPane scroll;
    GK_Styringspunkter()
              model = new DataModel();
              tabel = new JTable(model);
              tabel.setRowHeight(0, 60);
              tabel.setDefaultRenderer(String.class, new MultiLineRenderer());
              scroll = new JScrollPane(tabel);
              panel.add("Center",scroll);
              setSize(1024,768);
              setVisible(true);
    class DataModel extends AbstractTableModel
         String hoved[];
         Object data[][];
         DataModel()
              hoved = new String[]{"Processtrin","Kritisk styringspunkt","Risikofaktor","Styrende foranstaltning",
              "Kritisk gr�nse","Overv�gning","Afhj�lpende foranstaltning","Ansvarlig"};
              data = new Object[1][8];
              data[0][0] = "Fiskeafdelingen";
              data[0][1] = "Temperatur";
              data[0][2] = "Opformering \n af mikroorganismer";
              data[0][3] = "Temperatur kontrol \n ved modtagelse";
              data[0][4] = "Frisk fisk:2C \n R�get fisk: 5C";
    void opdater()
    public int getColumnCount()
    return hoved.length;
    public int getRowCount()
    return data.length;
    public String getColumnName(int col)
    return hoved[col];
    public Object getValueAt(int row, int col)
    return data[row][col];
    public boolean isCellEditable(int row, int col)
    return true;
    public void setValueAt(Object value, int row, int col)
    data[row][col] = value;
    fireTableCellUpdated(row,col);      
    class MultiLineRenderer extends JTextArea implements javax.swing.table.TableCellRenderer
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
         setLineWrap(true);
         setText((String)value);
         if (isSelected)setBackground(Color.BLUE);
         else setBackground(Color.WHITE);
         return this;
    public static void main(String[] aslan)
         new GK_Styringspunkter();

  • Help with adding new song to 2007 iPod shuffle

    I have an iPod shuffle from 2007 and just recently went to add new songs to it.  Itunes program keeps telling me I have to erase everything and reload w/ new playlist I've added??  Confused, don't remember it working like this last year when I added songs.  Any help??

    With the 1st and 2nd gen iPod shuffle, it can only be associated with one iTunes library at a time.  That has always been the design.  It is basically like a mobile playlist for iTunes the library.  The 3rd and 4th gen shuffles work more like the "bigger" iPods that have a screen, which is different from the very simple 1st and 2nd gen.
    If you previously used this shuffle with a different iTunes library, iTunes is asking if you want to associate the shuffle with the iTunes library you are now using.
    Any help??
    What do you want to do...?

  • Help With adding a scrollbar to my applet

    This is the source code of my applet.I wat to have an autoscroll on this applet
    i think it is usefull if i put here all the code for my project.
    ======================================================
    Class ConsolePanel:
    The file defines a class ConsolePanel. Objects of type
    ConsolePanel can be used for simple input/output exchanges with
    the user. Various routines are provided for reading and writing
    values of various types from the output. (This class gives all
    the I/O behavior of another class, Console, that represents a
    separate window for doing console-style I/O.)
    This class is dependent on another class, ConsoleCanvas.
    Note that when the console has the input focus, it is outlined with
    a bright blue border. If, in addition, the console is waiting for
    user input, then there will be a blinking cursor. If the console
    is not outlined in light blue, the user has to click on it before
    any input will be accepted.
    This is an update an earlier version of the same class,
    rewritten to use realToString() for output of floating point
    numbers..
    package myproj;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JScrollPane;
    import javax.swing.JScrollBar;
    import javax.swing.*;
    public class ConsolePanel extends JTextArea{
    static public JScrollPane scrollPane;
    // ***************************** Constructors *******************************
    public ConsolePanel() { // default constructor just provides default window title and size
    setBackground(Color.white);
    setLayout(new BorderLayout(0, 0));
    canvas = new ConsoleCanvas(500,1000);
    scrollPane = new JScrollPane(canvas);
    scrollPane.setVerticalScrollBarPolicy(
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize( new Dimension( 1000,10000) );
    add("Center", scrollPane);
    //scrollPane.getVerticalScrollBar().setUnitIncrement(1);
    try {
    jbInit();
    } catch (Exception ex) {
    ex.printStackTrace();
    public void clear() { // clear all characters from the canvas
    canvas.clear();
    // *************************** I/O Methods *********************************
    // Methods for writing the primitive types, plus type String,
    // to the console window, with no extra spaces.
    // Note that the real-number data types, float
    // and double, a rounded version is output that will
    // use at most 10 or 11 characters. If you want to
    // output a real number with full accuracy, use
    // "con.put(String.valueOf(x))", for example.
    public void put(int x) {
    put(x, 0);
    } // Note: also handles byte and short!
    public void put(long x) {
    put(x, 0);
    public void put(double x) {
    put(x, 0);
    } // Also handles float.
    public void put(char x) {
    put(x, 0);
    public void put(boolean x) {
    put(x, 0);
    public void put(String x) {
    put(x, 0);
    // Methods for writing the primitive types, plus type String,
    // to the console window,followed by a carriage return, with
    // no extra spaces.
    public void putln(int x) {
    put(x, 0);
    newLine();
    } // Note: also handles byte and short!
    public void putln(long x) {
    put(x, 0);
    newLine();
    public void putln(double x) {
    put(x, 0);
    newLine();
    } // Also handles float.
    public void putln(char x) {
    put(x, 0);
    newLine();
    public void putln(boolean x) {
    put(x, 0);
    newLine();
    public void putln(String x) {
    put(x, 0);
    newLine();
    // Methods for writing the primitive types, plus type String,
    // to the console window, with a minimum field width of w,
    // and followed by a carriage return.
    // If outut value is less than w characters, it is padded
    // with extra spaces in front of the value.
    public void putln(int x, int w) {
    put(x, w);
    newLine();
    } // Note: also handles byte and short!
    public void putln(long x, int w) {
    put(x, w);
    newLine();
    public void putln(double x, int w) {
    put(x, w);
    newLine();
    } // Also handles float.
    public void putln(char x, int w) {
    put(x, w);
    newLine();
    public void putln(boolean x, int w) {
    put(x, w);
    newLine();
    public void putln(String x, int w) {
    put(x, w);
    newLine();
    // Method for outputting a carriage return
    public void putln() {
    newLine();
    // Methods for writing the primitive types, plus type String,
    // to the console window, with minimum field width w.
    public void put(int x, int w) {
    dumpString(String.valueOf(x), w);
    } // Note: also handles byte and short!
    public void put(long x, int w) {
    dumpString(String.valueOf(x), w);
    public void put(double x, int w) {
    dumpString(realToString(x), w);
    } // Also handles float.
    public void put(char x, int w) {
    dumpString(String.valueOf(x), w);
    public void put(boolean x, int w) {
    dumpString(String.valueOf(x), w);
    public void put(String x, int w) {
    dumpString(x, w);
    // Methods for reading in the primitive types, plus "words" and "lines".
    // The "getln..." methods discard any extra input, up to and including
    // the next carriage return.
    // A "word" read by getlnWord() is any sequence of non-blank characters.
    // A "line" read by getlnString() or getln() is everything up to next CR;
    // the carriage return is not part of the returned value, but it is
    // read and discarded.
    // Note that all input methods except getAnyChar(), peek(), the ones for lines
    // skip past any blanks and carriage returns to find a non-blank value.
    // getln() can return an empty string; getChar() and getlnChar() can
    // return a space or a linefeed ('\n') character.
    // peek() allows you to look at the next character in input, without
    // removing it from the input stream. (Note that using this
    // routine might force the user to enter a line, in order to
    // check what the next character.)
    // Acceptable boolean values are the "words": true, false, t, f, yes,
    // no, y, n, 0, or 1; uppercase letters are OK.
    // None of these can produce an error; if an error is found in input,
    // the user is forced to re-enter.
    // Available input routines are:
    // getByte() getlnByte() getShort() getlnShort()
    // getInt() getlnInt() getLong() getlnLong()
    // getFloat() getlnFloat() getDouble() getlnDouble()
    // getChar() getlnChar() peek() getAnyChar()
    // getWord() getlnWord() getln() getString() getlnString()
    // (getlnString is the same as getln and is onlyprovided for consistency.)
    public byte getlnByte() {
    byte x = getByte();
    emptyBuffer();
    return x;
    public short getlnShort() {
    short x = getShort();
    emptyBuffer();
    return x;
    public int getlnInt() {
    int x = getInt();
    emptyBuffer();
    return x;
    public long getlnLong() {
    long x = getLong();
    emptyBuffer();
    return x;
    public float getlnFloat() {
    float x = getFloat();
    emptyBuffer();
    return x;
    public double getlnDouble() {
    double x = getDouble();
    emptyBuffer();
    return x;
    public char getlnChar() {
    char x = getChar();
    emptyBuffer();
    return x;
    public boolean getlnBoolean() {
    boolean x = getBoolean();
    emptyBuffer();
    return x;
    public String getlnWord() {
    String x = getWord();
    emptyBuffer();
    return x;
    public String getlnString() {
    return getln();
    } // same as getln()
    public String getln() {
    StringBuffer s = new StringBuffer(100);
    char ch = readChar();
    while (ch != '\n') {
    s.append(ch);
    ch = readChar();
    return s.toString();
    public byte getByte() {
    return (byte) readInteger( -128L, 127L);
    public short getShort() {
    return (short) readInteger( -32768L, 32767L);
    public int getInt() {
    return (int) readInteger((long) Integer.MIN_VALUE,
    (long) Integer.MAX_VALUE);
    public long getLong() {
    return readInteger(Long.MIN_VALUE, Long.MAX_VALUE);
    public char getAnyChar() {
    return readChar();
    public char peek() {
    return lookChar();
    public char getChar() { // skip spaces & cr's, then return next char
    char ch = lookChar();
    while (ch == ' ' || ch == '\n') {
    readChar();
    if (ch == '\n') {
    dumpString("? ", 0);
    ch = lookChar();
    return readChar();
    public float getFloat() { // can return positive or negative infinity
    float x = 0.0F;
    while (true) {
    String str = readRealString();
    if (str.equals("")) {
    errorMessage("Illegal floating point input.",
    "Real number in the range " + Float.MIN_VALUE +
    " to " + Float.MAX_VALUE);
    } else {
    Float f = null;
    try {
    f = Float.valueOf(str);
    } catch (NumberFormatException e) {
    errorMessage("Illegal floating point input.",
    "Real number in the range " + Float.MIN_VALUE +
    " to " + Float.MAX_VALUE);
    continue;
    if (f.isInfinite()) {
    errorMessage("Floating point input outside of legal range.",
    "Real number in the range " + Float.MIN_VALUE +
    " to " + Float.MAX_VALUE);
    continue;
    x = f.floatValue();
    break;
    return x;
    public double getDouble() {
    double x = 0.0;
    while (true) {
    String str = readRealString();
    if (str.equals("")) {
    errorMessage("Illegal floating point input",
    "Real number in the range " + Double.MIN_VALUE +
    " to " + Double.MAX_VALUE);
    } else {
    Double f = null;
    try {
    f = Double.valueOf(str);
    } catch (NumberFormatException e) {
    errorMessage("Illegal floating point input",
    "Real number in the range " + Double.MIN_VALUE +
    " to " + Double.MAX_VALUE);
    continue;
    if (f.isInfinite()) {
    errorMessage("Floating point input outside of legal range.",
    "Real number in the range " + Double.MIN_VALUE +
    " to " + Double.MAX_VALUE);
    continue;
    x = f.doubleValue();
    break;
    return x;
    public String getWord() {
    char ch = lookChar();
    while (ch == ' ' || ch == '\n') {
    readChar();
    if (ch == '\n') {
    dumpString("? ", 0);
    ch = lookChar();
    StringBuffer str = new StringBuffer(50);
    while (ch != ' ' && ch != '\n') {
    str.append(readChar());
    ch = lookChar();
    return str.toString();
    public boolean getBoolean() {
    boolean ans = false;
    while (true) {
    String s = getWord();
    if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t") ||
    s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y") ||
    s.equals("1")) {
    ans = true;
    break;
    } else if (s.equalsIgnoreCase("false") || s.equalsIgnoreCase("f") ||
    s.equalsIgnoreCase("no") || s.equalsIgnoreCase("n") ||
    s.equals("0")) {
    ans = false;
    break;
    } else {
    errorMessage("Illegal boolean input value.",
    "one of: true, false, t, f, yes, no, y, n, 0, or 1");
    return ans;
    // ***************** Everything beyond this point is private *******************
    // ********************** Utility routines for input/output ********************
    private ConsoleCanvas canvas; // the canvas where I/O is displayed
    private String buffer = null; // one line read from input
    private int pos = 0; // position next char in input line that has
    // not yet been processed
    private String readRealString() { // read chars from input following syntax of real numbers
    StringBuffer s = new StringBuffer(50);
    char ch = lookChar();
    while (ch == ' ' || ch == '\n') {
    readChar();
    if (ch == '\n') {
    dumpString("? ", 0);
    ch = lookChar();
    if (ch == '-' || ch == '+') {
    s.append(readChar());
    ch = lookChar();
    while (ch == ' ') {
    readChar();
    ch = lookChar();
    } while (ch >= '0' && ch <= '9') {
    s.append(readChar());
    ch = lookChar();
    if (ch == '.') {
    s.append(readChar());
    ch = lookChar();
    while (ch >= '0' && ch <= '9') {
    s.append(readChar());
    ch = lookChar();
    if (ch == 'E' || ch == 'e') {
    s.append(readChar());
    ch = lookChar();
    if (ch == '-' || ch == '+') {
    s.append(readChar());
    ch = lookChar();
    } while (ch >= '0' && ch <= '9') {
    s.append(readChar());
    ch = lookChar();
    return s.toString();
    private long readInteger(long min, long max) { // read long integer, limited to specified range
    long x = 0;
    while (true) {
    StringBuffer s = new StringBuffer(34);
    char ch = lookChar();
    while (ch == ' ' || ch == '\n') {
    readChar();
    if (ch == '\n') {
    dumpString("? ", 0);
    ch = lookChar();
    if (ch == '-' || ch == '+') {
    s.append(readChar());
    ch = lookChar();
    while (ch == ' ') {
    readChar();
    ch = lookChar();
    } while (ch >= '0' && ch <= '9') {
    s.append(readChar());
    ch = lookChar();
    if (s.equals("")) {
    errorMessage("Illegal integer input.",
    "Integer in the range " + min + " to " + max);
    } else {
    String str = s.toString();
    try {
    x = Long.parseLong(str);
    } catch (NumberFormatException e) {
    errorMessage("Illegal integer input.",
    "Integer in the range " + min + " to " + max);
    continue;
    if (x < min || x > max) {
    errorMessage("Integer input outside of legal range.",
    "Integer in the range " + min + " to " + max);
    continue;
    break;
    return x;
    private static String realToString(double x) {
    // Goal is to get a reasonable representation of x in at most
    // 10 characters, or 11 characters if x is negative.
    if (Double.isNaN(x)) {
    return "undefined";
    if (Double.isInfinite(x)) {
    if (x < 0) {
    return "-INF";
    } else {
    return "INF";
    if (Math.abs(x) <= 5000000000.0 && Math.rint(x) == x) {
    return String.valueOf((long) x);
    String s = String.valueOf(x);
    if (s.length() <= 10) {
    return s;
    boolean neg = false;
    if (x < 0) {
    neg = true;
    x = -x;
    s = String.valueOf(x);
    if (x >= 0.00005 && x <= 50000000 &&
    (s.indexOf('E') == -1 && s.indexOf('e') == -1)) { // trim x to 10 chars max
    s = round(s, 10);
    s = trimZeros(s);
    } else if (x > 1) { // construct exponential form with positive exponent
    long power = (long) Math.floor(Math.log(x) / Math.log(10));
    String exp = "E" + power;
    int numlength = 10 - exp.length();
    x = x / Math.pow(10, power);
    s = String.valueOf(x);
    s = round(s, numlength);
    s = trimZeros(s);
    s += exp;
    } else { // constuct exponential form
    long power = (long) Math.ceil( -Math.log(x) / Math.log(10));
    String exp = "E-" + power;
    int numlength = 10 - exp.length();
    x = x * Math.pow(10, power);
    s = String.valueOf(x);
    s = round(s, numlength);
    s = trimZeros(s);
    s += exp;
    if (neg) {
    return "-" + s;
    } else {
    return s;
    private static String trimZeros(String num) { // used by realToString
    if (num.indexOf('.') >= 0 && num.charAt(num.length() - 1) == '0') {
    int i = num.length() - 1;
    while (num.charAt(i) == '0') {
    i--;
    if (num.charAt(i) == '.') {
    num = num.substring(0, i);
    } else {
    num = num.substring(0, i + 1);
    return num;
    private static String round(String num, int length) { // used by realToString
    if (num.indexOf('.') < 0) {
    return num;
    if (num.length() <= length) {
    return num;
    if (num.charAt(length) >= '5' && num.charAt(length) != '.') {
    char[] temp = new char[length + 1];
    int ct = length;
    boolean rounding = true;
    for (int i = length - 1; i >= 0; i--) {
    temp[ct] = num.charAt(i);
    if (rounding && temp[ct] != '.') {
    if (temp[ct] < '9') {
    temp[ct]++;
    rounding = false;
    } else {
    temp[ct] = '0';
    ct--;
    if (rounding) {
    temp[ct] = '1';
    ct--;
    // ct is -1 or 0
    return new String(temp, ct + 1, length - ct);
    } else {
    return num.substring(0, length);
    private void dumpString(String str, int w) { // output string to console
    for (int i = str.length(); i < w; i++) {
    canvas.addChar(' ');
    for (int i = 0; i < str.length(); i++) {
    if ((int) str.charAt(i) >= 0x20 && (int) str.charAt(i) != 0x7F) { // no control chars or delete
    canvas.addChar(str.charAt(i));
    } else if (str.charAt(i) == '\n' || str.charAt(i) == '\r') {
    newLine();
    private void errorMessage(String message, String expecting) {
    // inform user of error and force user to re-enter.
    newLine();
    dumpString(" *** Error in input: " + message + "\n", 0);
    dumpString(" *** Expecting: " + expecting + "\n", 0);
    dumpString(" *** Discarding Input: ", 0);
    if (lookChar() == '\n') {
    dumpString("(end-of-line)\n\n", 0);
    } else {
    while (lookChar() != '\n') {
    canvas.addChar(readChar());
    dumpString("\n\n", 0);
    dumpString("Please re-enter: ", 0);
    readChar(); // discard the end-of-line character
    private char lookChar() { // return next character from input
    if (buffer == null || pos > buffer.length()) {
    fillBuffer();
    if (pos == buffer.length()) {
    return '\n';
    return buffer.charAt(pos);
    private char readChar() { // return and discard next character from input
    char ch = lookChar();
    pos++;
    return ch;
    private void newLine() { // output a CR to console
    canvas.addCR();
    private void fillBuffer() { // Wait for user to type a line and press return,
    // and put the typed line into the buffer.
    buffer = canvas.readLine();
    pos = 0;
    private void emptyBuffer() { // discard the rest of the current line of input
    buffer = null;
    public void clearBuffers() { // I expect this will only be called by
    // CanvasApplet when a program ends. It should
    // not be called in the middle of a running program.
    buffer = null;
    canvas.clearTypeAhead();
    private void jbInit() throws Exception {
    this.setNextFocusableComponent(scrollPane);
    this.setToolTipText("");
    } // end of class Console
    ============================================================
    Class ConsoleCanvas:
    /* A class that implements basic console-oriented input/output, for use with
    Console.java and ConsolePanel.java. This class provides the basic character IO.
    Higher-leve fucntions (reading and writing numbers, booleans, etc) are provided
    in Console.java and ConolePanel.java.
    (This vesion of ConsoleCanvas is an udate of an earilier version, rewritten to
    be compliand with Java 1.1. David Eck; July 17, 1998.)
    (Modified August 16, 1998 to add the
    a mousePressed method to ConsoleCanvas. The mousePressed method requests
    the focus. This is necessary for Sun's Java implementation -- though not,
    apparently for anyone else's. Also added: an isFocusTraversable() method)
    MouseListener interface and
    Minor modifications, February 9, 2000, some glitches in the graphics.
    package myproj;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    public class ConsoleCanvas extends JTextArea implements FocusListener, KeyListener,
    MouseListener {
    // public interface, constructor and methods
    public ConsoleCanvas(int u,int y) {
    addFocusListener(this);
    addKeyListener(this);
    try {
    jbInit();
    } catch (Exception ex) {
    ex.printStackTrace();
    public final String readLine() { // wait for user to enter a line of input;
    // Line can only contain characters in the range
    // ' ' to '~'.
    return doReadLine();
    public final void addChar(char ch) { // output PRINTABLE character to console
    putChar(ch);
    public final void addCR() { // add a CR to the console
    putCR();
    public synchronized void clear() { // clear console and return cursor to row 0, column 0.
    if (OSC == null) {
    return;
    currentRow = 0;
    currentCol = 0;
    OSCGraphics.setColor(Color.white);
    OSCGraphics.fillRect(4, 4, getSize().width - 8, getSize().height - 8);
    OSCGraphics.setColor(Color.black);
    repaint();
    try {
    Thread.sleep(25);
    } catch (InterruptedException e) {}
    // focus and key event handlers; not meant to be called excpet by system
    public void keyPressed(KeyEvent evt) {
    doKey(evt.getKeyChar());
    public void keyReleased(KeyEvent evt) {}
    public void keyTyped(KeyEvent evt) {}
    public void focusGained(FocusEvent evt) {
    doFocus(true);
    public void focusLost(FocusEvent evt) {
    doFocus(false);
    public boolean isFocusTraversable() {
    // Allows the user to move the focus to the canvas
    // by pressing the tab key.
    return true;
    // Mouse listener methods -- here just to make sure that the canvas
    // gets the focuse when the user clicks on it. These are meant to
    // be called only by the system.
    public void mousePressed(MouseEvent evt) {
    requestFocus();
    public void mouseReleased(MouseEvent evt) {}
    public void mouseClicked(MouseEvent evt) {}
    public void mouseEntered(MouseEvent evt) {}
    public void mouseExited(MouseEvent evt) {}
    // implementation section: protected variables and methods.
    protected StringBuffer typeAhead = new StringBuffer();
    // Characters typed by user but not yet processed;
    // User can "type ahead" the charcters typed until
    // they are needed to satisfy a readLine.
    protected final int maxLineLength = 256;
    // No lines longer than this are returned by readLine();
    // The system effectively inserts a CR after 256 chars
    // of input without a carriage return.
    protected int rows, columns; // rows and columns of chars in the console
    protected int currentRow, currentCol; // current curson position
    protected Font font; // Font used in console (Courier); All font
    // data is set up in the doSetup() method.
    protected int lineHeight; // height of one line of text in the console
    protected int baseOffset; // distance from top of a line to its baseline
    protected int charWidth; // width of a character (constant, since a monospaced font is used)
    protected int leading; // space between lines
    protected int topOffset; // distance from top of console to top of text
    protected int leftOffset; // distance from left of console to first char on line
    protected Image OSC; // off-screen backup for console display (except cursor)
    protected Graphics OSCGraphics; // graphics context for OSC
    protected boolean hasFocus = false; // true if this canvas has the input focus
    protected boolean cursorIsVisible = false; // true if cursor is currently visible
    private int pos = 0; // exists only for sharing by next two methods
    public synchronized void clearTypeAhead() {
    // clears any unprocessed user typing. This is meant only to
    // be called by ConsolePanel, when a program being run by
    // console Applet ends. But just to play it safe, pos is
    // set to -1 as a signal to doReadLine that it should return.
    typeAhead.setLength(0);
    pos = -1;
    notify();
    protected synchronized String doReadLine() { // reads a line of input, up to next CR
    if (OSC == null) { // If this routine is called before the console has
    // completely opened, we shouldn't procede; give the
    // window a chance to open, so that paint() can call doSetup().
    try {
    wait(5000);
    } catch (InterruptedException e) {} // notify() should be set by doSetup()
    if (OSC == null) { // If nothing has happened for 5 seconds, we are probably in
    // trouble, but when the heck, try calling doSetup and proceding anyway.
    doSetup();
    if (!hasFocus) { // Make sure canvas has input focus
    requestFocus();
    StringBuffer lineBuffer = new StringBuffer(); // buffer for constructing line from user
    pos = 0;
    while (true) { // Read and process chars from the typeAhead buffer until a CR is found.
    while (pos >= typeAhead.length()) { // If the typeAhead buffer is empty, wait for user to type something
    cursorBlink();
    try {
    wait(500);
    } catch (InterruptedException e) {}
    if (pos == -1) { // means clearTypeAhead was called;
    return ""; // this is an abnormal return that should not happen
    if (cursorIsVisible) {
    cursorBlink();
    if (typeAhead.charAt(pos) == '\r' || typeAhead.charAt(pos) == '\n') {
    putCR();
    pos++;
    break;
    if (typeAhead.charAt(pos) == 8 || typeAhead.charAt(pos) == 127) {
    if (lineBuffer.length() > 0) {
    lineBuffer.setLength(lineBuffer.length() - 1);
    eraseChar();
    pos++;
    } else if (typeAhead.charAt(pos) >= ' ' &&
    typeAhead.charAt(pos) < 127) {
    putChar(typeAhead.charAt(pos));
    lineBuffer.append(typeAhead.charAt(pos));
    pos++;
    } else {
    pos++;
    if (lineBuffer.length() == maxLineLength) {
    putCR();
    pos = typeAhead.length();
    break;
    if (pos >= typeAhead.leng

    Hi
    I don't understand the exact need you want
    you want to add Scrolling facility to your Entire Applet or only for the Textarea Class?
    In first case
    Create the ScrollPane and add it to the applet contentPane. and put entire components to a Panel and just add it to scroll pane.
    Regards
    Vinoth

  • Need help with adding a Key flex field to a seeded OAF page

    We have a seeded OAF page on which we already have Account Key Flex Field.
    Properties of this flex field are:
    The ApplShortName - SQLGL
    Name - GL#
    Type - Key
    As per the client requirement, in the KFF screen, we have disabled the seeded structure for Accounting Flexfield and created a custom structure.
    Our custom structure for the KFF is displayed correctly on the OAF page.
    But now the requirement is to add a new KFF on the OAF page which is duplicate of the existing KFF, along with the existing KFF field; the structure and segments are same. Only difference being the display name of the existing KFF field is Account; the new one needs to be Tax structure.
    Using personalization we added a new flex item and added the properties same as the existing KFF.
    ApplShortName - SQLGL
    Name - GL#
    Type - Key
    But the page is giving following error:
    The data that defines the flexfield on this field may be inconsistent. Inform your system administrator that the function: KeyFlexfieldDefinitionFactory.getStructureNumber could not find the structure definition for the flexfield specified by Application = SQLGL, Code = GL# and Structure number =
    We tried options like compiling the flexfield definition, but the error persists.
    Any help in this regard is highly appreciated.
    Regards,
    Kiranmayi.

    Hi,
    Please check whether your key flex structure is frozen or not. If now please freeze it and re compile and try.
    This may helps too
    error while developing KFF in oaf
    Thanks
    Bharat
    Edited by: Bharat on May 10, 2013 4:51 AM

Maybe you are looking for

  • Question about finding whether a reference number is NOT in the database?

    Hello, I use the following code to test whether the reference number is in the database <ul><li>CURSOR cur_yellow</li></ul> <ul><li>IS SELECT</li></ul> <ul><li>REFERENCE_NO,</li></ul> <ul><li>COMPANY_NAME</li></ul> <ul><li>FROM CONSULTANTS;</li></ul>

  • Slow down after my line was upgraded to ADSL2+

    Hi there a couple months ago BT upgraded our line from ADSL 1 to ADSL2+ now it all sounds good but I have experienced some major slow downs since they have done it and constant calls to CS have just resulted in my line getting tested and then having

  • Can't open Iphoto-'06 pic in Photoshop CS

    I set I-Photo preferences to use PhotoshopCS to edit, as I had in I-photo-4, but double clicking on a thumbnailin in I-Photo only opens the Photoshop application but does not open the photo. Any ideas what may be wrong. Never had this problem in the

  • How to pass parameters to a Lov's Query?

    Hi friends, [Apps R12] I'm trying to extend the a ProjectLOVVO (for OTL, in example) and the extension would consist on modifying the Lov Query adding in the where clause a comparison with certain fields of the page.... How can I retrieve a value in

  • URGENT LargeFile in Pro*C

    I need to manage text files of 4GBytes on a Unix system (the usual limit is 2GBytes on this file-system). I tried using the directive CDEFS=_LARGEFILE_SOURCE in the Makefile, but it does'n seem to work (the C compiler seems to loose the call to <sqlc