JScrollPane scroll setting first column is not visible?

Hi All,
i am using jtable and jscrollpane. in this my first column of 70 pixal width and rest 125 pixal width.set focus is on 1 cell(1 row, 1 column) in table. but due to this scrollbar is slightly on right side whice coz first column not visible.(need to drag for visibility). i am trying to make it visible without dragging.
how to do this? HELP.
i tried with tableScroll.scrollRectToVisible(table.getCellRect(0,0,true )); & -1,-1
but it didnt worked.
Code is like this..........
table = new JTable(64,65){
table.setName("Table");
((DefaultTableModel)table.getModel()).setColumnIdentifiers(vectName.getColumnIdentifiers());
          for(int i = 0;i<table.getRowCount();i++) {
               table.setValueAt((i+1)+"",i,0);
          table.setGridColor(Color.black);
          table.setSelectionBackground(new Color(125,255,144));
          table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
          table.setCellSelectionEnabled(true);          
          table.addKeyListener(listener);
          table.addMouseListener(listener);
          table.getSelectionModel().addListSelectionListener(this);
          table.getColumnModel().addColumnModelListener(this);
          table.getColumnModel().getColumn(0).setResizable(false);
          table.getColumnModel().getColumn(0).setMinWidth(70);
          table.getColumnModel().getColumn(0).setMaxWidth(70);
JScrollPane tableScroll = new JScrollPane(table);
Dimension minimumSize = new Dimension(100,25);
tableScroll.setMinimumSize(minimumSize);          
add(tableScroll);

Hi weebib ,
pls find some working code which shous my problame .
you can see its coming to column 'B'. but i want it to show from column 'A' .
sample working code : =
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.table.*;
import java.util.*;
public class myTable extends JFrame{
JTable table;
JScrollPane jsp;
JPanel p1;
int NO_OF_ROWS = 64;
int NO_OF_COLUMNS = 65;
Vector vColumnNames ;
myTable(){
     Container con = getContentPane();
     p1 = new JPanel();
     table = new JTable(NO_OF_ROWS,NO_OF_COLUMNS){
          public boolean isCellEditable(int row, int column) {
                              if(column == 0){
                                   return false;
                              else{
                                   return true;
     setTableProperties();
     jsp = new JScrollPane(table);
     p1.add(jsp);
     con.add(p1);
     setSize(400,500);
     show();
     //System.out.println("Hello there");
public Vector getColumnIdentifiers(){
     vColumnNames = new Vector();
               for(int i=65;i<129;i++) {
                    vColumnNames.add(new String((char)i+""));// setting the alphabets for the column names //orig
     return vColumnNames ;
public void setTableProperties(){
     ((DefaultTableModel)table.getModel()).setColumnIdentifiers(getColumnIdentifiers());
     for(int i = 0;i<table.getRowCount();i++) {
                    table.setValueAt((i+1)+"",i,0);// Set the names of the row
     table.setGridColor(Color.black);
     table.setSelectionBackground( Color.RED);
     table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
     table.setCellSelectionEnabled(true);
     table.addMouseListener(new myMouseListener());
     table.addKeyListener(new myKeyListener());
//     table.getColumnModel().getColumn(0).setPreferredWidth(125);
//     table.getColumnModel().getColumn(0).setResizable(false);
//     table.getColumnModel().getColumn(0).setMinWidth(70);
//     table.getColumnModel().getColumn(0).setMaxWidth(70);
     for(int u =0 ;u<64;u++){
          if(u==0){
               table.getColumnModel().getColumn(u).setPreferredWidth(70);
          else{
               table.getColumnModel().getColumn(u).setPreferredWidth(200);
     table.changeSelection(0,1,false,false);
static public void main(String[] args){
          myTable test = new myTable();
          test.addWindowListener(new WindowAdapter(){
               public void windowClosing(WindowEvent e){System.exit(0);}
public class myMouseListener extends MouseAdapter{
     public void mousePressed(MouseEvent me){
               table.repaint();
public class myKeyListener extends KeyAdapter{
     public void keyPressed(KeyEvent ke){
               if(table.getSelectedColumn() == 0){
                    ke.consume();
================
pls do reply back if i am doing something wrong.
== Gavin

Similar Messages

  • SSRS 2008 R2 - Column Headers of a tablix visible while scrolling - Then the column headers not visible on 2nd page onwards for PDF EXPORT. it's vice versa. Hence it is possible to provide both at same time ?

    Hi,
    I am using SSRS 2008 R2.
    I have two TABLIX in a report.  One is TABLIX with row/clumn grouping. 2nd one is flat view.
    Here each tablix is dispaly it's data on single page for each.
    My Requirement on First TABLIX is:
         1. I have to make column headers visible on scrolling down
         2. Export to PDF - column headers must be visible on all the pdf pages  for same tablix data.
    But ... either one is achieved at my end.
    so ... any suggestions please to achieve both at same time.
    thank you in advance.
    best regards,
    venkat.

    Hi G.V.Naidu,
    According to your description, the first tablix is matrix to use display data.
    In SSRS, if we want to fix matrix header visible while scrolling and repeat header columns on each page, we can select the corresponding option to enable this function. Please refer to the steps below:
    1. Right click tablix, and select Tablix Properties.
    2. Select “Keep header visible while scrolling” and “Repeat header rows on each page” to enable these function.
    If we are use table to display data, please refer to the article about Repeat Header / Keep Header Visible in Tables.
    http://blogs.msdn.com/b/robertbruckner/archive/2008/10/13/repeat-header-and-visible-fixed-header-table.aspx
    If there are any misunderstanding, please feel free to let me know.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • WPF: How to make the first column does not show row separator and Left column separator in DataGrid?

    Our WPF application uses DataGrid.
    One of request is that first column of DataGrid does not show row separator and also does not show Left column separator. So it looks like the first column does not belong to the DataGrid. However, when select a row, the cell of first column still get selected.
    How do we make it? Thx!
    JaneC

    Hi Magnus,
    Thanks for replying our question and provide your solution!
    Your solution works by setting "HorizontalGridLinesBrush" and "VerticalGridLinesBrush" to {x:Null} in the DataGrid style and modify "CellStyle" in first column as following:
    <DataGridTextColumn MinWidth="32"
    Binding="{Binding CellName}"
    CanUserReorder="False"
    CanUserSort="False"
    Header="Cell}"
    IsReadOnly="true" >
    <DataGridTextColumn.CellStyle>
    <Style TargetType="DataGridCell">
    <Setter Property="IsEnabled" Value="False"></Setter>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridCell}">
    <Border BorderThickness="0" BorderBrush="{x:Null}"
    Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Margin="-1">
    <Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
    <ContentPresenter VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    </DataGridTextColumn.CellStyle>
    </DataGridTextColumn>
    We found another way to achieve it by using DataGridRowHeader. The good way to use DataGridRowHeader is that we do not need to make the first column ReadOnly (click on first column does not select whole row anymore). Select RowHeader in a row will select
    whole row. Move scroll bar horizontally, the row header still keep in visible area.
    <Style TargetType="{x:Type DataGridRowHeader}" x:Key="dataGridRowHeaderStyle">
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="HorizontalAlignment" Value="Center" />
    <Setter Property="Height" Value="42" />
    <Setter Property="SeparatorBrush" Value="{x:Null}" />
    <Setter Property="FontSize" Value="16" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
    <Grid>
    <Border x:Name="rowHeaderBorder"
    BorderThickness="0"
    Padding="3,0,3,0"
    Background="{Binding Background, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
    BorderBrush="{x:Null}">
    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
    </Border>
    </Grid>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <DataGrid>
    <DataGrid.RowHeaderStyle>
    <Style TargetType="DataGridRowHeader" BasedOn="{StaticResource dataGridRowHeaderStyle}">
    <Setter Property="Content" Value="{Binding CellName}" />
    <Setter Property="Width" Value="35"/>
    </Style>
    </DataGrid.RowHeaderStyle>
    </<DataGrid>
    JaneC

  • How to set first column as date (dd/mm/yyyy) in the specific format in excel

    hi need help wat i did need help is tht i need wen ever i send view a excel data  the first column set to date  but some times wen i view in different type of pc the date format change to mm/dd/yyyy. is  thr any way i can set the format?

    If you just need to reformat a correct date to show up as dd/mm/yyyy, just use the "Format Cells" command and set a custom format string to exactly that. If, on the other hand, you are finding that Excel just doesn't get that the first value is a DAY, not a month, such as trying to graph a temperature data logger that records data in dd/mm/yyyy:
    Reformat the strings as dd/mm/yyyy, using the first method. This will make them LOOK correct, even though the actual date VALUES are still day-month inverted. Now save the table as a .CSV file. This will save the dates as plain text in the correct order, which you can then re-import and have Excel now read the correct date value.
    Ryan R.
    R&D

  • Column names not visible in JTable

    Hello everyone,
    i have an Object array columns that i pass to the constructor of JTable, but for some reason the column names are not visible in my table.
    private final Object[] columns = {"Zeit", "Termin"};
    private Object[][] rows;
    //the next line fills the two-dimensional rows-array
    fillRows();
    //here the constructor
    JTable table = new JTable(rows, columns);
    table.setColumnSelectionAllowed(false);
    table.setDragEnabled(false);
              table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    TableColumnModel colModel = table.getColumnModel();
    TableColumn column = colModel.getColumn(1);
    column.setCellRenderer(new BookedCellRenderer(new int[] {3,4}));What are possible reasons/sollutions for this problem?

    Gosh, thanks! Usually i always use a jscrollpane for
    jtables and was about to use it too, but i got
    confused because of the headers when i tried to see
    whether the data in the table was right.You're welcome. The JTableHeaders object can be displayed in, say,
    the NORTH part of a BorderLayout while the JTable itself is displayed
    int the CENTER part. You can even display the headers SOUTH of
    the table itself if you like. A JTable object is quite flexible.
    kind regards,
    Jos

  • Lookup columns values not visible in Sharepoint designer

    I had created a lookup column for a list.
    I had generated a stp and created a new list in the new environment.
    The lookup columns were not working, so i created new columns with the existing name.
    But when i eid t aview in designer, i dont seem to find the clumn values.
    Could you please help.

    Hi,
    It is known issue that on exporting list items, look up column values are lost.
    For your issue, you can take steps as below to retain look up column values in export list template:
    1. Browse to the source Web’s lookup list “Sub Category” and choose Modify settings and columns.
    2. Copy the source lookup list GUID from the URL. It should be a sequence of numbers and letters similar to:  %7BFFA47BF8%2D849C%2D4F20%2D9C50%2D173D2F5B6725%7D.
    3. Browse to the destination Web’s lookup list and choose Modify settings and columns.
    4. Copy the destination lookup list GUID from the URL. Similar as point 2.
    5. Delete %2D from the string and replace with a dash sign (-). There should be no dash sign (-) at the start and the end. GUID should be in the following format: FA47BF8-849C-4F20-9C50-173D2F5B6725
    6. Save the source Web’s list that contains a lookup column “Category” to the lookup list as a list template called category.stp.
    7. Export the list template STP from the source list template gallery to the file system.
    8. Rename the category.stp file to category.cab so Windows can open it.
    9. Open the file, right click on the manifest.xml file and export it to the file system.
    10. Edit the manifest.xml file; find the source Web’s lookup list GUID and replace it with the destination Web’s lookup list GUID.
    11. Save the manifest.xml file.
    12. Open a VS.NET command prompt.
    13. Run the makecab command as: makecab manifest.xml category.stp
    14. Import the new STP into the destination Web’s list template gallery. You will need to delete it if it has previously been imported.
    Reference:
    http://sharepointknowledgebase.blogspot.com/2012/09/retain-look-up-column-values-in-export.html#.VPg8d3kcQiQ
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to Set column value in SO matrix , if the column is not visible.

    Hi,
    We are trying to set value in to a column from sales order matrix with the below mentioned code
    ((SAPbouiCOM.EditText)oMat.Columns.Item("U_TWBS_AC_BaseEntry").Cells.Item(pVal.Row).Specific).String
    it will throw an u201CForm Item is not editable u201C  error if the  column ("U_TWBS_AC_BaseEntry")  visible is set to false through form settings.
    how can we solve the issue,can we use any DI object in order to reset the form settings.
    Thanks & Regards

    Hi
    Try and make the column visible then set the value and make it invisible then
    Hope this helps
    Regards
    Vivek

  • ESS- ABAP Webdynpro- table column not visible

    Hi,
    We are using SAP travel management for expense approvals. In the package PTRM_WEB_UI, you will find the component FITE_VC_RECEIPTS. In the VIEW - RECEIPTS_VIEW you will find in the table that there is a column called "Short Info". However this column in not visible in the portal.
    There is no personalization done to hide this column.
    The visible property of this column  is set to "visible".
    In portal content directory if i right click....this column is not even available to be added/removed.
    Please help me understand why this column in not visible and how can i make it appear in portal.
    Thank You!

    Any input?

  • BOM Item category column not visible into CS01

    Hi,
    Till yesterday we create BOM for FG component with item category L,
    But today while creatting BOM ,item category column is not visible so that it is not possible to create BOM.
    we have not make any changes into SPRO Regarding BOM,
    What will be the possible reason?
    Regards,
    Devendra

    Hi,
    Item category column was make invisible by someone during processing CO02 through SHD0.
    now it it makes visible.
    Regards,
    Devendra

  • Read From Measurement File... removes X Values of first column?

    During one of our tests, two instruments were switched at the terminal by accident. I need to read in the massive lvm files, remove the wrong scaling and apply the correct scaling, while switching the values in the columns and right it all to new files. Simple right?
    I wanted to use the Read from Measurement File.vi to make things easier, because the files are very large and I would like to analyze them 100 rows at a time. Some of the the files are around 1.5 Gigs in size so I need to read them in chunks.
    The read from measurement file keeps removing the first column from the data! It outputs the data as a signal (dynamic data) and I have to use the dynamic to numeric array express vi. For some reason, before I even get to that point, the first column is not in the data.
    No matter what settings I pick on the read from measurement express vi, the time column is removed from the data. I have checked/unchecked the "first row is channel names" and "first column is time channel" to no avail. The odd thing is that in the preview it shows the first column, as if it will read it properly... but it doesnt. Nothing I change in the settings can seems to make a difference in getting the first column, the x values, out of the file.
    Below you can see the first column completely removed from the data.
    This is extremely frustrating. By probing the signal out I can see the dynamic data attributes and the time column has already been removed, so I don't think that the signal to double array express vi is the problem, but I am not sure.
    I am attaching my VI and a small data file to be analyzed. You can see what I mean.
    The alternatives seem less than adequate. The read from spreadsheet file vi wants an offset of a specific number of characters not rows. The problem is that this is not constant between rows for some reason, when hidden characters are taken into account so I cant just set the number of characters in 100 rows and increment the offset in a loop... like I normally would. That means I might miss data or get a corrupted row.
    This means that I have to use the read from text file, read how ever many characters I think a row is (over estimating a bit) then search for the newline character, find out how many chars are in that set and then offset that for the next loop iteration, all while converting each string number to a double. Talk about slow.
    I have searched around and found that I am not the only one that has had this issue. This is a common thing, but no one seems to have the answer. Why can't the read from measurement file VI read all of the numbers in every row? Why cant I tell it I want a 2d array of doubles out and not a dynamic data type? It has to be something I am doing wrong.
    Attached is a zip file with my VI and two data files. The "S19_A_DSI_detensioning_c.lvm" is the one generated by my VI (_c meaning corrected). "S19_A_DSI_detensioning.lvm" is the original measurement file. I hope you will pardon my messy VI, it's a quicky.
    Any help you guys can give would be much appreciated.
    [will work for kudos]
    Attachments:
    Scaling Factor Correction.zip ‏1109 KB

    That is a great workaround. The help talked about putting a check next to "read lines" but for the life of me I couldn't find where to do that. I wonder what other VIs have mystery check options in the right mouse click menu. I mean normally options like those are inputs, I thought. I'm going to start right clicking on every VI I drop to see if there are options there I never realized.
    I would still have to use the set file position VI and specify the byte offset right? How would I know where that is? I guess each character is a byte and I would count the characters in the string retrieved and then offset by that amount on the next iteration using a shift register?
    While waiting for help, I ended up using the read from text file and using the match string to look for the new line character, and using the spreadsheet string to array vi, analyzed the files line by line. Thats just because I couldn't easily come up with a regular expression to get 100 lines. It was slow but it worked.
    However, that still really doesn't answer the question of why it is impossible to get the first column with the read from measurement file express VI. Does anyone know? Is this a known bug?
    [will work for kudos]

  • Assign first column as fixed in table view

    I have a table view with many columns and I was wondering if it's possible in JavaFX 2.2 to assign the first column as fixed so when a user scrolls to the right the first column is always visible? I checked the API and this forum and didn't find a way to accomplish that.
    Thanks.
    Stefan
    Edited by: 882590 on Mar 26, 2013 12:43 PM

    I'd also like to see this functionality. This kind of behavior is useful when the first column is an ID-type attribute and there are too many other attributes to view at once for each record.
    Actually, it turns out there is an open Feature request for just this: https://javafx-jira.kenai.com/browse/RT-19454 . If it's important to you, you ought to vote for it.
    -David

  • Oracle 10G Commit Not Visible

    I have a commit or concurrency issue I hope someone can shed some light on.
    I'm building rows in a reporting table via several stored procedures and reporting on the results.
    The final stored procedure uses the rows built by the initial stored procedures and occasionally, the rows initially created are not visible to the final stored procedure.
    Is there a way to force Oracle to COMMIT the rows and WAIT so there are 100% visible to subsequent stored proccedures?
    Thanks. (Oracle DB 10.2.0.3.0 Client 11.2.0.2)
    In summary -
    1> Proc #1 runs and builds summary rows
    2> Proc #2 runs and builds summary rows
    3> proc #3 runs and builds summary rows
    4> proc #4 then does some totals on the results of the first 3 procs.
    Sometimes the results of the first procs are not visible to proc#4 when it runs.
    I have explicit commits at the end of the stored procedures. In theory I (or anyone else) should be able to see the results of each stored procedures as it runs but sometimes they are not. I have actually seen this happen by monitoring the rows in the reporting table coupled with DBMS_OUTPUT from the stored procs.
    The reporting table can be active, accessed simultaneously by a 20? users at a time. It does seem timing sensitive, when I add some wait time in the app before calling each stored proc the number occurrences where rows are not found decrease. Similarly, when the numbers of users decrease the number of occurrences decrease.
    proc1 summary_labor
    cursor proc_cursor1 is select * from table1;
    For c_row1 in proc1
    Do some calculations
    Insert a summary row into reporting table
    end; -- For
    COMMIT;
    End Proc1

    user7313584 wrote:
    I have a commit or concurrency issue I hope someone can shed some light on.
    I'm building rows in a reporting table via several stored procedures and reporting on the results.
    The final stored procedure uses the rows built by the initial stored procedures and occasionally, the rows initially created are not visible to the final stored procedure.
    Is there a way to force Oracle to COMMIT the rows and WAIT so there are 100% visible to subsequent stored proccedures?
    Thanks. (Oracle DB 10.2.0.3.0 Client 11.2.0.2)
    In summary -
    1> Proc #1 runs and builds summary rows
    2> Proc #2 runs and builds summary rows
    3> proc #3 runs and builds summary rows
    4> proc #4 then does some totals on the results of the first 3 procs.
    Sometimes the results of the first procs are not visible to proc#4 when it runs.
    I have explicit commits at the end of the stored procedures. In theory I (or anyone else) should be able to see the results of each stored procedures as it runs but sometimes they are not. I have actually seen this happen by monitoring the rows in the reporting table coupled with DBMS_OUTPUT from the stored procs.
    The reporting table can be active, accessed simultaneously by a 20? users at a time. It does seem timing sensitive, when I add some wait time in the app before calling each stored proc the number occurrences where rows are not found decrease. Similarly, when the numbers of users decrease the number of occurrences decrease.So procedure 4 is dependant on the completion of procedures 1 thru 3. So what is causing procedure 4 to run before those others have completed? You need to ensure it doesn't run until such a time.
    proc1 summary_labor
    cursor proc_cursor1 is select * from table1;
    For c_row1 in proc1
    Do some calculations
    Insert a summary row into reporting table
    end; -- For
    COMMIT;
    End Proc1Horrible code.
    Use a single INSERT ... SELECT ... statement to avoid context switching which is inevitably causing the code to run slowly.

  • How to make added columns to be visible by default in interactive report?

    Hi,
    I've added two columns to an interactive report.
    When I run the page, the added columns are not visible.
    Then I made them visible through 'Select Columns' option.
    But next time when I log in those two columns are again invisible.
    How can I make the added columns to be visible by default in the interactive report?
    Thanks,
    Guy

    Hi Steve,
    I am ahving a similar issue.After I migrated my classic report to interative report, I have added few columns to the SQL query...I am not anle to see these in the report..I deint understand the solution u gave here..Can you please elaborate..
    Where can I include the "actions" option? and how do I use the Save Action.
    Can you please provide more details.
    Thanks in Advance

  • JTable - make first column not scrollable

    I like to know using one JTable and JScrollPane to make it generically not scroll for the first column.
    Do you set the viewport to start at the second column, if so how?
    Thanks
    Abraham

    Heres a test to run with the renderers and editors for fixed table columns
    See source for FixedColumnScrollPane
    // import libraries required, no space
    public class SimpleTable extends JFrame {
       private static class MyTableCellRenderer extends DefaultTableCellRenderer {
          public MyTableCellRenderer() {
             super();
             setOpaque(true);
             noFocusBorder = new EmptyBorder(1, 2, 1, 2);
             setBorder(noFocusBorder);
          public Component getTableCellRendererComponent(JTable table, Object value,
                                                         boolean isSelected, boolean hasFocus,
                                                         int row, int col) {
             JLabel renderer = (JLabel) super.getTableCellRendererComponent(table, value,
                   isSelected, hasFocus, row, col);
             String cellValue = value.toString();
             renderer.setHorizontalAlignment(SwingConstants.LEFT);
             renderer.setToolTipText(cellValue);
             String headerValue = table.getColumnModel().getColumn(col).getHeaderValue().toString();
             // Use header value for renderers when splitting table columns, dont check by column index
             if (headerValue.length() == 0) {
                renderer.setText("Row " + (row+1));
             if (cellValue.startsWith("a")) {
                renderer.setForeground(Color.blue);
             } else if (cellValue.startsWith("b")) {
                renderer.setForeground(Color.green);
             } else if (cellValue.startsWith("c")) {
                renderer.setForeground(Color.blue);
             } else if (cellValue.startsWith("d")) {
                renderer.setForeground(Color.magenta);
             } else if (cellValue.startsWith("e")) {
                renderer.setForeground(Color.ORANGE);
             return this;
       public class MyTableCellEditor extends AbstractCellEditor implements TableCellEditor {
          private JComponent component = null;
          public Component getTableCellEditorComponent(JTable table, Object value,
                                                       boolean isSelected,
                                                       int row, int col) {
             this.component = new JTextField(value.toString());
             return this.component;
          public Object getCellEditorValue() {
             if (component instanceof JTextComponent) {
                String text = ((JTextComponent) component).getText();
                return text;
             return null;
       public SimpleTable() {
          super("Simple JTable Test");
          setSize(300, 200);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          TableModel mainTableModel = new AbstractTableModel() {
             private static final int ROWS = 1000;
             String colValues[] = {"", "a", "b", "c", "d", "e"};
             String data[][] = new String[ROWS][colValues.length];
             String headers[] = {"", "Column 1", "Column 2", "Column 3", "Column 4", "Column 5"};
             public int getColumnCount() {
                return colValues.length;
             public int getRowCount() {
                return ROWS;
             public String getColumnName(int col) {
                return headers[col];
             // Synthesize some entries using the data values & the row #
             public Object getValueAt(int row, int col) {
                String val = data[row][col];
                if (val == null) {
                   val = colValues[col] + row;
                   data[row][col] = val;
                return val;
             public void setValueAt(Object value, int row, int col) {
                data[row][col] = value.toString();
             public Class getColumnClass(int column) {
                return getValueAt(0, column).getClass();
             public boolean isCellEditable(int row, int col) {
                return (col > 0);
          JTable mainTable = new JTable(mainTableModel);
          TableColumnModel mainColumnModel = mainTable.getColumnModel();
          for (int i = 0; i < mainColumnModel.getColumnCount(); i++) {
             TableColumn tableColumn = mainColumnModel.getColumn(i);
             tableColumn.setCellRenderer(new MyTableCellRenderer());
             tableColumn.setCellEditor(new MyTableCellEditor());
          FixedColumnScrollPane fixedColumnScrollPane
                = new FixedColumnScrollPane(mainTable, 1);
          setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
          JLabel fixedLabel = new JLabel("Fixed Column Table");
          fixedLabel.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 11));
          getContentPane().add(fixedLabel);
          getContentPane().add(fixedColumnScrollPane);
       public static void main(String args[]) {
          SimpleTable st = new SimpleTable();
          st.setVisible(true);
    }

  • Setting scroll bar to inbisible when not needed

    Here is the post again, some quotation marks came out as
    letters before. This is correct version
    I'm using AS 2.0, and have added a
    scroll bar with instance name: ...................sb1
    a dynamic text field with instance name:.... tb1_txt
    an external text file named as:....................home.txt
    I want to make the scroll bar invisible or transparent, when
    its is not needed. I'm thinking that I may have to use the _visible
    property, but not sure of the correct code to integrate this.
    Any suggestions anyone?

    // Note:
    Create a movie clip to put the code into
    Use only 2 frames
    Use 2 layers
    Layer 1 put the action script
    Layer 2 put the textarea and the scrollbar
    Put a keyframe on each frame in only the Action Script layer.
    The 2nd layer should only have a keyfram on the first frame
    and span both frames 1 and 2.
    On the first frame (do not put a stop() method here)
    - set the visibility of the scrollbar to false
    - set the text content / value of the textarea
    On the second frame
    - Put the action script
    stop();
    if(textDisplay.maxscroll &gt; 1){
    textscroll._visible = true;
    } // if

Maybe you are looking for

  • Oracle Portal & BI 10g on Windows XP Professional

    Hi, I'm planning to install 10gAS (Portal, BI) on XP Professional. But while installing it says it is not Certified. Does anyone using it on XP? If I ignore warning and go ahead will it work? Thanks & Regards Santos B

  • Problem may be with saaj.jar and AXIS,WAS,WSAD

    Hi, I have successfully developed and deployed an EJB using WSAD 5.1.2's WebSphere 5.0 Test Environment. I have even able to access the EJB using UTC(Universal Test Client) in WSAD and by launching the j2ee client module using WebSphere lauchClient p

  • Need advice on displays

    I am currently using a couple of Sony CRT G520/420 displays. I am looking at getting a 23-24 inch LCD and will be using it mostly at home for Photography using Photoshop, Bridge, Lightroom etc., for output to inkjet and/or Lambda. I also spend time i

  • How to view SOAP Header

    Hi Gurus, i have a simple questions to you (hopefully). At the moment i am working with SOAP AXIS Receiver Adapter because i need to add <wsse> Tags to my SOAP Header. (according to blog: /people/pravesh.puria/blog/2009/08/26/adding-usernametoken-tim

  • Why iWork doesn't open an exel file 97'-2004 workbook? Icon shoes default during import.

    Why iWork doesn't open an exel file 97'-2004 workbook? A message appears that default during import. This document was created with a version of exel, which is not supported. Can be opened only documents created in exel'97 or greater.