How can i set the column width in the jtable?

how can i set the column width in the jtable?
can anybody send me a simple example??

TableColumn column = table.getColumnModel().getColumn( columnIndex );
column.setWidth( desiredColumnWidth);
column.setMinWidth( desiredMinColumnWidth);
column.setMaxWidth( desiredMaxColumnWidth);

Similar Messages

  • Is there any way to set default column widths in the Finder's Column view

    When my Finder windows open in column view, all the columns are always VERY wide. I have to then spend time resizing them to a managable width. Is there any way to set default column widths in the Finder's Column view?
    <Re-Titled By Host>

    No, because you can't set a columns view default.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    How can I set up two iPhones with the same contact, photos, music etc... but a different sim card and phone number. They will both be my phones, but one will be for use in other countries.

    Phone A = phone with information you want duplicated
    Phone B = phone that you want to copy from A
    Backup Phone A.
    Wipe Phone B using these instructions. What to do before selling or giving away your iPhone, iPad, or iPod touch - Apple Support
    Phone B should be on the 'Hello' screen. Do not swipe it. Launch iTunes. Plug in Phone B.
    When iTunes asks if you want to set up as new phone or restore from backup, choose restore from backup of Phone A.
    After this setup, any changes to one phone (i.e. adding a contact, downloading an app) will have to be manually duplicated on the second phone, if that is your desire). Making changes to one phone will not affect the other after setup.

  • How can I set up iMessage to ensure the text messages people are sending me arrive both on my computer AND on my iPhone as well?

    How can I set up iMessage to ensure the text messages people are sending me arrive both on my computer AND on my iPhone as well?

    Use the same ID in Settings > Messages > Send & Receive on both devices and have people use that ID. Your iPhone number would be a good choice.

  • How to set the column width in the PDF exports of interactive reports ?

    Hello,
    I have a huge problem with the PDF export for the Interactive reports. I'm using APEX 3.2.
    I have to produce a PDF report in landscape format that show 21 columns. My problem is that the columns have a ridiculous short width and that the text inside the columns do not wrap in the columns. So I get things like that :
    Date Name
    2011 Leina
    I should see 2011-08-01 and the name Leinad Jan
    I tried several things to format the columns, but none of the them has any effect on the PDF itself.
    1) I used HTML code in the report query. It works well with the interactive report, but display the HTML tags in the PDF.
    2) I used css to set the width of my columns. It works in the interactive report, but not in the PDF, the column width do not change.
    It's like the report do not notice that my page format is Legal 14 x 8.5 (Landscape) and still believe it's 8.5 x 11 (which is "portrait")
    Do you have any idea so set the columkn widths in the reports ?
    Thank you !
    Edited by: leinadjan on Aug 1, 2011 11:15 AM

    To "remember" the column widths, add a mouse listener to the table header. Upon mouseReleased(), get the column widths and save them to your file. When the application starts next time, get the stored widths and set them using:
    table.getColumn("XXX").setPreferredWidth(...);
    By default, your columns are adjustable, but you can use:
    table.getTableHeader().setResizingAllowed(true);

  • Can't set custom column widths in JTable

    I'm trying to set custom columns widths. They are set as I wish but then they are reset to default values (all columns have the same size). This is caused by method JFrame.setVisible(true) which invokes JTree.setWidthsFromPreferredWidths(). It can be investigated from following stack trace printed when a column being resized (see below).
    How to prevent this auto width sizing?
    P.S. can't override JTable.setWidthsFromPreferredWidths(); seems it's private
    table = new JTable(model) {
         public void columnMarginChanged(ChangeEvent event) {
              new Exception("stack trace").printStackTrace();
              super.columnMarginChanged(event);
    // setting here custom columns widths via table column model ...java.lang.Exception: stack trace
         at mtu.gui.TrackList$1.columnMarginChanged(TrackList.java:30)
         at javax.swing.table.DefaultTableColumnModel.fireColumnMarginChanged(DefaultTableColumnModel.java:615)
         at javax.swing.table.DefaultTableColumnModel.propertyChange(DefaultTableColumnModel.java:679)
         at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:264)
         at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:232)
         at javax.swing.table.TableColumn.firePropertyChange(TableColumn.java:249)
         at javax.swing.table.TableColumn.firePropertyChange(TableColumn.java:255)
         at javax.swing.table.TableColumn.setWidth(TableColumn.java:482)
         at javax.swing.JTable$2.setSizeAt(JTable.java:2242)
         at javax.swing.JTable$5.setSizeAt(JTable.java:2336)
         at javax.swing.JTable.adjustSizes(JTable.java:2372)
         at javax.swing.JTable.adjustSizes(JTable.java:2340)
         at javax.swing.JTable.setWidthsFromPreferredWidths(JTable.java:2250) <======
         at javax.swing.JTable.doLayout(JTable.java:2165)
         at java.awt.Container.validateTree(Container.java:1089)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validateTree(Container.java:1096)
         at java.awt.Container.validate(Container.java:1064)
         at java.awt.Window.show(Window.java:455)
         at java.awt.Component.show(Component.java:1134)
         at java.awt.Component.setVisible(Component.java:1089) <=====
         at mtu.gui.Test.test_03(Test.java:56)
         at mtu.gui.Test.main(Test.java:29)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.intellij.rt.execution.application.AppMain.main(Unknown Source)

    When I create the table I have code like this:TableColumn col = getColumnModel().getColumn(2);
    col.setMinWidth(width + 4);
    col.setMaxWidth((int)(width * 1.2));Works just fine for me. The setWidthsFromPreferredWidths() method will use these limits as far as I can see.
    PC&#178;

  • How can I set a unique macro for the function keys on my wireless keyboard?

    I'd like to use the F5 key as a quick stroke key for a sentence I use commonly - how can I set that up?

    <http://www.keyboardmaestro.com>

  • How Can I Set Photoshop to Default Open the Most Recent Folder

    Lately, Photoshop CC always opens a default folder-which is several clicks away from the folder I am using. How do I set it to default to the most recent open folder when I click "OPEN" ?

    They would seem to be, but it's possible that they were released separately in the iTunes Store. Some apps are different but named the same (Angry Birds being a case in point). Not having any of those apps I can't say with any certainty. It's definitely not normal for iTunes to keep older versions.
    If you're still on Mac OS X 10.5.6 as your profile indicates, update to 10.5.8 and the latest version of iTunes and see if that makes any difference.
    Regards.

  • Change the column width on the fly

    Dear all,
    I have a problem, i have a matrix report, the row is "the project name" and the column is "the items" using within each project, and the problem is the items are variable from time to time the report run for each project, so its exceeds the paper width.
    And the question is, is there any way to change the width of the column on the fly, i mean dynamiclly change the column width each time the report is called to make all items fit the paper width.
    Thank u

    i don't think that we can change the layout of the column in reports
    The simple solution for that problem is that u have to
    fix the horizontal and vertical layout of the text item
    better is to post this problem at reports forum
    Najeeb

  • How can i set a column which would show me the name of the user

    how can i write a trigger which would show me the name of the user now make changes in the table.

    872959 wrote:
    how can i write a trigger which would show me the name of the user now make changes in the table.I think what sb is trying to say is: if you mean the database user, you can use the USER session variable to identify the database user:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions227.htm#SQLRF06156
    you would write a before each row trigger to update an "updated_by" column on your table to be USER.
    e.g.:
    :new.updated_by := USER;

  • When I email myself a picture from my iphone 4s, the email is sent from an email account that I don't have set up as the default account. How can I set it up so that the emails are coming from the default account selected in Mail?

    Under my mail tab, it shows that I have a specific email account set up as a default account. That is the account I would like for me emails to be sent from. But when I actually send out an email such as a picture, it is being sent from one of my different email accounts that is not set up as the default. How can I change this so that future messages will be sent from the default account? Any advice would be appreciated. Thanks!!

    All photo attachments received or sent with the iPhone's Mail app appear inline or viewed in place within the body of the message when viewed with the iPhone's Mail app which is the same with the Mail.app on a Mac. A photo attachment that appears inline or viewed in place does not mean the photo was not sent as a true attachment to the message. A photo attached to a message with the iPhone's Mail app is sent as a true attachment to the message. How an inline or viewed in place attachment appears on the recipient's end depends on the recipient's email client. If the recipient's email client does not support viewing an attached photo inline or viewed in place within the body of the message, the attached file must be manually selected and opened to viewed.
    I am getting the email with the Picture Inline ( not as attachment),The picture is shown distorted , no metter what i do and with what mail client i am using (Gmail\Hotmail\My Enterprise exchange mail), i still get the same behavior.
    With which email client?

  • How can I set #HOST# variable referenced in the Chart template?

    #HOST# and #HOST_PROTOCOL# are being set incorrectly by APEX from CGI variables when I create a chart. I am using APEX 4.1 and Oracle 11g. The get the continual "Loading data..." and then after it times out I get "Error loading file".
    Before we changed to a secure http environment, our charts worked. After we changed to the new web layer, the charts do not work. The #HOST# substitution was set to http://correctservername/ and #HOST_PROTOCOL# was set to http. We set PlsqlCGIEnvironmentList REQUEST_PROTOCOL=https in the dads configuration file and now the #HOST# displays https but it also includes the default port number which we do not want (https://correctservername:port/) The charts work without the port. REQUEST_PROTOCOL is not in the cgi list and setting this variable set #HOST_PROTOCOL#. What variable can we set to make #HOST# correct. It seems like #HOST# is being set by #REQUEST_PROTOCOL#'://'||HTTP_HOST||':'||SERVER_PORT||SCRIPT_NAME||'/'. SERVER_NAME could also be used in of HTTP_HOST. I don't know how APEX is setting #HOST#. Does it come from a host alias somewhere in the environment?
    I don't want to add a new cgi variable called HOST because HOST sounds so generic and it might interfere with something else running in our environment. Or, I don't want to change the plsql cgi environment variable (such as HTTP_HOST) because many developers may use owa_util.get_cgi_env('HTTP_HOST') to get the current server. If the SERVER_PORT is part of the #HOST# then what could I change it to if it needs to be null. If you leave it blank, then the default SERVER_PORT comes from the CGI variables.
    I would rather not create a global variable (hard-coding) and create a new chart template using the global variable or create a before header application process to re-direct url without a port.
    Edited by: Donna C-Houston on Oct 10, 2012 1:06 PM

    Hi Donna,
    changing the CGI environment variables HTTP_HOST, REQUEST_PROTOCOL and SERVER_PORT is the correct way how to resolve this, because it appears that your hiding the web server where you have installed mod_plsql or EPG by a different outside facing web server (also called reverse proxy). That's why APEX gets the host name, protocol and port of the internal web server, but should actually get the values of your reverse proxy web server. Can can fix that by changing the following CGI environment variables.
    HTTP_HOST should just contain the domain name (no protocol or port). For example: www.oracle.com
    REQUEST_PROTOCOL should contain http or https
    SERVER_PORT should be the port for https
    I don't want to add a new cgi variable called HOST because HOST sounds so generic and it might interfere with something else running in our environment. Or, I don't want to change the plsql cgi environment variable (such as HTTP_HOST) because many developers may use owa_util.get_cgi_env('HTTP_HOST') to get the current server. If the SERVER_PORT is part of the #HOST# then what could I change it to if it needs to be null. If you leave it blank, then the default SERVER_PORT comes from the CGI variables.The value of HTTP_HOST is wrong anyway and points to your internal web server, but I assume your developers actually want to get the host name of your external web server if they use it to generate absolute URLs. That's why I wouldn't bother and set it to the correct host name.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How can I set a default zoom for the browser (freeze it)?

    Hello, there's an option of using the Ctrl + + to zoom the Web page, but it reverts to the Firefox default zoom in the midst which is very annoying. Generally, I'd like to be able to set a certain default zoom level and then only if needed use the CTRL +/- zoom in and out options. So my optimal zoom level is used for all my browsing unless I change it.

    I have listed 2 add-ons below for you to consider. I have not used NoSquint, but I use and rely on Default FullZoom Level.
    *You can set a default zoom level in DFZL Options
    *You can use the mouse scroll wheel on the Add-on Bar DFZL icon to increase or decrease the zoom or click the icon and choose from the available zoom percentages.
    *In NoSquint, it says it saves the zoom level by web site/page.
    *'''''Default FullZoom Level''''': https://addons.mozilla.org/en-US/firefox/addon/default-fullzoom-level/
    *'''''NoSquint''''': https://addons.mozilla.org/en-US/firefox/addon/nosquint/
    **More info on NoSquint: http://urandom.ca/nosquint/
    You can also set a "Minimum Font Size" in Firefox Options > Content > Fonts & Colors Advanced".
    *See --> [https://support.mozilla.com/en-US/kb/Options%20window%20-%20Content%20panel#w_fonts-colors Options window-Content panel-Fonts & Colors]
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check: https://www-trunk.stage.mozilla.com/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *Adobe PDF Plug-In For Firefox and Netscape: [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *Next Generation Java Plug-in for Mozilla browsers: [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • How can I import db column comments into the OBIEE presentation layer?

    We have a very well designed data mart - it is a star schema and all the fact and dimension table columns have comments in them with their definition and use. There is virtually no change required in the physical or business layer. The only modifications done in the presentation layer was to hide the Pk/Fk columns.
    Is there a way to import these column comments into the presentation layer so that the business user can see this comment in the tool tip while hovering over the presentation column in Answers?
    Thanks for your help!

    Hi,
    I assume the comments you mean are stored in user_tab_comments and user_col_comments.
    When this is the case you should do the following:
    Go to your subject area in your presentation layer. For now I assume the name of this subject area is "Subject Area".
    Then right click on this subject area and check "Externalize Descriptions".
    Then create an initialization block (session) using this query:
    (select 'CD_Subject_Area_' || table_name, comments from user_tab_comments)
    union all
    (select 'CD_Subject_Area_' || table_name || '_' || column_name, comments from user_col_comments)
    Use "Row-wise initialization" for this initialization block.
    Two comments:
    1) Like I said, I assume Subject Area is the name of your subject area in your presentation layer, so I guess you need to replace this with the name of your Subject Area.
    But be sure that you replace each space ' ' with an underscore '_'.
    2) Maybe you need to refine above querys by filtering on table_name for those table_names you are using.
    Good luck.
    Regards,
    Stijn

  • How can i dynamically select columns based on the input parameter?

    I have an input parameter which takes single numeric value.
    Based on this value i have to dynamically select table-columns .
    For eg: if i have following fields in my table :
    SEM_1
    SEM_2
    SEM_3 and SEM_4.
    And if i give numeric input as 2 , then i have to select "SEM_2" column only.
    if the input is 3 then i have to select "SEM_3" only and leave the rest of the columns.
    how do i achieve this dynamic feature in the "Select .....  From...... table...." statement in the ABAP??

    Hi,
    you should try something like this.
    TYPES: cond(72) TYPE c.
    data: condtab TYPE TABLE OF cond,
             condw type cond.
    data: lv_field(30) type c value 'SEM_'.
    write p_num to lv_field+4(1).
    condw = lv_field.
    append condw to condtab.
    SELECT (CONDTAB) FROM table INTO.....
    Kostas
    Message was edited by:
            Kostas Tsioubris

Maybe you are looking for