How to make a cell or column in JTable non focusable.

I have created a table which contains 2 rows and 2 columns. My requirement is that 2nd column should be non editable and non focusable. Making any cell non editable is very easy but how should i avoid focus on particular cell.i.e., suppose focus is on first cell and now if u press right arrow button on the keyboard 2nd cell should not get highlighted and focus should remain on first cell.
Thanks in advance

Override the default Tab Action. Here is an example:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=657819

Similar Messages

  • How to make editing cell to show up caret and taking keyboard event

    Hello everyone:
    I have the following problem with table editing.
    1. using mouse clicking, the editing cell will have cursor and taking keyboard event.(no problem with it)
    2. just type in data, it will show up in the selected cell, but the editing cell do not have cursor visible and also do not fire the keyboard event.
    I have problem with this one. So how to make editing cell to have caret visible and taking keyboard event.
    Thank you very much!
    --tony                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    you should subclass JTable and overwrite two methods.
    1. protected boolean processKeyBinding(javax.swing.KeyStroke ks,
    java.awt.event.KeyEvent e,
    int condition,
    boolean pressed)
    to store the current keyboard event,
    2.public boolean editCellAt(int row,int column,java.util.EventObject e)
    to fix the problem with isCellEditable and curret position and direct the event into proper place.

  • How to make table cell have certain width

    Hi
    i have 3 cells when i write text in any cell it effects the
    width of other cells !!!
    how to make every cell have certain? i mean i want to wrap
    the text not to effect the cell width
    thanks in advance.

    Hi Mac,
    Try this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
    Transitional//EN">
    <HTML><HEAD><TITLE>Home</TITLE>
    <META http-equiv=Content-Type content="text/html;
    charset=iso-8859-1">
    <style>
    .text-content-green {
    FONT-SIZE: 11px;
    COLOR: #a5a834;
    LINE-HEIGHT: 20px;
    FONT-STYLE: normal;
    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
    TEXT-DECORATION: none;
    .text-content-green:hover {
    FONT-SIZE: 11px;
    COLOR: #AE0B0B;
    LINE-HEIGHT: 20px;
    FONT-STYLE: normal;
    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
    TEXT-DECORATION:underline;
    .margin {
    margin: 1px 1px 1px 1px;
    border-style: solid;
    border-top-width: 1px;
    border-left-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-color: gainsboro;
    </style
    </HEAD>
    <BODY topmargin="10px" leftmargin="0" rightmargin="0"
    class="body-style">
    <TABLE width="729" border="0" cellpadding="0"
    cellspacing="0" cellsadding="0" align="center" class="margin">
    <TBODY>
    <TR>
    <TD width="125" valign="top" bgcolor="#f0f0c1">
    <table width="125" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td width="25" height="25" align="middle"></td>
    <td width="108" class="text-content-green"><A
    class="text-content-green" href="default.html">LEFT
    NAV</A></td>
    </tr>
    <tr>
    <td colspan="2" align="middle"></td>
    </tr>
    <tr>
    <td width="25" height="25" align="middle"></td>
    <td width="108" class="text-content-green"></td>
    </tr>
    <tr>
    <td colspan="2"></td>
    </tr>
    </table>
    </TD>
    <TD vAlign=top width=539 bgColor="white" height=471>
    <P class="text-content-green" align=left
    style="padding-left:5px">Lorem ipsum dolor sit amet, consectetur
    adipisicing elit.Duis aute irure dolor in reprehenderit in
    voluptate velit esse cillum .
    </P>
    </TD>
    </TR>
    </TBODY>
    </TABLE>
    </TD>
    </TR>
    </TBODY>
    </TABLE>
    </BODY>
    </HTML>
    HTH
    Shanthi

  • How to make a cell/column read only

    HI All,
    Is there any way to make a specific cell read only with in a specific data form?
    Similarly is there any way to make whole column read only inside a specific data form?
    I don't want to make changes in my dimension member (e.g Dynamic Calc), i want to make these changes at data form level because, these cell/column are read only at one form but on some other data form they are editable/enterable

    If you want to make a column read only then have a look at asymettric columns in the planning admin doc, if you use them then you can make one of the columns read only.
    If you want a make one cell read only then one method could be to use javascript, you could add an extra member which is dynamic calc and point to the original member with a formula but it doesn't sound like you want to do that.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to make ALV cell editable

    Hi ,
    I am using cl_gui_alv_grid .
    please let me know how to make a particular cell is editable
    eg:  cell corresponding to first row second column should be editabel but remaining all are non editable

    Hi,
    Loop at your internal table.
    Eg: i have total 5 fields in my internal table itab_zqmeinz. in that 3 fields are editable as below.
    declare DATA: lt_celltab TYPE lvc_t_styl.
    internal table with celltab as one of the column
    DATA: BEGIN OF itab_zqmeinz OCCURS 0. "TYPE STANDARD TABLE OF zqmseqkopf
            INCLUDE STRUCTURE zqmseqeinz.
    DATA: celltab TYPE lvc_t_styl.
    DATA: END OF itab_zqmeinz.
    LOOP AT itab_zqmeinz INTO wa_zqmeinz.
          l_index = sy-tabix.
          REFRESH lt_celltab.
          CLEAR wa_zqmeinz-celltab.
          PERFORM fill_celltab1 USING 'RW'
                                  CHANGING lt_celltab.
          INSERT LINES OF lt_celltab INTO TABLE wa_zqmeinz-celltab.
          MODIFY  itab_zqmeinz FROM wa_zqmeinz INDEX l_index.
        ENDLOOP.
    FORM fill_celltab1 USING value(p_mode)
                      CHANGING pt_celltab TYPE lvc_t_styl.
    Refresh pt_celltab.
      clear ls_celltab.
      IF p_mode EQ 'RW'.
        l_mode = cl_gui_alv_grid=>mc_style_enabled.    "to enable the required fields
      ELSE.                                "p_mode eq 'RO'
        l_mode = cl_gui_alv_grid=>mc_style_disabled.
      ENDIF.
      ls_celltab-fieldname = 'NEBENSEQUEN'.   " field1
      ls_celltab-style = l_mode.
      INSERT ls_celltab INTO TABLE pt_celltab.
      ls_celltab-fieldname = 'BEZEICHNUNG'.     "field2
      ls_celltab-style = l_mode.
      INSERT ls_celltab INTO TABLE pt_celltab.
      ls_celltab-fieldname = 'SORTIERUNG'.         "field3
      ls_celltab-style = l_mode.
      INSERT ls_celltab INTO TABLE pt_celltab.
    Endform.
    It works. I have done it in my program.
    Thanks,

  • How to make crosstab cell value become hot link which can link to other?

    Dear Gurus:
    I am using Bi beans in a project, i create a crosstab in one .jsp file,the crosstable can display data correctly,but i want to make every cell value become hot link which point to a url,this url contains measure info and all dimension info,how can i do? Thanks a lot!

    Hi Tomsong,
    We will post a BI Beans Sample that does that to OTN next week.
    In the mean time, look at the following BI Beans Help topic (under Jdeveloper BI Beans Help)
    Handling Drill-Out Events in HTML-Client Applications
    Hope this helps
    Katia

  • How to make changes in deduction column in IT 2006

    Hi All,
    Scenario: Employee had a sick leave & casual leave quota 6 days in a financial year.
    Now the employee had used all his sick leaves and casual leaves and the leaves got exhausted pertaining to this quota.
    These days are reflecting in 2001 IT as leaves taken  but the deduction did'nt happen in IT 2006
    Can anyone tell how to make changes in the deduction column for specific employee code's
    Regards,
    Srikanth

    Hi Megha,
    The assignment is properly mapped to counting rule.. Issue is with the validity intervals. SInce the employee already availed the leaves the quotas cannot be deleted in the IT 2006. Issue resolved by making some changes in the deduction column through SQL table entry..
    Really appreciate your response..
    Regards,
    Srikanth

  • How to make a cell in a JTable to be uneditable and handle events

    I tried many things but failed,How do you make a cell in a JTable to be uneditable and also be able to handle events>Anyone who knows this please help.Thanx

    Hello Klaas2001
    You can add KeyListener ,MouseListener
    Suppose you have set the value of cell using setValueAt()
    table.addKeyListener(this);
    public void keyTyped(KeyEvent src)
    String val="";
    int r= table.getEditingRow();
    int c= table.getEditingColumn();
    val=table.getValueAt(r,c).toString();
    if (r!=-1 && c!=-1)
    TableCellEditor tableCellEditor = table.getCellEditor(r, c);
    tableCellEditor.stopCellEditing();
    table.clearSelection();
    table.setValueAt(val,r,c);
    public void keyReleased(KeyEvent src)
    public void keyPressed(KeyEvent src)
    table.addMouseListener(this);
    public void mouseClicked(MouseEvent e)
    public void mouseEntered(MouseEvent e)
    public void mouseExited(MouseEvent e)
    public void mousePressed(MouseEvent e)
    public void mouseReleased(MouseEvent e)
    if(e.getClickCount()>=2)//Double Click
    table.clearSelection();
    int r= table.getEditingRow();
    int c= table.getEditingColumn();
    if (r!=-1 && c!=-1)
    TableCellEditor tableCellEditor = table.getCellEditor (
    r,c);
    tableCellEditor.stopCellEditing();
    table.clearSelection();
    table.setValueAt("",r,c);
    }//Mouse Released
    You can remove keyListener and Mouse Listener whenever You want to edit
    then add it later.
    Regarding handling events implement javax.swing.event.TableModelListener
    table.getModel().addTableModelListener(this);
    public void tableChanged(javax.swing.event.TableModelEvent source)
    TableModel tabMod = (TableModel)source.getSource();
         switch (source.getType())
    case TableModelEvent.UPDATE:
         break;
         }//Table Changed Method
    //This method gets fired after table cell value is changed.

  • How to make editable cell in ALV TREE?

    Hi all,
    I have a problem to make the cell in item row (I mean not  the cell in hierarchy columns and not in the node row) in ALV tree editable.
    I know to make it in "normal" ALV, but my ALV is type class: cl_gui_alv_tree and the nodes are calculated in a sum.Can anyone help me to set the cell editable in ALV tree?
    Thank you a lot!
    Best regards,
    Danijela Zivanovic
    Message was edited by: Danijela Zivanovic

    HI,
    To make a column editable, it will be sufficient to set the field “<b>EDIT</b>” in the field catalog. The ALV Grid perceives if there are some editable fields and adds buttons for editing purposes. If you do not need these new buttons
    <u><i>if you want it in the Classes</i></u>
    For this procedure; add the name of the field to the field “FIELDNAME”, and pass “cl_gui_alv_grid=>mc_style_enabled” to make a field editable and “cl_gui_alv_grid=>mc_style_disabled” to make a field non-editable,
    <b>Example:</b>
    FORM adjust_editables USING pt_list LIKE gt_list[] .
    DATA ls_listrow LIKE LINE OF pt_list .
    DATA ls_stylerow TYPE lvc_s_styl .
    DATA lt_styletab TYPE lvc_t_styl .
    LOOP AT pt_list INTO ls_listrow .
    IF ls_listrow-carrid = 'XY' .
    ls_stylerow-fieldname = 'SEATSMAX' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled . APPEND ls_stylerow TO lt_styletab .
    ENDIF .
    IF ls_listrow-connid = '02' .
    ls_stylerow-fieldname = 'PLANETYPE' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled . APPEND ls_stylerow TO lt_styletab .
    ENDIF .
    INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles . MODIFY pt_list FROM ls_listrow .
    ENDLOOP .
    ENDFORM
    Thanks
    Sudheer

  • How to make one of the columns in my tabular an text item with popup lov

    Hello,
    I want to manually make one of the columns say for the deptno in my tabular form as on text item popup lov using apex_item package
    and whenever user clicks on the text item popup lov, it should open up an dept table report and from which he/she needs to select
    the deptno and this deptno should be returned into the text item popup lov column.
    like for example: say if i have an emp table tabular form with all the columns and deptno column as an popup lov and when user clicks on this column
    it should open up an new sql report(similar to popup lov window), the select statement for this would be
    select deptno,dname,loc from dept order by 1;
    And from this popup lov report whenever an user selects a particular deptno, the same deptno should be returned to my text item popup column in emp tabular form.
    something like this
    select
    "EMPNO",
    "EMPNO" EMPNO_DISPLAY,
    "ENAME",
    "JOB",
    "MGR",
    "HIREDATE",
    "SAL",
    "COMM",
    APEX_ITEM.TEXT(3,deptno,20,50,'readonly=true') || '<img height="16" align="middle" width="16" style="vertical-align: middle;" alt="Popup Lov" src="/i/lov_16x16.gif"/>' deptno
    from "#OWNER#"."EMP"
    like i made my column as an text item lov and now I want to write an onclick event for the text item lov so that an popup window is displayed which is a sql report of the table dept (select deptno,dname,loc from dept order by 1;) and in this report i want to make deptno as an link so that when ever an user clicks on it
    -- this value should be returned to my text item popup lov column deptno in the emp tabular form.
    can anyone help me out with this issue.
    thanks,

    Hi,
    Refer to the link for the detailed information on ALV Grid.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    Hope it helps.
    Regards,
    Rajesh Kumar
    Edited by: Rajesh Kumar on May 25, 2009 9:13 AM

  • How to make a cell populate the same as other cells mac numbers

    does anyone know if theres a command where I can make a cell be the same value as another cell? so i change one cell and it populates the same in others. Thanks!

    Hi appleryan,
    =A1
    in any cell will bring the value of A1 into that cell.
    quinn

  • How to make state model added to the annots non changeable?

    how to make state model non changeable?
    if once i add state model Review to any annot then i should able to lock this state for that comment and no one can change this other than me.
    Is there anyway to this using java script.

    The formula node is similar to C in syntax so I would try to copy it into that. If the code you have is in Matlab you might have to make some adjustments for functions that exist only in Matlab. Of course, if you are running Matlab on the same computer you can use the Matlab interface. Complicated math in G sometime makes more sense when it is put in a formula node.

  • HELP Friends!!! How to set the width of columns of JTABLE?

    Hi!
    How to set the width of a particular column in JTable?
    I tried using headerRenderers and though I'm able to set the color and font of the header (using getTableCellRendererComponent method)I can't change the size.
    Pls some one help me..it's very urgent.
    Thanks in advance.
    Regards,
    Naval

    JTable.getColumnModel().getColumn(i).setWidth(width). There are also setPreferredWidth, setMaxWidth and setMinWidth methods.

  • How to set a column in JTable non-editable?

    I have a JTable, and how can I set a particular column non-editable?
    Thank you.

    You could create a sub class of DefaultTableModel, you pass the column number to the constructor or you add a method like setColumnEditable(0, false); to set column 0 non-editable.
    You overwrite the method isCellEditable so it will return false when the column number that is passed to the method is 0 (if you want to have column 0 non-editable).

  • How to make a cell in JTable a different colour?

    Hi, i've been playing with JTables with a custom CellRenderer, which I'm trying to make so that in the JTable, when two values down a column are found to be the same, the back ground colour changes to something same (hoping that there is a way to randomize the colour values) the code i have atm is
    In the main program :
                        find.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  datahome = cC.data;
                                  TableColumnModel colModel = cC.jtable.getColumnModel();
                                  TableColumn column = colModel.getColumn(0);
                                  column.setCellRenderer(new RedCellRenderer(new int[] {1,2}));
    in the cellrenderer:
    package packageSolo;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.*;
    import java.awt.*;
    public class SetCellColour extends DefaultTableCellRenderer {
         private int arrVerifyColumns[] = null;
         public SetCellColour(int iTestColumns[]) {
              arrVerifyColumns = iTestColumns;
         public Component getTableCellRendererComponent(JTable table, Object value,
                   boolean isSelected, boolean hasFocus, int row, int column) {
              this.setBackground(Color.RED); // All columns verified were empty - set
              // our background RED
              return this;
    }any my problem is that this cellrenderer will change the column and not just the cell, i've tried to pass where the cell is (the x and y of the cell) to the cellrenderer, but there is no way for me to interpret this value in cellrenderer and set that cell to that colour i'm not sure if there is a cell model instead of column model and be able to pass that onto the cellrenderer

    ell after several tries, i have determined that it may be something wrong with that my jtable is part of a JPanel, that is attached to a container with scroll pane that is then added to a JFrame's center... and somewhere here it freezes the display...
    my code for the actual JFrame:
    package packageSolo;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    public class ConflictCheckerGUIIntialization extends JFrame {
          * debugger
          * @param x
          *            takes in an int and prints a debug line when enabled to the
          *            console
         private void debug(int x) {
              // System.out.print("Flag: "+ x);
         private static int flag1 = 0;
         private static int flag2 = 0;
         private static int flag3 = 0;
         private static int flag4 = 0;
         private static int flag5 = 0;
         private static int flag6 = 0;
         private static int flag7 = 0;
         private static int flag8 = 0;
         private static int flag9 = 0;
         private Object[][] datahome;
         private JButton cConflict = new JButton("Check Conflict");
         private JButton find = new JButton("Find");
         private JButton quit = new JButton("Exit");
         // private JButton northavg = new JButton("North's Average");
         // private JButton eastavg = new JButton("East's Average");
         // private JButton largest = new JButton("Largest Percepitation");
         // private JButton totalPercepitation = new JButton("Total Percepitation");
         private ConflictCheckerGUI cC = new ConflictCheckerGUI();
         private JFrame jf = new JFrame();
         private JFrame jf1 = new JFrame();
         // Get the size of the default screen
         private static Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
         private int screensizex = (int) (dim.width * 0.8);
         private int screensizey = (int) (dim.height * 0.75);
         private static int gcsizex = (int) (dim.width * 0.625);
         private static int gcsizey = (int) (dim.height * 0.1953125);
         private static GUIConsole gc = new GUIConsole("Output", gcsizex, gcsizey);
         public ConflictCheckerGUIIntialization() {
              boolean RunOnce = false;
              while (RunOnce == false) {
                   if (cC.finished == true) {
                        System.out.println("he");
                        Container c1 = jf.getContentPane();
                        c1.setLayout(new FlowLayout());
                        Container c = this.getContentPane();
                        Container c2 = jf1.getContentPane();
                        JPanel jp = new JPanel();
                        jp.add(cC);
                        cConflict.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  datahome = cC.data;
                                  // System.out.print(datahome
                                  // [0][0].toString().compareTo(datahome
                                  // [1][0].toString()));
                                  // System.out.print(datahome
                                  // [0][0].toString().equals(datahome
                                  // [1][0].toString()));
                                  for (int conflictCounter2 = 1; conflictCounter2 < 3; conflictCounter2++) {
                                       int conflictCounter4 = 0;
                                       for (int conflictCounter1 = 0; conflictCounter1 <= cC.Classroomint; conflictCounter1++) {
                                            conflictCounter4++;
                                            for (int conflictCounter3 = 1; conflictCounter3 <= (cC.Classroomint - conflictCounter4); conflictCounter3++) {
                                                 if (datahome[conflictCounter2][conflictCounter1]
                                                           .toString()
                                                           .equals(
                                                                     datahome[conflictCounter2][conflictCounter1
                                                                               + conflictCounter3]
                                                                               .toString())) {
                                                      System.out.println("error at "
                                                                + conflictCounter2 + " "
                                                                + conflictCounter1);
                                   * for (int counter1 = 0; counter1 < pg.monthint;
                                   * counter1++) { for (int counter2 = 0; counter2 < 5;
                                   * counter2++) {
                                   * System.out.print(datahome[counter1][counter2] +
                                   * "\t"); } System.out.println(); }
                        quit.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  try {
                                       System.exit(0);
                                  } catch (SecurityException ea) {
                                       System.out.println("Cannot exit");
                        find.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent ae) {
                                  datahome = cC.data;
                                  Object value = null;
                                  cC.jtable.getCellRenderer(0, 0)
                                            .getTableCellRendererComponent(cC.jtable,
                                                      value, false, true, 0, 0).setFont(new Font(
                                                      "Serif", Font.BOLD, 14));
                                  System.out.println(cC.data[0][0].toString());
                                  // .setFont(new Font("serif", Font.BOLD, 12));
                        gc
                                  .println("There is a known bug with this program that if you enter any information in the table,");
                        gc
                                  .println("then not confirming it by not going to another cell, then the data you've entered it not valid and not considered to be input,");
                        gc
                                  .println("this will be fixed in future revisions if possible");
                        gc.show();
                        gc.setLocation(0, screensizey);
                                    *bold*
                                   *bold* c2.add(jp, "Center");
                        *bold*c2.add(new JScrollPane(jp,
                                  *bold*ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                  *bold*ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED),
                                  *bold*"Center");
                        c1.setLayout(new GridLayout(2, 5));
                        c1.add(cConflict);
                        c1.add(find);
                        c1.add(quit);
                        c1.setVisible(true);
                        c2.setVisible(true);
                        c.add(c1, "South");
                        c.add(c2, "Center");
                        c.setVisible(true);
                        this.pack();
                        this.setTitle("Lancer's Class Conflict Checker");
                        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
                        this.setSize(screensizex, screensizey);
                        RunOnce = true;
                        // ! this.pack(); //this tries to set the size of the thing to a
                        // perferred size, and if used will not alow the dynamic sizing
                        // of
                        // the
                        // main JTable window based on the user's screensize
         public static void main(String[] args) {
              ConflictCheckerGUIIntialization x = new ConflictCheckerGUIIntialization();
              x.setVisible(true);
    }here, the JPanel with the jtable is added to c2 and c2 is added to c and c's parent is the JFrame of this whole class
    and the code for the jtable JPanel is:
    package packageSolo;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import java.io.FileNotFoundException;
    import javax.swing.*;
    import javax.swing.table.*;
    public class ConflictCheckerGUI extends JPanel {
         private void debug(int x) {
              // System.out.println(x);
         protected static boolean finished = false;
         protected static DefaultTableModel[][] data;
         protected static int Classroomint = 0;
         protected static JTable jtable;
         protected static String[] columnNames = { "Classroom", "Period One",
                   "Period Two", "Period Three", "Period Four" };
         protected static int GoAheadFlag = 0;
         SetCellColour renderer;
         public ConflictCheckerGUI() {
              // super(new GridLayout(1, 0));
              JFrame Choose = new JFrame();
              Choose.setDefaultCloseOperation(Choose.EXIT_ON_CLOSE);
              JButton ImportFromFile = new JButton("Impoort From File");
              JButton New = new JButton("New Planner");
              ImportFromFile.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent ae) {
                        String[] North;
                        String[] East;
                        String[] South;
                        String[] West;
                        String[] Month;
                        // JFileChooser fc = new JFileChooser();
                        // fc.show();
                        // int returnVal = fc.showOpenDialog(fc);
                        // File file = null;
                        // if (returnVal == JFileChooser.APPROVE_OPTION) {
                        // file = fc.getSelectedFile();
                        java.util.Scanner parse = null;
                        File file = new File(
                                  "E://Documents and Settings//TheHolyLancer//My Documents//java - old//Eclipse workspace//Precipitation//packageSolo//datasave.txt");
                        try {
                             parse = new java.util.Scanner(file);
                        } catch (FileNotFoundException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                        Classroomint = Integer.parseInt(parse.next());
                        North = new String[Classroomint];
                        East = new String[Classroomint];
                        South = new String[Classroomint];
                        West = new String[Classroomint];
                        Month = new String[Classroomint];
                        for (int counter1 = 0; counter1 < Classroomint; counter1++) {
                             Month[counter1] = "n/a";
                        for (int counter2 = 0; counter2 < Classroomint; counter2++) {
                             North[counter2] = "n/a";
                             East[counter2] = "n/a";
                             South[counter2] = "n/a";
                             West[counter2] = "n/a";
                        data = new DefaultTableModel[Classroomint][5];
                        jtable = new JTable(new DefaultTableModel(Classroomint,5));//columnnames
                        jtable.setPreferredScrollableViewportSize(new Dimension(800,
                                  600));
                        finished = true;
              New.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent ae) {
                        String input;
                        String[] North;
                        String[] East;
                        String[] South;
                        String[] West;
                        String[] Month;
                        int flag2 = 0;
                        int flag4 = 0;
                        int flag5 = 0;
                        int flag8 = 0;
                        input = JOptionPane
                                  .showInputDialog("How many classromms are there?");
                         * see if the user wantes to quit at this point
                        if (input == null) {
                             debug(4);
                             int exitint = 0;
                             exitint = JOptionPane.showConfirmDialog(null,
                                       "Do you want to exit?", "Exit?",
                                       JOptionPane.OK_CANCEL_OPTION);
                             if (exitint == 0) {
                                  try {
                                       System.exit(1);
                                  } catch (SecurityException eb) {
                                       System.out.println("exit");
                        while (flag4 == 0) {
                              * this while loop with flag2 is for checking if the thing
                              * is of int class
                             while (flag2 == 0) {
                                   * try to get a integer, check for a bad input class
                                  try {
                                        * parse, and if success set flag2 to 1 and break
                                        * out this while loop
                                       Classroomint = Integer.parseInt(input);
                                       flag2 = 1;
                                       debug(2);
                                  } catch (NumberFormatException ec) {
                                       debug(3);
                                        * ops user input was not a integer class
                                       JOptionPane.showMessageDialog(null,
                                                 "Enter a positive integer only",
                                                 "Number Format is Wrong",
                                                 JOptionPane.ERROR_MESSAGE);
                                       input = JOptionPane
                                                 .showInputDialog("How many months are there?");
                                        * see if the user wantes to quit at this point
                                       if (input == null) {
                                            debug(4);
                                            int exitint = 0;
                                            exitint = JOptionPane.showConfirmDialog(null,
                                                      "Do you want to exit?", "Exit?",
                                                      JOptionPane.OK_CANCEL_OPTION);
                                            if (exitint == 0) {
                                                 try {
                                                      System.exit(1);
                                                 } catch (SecurityException eb) {
                                                      System.out.println("exit");
                              * this while loop sees if the integer is smaller than 0 so
                              * the array cannot be a real one
                             while (flag5 == 0) {
                                  // numamountint = Integer.parseInt(numamount);
                                  if (Classroomint < 0) {
                                       debug(5);
                                       JOptionPane.showMessageDialog(null,
                                                 "Enter a positive integer",
                                                 "Number Format/Size is Wrong",
                                                 JOptionPane.ERROR_MESSAGE);
                                       input = JOptionPane
                                                 .showInputDialog("How many months are there?");
                                       if (input == null) {
                                            int exitint = 0;
                                            exitint = JOptionPane.showConfirmDialog(null,
                                                      "Do you want to exit?", "Exit?",
                                                      JOptionPane.OK_CANCEL_OPTION);
                                            if (exitint == 0) {
                                                 try {
                                                      System.exit(1);
                                                 } catch (SecurityException eb) {
                                                      System.out.println("exit");
                                        * this while loop check for number format again
                                       while (flag8 == 0) {
                                            try {
                                                 debug(6);
                                                 Classroomint = Integer.parseInt(input);
                                                 flag8 = 1;
                                            } catch (NumberFormatException ec) {
                                                 debug(7);
                                                 JOptionPane.showMessageDialog(null,
                                                           "Enter a positive integer only",
                                                           "Number Format is Wrong",
                                                           JOptionPane.ERROR_MESSAGE);
                                                 input = JOptionPane
                                                           .showInputDialog("How many months are there?");
                                                 if (input == null) {
                                                      int exitint = 0;
                                                      exitint = JOptionPane
                                                                .showConfirmDialog(
                                                                          null,
                                                                          "Do you want to exit?",
                                                                          "Exit?",
                                                                          JOptionPane.OK_CANCEL_OPTION);
                                                      if (exitint == 0) {
                                                           try {
                                                                System.exit(1);
                                                           } catch (SecurityException eb) {
                                                                System.out.println("exit");
                                  } else {
                                        * here the input is greater than 0 so it sets flag5
                                        * and 4 then break out of the while loops
                                       debug(8);
                                       flag5 = 1;
                                       flag4 = 1;
                        North = new String[Classroomint];
                        East = new String[Classroomint];
                        South = new String[Classroomint];
                        West = new String[Classroomint];
                        Month = new String[Classroomint];
                        for (int counter1 = 0; counter1 < Classroomint; counter1++) {
                             Month[counter1] = "n/a";
                        for (int counter2 = 0; counter2 < Classroomint; counter2++) {
                             North[counter2] = "n/a";
                             East[counter2] = "n/a";
                             South[counter2] = "n/a";
                             West[counter2] = "n/a";
                        DefaultTableModel tableModel = new DefaultTableModel(Classroomint, 0);
                        tableModel.addColumn("Classroom");
                        tableModel.addColumn("Period One");
                        tableModel.addColumn("Period Two");
                        tableModel.addColumn("Period Three");
                        tableModel.addColumn("Period Four");
                        /*protected static String[] columnNames = { "Classroom", "Period One",
                             "Period Two", "Period Three", "Period Four" };*/
                        // /jtable = new JTable(data, columnNames);
                        jtable = new JTable(tableModel) {
                             private static final long serialVersionUID = 1L;
                             public TableCellRenderer getCellRenderer(int row, int col) {
                                  return renderer;
                        jtable.setRowSelectionAllowed(true);
                        jtable.setPreferredScrollableViewportSize(new Dimension(800,
                                  600));
                        finished = true;
              Container ButtonHolder = new Container();
              ButtonHolder.setLayout(new GridLayout(1, 2));
              ButtonHolder.add(New);
              ButtonHolder.add(ImportFromFile);
              Choose.add(ButtonHolder);
              Choose.setSize(200, 300);
              Choose.setVisible(true);
              boolean RunOnce = false;
              while (RunOnce == false) {
                   if (finished == true) {
                        //JScrollPane scrollPane = new JScrollPane(jtable);
                        this.add( jtable, BorderLayout.CENTER );
                        Choose.setEnabled(false);
                        RunOnce = true;
    }but upon start, and select start new table, the windows come up, but on where the large JFrame is and where the jtable is, nothing appears, and it acts like a screen cap and the thing just stucks like what is on the background of the computer... i think in all this linking i may have screwed something up, and the examples given were not designed for JPanels, but rather for JFrames... maybe i could implement all this into one class, since the buttons for choosing from load from file and all that can be in the first file as another JFrame, that is first visible, then when user chose one, something becomes visible, or something
    but anyone knows how to fix all this?

Maybe you are looking for

  • "itunes has encountered a problem and needs to close" message appears

    Every time I try to open itunes a Windows message comes up saying "itunes has encountered a problem and needs to close." I tried uninstalling and downloading it again, but nothing is working. What do I do??   Windows XP  

  • Holdback (without taxes) on PO invoice?

    hi all, i have a requirement where business holds back 10% (without taxes) and pays 90% (with taxes) to the vendor. Any help on how to accomplish this would be great! The invoice is broken down as follows: PO Invoice with original contract: 197,299.0

  • T7900 remote screwed...

    Hey. I bought a Creative Inspire T7900 with my dell computer, and now i have a problem with the sound system(which is covered by dell), but i hoped for a quicker answer here before i asked them. The bass in my sound dissapears sometimes when i use th

  • Corruption on screen recordings - Captivate 6

    I am trying to capture some simple data entry screens in Captivate 6. However I keep getting artefacts in the output SWF file .. horizontal lines and the remnants of previous screens text boxes. Have experimented with loads of different settings ...

  • BPM WorkSpace in WebCenter Space

    Hi, How to configure BPM Workspace in WebCenter Space? Pleaes help me & provide step by step configuration doc. Thanks Dharm