Jatble: setting column-width,why can't I do it here?

public class SpieleTableModel extends DefaultTableModel {
     * Creates a new instance of SpieleTableModel
    public SpieleTableModel() {
        super();
        //SpieleTable
        addColumn(" Nr.");
        addColumn(" Name");
        addColumn(" max");
        addColumn(" is");
        addColumn(" startet");
        addColumn(" stoppedt");
       // now I want to set the col preferred width
      // this does not work
      TableColum column = getColumnModel().getColumn(0);
    }Is it not possible to set the width right in my class?
TIA Hanns

getColumnModel() is not a method of DefaultTableModel:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/table/DefaultTableModel.html

Similar Messages

  • How can I set column width in JTable?

    How can I set column width in JTable?

    Also, read the JTable API before posting questions. You will find a link to the Swing tutorial on "How to Use Tables", which contains an example of doing exactly this.

  • Setting column width in a command-line program

    Is there a way to send data to the screen in a command-line Java program that will be formatted as a number
    of columns with a set column width? I am looking for something similar to the C++ setw() I/O manipulator
    used in cout.
    Thanks,
    Steve

    If you go to: http://java.sun.com/docs/books/tutorial/essential/io/writingFiltered.html
    it will show you how to subclass a filtered output stream and add your own formatting methods.Then you can chain your new class to System.out
    like this:
    YourFilteredStream yfs = new YourFilteredStream(System.out); .
    Then:
    yfs.yourNewMethod(); goes directly to system out in the new format.

  • Set Column width in query (not using SQL*Plus)

    How can I Set Column width in query
    I understand you can set column width using
    column col1 FORMAT A5
    select col1 from table1;But this only works in SQL*Plus
    I want to be able to do this in a regular SQL query window (not in SQL*Plus), how can I do it.....
    I am using a 'SQL window' in PL/SQL Developer IDE
    and when I use this syntax it says:
    ORA-00900: Invalid SQL statement
    Any suggestions are appreciated...
    thanks,
    M.

    Did you try using RPAD or LPAD functions? They fill the unfilled part of a string with character you provide... either on right or left side depending on what function you use.
    e.g.
    SELECT RPAD('Smith', 10, ' ') Name FROM dual;http://www.adp-gmbh.ch/ora/sql/rpad.html
    Edited by: Zaafran Ahmed on Nov 10, 2010 11:50 AM

  • I have a new macbook pro and an LG w2361v monitor.  The max resolution the mac is allowing me to set is 1400x1050, why can't I get to the max resolution the monitor can accept (1900x1080)

    I have a new macbook pro and an LG w2361v monitor.  The max resolution the mac is allowing me to set is 1400x1050, why can't I get to the max resolution the monitor can accept (1900x1080)?  I know that the monitor is able to accept this resolution but It can't seem to find it.  Is it something to do with the new thunderbolt port? or the fact that I'm utilizing the VGA adaptor?  I could go HDMI if that works better.

    Use DVI or HDMI.
    VGA runs out of steam after a while.

  • How to set column widths in tables for selected table only, not globally throughout document?

