Which rows/columns could be seen in scrollpane?

hi, there,
I have a large table. whenever I scroll the scrollbar, I'd like to know which part the table is visible. How could I do that?
Any help will be greatly appreciated.
Jim

Code?
BTW, if you're using 1.5, print() is a JTable method:
import java.awt.*;
import java.awt.event.*;
import java.awt.print.PrinterException;
import javax.swing.*;
public class PrintTest {
    public static void main(String[] args) throws PrinterException {
        Object[] columnNames = {"first name", "last name", "hair"};
        Object[][] data = {
            {"Homer","Simpson","sparse"},
            {"Marge","Simpson","blue"},
            {"Crusty","Clown","tufts"}
        final JTable table = new JTable(data, columnNames);
        JButton print = new JButton("print");
        print.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent evt) {
                try {
                    table.print();
                } catch (PrinterException e) {
                    e.printStackTrace();
        JPanel south = new JPanel();
        south.add(print);
        JFrame f = new JFrame("PrintTest");
        Container cp = f.getContentPane();
        cp.add(new JScrollPane(table));
        cp.add(south, BorderLayout.SOUTH);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
}

Similar Messages

  • A row delimiter should be seen after column number

    A column delimiter was seen after column number <70> for row number <533394> in file
    The total number of columns defined is <70>, so
                                                          a row delimiter should be seen after column number <70>. Please check the file for bad data, or redefine the input schema for
                                                          the file by editing the file format in the UI.
    So i checked the flat file i was trying to retrieve the data for the row number and checked the last column and did not find anything unsual in that row that could have caused this error.
    There are 70 columns and it proposes there is a problem in the last column. I checked but there were no carriage return
    Please help me on this.

    It appears to me the problem with the particular row(s).
    I suggest open the file in notepad if not very big and look at the record number 533394.
    you can also use u2018Overflow fileu2019 option in the error handling section on the target table under the option tab to find out the bad record(s).
    Regards,
    Vibhor

  • Right way to change datagrid row, column, cells background colors in code-behind?

    Hi all,
    I have a winform program that I'm upgrading to wpf (I'm new to wpf). The wpf code for the function (SetdataGridBackgroundColors()) is below with the winform code commented out so I can fix it.  I have a datagrid with a Cornsilk background color alteranating
    with LightGreen depending on the content of datetime  cell. If the day portion of the datetime is different then the color changes from one to the other. I used a colorIndex variable because at the end of the month it could go from 31 to 1 and that would
    not work if I use the day directly.
    I tried this line to change the background color:
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.Cornsilk);
    this works but it changes every row. I found this other stuff:
    DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromItem(optionsDataDatagrid.Items[i]) as DataGridRow;
    currentRowColor.Background = new SolidColorBrush(Colors.Cornsilk);
    Either ContainerFromIndex or ContainerFromItem throw an exception because currentRowColor is null. I looked at optionsDataDatagrid.Items[i] and is not null. Then I read that using ItemContainerGenerator is not a good idea.
    BTW I'm calling SetdataGridBackgroundColors() after datagrid is been filled with data.
    So... what is the proper way to set each row, column or cell background color in wpf?
    Thanks
    private void SetdataGridBackgroundColors()
    optionRowData rowData = new optionRowData();
    if (optionsDataDatagrid.Items.Count == 0)
    return;
    int colorIndex = 1;
    DateTime savedDate, currentRowDate;
    rowData = optionsDataDatagrid.Items[0] as optionRowData;
    savedDate = rowData.col_datetime.Date; //only compare the date not the time
    for (int i = 0; i < optionsDataDatagrid.Items.Count; i++)
    //currentRowDate = Convert.ToDateTime(optionsDataDatagrid.Rows[i].Cells[3].Value); //winform code
    //currentRowDate = currentRowDate.Date; //winform code
    rowData = optionsDataDatagrid.Items[i] as optionRowData;
    currentRowDate = rowData.col_datetime.Date;
    if (currentRowDate != savedDate)
    colorIndex++;
    savedDate = currentRowDate;
    if (colorIndex % 2 == 0)
    //optionsDataDatagrid.Rows[i].DefaultCellStyle.BackColor = Color.Cornsilk;
    //------------------- testing new code --------------begin
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.Cornsilk); //this changes all rows
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromIndex(i) as DataGridRow;
    //DataGridRow currentRowColor = optionsDataDatagrid.ItemContainerGenerator.ContainerFromItem(optionsDataDatagrid.Items[i]) as DataGridRow;
    //currentRowColor.Background = new SolidColorBrush(Colors.Cornsilk);
    //------------------- testing new code --------------end
    //optionsDataDatagrid.Columns[4].DefaultCellStyle.BackColor = Color.DarkSalmon;
    //optionsDataDatagrid.Columns[5].DefaultCellStyle.BackColor = Color.Aquamarine;
    //optionsDataDatagrid.Rows[i].Cells[4].Style.ApplyStyle(optionsDataDataGridView.Columns[4].DefaultCellStyle);
    //optionsDataDatagrid.Rows[i].Cells[5].Style.ApplyStyle(optionsDataDataGridView.Columns[5].DefaultCellStyle);
    else
    //optionsDataDatagrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
    //------------------- testing new code --------------begin
    optionsDataDatagrid.RowBackground = new SolidColorBrush(Colors.LightGreen); //this has no effect
    //------------------- testing new code --------------end
    //optionsDataDatagrid.Columns[4].DefaultCellStyle.BackColor = Color.Coral;
    //optionsDataDatagrid.Columns[5].DefaultCellStyle.BackColor = Color.LimeGreen;
    //optionsDataDatagrid.Rows[i].Cells[4].Style.ApplyStyle(optionsDataDataGridView.Columns[4].DefaultCellStyle);
    //optionsDataDatagrid.Rows[i].Cells[5].Style.ApplyStyle(optionsDataDataGridView.Columns[5].DefaultCellStyle);

    I (also) strongly recommend mvvm.
    Setting values is a particularly bad idea in this case.
    I don't mean to be rude but your explanation of the requirement is kind of vague.
    I would bind solidcolourbrushes.
    Set the properties based on whatever your logic is within the viewmodel.
    You can switch out what each of the brushes holds when the user clicks wherever.
    So you use a highlightbrush when something or other is true.
    That highlightbrush is set to a blue brush when the user clicks left and a red brush when they click right.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Can I create a generic Point to Row Column function?

    I have a VI with multiple MultiColumn Listboxes in it.  One way I've seen to make the entries writeable is as follows:
    This works fine.  The only issue is that to get the 'Point to Row Column' (PtRC) method requires (as I understand it) right-clicking on the MCL and selecting that method.
    I have multiple MCLs, and I wanted to create an event structure that was generic and could process any of them the same way.  But the problem with that is that I don't know a way to get access to the PtRC method for each one.  The only way I know to do it would be to use VI Scripting to create the reference on the fly (not sure if that would even work), but even if that works for me, I don't think it will work with the free LV RunTime Engine (my experience is that you can't use the RTE to execute any VIs that utilize VI Scripting).
    So my question is, is there a way to get a reference to the PtRC method - generically - without using VI Scripting, and/or is there a different way to do what I'm trying to do here (i.e. make the MCL writeable by the user and have it retain the values the user writes to it during VI execution).
    thanks
    Solved!
    Go to Solution.

    Not generic enough for you (not sure why it wouldn't be) here we can have code that finds the Multicolumn Listboxes and registers for all of them.
    Edit: As I feared the snippet isn't exactly what I made.  The "This VI" control on the left should be the "This VI" constant.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How to update table which has column name as Oracle keyword?

    Hi All,
    Somebody has created one table which has column name as "OPTION", now i am trying update this table column value and its throwing an error. "Invalid Identifier".
    Could you please help me in this?
    Thanks in advance.
    Regards,
    Ganesh Patil

    check this :
    batch@DOLN1> create table "from" ("select" varchar2(10));
    Table created.
    batch@DOLN1> desc "from";
    Name                                                                                                  Null?    Type
    select                                                                                                         VARCHAR2(10)
    batch@DOLN1> update "from" set "select" = 'hello World';
    0 rows updated.
    batch@DOLN1> insert into "from" values('hello World');
    insert into "from" values('hello World')
    ERROR at line 1:
    ORA-12899: value too large for column "TCM_BATCH"."from"."select" (actual: 11, maximum: 10)
    batch@DOLN1> update "from" set "select" = 'hello';
    0 rows updated.
    batch@DOLN1> insert into "from" values('hello');
    1 row created.
    batch@DOLN1> commit;
    Commit complete.
    batch@DOLN1> update "from" set "select" = 'World' where "select" = 'hello';
    1 row updated.
    batch@DOLN1> select * from "from";
    select
    World

  • How I can know which row is parent item code or child item in matrix?

    Hi,
    In marketing document, when insert a item into contents page, if it is a BOM then all child item will be inserted into matrix automatically. My question is when i view the rows in matrix how i can know which row is normal master item and which row is a child item row? From the UI, i can only see the child item code looks readonly but how i can know it in my add-on code? I tried to get the edittext box object from item No. cell, but i can't find any difference.
    Thanks!
    Lan

    Sorry, i found an issue when i try to retrieve the BOM Type column value. I am in adding mode, when i insert a BOM with components, the bom type will appears as "Component of a Sales BOM". But in the event, when I try to get the value from this cell (it is combobox), it gives another value which is not same with the one it appears in the matrix. Is anyone know how to solve my problem?
    Thanks!
    Lan

  • Where can I find the function "mark a line" in a table (not a row but the line in-between the rows/columns)

    In the old version of Numbers (09) as well as in the same Pages version I could choose to allow to mark single lines inbetween rows/columns in order to choose to create different types of lines to mark separations in different sections or just single cells within a table, how do I do that in the recent upgrade?!!! I´m going mad over here!!!!!

    Hi A-S,
    Do you mean Cell Borders in the Format Panel?
    To create this?
    Or if you want borders under only A5 and C5 (but not B5) command click on those cells to select them before applying the borders in Format Panel
    Regards,
    Ian.

  • ADF table: How to find out which rows were modified by the user

    Hi,
    I am using ADF table to display data that can be modified by the user (ReadOnly = false in the input text). I need to find out which rows were modified by the user, and only update (persist) those rows in the database.
    Is there an easy way to find out which rows were modified by the user.
    I am NOT particularly concerned with which columns were modified as I would update the entire row (if any data in that row is modified).
    I am using Oracle JDeveloper version 11.1.1.3.
    Thanks,
    Ash K

    Thanks Timo.
    I am using ADF Data Control (which are created from Web Service proxy) to display/update the data.
    In the backing bean, the operation that is invoked at the time persisting data is as follows:
    public void commitOperation {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("operationA");
    DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("someIterator");
    for(int i=0; i<dciter.getViewObject().getEstimatedRowCount(); i++)
    Row row=dciter.getRowAtRangeIndex(i);
    SomeObject someObject= new SomeObject ();
    someObject.setAttr1(row.getAttribute("Attrbute1").toString());
    someObject.setAttr2(row.getAttribute("Attribute2").toString());
    objectList.add(someObject);
    operationBinding.getParamsMap().put("param1", objectList);
    ResultObject result = (ResultObject) operationBinding.execute();
    Inside the for loop (or any other place in the backing bean), I would like to figure out if the row was modified by the user. Please let me know if how to get that. If ADF provides this automatically, that would be GREAT.
    Thanks,
    Ash K

  • How can I write into a table cell (row, column are given) in a databae?

    How can I write into a table cell (row, column are given) in a database using LabVIEW Database Toolkit? I am using Ms Access. Suppose I have three columns in a table, I write 1st row of 1st column, then 1st row of 3rd column. The problem I am having is after writing the 1st row 1st column, the reference goes to second row and if I write into 3rd column, it goes to 2nd row 3rd column. Any suggestion? 
    Solved!
    Go to Solution.

    When you do a SQL INSERT command, you create a new row. If you want to change an existing row, you have to use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column=some_value). The some_column could be the unique ID of each row, a date/time, etc.
    I have no idea what function to use in the toolkit to execute a SQL command since I don't use the toolkit. I also don't understand why you just don't do a single INSERT. It would be much faster.

  • Which row was clicked in an SQL Query (updateable report)?

    I have an application with a report based on an SQL Query (PL/SQL function ...) defined on the Global Page.
    On the pages where the report is used, I want to click in a particular column (TCKT_ID) and pass the values in that row to another page for processing.
    Things I would like to know:
    1) How to determine which row was clicked?  The column is TCKT_ID and it is used as a link to another page.  The SQLis a non-trivial (for me!) join of tables.
    2) How to refer to the values of the other columns in that row?  Because I format with "div," the columns are named -- no "f02", "f03", etc.
    3) How to pass multiple values (ENAME, JOB, MGR, SAL, COMM) to the target page?  You might ask: Why not just re-query for the data using a unique key.  Splendid idea, but the unique key is four columns so I still need some way to pass these four values to have that unique key.
    I've constructed a "pretty close" example of the situation here:
    WS APEX_EXAMPLES_01
    demo / demo
    Application: Row Info  10782  - Page 0 has the report.  Page 1 displays it with a link (in red) to page 2.
    I think I can complete most of what I need if someone can just show me how to get, say, the ENAME of the row clicked on page 1, so I can use it to filter the query on page 2 to just this row clicked on page 1.
    Using <tt> </tt>, I tried to display the actual row from View -- Source of the real report I'm dealing with but it just comes out like this
    M - F
    MM_O_BD_DAILY.ctl (ftp D046)CMM_O_BD_DAILY.sh (ftp D046)17:15
    10JUN13 17:00:52
    10JUN13 17:00:53
    17:15
    10JUN13 17:00:52
    10JUN13 17:00:53
    17:00
    10JUN13 17:00:59
    10JUN13 17:01:00
    Y
    ARS003_TESTNBD

    I wonder if I'm not understanding something. This seems like a very simple thing to do without any "tricks"
    Take a look, I've modified the LINKING_NUMBER column on the p0 report.
    Basically, you just specify the fields you want to populate and their assignments.  I added 4 destination fields on p2 to receive the assignments.  Then you can do anything you want with them like modifying a report, etc...
    The only trick here is that in order to pass more than 3 items in the URL you need to change your link type from Page in this application to URL.  Then you can specify lost of items this way.
    Thanks
    -Jorge

  • All websites including Firefox have security warning "the information you entered is to be sent over an unencrypted connection and could be seen by a third party" Firefox is not safe date started July 1, 2010 even when I remmove the security warnings the

    security warning "the information you have entered is to be sent over an unencrypted connection and could be seen by a third party" this warning appears on ALL websites, including all Firefox sites, happened after a MSupdate on July 1, 2010. I wont use Firefox is is not safe - hwat happened?
    == This happened ==
    Every time Firefox opened
    == july 1, 2010

    Ignore that warning. Report it to the Website Developers of the websites on which you are seeing this message. Ask them to deploy Secure HTTP Connection. And use secure Websites (https) addresses.
    Site Identity Button
    * https://support.mozilla.com/en-US/kb/Site%20Identity%20Button

  • Is there a way to determine which rows are inserted in JDT1 table by the system automatically?

    Hi,
    Is there a way to determine which rows are inserted in JDT1 table by the system automatically? Example, many GLs which are mapped in GL Account Determination, like Foreign Exchange Gain / Loss, Rounding Account, etc. are inserted by the system automatically in the Journal Entry on various scenarios, like during Incoming Payment, etc.
    Which SQL query can give me those rows? Basically the WHERE condition should be based on which column or multiple columns in JDT1 table?
    Thanks.

    Hi Rajesh,
    I'm not entirely sure but I think the TransId is the same in the header that belongs to the transaction.
    OINV.TransId = JDT1.TransId
    Best regards,
    Pedro Magueija

  • How do i set the background of the table( not of cell / row / column).

    How do i set the background of the table( not of cell / row / column).
    What happens when i load the applet the table is blank and displays the background color is gray which we want to be white.
    We tried using the setBackGround but it is not working maybe we are not using it properly. Any help would be gr8.
    Thanks in advance.

    I don't understand very well, but i guess that the background is gray when the table content's empty, isn't it?
    When the table model is empty, the JTable doesn't paint, so its container displays its background (often gray).
    In this case, what you must do is force the table to paint, even if the model is empty. So, you have to create your own table and override three methods :
    public class MyTable extends JTable
    //specify the preferred and minum size when empty
    myPreferredWidth = 200;
    myPreferredHeigth =200;
    myMinimunWidth = ...;
    myMinimunHeigth = ...;
    public Dimension getPreferredSize()
    if(getModel().getRowCount() < 1)
    return new Dimension(myPreferredWidth, myPreferredHeigth);
    else
    return super.getPreferredSize();
    public Dimension getMinimumSize()
    if( getModel().getRowCount() > 0)
    return new Dimension(myMinimunWidth, myMinimunHeigth);
    else
    return super.getMinimumSize();
    protected void paintComponent(Graphics g)
    if (getModel().getRowCount<1 && isOpaque()) { //paint background
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    else super.paintComponent(g);
    }

  • Duplicating MovieClips into Rows & Columns

    Hi People,
    I am creating a project, which is a dynamic image gallery,
    wherein the images are loaded from an XML file. I am looking to
    create the thumbnails as rows & columns, based on the total
    number of images.
    I am able to duplicate the movieclips in rows & columns,
    if I define the number of rows & columns, but don't know how to
    do this at runtime, depending on the total number of images.
    Let's say I have 12 images, so the resulting grid should be
    like the one shown below:
    Can anybody please help, this is really urgent, and I losing
    my head over this
    Thanks to all in advance.
    Cheers,
    Husain

    //upper left corner of image grid
    var colStart = 30;
    var rowStart = 30;
    var imagesPerColumn = 5;
    var colCount = 0;
    //width and height of thumbs plus any buffer space between
    them
    var colWide = 50;
    var rowHigh = 50;
    //starting depth of new clips
    var deep = 5;
    for (var i = 0; i < 12; i++) {
    thisImage = this.attachMovie("thumb", "thumb" + i, deep + i,
    {_x:colStart +
    (colCount * colWidth), _y:rowStart});
    colCount++;
    if (colCount + 1 > imagesPerColumn) {
    colCount = 0;
    rowStart += rowHigh;
    This should get you going - just replace the 12 in the for
    loop with your
    array length. I used attachMovie to attach a thumb clip from
    the library but
    you can duplicate instead.
    HTH, let me know if you need more explanation.
    Dave -
    Adobe Community Expert
    www.blurredistinction.com
    www.macromedia.com/support/forums/team_macromedia/

  • ADF 11g Partial Triggers Row Column Update By Column in the Same Row

    Hi.
    I have a situation whereby I have a checkbox in a table row, which has an eventchangelistener, which upon activation, trys to update another column in the same row. I can not get this to work through partial triggers, even though I have set up my ids up correctly. The row though can be updated by a command button outside of the table using the same coding techniques, but I need it updated via the checkbox.
    Is there a limitation in updating a column within a row, from another row column's event change listener.
    Thanks.

    Updating the other rows from the checkbox works fine for me. Here is what I did.
    I DnD Emp table with a new column that says if the emp is new hire. If the checkbox is checked, I set Firstname and Lastname for that row as NewHire. I have partial triggers on Firstname and Lastname columns to update whenever checkbox is checked/unchecked and autosubmit on checkbox to true. Hope this helps.
    Try adding column selection property to single and see if it helps.
    Edited by: asatyana on Jan 16, 2012 12:48 AM
    Edited by: asatyana on Jan 16, 2012 12:49 AM

Maybe you are looking for

  • DVD SP burned disc won't play on DVD player

    I recently compiled a FCP HD project into Standard Defintion 16:9 and imported it into DVD SP 4. I build, format and burned a DVD-R disc without any problems. However the disc won't play on any of the DVD players in my house (1 philips and 1 Pioneer)

  • IOS update

    Has anyone used the new iOS update?  What were you thinking Apple?  It was your sophisticated design and streamline ease that set you apart.  Now I feel like I'm looking at a dumb down windows screen!

  • Captivate 3 - Slides don't display

    I've got a user who has a LARGE .cp file - about 51MG - and when he opens the presentation, the slides don't display.  I can see 70 items in the Library, but the Storyboard, Edit and Branching views only display one blank slide.  Title Bar says Slide

  • PL/SQL Wrappers for C

    Hey Guys and Gals, I am using PL\SQL and forms to generate a geocoder and the engine for this geocoder happens to need to be accessed by C. I would like the user choices to be accessed through Forms as this happens to be the basis of my project from

  • Problem when renaming iPhoto Library

    I recently renamed two iPhoto Libraries. A day later I plugged in my external HDD to do a Time Machine (TM) backup and noticed that TM deleted ALL my previous backups except the last one, stating there was not enough space. My conclusion is that rena