Help with column resizing

Hi,
Relatively new to java swing...
I have a JTable inside a JScrollPane that gets filled dynamically. What I would like to happen is to set a min column width, and then have each column be large enough to fit its largest cell (by largest cell I mean the cell in the column that has the most data to display). If this is too large for the pane, a scrollbar should come up. Right now I am using
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);but the column sizes are showing up only as big as the column headers need to be, and then for the other cells in the column i get some of my data followed by "..." It lets me manually resize the columns so that everything looks OK, but I would rather have it start out this way
Thanks for any tips...

but the column sizes are showing up only as big as the column headers need to be,The size of the header has nothing to do with the size of the column. The column width defaults to 75 pixels. If you want to change the size then you need to manually calculate the width of the column.
Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#width]Setting Column Widths. Then check out [url http://www.exampledepot.com/egs/javax.swing.table/PackCol.html]Packing a Column.

Similar Messages

  • [CS3][JS] Help with image resizing

    I'm still a newbie of ID scripting.
    I'm using js scripting in Indesign CS3 to make an auto-impaginator and I have a problem with images.
    I charged my contents from an xml set of tables, that I put into a fixed textFrame of the master page.
    Because of the table needs to fill multiple pages, I made a function that keep creating pages and link the textFrames so that the table continues in various pages.
    In this whole process I have some images too, that I need to resize them to fill the cell, because now they pass the parent cell.
    I found a method that looks at the bounds and resizes the image and the rectangle too, but it doesn't work always, because if a image is overflowing, it hasn't any bound and it fails, and this causes other problems in my process, so I would find another method.
    So:
    Is there another way to resize an image on-the-way while importing it? Some xml attribute or preference?
    Or some method that works also if the image is overflowing?

    These forums are pointless. Adobe must believe that other users will cut the mustard. Absolutely a waste of effort for everyone. Adobe should PAY at least a junior developer involved in the projects to monitor and help with these posts. FLEX rules yeah and thousands more do scripting than develop plug ins...
    Come on Adobe, step up your better than this. Customer Service can be free to the customers ... we are not talking about GET IT ALL FREE, talking about buy it and create a community and support it, but then again LAYERS and INDESIGN SECRETS have people who actually want to help users rather than rabbit hole everything.
    Please join hands and SING...

  • Please help with column float problem in IE8

    Hi there,
    Sorry to be so pushy - but I am desperate for help!!
    Having serious problems with my site in some PC's showing Internet Explorer 8. My right column floated right is moving down the page underneath the left column..
    It shows fine on IE8 on my PC - however on my clients PC (vista with IE8) it is showing up as mentioned above. Is there a fix for this.
    Here is my link http://www.dooks.com/pgs/welcome.html
    The css is all there! If you need anything please let me know as I need to get this sorted - I have had serious issues with this site that I have never had before with other sites and am starting to think there is a bug in my software. I redid the index page and this one page (linked above) to see what my problems are - so help with query v appreciated.
    Many thanks,
    Karen

    Lawrence_Cramer wrote:
    A point to keep in mind is that IE8 is still in Beta.
    Not anymore.
    http://www.microsoft.com/Presspass/press/2009/mar09/03-18IE8AvailablePR.mspx
    "REDMOND, Wash. — March 18, 2009 — Today Microsoft Corp. announced the availability of Windows Internet Explorer 8, the new Web browser that offers..."
    Mark A. Boyd
    Keep-On-Learnin' :-)

  • PSE newbie frustrated, please help with image resizing

    Hi!
    Tutorials aren't helping me, nor is trial and error. I just want to resize some photos I downloaded to my computer, then upload them to a website to use as my avatar or signature. There are specific pixel dimensions I must adhere to. I want to keep the photo in it's entirety, but when I resize it, it distorts a bit, looks fuzzy...
    I can't figure out what the heck I am doing wrong. Some pictures turn out just fine and others look really bad. I know it can be done because I've seen the same pictures I'm trying to size, being used for the same thing I want to use them for, but theirs are clear, absolutely no distortion whatsoever. The pixel dimensions I have to work with are either 100x100, or 450 pixels wide by 90 pixels high.
    I hope this made sense, I'm not sure how else to word it. Please forgive my ignorance, I've really been trying.
    Thank-you
    B

    For an avatar it’s possibly best to crop to begin with so you get a true square.
    Open the image and select the crop tool and change the aspect ratio to 1 x 1 or 5 x 5 then drag out a square and move the image around inside it or drag the bounding box borders until you have it looking as you want. Then click the green check mark.
    On the top menu click Image > Resize > Image Size and in either the height or width box type 100 px (you only need to type the dimension once the other box will change to 100 automatically. Make sure you have the bottom three boxes checked:
    Scale Styles
    Constrain Proportions
    Resample Image
    With all three checked set the bottom dropdown to Bicubic and then hit OK.
    If you want to apply some sharpening select Enhance on the top menu and choose Unsharp Mask.
    Make sure the Radius is no more than 1.5 and use the amount slider to get the image looking as you want it then save.
      

  • Need help with column formatting (see image)

    I am trying to make a spreadsheet that calculates proportional image sizes of a fixed original size. I have it set up so you enter an original size on the left (see image below) and the spreadsheet calculates the proportional sizes on the right (in the pink column). I would like to know how to get Appleworks to re-list the proportional sizes while omitting the size pairs that = 0. Basically i want to display the proportional sizes in a new column without the zeros. This way the proportional sizes list is much smaller and easier to read.
    Thanks for any help
    morgan
    g5   Mac OS X (10.4)  
    g5   Mac OS X (10.4)  
    g5   Mac OS X (10.4)  

    Part 2
    The method indicated in your original spreadsheet, and after the refinements suggested earlier, is essentially a sieve—calculate all the values, then strain out the chaff (ie. the results with non-integer values for one or both dimensions).
    A more efficient approach is to calculate and display only the cases where both dimensions are integers.
    Here's one way. You may want to move some of the calculations and revise the formulas accordingly.
    Data Entry:
    Cells B4 and C4 are used for data entry, as in the original.
    Initial calculation: Find the LCF (largest common factor) Columns J, K, L and cell M1.
    J1: =(B$4/ROW())=INT(B$4/ROW())
    K1: =(C$4/ROW())=INT(C$4/ROW())
    L1: =IF(J1+K1=2,ROW(),"")
    Fill these three columns down to the largest short side dimension you expect to use (ie. if you'll use 39 x 78 inch original images, fill down to row 39).
    What the formulas do:
    J1: The ROW() function returns the number of the row in which the formula is located. B$4/ROW() divides the number in B4 by the number of the row. INT(B$4/ROW()) does the same division, then strips off any fractional part of the result. The second = sign is a comparison operator. The formula compares the results of the parts on each side of the sign and, if they are equal, returns TRUE (or 1), and if they are not equal, returns FALSE (or 0).
    For the example (6), the formula would return TRUE in rows 1, 2, 3 and 6, marking the four factors of 6.
    K1: Does the same, but for the number in C4.
    For the example (8), the formula returns TRUE in rows 1, 2, 4 and 8, marking the four factors of 8.
    L1: This IF() formula checks for common factors. If the cells in both columns (J and K) in a particular row contain TRUE (ie. the number of that row is a factor of both the number in B4 and the number in C4), then the sum of the two cells will be 2 (TRUE=1, FALSE=0, TRUE + TRUE = 2), and the formula will return the result of the ROW() function (ie. the number of the row). For any other result, the formula will return 'empty' (ie. what's between the two double quotes "" ).
    For the example, cells L1 and L2 will contain 1 and 2 respectively; the rest of the cells in column L will be empty.
    M1: =MAX(L1..L39)
    M1: This formula completes the search by picking off and returning the greatest number in column L, or the Largest Common Factor for the two numbers. Adjust the second cell reference in the formula to reflect the largest original image size you'll use.
    Final Calculations
    D4: =B$4/$M$1*(ROW()-3)
    E4: =C$4/$M$1*(ROW()-3)
    D4: The formula divides the number in B4 by the LCF determined above to determine the size increment that will give integer results for both dimensions of the final image(s). It then multiplies that increment by 1 in row 4, by 2 in row 5, by 3 in row 6, and so on, for as many rows as you wish. The -3 in the second part of the formula is an offset to make the value of the multiplier three less than the row in which the formula is located.
    E4: Same formula, but acting on the number in C4.
    The first five results for the example ( 6 and 8) are:
    3 4
    6 8
    9 12
    12 16
    15 20
    and for a 4 x 6 initial image:
    2 3
    4 6
    6 9
    8 12
    10 15
    Regards,
    Barry

  • Help with Column Link

    Using APEX 3.2.1
    I have an updatable report where I have a column link (using edit icon) on one field. This is a 4000 char field so I want to go to another page where the users can easily read and/or update the field. This works and the field can be updated on the new page (with submit). However, when you branch back to the original page after the submit and then modify another field, you get the error
    Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-20001: ORA-20001: Current version of data in database has changed since user initiated update process. current checksum = "1E30D234E78C21CE2B8BC54798889D9C", item checksum = "0E8201F749D53031EB3F3C557B50D387".,
    Even if I get out of the updatable report or log off and on in, I still get the error. I thought maybe I could just bring the field value back to the originating page and do a submit from there, but not able to bring the value back without doing a submit.
    Any ideas/help would be really appreciated!
    Thanks,
    Sandie

    Hi ,
    y dont u create the another field in the chhild table and dont use it in this table ,
    or create view and mintain a foriegn with child and parent relation and then create the master detail form ,
    as in ur case the report is displayed iwth older value hence given error when page is submited .
    Else
    u can use the functions md5 etc.,, to mainatain the consistency.
    Regards,
    Nandini

  • JTable - Help with column names and rowselection

    Hi,
    Is there anyone that can help me. I have successfully been able to load a JTable from an MS access database using vectors. I am now trying to find out how to hardcode the column names into the JTable as a string.
    Can anyone please also show me some code on how to be able update a value in a cell (from ''N'' to ''Y'') by double clicking on that row.
    How can I make all the other columns non-editable.
    Here is my code:
         private JTable getJTable() {
              Vector columnNames = new Vector();
    Vector data = new Vector();
    try
    // Connect to the Database
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    // String url = "jdbc:odbc:Teenergy"; // if using ODBC Data Source name
    String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/Documents " +
              "and Settings/Administrator/My Documents/mdbTEST.mdb";
    String userid = "";
    String password = "";
    Class.forName( driver );
    Connection connection = DriverManager.getConnection( url, userid, password );
    // Read data from a table
    String sql = "select * from PurchaseOrderView";
    Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery( sql );
    ResultSetMetaData md = rs.getMetaData();
    int columns = md.getColumnCount();
    // Get column names
    for (int i = 1; i <= columns; i++)
    columnNames.addElement( md.getColumnName(i) );
    // Get row data
    while (rs.next())
    Vector row = new Vector(columns);
    for (int i = 1; i <= columns; i++)
    row.addElement( rs.getObject(i) );
    data.addElement( row );
    rs.close();
    stmt.close();
    catch(Exception e)
    System.out.println( e );
              if (jTable == null) {
                   jTable = new JTable(data, columnNames);
                   jTable.setAutoCreateColumnsFromModel(false);
                   jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
                   jTable.setShowHorizontalLines(false);
                   jTable.setGridColor(java.awt.SystemColor.control);
                   jTable.setRowSelectionAllowed(true);
                   jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
                   jTable.setShowGrid(true);     
              return jTable;
         }

    this method has a default behavior to supply exactly what you're seeing: column names consisting of the capitalized letters, "A", "B", "C".Thanks Pete, had seen that but never really thought about it... about 10 days ago somebody needed to obtain Excel column names, I'd offered a rigorous solution and now see it would have been shorter and simpler (if a little heavier) to extend DefaultTableModel and provide the two additional methods needed (getOffsetCol and getColIndex).
    Not much of a difference in LOC but certainly more elegant ;-)
    Darryl

  • Help with page resizing

    Hi all
    I'm currently building a website using Dreamweaver 8. You can
    see it at www.idl.dundee.ac.uk/~lyndon/active.htm
    as you can see i have a timeline running across the page and
    layers that pop up when the mouse is moved over them to give
    details(using show/hide layers behaviours). The problem is i have
    the width set at 100% so when the page resizes the layers are in
    the wrong places.
    If anyone can give me some pointers as to how i might get
    this to work it would be greatly appreciated!
    Thanks
    Lyndon

    The only way to get this to work with a 100% table that can
    expand on the
    page, is to place your layers inside a relatively positioned
    div that is
    inside strategic table cells, e.g.,
    <td><div style="position:relative;"><div
    id="Layer1"
    style="position:absolute; top:....
    Each layer will have to be positioned as need with regard to
    that table
    cell. Once you do that, you should be good to go.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Lyndon1983" <[email protected]> wrote in
    message
    news:eaq0cb$if1$[email protected]..
    > Hi all
    > I'm currently building a website using Dreamweaver 8.
    You can see it at
    > www.idl.dundee.ac.uk/~lyndon/active.htm
    > as you can see i have a timeline running across the page
    and layers that
    > pop
    > up when the mouse is moved over them to give
    details(using show/hide
    > layers
    > behaviours). The problem is i have the width set at 100%
    so when the page
    > resizes the layers are in the wrong places.
    > If anyone can give me some pointers as to how i might
    get this to work it
    > would be greatly appreciated!
    >
    > Thanks
    > Lyndon
    >

  • Help with Animation Resize on Tablet devices

    Hi,
    I would appreciate any help to fix this problem. I have this edge animation that doesn't resize correctly on tablet devices.
    http://www.lab2x.com/guest/Jaime/lab2x-1/
    It happens especially on vertical view of tablets.
    When I publish from edge directly it works perfect on tablets, but when I insert it to the html page I get the problem.
    Here is the animation alone and how I want it to work on tablets.
    http://www.lab2x.com/pacificdental/edge/v5/header.html
    Thanks,
    Rodrigo

    Rodrigo-
    I checked on a first gen. iPad and you are right, it does not resize.  Funny thing is, it does re-size when you close your browser to between 750px - 775px :-)
    My first thought is your script to check for tablet usage:
    <!-- Mobile Specific Metas -->
              <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
              <script type="text/javascript">
                        var browser                              = navigator.userAgent;
                        var browserRegex          = /(Android|BlackBerry|IEMobile|Nokia|iP(ad|hone|od)|Opera M(obi|ini))/;
                        var isMobile                    = false;
                        if(browser.match(browserRegex)) {
                                  isMobile                              = true;
                                  addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
                                  function hideURLbar(){
                                            window.scrollTo(0,1);
              </script>
    I'm rather new to Edge and havent gotten to making a "Tablet" sized animation yet, so I don't know if Edge created the script or you added it it.
    Since it re-sizes in a regular browser, coun ld you try switching the size based on the browser size by adding these div's to your CSS, just to see if it affects it?
    Tablet:
    @media only screen and (min-width: 481px) {
    .tablet_div {
    add around your Edge animation.
    Desktop:
    @media only screen and (min-width: 769px) {
    .desktop_div {
    add around your Edge animation.
    James

  • Help with column-level RLS

    So I've started trying column-level RLS. But I don't know how to write the Function. Can somebody help?
    I want users in the same office and dept to see full details about the employees in their office, but masked fname, lname, salary of employees in other offices and depts.
    -- Table:
    'emp' contains columns: fname, lname, address, city, office, dept, position, salary
    'user' contains columns: username, office, dept
    -- Policy:
    BEGIN
    DBMS_RLS.ADD_POLICY(object_schema=>'appschema',
    object_name=>'emp',
    policy_name=>'emp_privacy_policy',
    function_schema=>'appschema',
    policy_function=>'emp_privacy',
    sec_relevant_cols=>'lname, fname, salary',
    sec_relevant_cols_opt=>dbms_rls.ALL_ROWS);
    END;
    -- Function:
    CREATE OR REPLACE FUNCTION emp_privacy (username IN VARCHAR2, office IN VARCHAR2, dept IN VARCHAR2)
    RETURN VARCHAR2 AS
    con VARCHAR2 (200);
    BEGIN
    con := 'dept = (select dept from USER where username = nvl(v(''APP_USER''),USER) AND office = (select office from USER where username = nvl(v(''APP_USER''),USER)';
    RETURN (con);
    END emp_privacy;

    Look at the demos in Morgan's Library under DBMS_FGAC at www.psoug.org.
    Then just follow the examples to build your own.

  • Help with cropping/resizing

    I have a document that I needed to crop to get rid of extra white space. The document needs to be 8.5 x 11; however, when I crop it, it is naturally a smaller size. Is there any way that I can re-save this document as 8.5 x 11 or increase the size of the entire .pdf itself?

    What is the size of the page to begin with?

  • Help with column source_action_id in table pay_assignment_actions

    I've searched all over and cannot find the true meaning of column source_action_id in table pay_assignment_actions. More to the point, I've inherited code that runs a relatively simple query to retrieve all specific payroll dates from pay_payroll_actions based on effective_date being between a date range. These dates are then used to pull 401k balances for the effective date. In this query, pay_payroll_actions is joined onto pay_assignment_actions solely to verify that for a given payroll, source_action_id is NOT null. If it is null, the query will not consider it for the 401k query.
    I've found at least two records in pay_payroll_actions that should have been retrieved for our 401K process that were not retrieved based on that source_action_id being NULL. Can someone provide guidance on what would cause that column to not be populated? Was there possibly a step missed in our payroll process?
    Thanks

    Thanks for the reply.
    It turned out that within that "large chunk of SQL", there was a package call that wasn't returning the expected results... which mucked up the rest of the SQL call.
    Apparently it was a permissions issue in that the package didn't like to be called from JDBC; but would work fine out of SQL*Plus. Have you heard of this?
    I ended up just throwing the first package call into an an anonymous PL/SQL block, and then doing the SQL call... both in SQLJ. Only because the app is throw-away. Otherwise I agree: it would have been better in a stored procedure/function.

  • Jtable need help with column name

    hi, i'm currently working on a project where my jtable grab data from the database.
    as for the where clause i am thinking if i can get the column name as the field name in the table. However, I would like to hide the field name from the user.
    So, I'm here to kindly ask if there is a way that i can display the column name that is hidden from the field name.
    thanks in advance.

    actually, I am thinking of a lazy way to add the 'where' clause for my sql statement.
    so, instead of detecting which column that is related to the field i can just use the columns header name as my field. But on the other hand, I'd like to hide my field name from the user .
    For say my field name is "emp_no" but it is displayed as "Employee No" to the user. and when i do my sql statement i can do something like this:
    select * from emp_details where + jtable.getcolumnname(i).tostring() + = jtable.getvalueat(j,i)
    is there a way i can do it so???
    thanks again. and thanks for the reply

  • Need Help with Column Masking

    Hi All,
    I am looking for Masking options/techniques to mask few columns.
    I am aware of the option Oracle Data Masking Pack. But its costly. Can you please suggest some other way/technique using which I can achieve this?
    Thanks in Advance

    You can always try manual masking using datapump and sql and pl/sql (export original data and then create function that will put some random/other data instead of real ones). I have seen some clients that have implemented this type of masking. However, be aware that this will not give the best results, and that it will not come anywhere near quality of Oracle Data Masking Pack's masked data.
    Zoran

  • Need help with automatic resizing of images

    I am working with a liquid template in dreamweaver and when I insert my banner image and preview the page, the image stays the same size while the page template expands with the screen resolution.
    How can I set the image so it automatically expands with the page?

    Expanding an image in this way isn't really the best way of doing things, because depending on the image it can get very distorted when it's increased or decreased in size.  You are better off selecting a background colour and blending the image into that, so that when the browser window is increased you see the majority of the image, but on larger monitors, the image is blending into the background on either side of that image.
    There is a technique that may make this possible - I did read something about it at one point, but didn't save the URL.  However, the above method is probably the most reliable way of doing what you want.

Maybe you are looking for

  • I can't update my itunes it stops halfway and says the feature you are trying to use is on a network resource that is unavailable! Help!

    I've been trying to update my itunes for AGES now and it just won't seem to do it! Everytime it get's halfway and say the feature you are trying to use is on a network resource that is unavailable. If someone could help me I would really appreciate i

  • CS5 Bridge and Elements

    Hello,    I happen to have Adobe Photoshop Elements 8.0 Plus and Adobe CS5 installed on my desktop.Both programs work fine when using one or the other.My problem is if  I have CS5 Bridge open and highlight a photo that I want to open (right click ope

  • How do I open a ZIP file?

    I received a ZIP file (.xlsx) from a PC user, dragged it to a folder on the desktop, and used my downloaded Unarchiver to open it. It created a new folder within the original folder. The new folder has a file (.xml) and three folders in it. I don't k

  • Changing the file

    Hi friends, Ours is BW3.5 on HPUX unix / oracle. I am trying to edit the following file in unix  tpparam_instBWD as the SID is wrongly given in the file. I am not able to make the changes, when i am trying to use VI  editor I doesn't allow me to  use

  • Problem in replicating the material from SRM to CCM

    Hi SRM gurus We have material created in ECC6 and replicated to SRM, but the same material is not being replicated to CCM. Back ground job for program BBP_CCM_TRANSFER_CATALOG is running. we are on SRM 5.0, Extended calssic scenario.