    I've been utilizing the below script (thank you so much Ramkumar. P!) to set column widths throughout a sizable InDesign book with tables on every page and it is truly a time saver. At this point in time, I have three versions of it because there are different column widths throughout the book. Is it possible to augment the script to run only on a selected text frame (containing a table)? If so, would someone be kind enough to share the augmented script with me? I've been trying to figure out this seemingly simple change through trial and error with no success as yet. I realize this is a totally newbie request and I'm entirely at the mercy of the kindness of the Javascript gods that contribute within this forum. Seeing that in a different post related to this script, one such guru responded to a request as simple as "Where do I put the scripts in InDesign" gave me enough courage to ask for some help! Thank you in advance to anyone willing to provide a solution.
      var myDoc = app.activeDocument;
         var myWidths = [100, 100, 150, 150];
         for(var T=0; T < myDoc.textFrames.length; T++){
             for(var i=0; i < myDoc.textFrames[T].tables.length; i++){
                 for(var j=0; j < myWidths.length; j++){
                     myDoc.textFrames[T].tables[i].columns[j].width = myWidths[j];
         alert("Table width updated successfully...");

    Hello all
    I have the same problem in that I'm not a scripting person, but was able to get the above script working without problem, and it does set irregular table column widths perfectly, so thanks to Ramkumar. P for that.
    BUT, it changes the column width for ALL tables in the document, whereas I would like to just target the selected table.
    Any ideas as to how I might amend this script to achieve this?
    Thx, Christian

  • How to set column width in alvgrid

    hi
    how to set column width in alvgrid.
    thanks.

    Hi,
    Check this,
    REPORT  ztest.
    DATA: BEGIN OF i_scarr_tab OCCURS 0.
            INCLUDE STRUCTURE  scarr.
    DATA: END OF i_scarr_tab.
    DATA: i_scarr LIKE TABLE OF i_scarr_tab WITH HEADER LINE,
          w_scarr LIKE LINE OF i_scarr_tab.
    DATA: o_grid      TYPE REF TO cl_gui_alv_grid,
          o_container TYPE REF TO cl_gui_custom_container.
    DATA: lt_fcat     TYPE lvc_t_fcat,
          ls_layo     TYPE lvc_s_layo,
          ls_sort     TYPE lvc_s_sort,
          lt_sort     TYPE lvc_t_sort,
          ls_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    START-OF-SELECTION.
      CALL SCREEN 9000.
    *&      Module  status_9000  OUTPUT
          text
    MODULE status_9000 OUTPUT.
      SET PF-STATUS '9000'.
      SET TITLEBAR '9000'.
    ENDMODULE.                 " status_9000  OUTPUT
    *&      Module  user_command_9000  INPUT
          text
    MODULE user_command_9000 INPUT.
      CASE sy-ucomm .
        WHEN 'BACK' OR 'EXIT'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.
    ENDMODULE.                 " user_command_9000  INPUT
    *&      Module  init_9000  OUTPUT
          text
    MODULE init_9000 OUTPUT.
      IF o_container IS INITIAL.
        SELECT * FROM scarr INTO CORRESPONDING FIELDS OF TABLE
           i_scarr UP TO 100 ROWS.
        IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    Create a custom container control for ALV Control
          CREATE OBJECT o_container
              EXPORTING
                  container_name = 'CONTROL'.
    Create a ALV Control
          CREATE OBJECT o_grid
              EXPORTING i_parent = o_container.
          PERFORM build_field_catalgue.
          ls_layo-sel_mode = 'A'.
          CALL METHOD o_grid->set_table_for_first_display
            EXPORTING
              i_save          = 'A'
              i_default       = 'X'
              is_layout       = ls_layo
            CHANGING
              it_outtab       = i_scarr[]
              it_fieldcatalog = lt_fcat
              it_sort         = lt_sort[].
        ENDIF.
      ENDIF.
    ENDMODULE.                 " init_9000  OUTPUT
    *&      Form  build_field_catalgue
          text
    -->  p1        text
    <--  p2        text
    FORM build_field_catalgue .
      DATA: ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-cprog
          i_internal_tabname     = 'I_SCARR_TAB'
          i_structure_name       = 'SCARR'
         i_client_never_display = 'X'
        CHANGING
          ct_fieldcat            = ls_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE 'FCAT Error' TYPE 'I'.
        EXIT.
      ENDIF.
      LOOP AT  ls_fieldcat.
        CLEAR ls_fcat.
        ls_fcat-fieldname = ls_fieldcat-fieldname.     "Fieldname
        ls_fcat-ref_table = ls_fieldcat-tabname.       "DDIC ref struct
        ls_fcat-inttype   = ls_fieldcat-inttype.       "Data type
        ls_fcat-outputlen = ls_fieldcat-outputlen.     "Column width
        ls_fcat-coltext   = ls_fieldcat-seltext_m.     "Column Header
        ls_fcat-seltext   = ls_fieldcat-seltext_m.     "Column Desc
        ls_fcat-ref_field = ls_fieldcat-ref_fieldname. "Reference field
        ls_fcat-ref_table = ls_fieldcat-ref_tabname.   "Reference table
        CASE  ls_fieldcat-fieldname.
          WHEN 'LUGGWEIGHT' OR 'FORCURAM'.
            ls_fcat-edit      = 'X'.
            ls_fcat-do_sum    = 'X'.
          WHEN 'URL'.
            ls_fcat-no_out = 'X'.
          WHEN OTHERS.
            ls_fcat-edit      = ' '.
            ls_fcat-do_sum    = ' '.
        ENDCASE.
        APPEND ls_fcat TO lt_fcat.
      ENDLOOP.
    ENDFORM.                    " build_field_catalgue
    check the programs bcalv_grid*.
    check this link for more detailed example.
    http://www.supinfo-projects.com/fr/2005/alv_display_fr/2/
    Regards
    Sruthi

  • After re-setting my password, why can't i sign into my email?

    After re-setting my password, why can't i sign into my email? After I reset my password and pull up my mail, a message pops up saying that it cannot sign in. What should I do??

    Try Frequently Asked Questions About Apple ID
    And on your iPad, tap Settings / Mail, Contacts, Calendars. Tap the mail account name / Account. Re type in the correct password there then tap Done.

  • Setting Column Widths Corrupts Spreadsheet

    I'm working with Open XML for the first time and I am astonished at how complicated it is.  The Excel object model was complicated, but it seems simple by comparison.  I'm about ready to give up and look for a different solution, but I'll try posting
    this question here and see if I can get any simple answers. 
    I have an ASP.NET MVC web page and I want to let my user download a spreadsheet with data from the database.  I can get some data to appear in the downloaded spreadsheet, but when I tried to set the column widths in Open XML it started given me file
    validation errors and none of the data appears, and the column widths are not set.  It's just a blank spreadsheet.  This is the error it displays:
    Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
    Replaced Part: /xl/worksheets/sheet.xml part with XML error.  Load error. Line 1, column 211.
    Here is the test code that has only one cell loaded with the value Test 4.  It appears when I don't load the Columns object.  It disappears with this error when I try to load the Columns object.  Here is my code:
    private void CreatePartsTest()
    document = SpreadsheetDocument.Create(moMemoryStream, SpreadsheetDocumentType.Workbook);
    WorkbookPart workbookPart = document.AddWorkbookPart();
    Workbook workbook = new Workbook();
    workbookPart.Workbook = workbook;
    WorkbookStylesPart workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>("rIdStyles");
    Stylesheet stylesheet = new Stylesheet();
    workbookStylesPart.Stylesheet = stylesheet;
    WorksheetPart worksheetPart = workbookPart.AddNewPart<WorksheetPart>("TestID");
    Worksheet worksheet = new Worksheet();
    Columns cs = new Columns();
    Column c = new Column()
    Min = (UInt32Value)1U,
    Max = (UInt32Value)1U,
    Width = 44.33203125D,
    CustomWidth = true
    cs.Append(c);
    //worksheetPart.Worksheet.Append(cs);
    worksheet.Append(cs);
    // LoadColumns(ref worksheet, oGridColumns);
    //worksheet.Append(new Columns(new Column() { Min = (uint)1U, Max = (uint)1U, Width = 24 }));
    SheetViews sheetViews = new SheetViews();
    SheetView sheetView = new SheetView() { TabSelected = true, WorkbookViewId = (UInt32Value)0U };
    sheetViews.Append(sheetView);
    SheetData sheetData1 = new SheetData();
    Row row1 = new Row() { RowIndex = (UInt32Value)1U };
    sheetData1.Append(row1);
    worksheet.Append(sheetViews);
    worksheet.Append(sheetData1);
    worksheetPart.Worksheet = worksheet;
    Sheet sheet = new Sheet();
    sheet.Name = "Test";
    sheet.SheetId = (uint)1;
    sheet.Id = "TestID";
    Sheets sheets = new Sheets();
    sheets.Append(sheet);
    workbook.Append(sheets);
    //oSpreadSheet.WorkbookPart.Workbook.Save();
    wbPart = document.WorkbookPart;
    MCSD .NET developer in Dallas, Texas

    Here is the test code that has only one cell loaded with the value Test 4.  It appears when I don't load the Columns object.  It disappears with this error when I try to load the Columns object. 
    Hi DallasSteve,
    How did you load the cells and why? Could you please post the details of the method "LoadColumns(ref worksheet, oGridColumns)"?
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Setting column widths in a PdfPTable at run time

    My web application is building PDF output using iText. The data is coming from a database through JDBC. At run time I will not know how many columns are being returned and I will not know the relative widths of each column, so I have to set this at run time to make it look good. This is the problem I am having.
    I am calling the data and returning an ArrayList of ArrayLists, each of the internal ArrayLists contains the data and the first one contains the column labels. The labels are going to be longer than the data so I can set the column widths to the labels and it should be fine. But how?
    Here is what I am trying so far, without success.
    ArrayList headRow = (ArrayList) mainList.get(0);
    float[] widths = new float[headRow.size()];
    for(int i=0;i<headRow.size();i++) {
    Chunk chunk = new Chunk((String) headRow.get(i));
    widths[i] = chunk.getWidthPoint();
    PdfPTable table=new PdfPTable(colCount);
    table.setWidthPercentage(100);
    table.setWidths(widths);
    As I said, this is not doing what I need, nor is any variation of this that I have tried. So how do I set the relative widths of the columns when I don't know how many columns I'm going to get back or how wide they need to be?
    Thanks

    It worked fine when I had a JTable associated to my table header.
    Any ideas as to why it no longer works or indeed, solutions?Not too sure if I understand the question or problem. Since when can you disassociate a tableheader from a table (or how can you create a tableheader without a table)?
    ;o)
    V.V.

  • Setting column widths using CSS...

    Hi guys,
    I am using a simple 2 column table to layout pictures and
    text. The problem I'm having is that I'm not sure how to set the
    column widths and as such when you flick from page to page the
    column widths and don't stay exactly equal to each other as I'd
    like them too.
    This can clearly be seen through clicking and comparing the
    following two pages.
    http://www.fyrne.com/mb_food_and_drink.html
    http://www.fyrne.com/mb_television.html
    Any advice on how I can resolve this would be much
    appreciated.
    Cheers, J

    Hi James,
    I see the scrollbars now but now I also see what you mean :(
    I think the easy fix is to create a class and apply it to
    every single
    td that has the text/image/heading to give them a fixed
    width! (Maybe
    only applying it to the top td's would do the trick... I'm
    really no
    good with tables)
    Hope it made some sense
    JamesFryer skrev:
    > Hi Kim,
    >
    > Thanks for posting this link. I think it was Nadia who
    previously suggested I
    > implement the suggest edcode line to auto add the
    vertical scroll bar and avoid
    > an overall site shift problem I was having.
    >
    > However I have now implemented this and am still getting
    the shift problem -
    > you will notice it is not the overall site (ie the
    bordered area) which is
    > shifting but the internal table columns. I believe I
    have set these column
    > widths in DW design view but this often proves
    problematic (pushing out the
    > width of the main table for no reason although this does
    not actually show when
    > previewed).
    >
    > As such I hoped I would be able to control this through
    CSS - I don't believe
    > it's the same as the shifting problem...
    >
    > Thanks again, J
    >
    Kim
    http://www.geekministry.com

  • Setting column width in OBIEE Answers report

    Hi All,
    Not sure if this has been asked before in the forums, but I did not succeeded in finding any clues. We have an OBIEE 10g Answers table view report that we need to display on our dashboard. The problem is that we need to set some width for all the columns in the report so that report does not extends horizontally as data in column grows but not much luck setting width in Column Properties. Since I am a newbie in the world of OBIEE, so I would appreciate any guidance with setting widths in an Answers report.
    Looking forward to your responses.
    Regards,
    Maria

    Hi,
    The best option to do this is :
    1. Create a report which has less data. And in the column properties hide it.
    2. Edit the Dashboard page and there is an option called 'Add Column'
    3. Place the report with the hidden column.
    4. Please hide the complete section and remove the collapsible. And save it
    5. When you view the report, it would not appear in the page but you can view the desired report.
    Please let me know if you still face issues.
    Regards
    MuRam

  • How to set column width in GridPane in FXML?

    I would like to set width, for ex, of column 4 in GridPane.
    I can do like this:
    <columnConstraints>
                <ColumnConstraints prefWidth="100"/>
                <ColumnConstraints prefWidth="200" />
                <ColumnConstraints prefWidth="200" />
                <ColumnConstraints prefWidth="200" />
    </columnConstraints>If i have 10 columns should i add 10 column constraints? (i need to set only width of 4th column)
    How can i do it easier?

    >
    Hi, Can someone please help on how to set the columnwidth in csv file using javacode.
    I used FileWriter class to upload data into the csv file but csv file is taking default width while showing content. Is there a way to set the fixed column width or set width dinamically based on value?
    >
    The fields in CSV (Comma-Separated-Value) files are separated by commas; they do not have a fixed width.

  • Interactive Report - download to PDF, fixed column widths-- why

    We are using 4.1.1.00.23, we have just installed the Apache/FOP solution to download our Interactive Reports to PDF.
    The issue is that it seems that no matter what we do the column widths become evenly distributed in the downloaded report. When the report only has 5-8 columns this is ok, doesn't look as good as we would like but it is ok. The problem comes when we have many columns, then all of the columns get shrunk down to these little columns that become totally useless.
    Also, it appears that no matter what page size I define in the Page Attributes it sizes the columns to fit on an standard page (8.5x11).
    The question I guess is: Is there a way to download an Interactive Report to PDF, that looks exactly like the report that is displayed for the Interactive Report?
    We have been looking at lots of the documentation and fear we are missing something because it appears that most solutions talk about creating a "Shared Component" Report Query and Report Layout, which when you have a hundred interactive reports seems crazy....why can't we just download what we see on the screen.
    If there was a way to put Headers/Footers on HTML download, then we would not need to do this, but I have not found a way to do that either.

    From our understanding, it looks like we would have to create another report for each of our existing Interactive Reports, which would be a JasperReport or something.
    We know there is something with the XSL-FO templates, is that what iReports can do for us? Really this is a new world for me, so I do fear that I might be asking my question wrong.
    Like I said maybe we are missing something. We were able to get the FOP to work, but the problem with that is all of the columns are evenly distributed widths. On some reports, which have many columns, there could be a name column that needs to display 50 characters, but then the next field only has 5 characters. It appears that without creating an additional report or report layout for each report we cannot print the results of the interactive report.
    Maybe I am completely missing something in all of this, but I find it hard to believe that we have to create multiple versions of a report just to be able to print it. If we had just wanted to create a static report, then I would have continued using Oracle Reports, like we have for the last 20yrs.

  • Pages stops column width, why?

    http://dl.dropbox.com/u/11608065/ScreenShot1.png
    This is the first screen shot. I made my first row with 4 columns and sized them exactly how I want them.
    http://dl.dropbox.com/u/11608065/ScreenShot2.png
    This next screen shot show you Pages stopping me from extending my column any further to the right, to match it up with my first row. I cannot pull that column border anymore, Pages literally stops the mouse. Why?
    http://dl.dropbox.com/u/11608065/ScreenShot3.png
    It gets even weirder. When I make 4 columns on the next row, just out of curiosity, it doesn't even let me extend the column to the same width as the previous row. What you see is the furthest it will allow me to extend the column.
    Please help...FYI, there is only one table with multiple rows on this document and you can see that it's doing this on both columns on each side of the document.

    There's a screenshot showing I'm really using Pages '09.
    http://dl.dropbox.com/u/11608065/ScreenShot4.png
    This screenshot shows the inspector with that particular column highlighted. The column width is grayed out, doesn't show me the width of the column, and doesn't allow me to edit the width of the column. Why?!
    http://dl.dropbox.com/u/11608065/ScreenShot5.png
    This screenshot shows the inspector with the next column highlighted. The column width is there, 0.88", and I can edit it if I want.
    http://dl.dropbox.com/u/11608065/ScreenShot6.png
    This screenshot shows the inspector with the first column highlighted in the 2nd row. Again, column width is grayed out, doesn't show me the width of the column, and doesn't allow me to edit the width of the column. Why?!
    http://dl.dropbox.com/u/11608065/ScreenShot7.png
    This screenshot shows the inspector with the next column highlighted in the 2nd row. Instead of showing the column width like it did on the 1st row, for whatever reason, this time it doesn't show the column width and it's grayed out. Why?!
    http://dl.dropbox.com/u/11608065/ScreenShot8.png
    Please tell me that there's a good reason for all this and that I'm doing it wrong.

Maybe you are looking for

  • I  can't see my ipod touch on itunes

    i have started having problems with my ipod touch 5 generation.  las day i got some cd. i tried to up date the ipod with the new songs. and i couldn't sync the ipod. now i can't even see the ipod on the itunes.  i have re instaled itunes three times

  • Charge new ipad on macbook pro (mid 2010)

    I have a Macbook Pro MID 2010. When I connect my new ipad using MAC OS X Lion it charges normally, but when I connect it on my Windows 7, it doesn't. does any of you guys know how to make it work?

  • MC$4 Vs FK10N

    HI Why there is difference between  MC$4 and FK10N Values. If I compare the debit amount from FK10N with Invoice amount figure from MC$4 for a prticular period there is huge difference. What is the basic fictionally between these two and If I want to

  • 10 million messages in one jms-queue

    Hi all,           we want to put about 10 million jms-messages in a jms-queue with a jdbc           persistent store on oracle database.           Does anyone of you made experiences with that much messages in one           queue? Are there any known

  • How to stop the boot process after the GRUB menu?

    Hello there. I am getting an error message in the boot process, after the GRUB menu, but I can't read completely the message because it is shown too fast. So, how can I stop the process when I see the error message, for writing down it? Thanks in adv