Can't get focused a JTextField within a JTable cell

I have a table and I placed a cell editor with a JText field on it for all cell editing,
I want to do things when the focus is lost or gained and my app works fine when a cell is double clicked or f2 is pressed, but when a cell is selected (without double clicking) and just begin typing it produces no focus gained event.
I tried by calling grabFocus method of that jTextField within the overriden prepareEditor method of the JTable but it doesn't get focus (doesn't even gains and loses it :s )
Does anyone have an idea of how to force this component to grab focus?
Thanks

Hai,
dont add the FocusListener to the EditorComponent.
Try to use the JTable Functions - like this:
import javax.swing.event.ChangeEvent;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.EventObject;
import javax.swing.*;
public class Test extends JFrame
     JTable table;
     JTextArea text;
     JScrollPane scroll;
     JTextField cellTextField;
     Test()
          DefaultTableModel model = new DefaultTableModel();
          cellTextField = new JTextField();
          text = new JTextArea();
          text.setEditable(false);
          scroll = new JScrollPane();
          scroll.setViewportView(text);
          table = new JTable(model){
               @Override
               public Component prepareEditor(TableCellEditor editor, int row, int column) {
                    text.append("Better use this to Start Edit!\n");
                    return super.prepareEditor(editor, row, column);
               @Override
               public void editingStopped(ChangeEvent e) {
                    text.append("Better use this to Stop Edit!\n");
                    super.editingStopped(e);
          model.addColumn("Column 1");
          model.addColumn("Column 2");          
          model.addRow(new String [] {"Cell 1", "Cell 2"});
          table.setCellSelectionEnabled( true );
          table.getColumnModel().getColumn(0).setCellEditor( new DefaultCellEditor(cellTextField));
          table.getColumnModel().getColumn(1).setCellEditor( new DefaultCellEditor(cellTextField));
          getContentPane().setLayout(new BorderLayout());
          getContentPane().add(table, BorderLayout.NORTH);
          getContentPane().add(scroll, BorderLayout.CENTER);
          setSize(300, 300);
          setVisible(true);
          setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
     public static void main(String[] args)
          new Test();
}

Similar Messages

  • Item - Can't set value on item because the item can't get focus.  [66000-15

    hi i created one text box in purchase order form and asign the choose from list.l when i choose in edit box its show the following error-- Item - Can't set value on item because the item can't get focus
    Dim lonHeadDatasource As SAPbouiCOM.DBDataSource
    lonHeadDatasource = oOrderForm.DataSources.DBDataSources.Item("OPOR")
    oNewItem1 = oOrderForm.Items.Add("EditDS", SAPbouiCOM.BoFormItemTypes.it_EDIT)
                        Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                        Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                        Dim oCFL As SAPbouiCOM.ChooseFromList
                        oCFLs = oOrderForm.ChooseFromLists
                        oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                        oCFLCreationParams.MultiSelection = False
                        oCFLCreationParams.ObjectType = "INTORDER"
                        oCFLCreationParams.UniqueID = "CFL1"
                        oCFL = oCFLs.Add(oCFLCreationParams)
                        oItem = oOrderForm.Items.Item("4")
                        oNewItem1.Top = 95
                        oNewItem1.Height = oItem.Height
                        oNewItem1.Width = 140
                        oNewItem1.Left = 125
                        oEdit = oNewItem1.Specific
                        oEdit.DataBind.SetBound(True, "OPOR", "U_EditDS")
                        oOrderForm.Items.Item("EditDS").Specific.ChooseFromListUID = "CFL1"
                        oEdit.ChooseFromListAlias = "U_ID"
    Item events
    Try
                If pVal.BeforeAction = False Then
                    If (pVal.FormType = 142) Then
                        Select Case (pVal.ItemUID)
                            Case "EditDS"
                                Select Case (pVal.EventType)
                                    Case SAPbouiCOM.BoEventTypes.et_GOT_FOCUS
                                    Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
                                        Dim bonCflEvents As SAPbouiCOM.ChooseFromListEvent
                                        Dim bonCflList As SAPbouiCOM.ChooseFromList
                                        Dim bnnstrUID As String
                                        Dim bonDTTable As SAPbouiCOM.DataTable = Nothing
                                        bonCflEvents = pVal
                                        bnnstrUID = bonCflEvents.ChooseFromListUID
                                        bonDTTable = bonCflEvents.SelectedObjects
                                        bonCflList = oOrderForm.ChooseFromLists.Item(bnnstrUID)
                                        If pVal.BeforeAction = False Then
                                            If oOrderForm.Mode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
                                                If Not (bonDTTable Is Nothing) Then
                                                    If bonCflList.UniqueID = "CFL1" Then
                                                        If pVal.ItemUID = "EditDS" Then
                                                            Dim value As String = Nothing
                                                            oOrderForm.Items.Item("EditDS").Specific.value = bonDTTable.GetValue(0, 0)
                                                        End If
                                                    End If
                                                Else
                                                    lonHeadDatasource.SetValue("EditDS", lonHeadDatasource.Offset, "")
                                                End If
                                            End If
                                        End If
                                End Select
                        End Select
                    End If
                End If
            Catch ex As Exception
                SBO_Application.SetStatusBarMessage(ex.Message)
            End Try
    Thanks & Regards
    B.Narain

    Hi
    Instead of   oOrderForm.Items.Item("EditDS").Specific.value = bonDTTable.GetValue(0, 0) the following
    lonHeadDatasource.SetValue("U_EditDS", 0, bonDTTable.GetValue(0, 0))
    Regards
    Arun

  • JTextField in a JTable cell

    Hi,
    I have just started coding in Swings and would like to find out ways by which I can add JtextField in a JTable cell. Is there any?
    Thanks in Advance.
    Cheena

    There sure is. The thing you're looking for is the cells TableCellEditor. Check out this tutorial, it will explain how to use CellEditors, you should have no diffculties adapting the example to your needs (otherwise just post again :-)
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • Rendering a JTable within a JTable Cell

    How can one render a JTable within another JTable cell?

    You could return JTable in your TableCellRenderer.
    Denis Krukovsky
    http://sourceforge.net/projects/dotuseful/

  • Getting focus on JTextField?

    I made a chat with a JApplet. In my chat i have a JTextField where users can write messages. I want to have focus on this JTextfield all the time, the user should not be allowed to get focus somewhere else. How can I do that? I tried requestFocus(); but its not making any differants. I use gridbaglayout and this is how I create my JTextfield:
    beskedFelt = new JTextField(10);
    c.insets = new Insets(10,0,0,0);
    c.gridx = 1;
    c.gridy = 2;
    gridbag.setConstraints(beskedFelt, c);
    contentPane.add(beskedFelt);
    beskedFelt.setEditable(true);
    beskedFelt.addActionListener(this);
    beskedFelt.requestFocus();
    thx for your time....

    yesss it worked:
    beskedFelt = new JTextField(10);
    EventQueue.invokeLater(new Runnable() {
    public void run() {
    beskedFelt.requestFocus();
    c.insets = new Insets(10,0,0,0);
    c.gridx = 1;
    c.gridy = 2;
    gridbag.setConstraints(beskedFelt, c);
    contentPane.add(beskedFelt);
    beskedFelt.setEditable(true);
    beskedFelt.addFocusListener(this);
    beskedFelt.addActionListener(this);
    public void focusGained(java.awt.event.FocusEvent fe)
    public void focusLost(java.awt.event.FocusEvent fe)
              Object source = fe.getSource();
              if ( source == beskedFelt)
    beskedFelt.requestFocus();
    thx a lot ppl....

  • Why my textfield can not get focus?

    I put a textfield on the first tab of a tabbed panel. I need this textfield to get the focus when I open the first tab. I tried to use grabfocus() method in the constructor of class, but it does not work. Does anybody know why? and how can I solve it?
    Thanks!

    No, I didn't call grab/requestFocus on the event thread.
    My code is like this:
    public class GeneralPane extends JPanel {
    JPanel ltPane;
    private JTextField txtCountry;
    public GeneralPane() {
    initComponents();
    private void initComponents(){
    setLayout(new BorderLayout());
    //Add another Panel to contain Labels and Text fileds
    ltPane = new JPanel();
    FocusListener mFL = new FL();
    txtCountry = new JTextField("US", 20);
    //this listener is used to store the data in the textfield into a variable
    txtCountry.addFocusListener(mFL);
    // add the textfield into ltPane
    mUtil.insertTextPane(txtCountry,ltPane);
    //txtCountry got focus
    //txtCountry.setFocusable(true);
    ltPane.requestFocus();
    //txtCountry.requestFocusInWindow();
    Then in the main program, I create an instance of this class and then use addTab(...) function into the my tabbedPanel.
    The logic is simple, but the textfield still couldn't get focus when I open the tabbedPanel.

  • Can't get focus in JTabbedPane

    I have several tabs in a JTabbedPane. Each tabb is hotkeyed to "1","2","3", etc. The left and right arrows keys are remapped in this way:
    mainTabbPane.registerKeyboardAction (PrintHi, KeyStroke.getKeyStroke (KeyEvent.VK_LEFT, 0), JComponent.WHEN_FOCUSED);
    And I have an AbstractAction like this:
    AbstractAction PrintHi = new AbstractAction ()
    public void actionPerformed (ActionEvent e)
    System.out.print ("Hi");
    The problem is this. On each tabb I have several JTables, JLabels, JTextAreas and other stuff showing information. When I select/edit something, like a JTable, the arrow hotkeys stop function. It seems to me as the last selected JTable still has the focus and won't let it go. So when I press arrow keys, the arrow keys is directed into the JTable instead? Dont know if it so, but that is the impression I get.
    The weird thing is, the hotkeys for the different tabs works. If I press ALT + 1, the first tabb pops up. But the JTable is still selected. And the arrow keys is directed into the JTable.
    Anyone has pointers and hints?

    Ok, I apologize for not having explained my question completely. This is exactly what I am trying to do:
    When I press the arrow keys, they will print out a message. After I go to the 3rd panel and choose a combobox, I go back to the first panel and the arrow keys suddenly stop working. Why???
    (It is as if the 1st tabbpane has lost the focus, and cant get it. The focus is stuck on the JComboBox. When I switch back to 1st panel from comboboxpanel, I want the 1st panel to get focus, and hence the arrow keys will work again. When I choose the 3rd panel the arrow keys can stop work, that is ok. The important thing is that when I switch back to the first panel, the arrow key must work again. In an ideal world, the arrow keys are tied to panel 1 and panel 2. Hence, when I switch to panel 3, the arrow keys will stop work. When I choose panel 1 again, the arrow keys must work.)
    Sorry for making it difficult for you to help me. I really appreciate your effort. The thing is, I am starting a software company and am supposed to deliver the first version tomorrow monday. And everything works ok, except this CENSORED hot keys. Making me really stressed. Well, anyway I have specified the question better now. I really hope you can point me in the right direction on how to solve this problem.
    Is there a way for the shown panel to get focus? When I switch to panel 1, it gets the focus? Or should I try to tie the arrow keys to panel 1? Or should I tell the combobox to not respond to arrow keys? Which way to go?
    Please execute the program and see if it is only me having a problem?
    package test;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JComboBox;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTable;
    import javax.swing.KeyStroke;
    public class SSCCEE extends JFrame {
         private static final long serialVersionUID = 1L;
         JTabbedPane tabbpane = null;
         public static void main(String args[]) {
              new SSCCEE();
         public SSCCEE() {
              tabbpane = new JTabbedPane();
              tabbpane.insertTab("tabb 1", null, new MyTablePane(), "tooltip1", 0);
              tabbpane.setMnemonicAt(0, KeyEvent.VK_1);
              tabbpane.insertTab("tabb 2", null, new MyTablePane(), "tooltip2", 1);
              tabbpane.setMnemonicAt(1, KeyEvent.VK_2);
              tabbpane.insertTab("tabb 3", null, new MyComboboxPane(), "tooltip3", 2);
              tabbpane.setMnemonicAt(2, KeyEvent.VK_3);
              this.add(tabbpane);
              setHotKeys();
              this.pack();
              this.setVisible(true);
         private void setHotKeys() {
              AbstractAction PrintHi = new AbstractAction() {
                   private static final long serialVersionUID = 1L;
                   public void actionPerformed(ActionEvent e) {
                        System.out.print("Hi ");
              AbstractAction PrintHo = new AbstractAction() {
                   private static final long serialVersionUID = 1L;
                   public void actionPerformed(ActionEvent e) {
                        System.out.print("Ho ");
              tabbpane.registerKeyboardAction(PrintHi, KeyStroke.getKeyStroke(
                        KeyEvent.VK_LEFT, 0), JComponent.WHEN_FOCUSED);
              tabbpane.registerKeyboardAction(PrintHo, KeyStroke.getKeyStroke(
                        KeyEvent.VK_RIGHT, 0), JComponent.WHEN_FOCUSED);
    class MyComboboxPane extends JPanel {
         private static final long serialVersionUID = 1L;
         private JComboBox aCombobox = null;
         MyComboboxPane() {
              aCombobox = new JComboBox();
              aCombobox.addItem("Meow");
              aCombobox.addItem("Voff");
              this.add(aCombobox);
              aCombobox.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent e) {
                        JComboBox cb = (JComboBox) e.getSource();
                        System.out.println((String) cb.getSelectedItem());
    class MyTablePane extends JPanel {
         private static final long serialVersionUID = 1L;
         private JTable aTable = null;
         MyTablePane() {
              aTable = new JTable(
                        new String[][] { { "This", "is", "cell 13" },
                                  { "a", "Test", "cell 23" },
                                  { "cell 31", "cell 32", "cell 33" } }, new String[] {
                                  "Col 1", "Col 2", "Col 3" });
              this.add(aTable);
    }

  • Can't get Single selection to work in jtable using Netbeans

    I used the GUI editor to create a jTable to play around and I can't get the single selection to work as it should
    I have it set like this:
    jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);The table still selection the rows as if they were set as Multi Interval selection. Anyone could explain why?
    Here is the full source
    To change this template, choose Tools | Templates
    *and open the template in the editor.*
    Tableframe.java
    Created on Jun 7, 2009, 6:57:57 PM
    *package examples;*
    @author ME
    *public class Tableframe extends javax.swing.JFrame {*
    *    /** Creates new form Tableframe */*
    *    public Tableframe() {*
    *        initComponents();*
    *    /** This method is called from within the constructor to
    *initialize the form.*
    WARNING: Do NOT modify this code. The content of this method is
    *always regenerated by the Form Editor.*
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            jTable1 = new javax.swing.JTable();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            jTable1.setOpaque(false);
            jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            jTable1.setShowHorizontalLines(false);
            jTable1.setShowVerticalLines(false);
            jTable1.getTableHeader().setReorderingAllowed(false);
            jScrollPane1.setViewportView(jTable1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(13, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(25, Short.MAX_VALUE))
            pack();
        }// </editor-fold>
    *@param args the command line arguments*
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Tableframe().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTable jTable1;
        // End of variables declaration
    }

    I used the GUI editor to create a jTable to play around and I can't get the single selection to work as it should
    I have it set like this:
    jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);The table still selection the rows as if they were set as Multi Interval selection. Anyone could explain why?
    Here is the full source
    To change this template, choose Tools | Templates
    *and open the template in the editor.*
    Tableframe.java
    Created on Jun 7, 2009, 6:57:57 PM
    *package examples;*
    @author ME
    *public class Tableframe extends javax.swing.JFrame {*
    *    /** Creates new form Tableframe */*
    *    public Tableframe() {*
    *        initComponents();*
    *    /** This method is called from within the constructor to
    *initialize the form.*
    WARNING: Do NOT modify this code. The content of this method is
    *always regenerated by the Form Editor.*
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            jTable1 = new javax.swing.JTable();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            jTable1.setOpaque(false);
            jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
            jTable1.setShowHorizontalLines(false);
            jTable1.setShowVerticalLines(false);
            jTable1.getTableHeader().setReorderingAllowed(false);
            jScrollPane1.setViewportView(jTable1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(13, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(25, Short.MAX_VALUE))
            pack();
        }// </editor-fold>
    *@param args the command line arguments*
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Tableframe().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTable jTable1;
        // End of variables declaration
    }

  • How to prevent Cell from getting focus when I click on a cell in JTable

    Hi,
    I have a new problem which I did not have when using jdk1.3. I have a non editable JTable. Now whenever I select a row the row gets highlighted - which is ok but at the same time the cell on which I click ( to select the row ) also gets focus.
    Previously I used to extend JTable and override the isManagingFocus method to return false. But now it doesnt seem to work
    What should
    Thanks
    --J                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Well, I'm still using JDK1.3 and I don't get the behaviour you describe.
    When isManagingFocus is true then using the tab key will cause focus to move from cell to cell within the JTable and focus will never leave the JTable.
    When isManagingFocus is false then using the tab key will cause focus to move the the JTable to the next component on the JFrame.
    In both cases once focus is on the JTable an individual cell is always highlighted to indicate it has focus.
    The question is if your program only cares which row has been selected, why do you care if an individual cells appears to have focus?

  • Can't get focus to address bar in new tab

    I have tried everything said in previous posts and unfortunately i cant get it to focus the address bar.
    I have tried uninstalling all adons, restarted in safe mode, this should be like this automatically, but for some reason it isn't. Can i change something in about:config?
    Ty
    /A.R

    You might need to reinstall Firefox to repair program files, but first, do you want to try a different new tab page: just a blank page?
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box above the list, type or paste '''newtab''' and pause while the list is filtered
    (3) Double-click the '''browser.newtab.url''' preference and change from ''about:newtab'' to ''about:blank'' and OK that change.
    You can test immediately with Ctrl+t to see whether that makes any difference.

  • Can you get focus for an invisible JFrame?

    I'm writing a program where I use a JFrame for user input, and, after receiving input, the JFrame goes invisible, leaving the desktop clear while the program continues processing in the background. I want the same JFrame to be called back with user keyboard input (e.g. F12), but I don't know how to get KeyListener to work because I cannot obtain focus on the invisible JFrame. Is this possible?
    If not, is there a similar way to work around the problem?
    Any help is appreciated, thanks!

    I don't think that you can have focus on an invisible frame (though I'm not sure) but a goos way around would be to show a small dialog that says "Currently working, press a key to go back to main screen" and add a key listener to this dialog instead of the invisible frame.
    But if you want to work in the background, maybe you'll have to run the dialog on a new thread for both to work at the same time.
    Hope it helps

  • Can't get OS9 to work within OSX Tiger

    Has anyone had success using OS9 within the newest Tiger? I have a favorite app that requires OS9 to work and the instructions in my Mac are vague about how to install the old operating system to have it work within OSX.
    I recently did a complete wipe of my hard drive and installed the latest Tiger OS. I created two partitions for the hard drive. I used the single disc OS9 install CD (the one that came with my Powerbook a few years ago) and successfully went through the install process using the second partition, the one that OSX is not on. The OS9 system folder does appear in the partition list of items.
    When I click on the app I want to use, the OS9 window pops up and says "Classic starting up using 'system folder' on 'untitled 2' (that's the partition name. The problem is that OS9 never completes starting up and I'm not able to use my app. I've waited ten+ minutes and OS still hasn't completed starting up.
    Can anyone help?
    John

    John, try this:
    1) Go to System Preferences -> Classic -> Start/Stop tab. Make sure the OS 9 System Folder is the one you want. (Hover the pointer over the selected one to see its location. Make sure it is the one on the 'untitled 2' partition, for example.)
    2) Leave the pref open -- you will need it again shortly.
    3) Open Disk Utilty. From its "File" menu select "Fix OS 9 permissions." This will repair OS X permissions on the OS 9 install you selected above. You can now quit Disk Utility.
    4) Back in Classic preferences, select the "Advanced" tab. Click the "Rebuild Desktop" button. Select the volume from step 1 & Click "Rebuild." (This step is just for good measure & not strictly necessary.)
    5) In the top section labeled "Startup and other options" make sure "Turn off extensions" is selected, then click the "Start Classic" button next to it. (This is the most important step.)
    If Classic now starts up with no problems, what you have is an old fashioned extension conflict. If so, stop Classic & switch to "Open Extension Manager" in the "Startup and other options" section, restart Classic & select one of the top two sets in Extensions Manager, next to the "Selected Set:" text. (These are the standard 'All' & 'Base' sets.)
    If Classic now finishes starting up, you will have to do the old process of elimination routine to find the conflicting extension(s).
    BTW, to boot into OS 9 from the partition, you must have an OS 9 boot driver on the drive (not volume) you boot from. You can make sure that is there with Disk Utility. Select the drive (not the volume) & click the blue "Info" button. Look for the line in the info window that pops up that says "Mac OS 9 Drivers Installed :" -- you want it to say "yes."

  • How can you get a java program working on a cell phone?

    I was thinking of making some stuff for cell phones so i was wondering how you get a normal java program to work on cells.

    its all j2me - midlet package....Huh? The jsr-118 MID profile alone has 11 packages, one of which is javax.microedition.midlet. Notj2me - midlet.
    works best on nokia phones.Sez who? You seem to be confusing Java ME with Symbian C.
    you can use net beans midlet packge add-on.Only it's called the NetBeans Mobiliity Pack.
    Its easy to use and has lots of tutorials.Ditto for the Wireless toolkit for CLDC.
    just search on google.Yes, but with which keywords?
    @OP:
    NetBeans mobility pack comes with a short tutorial and several samples, you also need to download the latest WTK as the ver. 2.2 which comes bundled with NetBeans is just too buggy to work with. Then there are the manufacturer-specific SDKs from Nokia, Motorola, Sony Ericsson and (maybe) others.
    If and when you get started in Java ME aka j2me, it will be appropriate to post any questions you might have on the mobility forums, not here.
    Google "j2me tutorial" for many good hits.
    luck, db

  • I can't get ArrayList to work in my JTable

    I want to be able to dynamically add and remove data (and rows) from my JTable, and so I wanted to just Lists when I implemented it. I've tried 2 ways and they both didn't work. Can someone show me some sample code to do this?
    I tried 2 different methods:
    method 1:
    JTable Data_Table = new  JTable(data_Vector, Collumn_Names_Vector);when I started the applet I got an error saying Applet init error
    But the error could also have happened in 2 other places here. 1, I created 2 Lists instead of Vectors and converted them to Vectors when passing them to JTable using:
    new Vector(data)
    and 2, I may have created my 2 dimensional data List incorrectly. I tried:
    List Parent = new ArrayList();
    List child1 = new ArrayList();
    List child2 = new ArrayList();
    child1.add(data1)
    child2 ...
    Parent.add(child1)
    Parent.add(child2)and I tried:
    List Parent = new ArrayList();
    Object[] temp = { new Integer(); new Integer()};
    Parent.add(temp.asList);But as I said method 1 did not work.
    method 2:
    I tried creating my own TableModel.
    In this way, the applet would start, and I can see my collumn names, but the data is blank and all cells are invisible or nonexistent, I don't know which. How do I initialize the Table values? I'd like to have one row with all 0's when the Applet opens? I'd also like to see a row so I can edit it.
    then I used this code (inside my model):
            public int getColumnCount() {
                return Analog_columnNames.length;
            public int getRowCount() {
                return Analog_data.size();
            public String getColumnName(int col) {
                return Analog_columnNames[col];
            public Object getValueAt(int row, int col) {
                java.util.List aRow = (ArrayList)Analog_data.get(row);
             return  aRow.get(col);
            public void setValueAt(Object value, int row, int col) {
                if (getValueAt(0,col) instanceof Integer                       
                        && !(value instanceof Integer)) {                 
                    try {
                         java.util.List tmp =  (java.util.List) Analog_data.get(row);
                  tmp.set(col, (Object)new Integer(value.toString()));
                  fireTableCellUpdated(row, col);
                    } catch (NumberFormatException e) {
                } else {
                     java.util.List tmp =  (java.util.List) Analog_data.get(row);
              tmp.set(col, (Object)new Integer(value.toString()));
                    fireTableCellUpdated(row, col);
            }Analog_columnNames is a normal array

    this may help You have to remove the button from the columns
    otherwise You need som other classes.
           jTable1.addextrarowtotable(Name, aantal , prijs);CopyCalcTable.java
    import javax.swing.*;
    import java.util.Vector;
    import javax.swing.table.*;
    import java.text.DecimalFormat;
    public class CopyCalcTable extends JTable{
        protected CopyCalcTableModel model;
        CopyCalcTable(){
            super();
            Vector columns= new Vector();
            columns.add("Type");
            columns.add("Omschrijving");
            columns.add("P/S");
            columns.add("Aantal");
            columns.add("Prijs");
            columns.add("Verwijderen");
            model = new CopyCalcTableModel(columns,1);
            setModel(model);
        public void setColumSize(){
            TableColumn column;
            int width = getWidth();
            column = getColumnModel().getColumn(0);
            column.setResizable(false);
            column.setMinWidth((width*2)/14);
            column.setPreferredWidth((width*2)/14);
            column = getColumnModel().getColumn(1);
            column.setResizable(false);
            column.setMinWidth((width*6)/12);
            column.setPreferredWidth((width*2)/14);
            column = getColumnModel().getColumn(2);
            column.setMinWidth((width*1)/14);
            column.setResizable(false);
            column.setPreferredWidth((width*1)/14);
            column = getColumnModel().getColumn(3);
            column.setResizable(false);
            column.setMinWidth((width*1)/14);
            column.setPreferredWidth((width*1)/14);
            column = getColumnModel().getColumn(4);
            column.setResizable(false);
            column.setMinWidth((width*1)/14);
            column.setPreferredWidth((width*1)/14);
            column = getColumnModel().getColumn(5);
            column.setResizable(false);
            column.setMinWidth((width*2)/14);
            column.setPreferredWidth((width*2)/14);
        public void HideColum(){
            TableColumn column;
            int width = getWidth();
            column = getColumnModel().getColumn(0);
            column.setResizable(false);
            column.setMinWidth((width*2)/14);
            column.setPreferredWidth((width*2)/14);
            column = getColumnModel().getColumn(1);
            column.setResizable(false);
            column.setMinWidth((width*6)/12);
            column.setPreferredWidth((width*2)/14);
            column = getColumnModel().getColumn(2);
            column.setMinWidth((width*1)/14);
            column.setResizable(false);
            column.setPreferredWidth((width*1)/14);
            column = getColumnModel().getColumn(3);
            column.setResizable(false);
            column.setMinWidth((width*1)/14);
            column.setPreferredWidth((width*1)/14);
            column = getColumnModel().getColumn(4);
            column.setResizable(false);
            column.setMinWidth((width*1)/14);
            column.setPreferredWidth((width*1)/14);
            column = getColumnModel().getColumn(5);
            column.setResizable(false);
            column.setMinWidth(0);
            column.setPreferredWidth(0);
        public void removefirstrow(){
            model.removeRow(0);
        public void removeTotalrow(){
            model.removeRow(model.getRowCount()-1);
        public void addTotalrow(){
            Vector data;
            String Col_Bediening = "";
            String Col_Uitboek ="";
            String Col_Rectoverso="";
            String Col_Formaat="";
            String Col_Kleur="";
            String Col_Gewicht="";
            Double Col_PS;
            String Col_Aantal;
            Double Col_Prijs;
            data = new Vector();
            Col_Prijs = new Double("0.00");
            double totaal= Col_Prijs.doubleValue();
            // number of extra's
            java.text.NumberFormat nf =  java.text.NumberFormat.getInstance();
            // set whether you want commas (or locale equivalent) inserted
            nf.setGroupingUsed(true );
            // set how many places you want to the right of the decimal.
            nf.setMinimumFractionDigits(2 );
            nf.setMaximumFractionDigits(2 );
            // set how many places you want to the left of the decimal.
            nf.setMinimumIntegerDigits(1 );
            int rows = model.getRowCount();
            for (int i = 0;i < rows; i++){
                Double d = new Double((String) model.getValueAt(i, 4));
                totaal += d.doubleValue();
            Col_Prijs = new Double(totaal*1.00);
            data.add("Totaal : EUR");
            data.add("");
            data.add(new String(""));
            data.add("");
            data.add(nf.format(Col_Prijs));
            //data.add(Col_Prijs.toString());
            javax.swing.JButton button = new javax.swing.JButton("EUR");
            data.add(button);
            model.addRow(data);
            setColumSize();
        public void addkopierowtotable(Integer aantal, double prijs, String omschrijving){
            Vector data;
            CopyCalcTableModel model = (CopyCalcTableModel) getModel();
            Double Col_PS;
            String Col_Aantal;
            Double Col_Prijs;
            //model.addColumn("Verwijderen");
            data = new Vector();
            Col_PS = new Double(prijs);
            Col_Aantal = new String(aantal.toString());
            Col_Prijs = new Double(prijs*aantal.intValue());
            data.add("Kopie�n");
            data.add(omschrijving);
            data.add(Col_PS.toString());
            data.add(Col_Aantal);
            data.add(Col_Prijs.toString());
            javax.swing.JButton button = new JButton("Verwijderen");
            button.addMouseListener(new MyJButtonMouseListener(this));
            data.add(button);
            removeTotalrow();
            model.addRow(data);
            addTotalrow();
        public void addextrarowtotable(String Name, Integer aantal, double prijs){
            Vector data;
            Double Col_PS;
            String Col_Aantal;
            Double Col_Prijs;
            data = new Vector();
            Col_PS = new Double(prijs);
            Col_Aantal = new String(aantal.toString());
            Col_Prijs = new Double(prijs*aantal.intValue());
            data.add("Extra");
            data.add(Name);
            data.add(Col_PS.toString());
            data.add(Col_Aantal);
            data.add(Col_Prijs.toString());
            javax.swing.JButton button = new javax.swing.JButton("Verwijderen");
            button.addMouseListener(new MyJButtonMouseListener(this));
            data.add(button);
            removeTotalrow();
            model.addRow(data);
            addTotalrow();
        public void addspiraalrowtotable(String Name, Integer aantal, double prijs){
            Vector data;
            Double Col_PS;
            String Col_Aantal;
            Double Col_Prijs;
            //model.addColumn("Verwijderen");
            data = new Vector();
            Col_PS = new Double(prijs);;
            Col_Aantal = new String(aantal.toString());
            Col_Prijs = new Double(prijs*aantal.intValue());
            data.add("Spiraal");
            data.add(Name);
            data.add(Col_PS.toString());
            data.add(Col_Aantal);
            data.add(Col_Prijs.toString());
            javax.swing.JButton button = new javax.swing.JButton("Verwijderen");
            button.addMouseListener(new MyJButtonMouseListener(this));
            data.add(button);
            removeTotalrow();
            model.addRow(data);
            addTotalrow();
        public void addklemrugrowtotable(String Name, Integer aantal, double prijs){
            Vector data;
            Double Col_PS;
            String Col_Aantal;
            Double Col_Prijs;
            //model.addColumn("Verwijderen");
            data = new Vector();
            Col_PS = new Double(prijs);
            Col_Aantal = new String(aantal.toString());
            Col_Prijs = new Double(prijs*aantal.intValue());
            data.add("Klemrug");
            data.add(Name);
            data.add(Col_PS.toString());
            data.add(Col_Aantal);
            data.add(Col_Prijs.toString());
            javax.swing.JButton button = new javax.swing.JButton("Verwijderen");
            button.addMouseListener(new MyJButtonMouseListener(this));
            data.add(button);
            removeTotalrow();
            model.addRow(data);
            addTotalrow();
        public void addplastificerenrowtotable(String Name, Integer aantal, double prijs){
            Vector data;
            Double Col_PS;
            String Col_Aantal;
            Double Col_Prijs;
            //model.addColumn("Verwijderen");
            data = new Vector();
            Col_PS = new Double(prijs);
            Col_Aantal = new String(aantal.toString());
            Col_Prijs = new Double(prijs*aantal.intValue());
            data.add("Plastcificeren");
            data.add(Name);
            data.add(Col_PS.toString());
            data.add(Col_Aantal);
            data.add(Col_Prijs.toString());
            javax.swing.JButton button = new javax.swing.JButton("Verwijderen");
            button.addMouseListener(new MyJButtonMouseListener(this));
            data.add(button);
            removeTotalrow();
            model.addRow(data);
            addTotalrow();
        public int getRowCount() {
            if ( model == null ){
                return 0;
            }else {
                return model.getRowCount();
    class CopyCalcTableModel extends AbstractTableModel {
        Vector data;
        Vector columnNames;
        CopyCalcTableModel(Vector head_vec, int rows) {
            columnNames = (Vector) head_vec.clone();
            //    coldata = new Vector(columnNames.size());
            data = new Vector(rows);
        CopyCalcTableModel(Vector head_vec) {
            columnNames = (Vector) head_vec.clone();
            //    coldata = new Vector(columnNames.size());
            data = new Vector();
        CopyCalcTableModel(Vector col_vec, Vector head_vec) {
            Vector coldata;
            columnNames = (Vector) head_vec.clone();
            data = (Vector) col_vec.clone();
        public int getColumnCount() {
            //        System.out.println(columnNames);
            return columnNames.size();
        public int getRowCount() {
            //        System.out.println(data);
            return data.size();
        public void removeRow(int row) {
            //        System.out.println(data);
            data.removeElementAt(row);
            fireTableStructureChanged();
        public String getColumnName(int col) {
            return (String) columnNames.elementAt(col);
        public Object getValueAt(int row, int col) {
            Vector v_row;
            Vector v_col;
            v_row = (Vector) data.elementAt(row);
            return v_row.elementAt(col);
         * JTable uses this method to determine the default renderer/
         * editor for each cell.  If we didn't implement this method,
         * then the last column would contain text ("true"/"false"),
         * rather than a check box.
        public Class getColumnClass(int c) {
            // return getValueAt(0, c).getClass();
            int rowIndex = 0;
            Object o = getValueAt(rowIndex, c);
            if (o == null) {
                return Object.class;
            } else {
                // System.out.println(o.getClass());
                return o.getClass();
         * Don't need to implement this method unless your table's
         * editable.
        public boolean isCellEditable(int row, int col) {
            //Note that the data/cell address is constant,
            //no matter where the cell appears onscreen.
            /*Vector v_row;
            v_row = (Vector) data.elementAt(row);
            if (col == 10 ) {
                return true;
            } else {
                return false;
            return false;
         * add collumn
        public void addColumn(String label, Object value){
            columnNames.add(label);
            for ( int i=0;data.size()>i;i++){
                Vector row = (Vector) data.elementAt(i);
                row.add(value);
                data.setElementAt(row, i);
            fireTableStructureChanged();
        public void addRow(Vector values){
            data.add(values);
            fireTableStructureChanged();
         * Don't need to implement this method unless your table's
         * data can change.
        public void setValueAt(Object value, int lrow, int lcol) {
    }

  • How can I get current Number file name in a cell ?

    I want to write current Number (3.5) file name in a cell.
    It was working in previous version of Number but not with latest one. Thanks.

    Yes, you can click the title bar of any document (the down arrow) to access the current file name:

Maybe you are looking for

  • Can I add a 2nd HDD on my Satellite A300-02C?

    Hi all, I'm wondering if it's possible to add a 2nd hard drive in my A300-02C? There is a 2nd HDD slot, but no sata connector on the PCB (see picture link). http://www.notebookreview.com/picture.asp?f=36752 I'm wondering if it's possible to add the c

  • Imovie/idvd ratio question

    ..If I made a movie/video in imovie, & completed it with the Aspect Ratio set to "Widescreen 16;9", how does that (or does it), affect how it will look in the end, after exporting it to idvd for a burn. I saw when I exported to itunes, I was able to

  • Possible bug in Edge (for strange users ;-)

    I created a slideContainer object on the stage by creating a rectangle, sizing it to the stage size and use it to load other symbols into. Given my flash experience, I created the symbol, then went in and deleted the rectangle thinking I'd leave the

  • Try/catch issue - "cannot find symbol - class InputMismatchExeption"

    I'm still learning try/catch but from what i've read online and in the class library it looks right...i'm not sure why it won't compile. try {                 do {                     System.out.print("Enter command (1-5): ");                     sel

  • SEQ with GG

    Hi , If i'm creating odd and even number of sequences in source and target for A-A replication, How to manage the existing sequences.? if there any changes required for existing seq for avoiding conflicts, and guide me this sequence mechanism is suit