How could I display some columns in a JTable?

Help, please:
I got a Table data(using AbstractedTableModel), and I can display all rows and columns. How can I just display several columns and all rows? Should I delete some columns from table and fireChanges or what? but I need these columns later. Make sense? any ideas?
Thanks for any helps.
Royan

this worked for me,
import java.util.*;
import java.io.*;
import java.net.URL;
import java.sql.*;
import javax.swing.table.*;
import javax.swing.*;
public class HideTableColumns
      public HideTableColumns()
      private void initialize()
      DefaultTableModel m = new DefaultTableModel();
      try {
         java.util.Vector data = new java.util.Vector();
         java.util.Vector headers = new java.util.Vector();
         String s = "";
         headers.addElement( "OrderID" );
         headers.addElement( "CustomerID" );
         java.util.Vector datum = null;
         datum = new java.util.Vector();
         s = "OrderID";
         datum.addElement( s );
         s = "CustomerID";
         datum.addElement( s );
         data.addElement( datum );
         m.setDataVector( data, headers );
         for( int r = 0; r < m.getRowCount(); r++ )
            for( int c = 0; c < m.getColumnCount(); c++ )
            s = ( m.getValueAt( r, c ) ).toString();
            System.out.println( s );
      } catch( Exception e ) {
         System.out.println(e.getMessage());
         e.printStackTrace();
      JFrame f = new JFrame();
      JPanel p = (JPanel) f.getContentPane();
      JTable tb = new JTable( m );
      TableColumn col = tb.getColumnModel().getColumn(1);
      col.setPreferredWidth(0);
      col.setMinWidth(0);
      col.setMaxWidth(0);
      p.add( tb );
      f.pack();
      f.show();
      public static void main( String[] args )
      HideTableColumns d1 = new HideTableColumns();
      d1.initialize();
}

Similar Messages

  • How could i display  india as  i  n  d i a in rowize

    how could i display india as i n d i a in rowize in oracle query
    output
    i
    n
    d
    i
    a
    (i am newbiee to this forum ,i dont know on which category i should post this question is there any general category for orcle questions?)
    thanks

    Hi,
    Welcome to the forum!
    1008045 wrote:
    how could i display india as i n d i a in rowize in oracle query
    output
    i
    n
    d
    i
    aHere's one way:
    WITH     got_target     AS
         SELECT     'India'     AS target
         FROM     dual
    SELECT     SUBSTR (target, LEVEL, 1)     AS letter
    FROM     got_target
    CONNECT BY     LEVEL     <= LENGTH (target)
    ; (i am newbiee to this forum ,i dont know on which category i should post this question is there any general category for orcle questions?)This is the right place for questions like this, and for any question like "If I have this data ... then how do I get these results ... in SQL?"
    Take a few minutes now to read the forum FAQ {message:id=9360002}; it has lots of good tips.

  • Hello , how could i insert some content into a large file?

    hello , how could i insert some content in a large file? ----just like a txt editor do.
    assume that i have a 6G file(i think it large enough), then i wann insert one ascii character at the begining of the file,does that means:
    1> i need create one 6G+1byte new file, then copy all content of the original file following by that addition character?
    2> not creat new file,just set original file length to 6G+1byte,then offset all 6G byte by one byte,after all adding my one character?(it seems not some kind of optimization ...)
    what should i do?
    Edited by: littleJohnny on Jan 16, 2008 2:03 AM

    could some means can set the read hint of 6Gbyte content after my character first read out? ----just let my addition point to the begining of 6G original content ,then the addition character take the place of the file header? ----the inster may be the same....
    i just think the already used txt editor seem so fast to process insert, replace .... 2M 10M maybe.... does they doing those operation use Java Type ---String? ------read all contet into memory,then it is easy to regular expression ,relinking read order....-----does it mean large file couldn't against with pattern?
    does all ctrl+s shortcut-----rewrite original file with memory relinked order? then large file could not easily manipulate its structure but all structured file is large than plain format...
    just teach me some "already used txt editor " trick,thanks very much.

  • How could I display a dialog attached to a window?

    If there is a way to do this, how could I, in Xcode 5, cocoa applescript? Something like:
    Display dialog "Hello Red_Menace" attached to MyWindow
    I know sheets can do this, but this seems a lot more simple, because I wouldn't have to design a window and link it.

    I saw what you did there...
    You don't necessarily need to create another window for simple alerts, you can use the NSAlert class.  I think there is still some weirdness with sheets, so the easiest way to do a sheet would be to use Myriad Helpers, which has a category that adds some methods to the NSAlert class, for example:
    tell Cocoa's NSAlert's makeAlert_buttons_text_("Alert", {"OK"}, "Hiya,  Apple_For_The_Win" & return & "This sheet will give up after 10 seconds")
      showOver_calling_wait_(mainWindow, {"sheetDismissed:", me}, 10)
    end tell
    on sheetDismissed_(theButton) -- the sheet has been dismissed
      # whatever
    end sheetDismissed_
    The completion handler (sheetDismissed in this case) is called when the sheet is dismissed, and is passed the name of the button (or 'Gave Up').

  • How can I display some OrdImages using a Applet in html or Jsp?

    hi
    I want to use a applet to display some images retrieved from intermedia OrdImage Object.
    Now ,I know that a applet can display some image objects or some images with their own filepaths. But we can get ordimag objects from Oracle database.And we can image data or image properties by ordimage java mathod. It is in html/Jsp environment. So how can I transform from ordimage to applet?? I appreciate someone who can help me!
    Bill

    Do you mean applet or Servlet?
    An Applet is java code that is downloaded over the web and runs in a web browser environment. Is this what you are doing?
    I suspect you are really talking about servlet/JSP environments, and the ability to include images from the database in a web page.
    In either case (applet or servlet), you want to be able to access images via a URL. For a Servlet/JSP/web page, this URL will be specified in a HTML <IMG> tag with a key as a parameter to the image you wish to view. Images are not in-line downloaded in a web page. They are access after the HTML is loaded, and are accessed with URLs, sometimes relative URLs rather than fully specified URLs.
    To deliver images to the web from the database using the PL/SQL gateway and iAS, where the procedures are generated by a wizard, see:
    http://otn.oracle.com/software/products/intermedia/htdocs/descriptions/imedia_code_wizard.html
    You can create a simple servlet (JSPs can not deliver binary data) that delivers database images using java classes. See:
    http://otn.oracle.com/software/products/intermedia/htdocs/descriptions/servlets_jsp.html
    http://otn.oracle.com/sample_code/products/intermedia/htdocs/intermedia_servlet_jsp_samples/imedia_servlet_jsp_readme.htm
    for a sample.

  • Verison 7 not correctly displaying some columns/windows

    NING is one of the larger providers of social networking sites around...since upgrading to version 7 some columns and windows do not display correctly (some text is not shown). I have a photo of the behavior but cannot find a way to post to help to demonstrate the issue. As an administrator for a site on NING, I cannot give you a URL as it is a password protected are of the site. However attached is a link to a discussion about the behavior from NING's Creator site

    The correct source of assistance with this situation is directly from
    http://www.samsontech.com/samson/products/microphones/usb-microphones/gtrack/ as they are the manufacturer of the hardware and have sole responsibility for support of their product.  This is not a Microsoft product and Microsoft does not provide support
    for third party hardware.
    I especially recommend you download and read
    Samson G Track FAQ's V2.0
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • How to not display the column header in the table view?

    I do not want to display the column header in the table view, how can I achieve it?

    If you're using JavaFX 8 you can use the following in an external style sheet:
    .table-view .column-header-background {
      -fx-pref-height : 0 ;
    If you're using JavaFX 2.2, the -fx-pref-height attribute is not available in css, so I think you have to resort to a lookup:
    final Region tableHeader = (Region)table.lookup(".column-header-background");
        tableHeader.setPrefHeight(0);
    As always, I feel obliged to point out that I don't really like lookups. Sometimes they seem to be the only way, though.

  • In ColumnChart, how to stop displaying small column for zero value?

    I'm trying to create a ColumnChart that does not display a column when the value is zero. The chart currently looks like this:
    This is a stacked column chart with red values representing Faults and green values representing Throughput. Each hour has an explicit value of zero for Faults. I don't want to see any red lines when the value is zero. Is there any way to accomplish this?
    My code looks like this:
    <mx:Script><![CDATA[
         import mx.collections.ArrayCollection;
         [Bindable]
         public var simpleStats:ArrayCollection = new ArrayCollection([
            {Hour:"0:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                 AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
            {Hour:"1:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                 AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
            {Hour:"2:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                 AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
            {Hour:"3:00", Throughput:5, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                 AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
            {Hour:"4:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                 AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0}
      ]]></mx:Script>
                                     <mx:ColumnChart id="trafficChart"
                                        dataProvider="{simpleStats}"
                                        showDataTips="true" width="500" height="100%" seriesFilters="[]"
                                        type="stacked">
                                        <mx:verticalAxis>
                                            <mx:LinearAxis title="Messages" id="a1"/>
                                        </mx:verticalAxis>                                   
                                        <mx:horizontalAxis>
                                           <mx:CategoryAxis
                                                   id="TrafficTimeAxis"
                                                dataProvider="{simpleStats}"
                                                categoryField="Hour"
                                                />
                                        </mx:horizontalAxis>
                                        <mx:horizontalAxisRenderers>
                                            <mx:AxisRenderer axis="{TrafficTimeAxis}" canDropLabels="true"/>                                       
                                        </mx:horizontalAxisRenderers>                                            
                                        <mx:series>                                                                         
                                           <mx:ColumnSeries
                                                yField="Faults"
                                                displayName="Faults"
                                                fill="{sc2}"
                                                stroke="{s2}"
                                                 minHeight="0">
                                           </mx:ColumnSeries>                                                                                                          
                                           <mx:ColumnSeries
                                                yField="Throughput"
                                                displayName="Throughput"
                                                fill="{sc1}"
                                                stroke="{s1}"
                                                minHeight="0">
                                            </mx:ColumnSeries>                                      
                                        </mx:series>
                                     </mx:ColumnChart>

    Answered my own question!!
    The solution is to set the stroke for the ColumnSeries to {noStroke}, which I defined like this:
        <mx:Stroke id="noStroke" color="0xFFFFFF" weight="0"/>
    Note that if you define {noStroke} without a color property, black is used by default, which means that those columns that do appear show up in black stroke outline.
    If there's a more elegant solution to the problem, please let me know...

  • How to programmatically select a column in a JTable

    Hi,
    I'm writing a program which requires me to select a column in the JTable through code. The problem is that I could only find getSelectedColumn() function in JTable and no setSelectedColumn().
    Please let me know if there is any workaround for this.
    Regards,
    Derreck

    Hi,
    table.setColumnselectionInterval(index0,index1);
    The above line will suffice your requirement.
    Cheers,
    Gokul.

  • How to forbid to moving columns in a JTable

    Hi together,
    i have one simple question. How can i forbid, that columns can be moved in my Jtable?
    If anyone can help or may has a useful link, i would be glad.
    thanks
    BackUP

    Hi,yourTable.getTableHeader() .setReorderingAllowed(false);

  • Overall results row - how not to show some columns

    Dear Experts
    I have set results rows enabled at a certain characteristic level.
    So, at the rows level, the results row is showing.
    But at the right-hand-side results columns, some of the keyfigure columns should not be displayed , for example, price should not be summed.
    How can this be achieved using a  query only?
    regards
    Pascal

    HI,
    As i dont have your report layout based on my assumptions i understand that you have put one char in rows column above the strucutre and thats why you are getting result in rows and column as well.
    Now you need to hide the column result which indeed seems no to me i tried same on my system but i can only make the value and result blank but cannot hide the complete result column.
    Please correct me if my understanding is worng or your requirement in something differnent.
    Hope it helps.
    Regards,
    AL

  • How can I display multiple column results of a sql query?

    I'm wanting to display the results of a query selecting from multiple columns, but I can't seem to find an item type that will allow this. I've tried LOV, multiselect, display as text and others. Any ideas on how to do this. Here is my basic query:
    Select ul.meaning,
    rqa.submission_date,
    rqa.location_num
    from
    cfa_rqa_doc_submit_dates rqa,
    cfa_user_lookups ul
    where
    rqa.location_num in (Select location_num from cfa_current_locations_mv
    where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
    and
    ul.lookup_type_id='1269'
    and
    to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
    and
    rqa.submission_date >= (SYSDATE-365)
    and ul.lookup_ID= rqa.document_type_id
    ;

    Hi,
    Do you just wish to display the result of the query? If so, you can simply parse it out in HTML.
    You can then choose if you want to use tables or css.
    Multiple column layout in tables are based on <tr> and <td>.
    <tr> is a table row, where <td> is a column.
    All tags should be closed.
    Example:
    <table>
    <tr>
    <td>col1</td><td>col2</td>
    </tr>
    <tr>
    <td colspan="2">spans over 2 cols</td>
    </tr>
    </table>If you want to do the same in css:
    (Seems this forum removes the styles!):
    float:left; width:50; << first div and 2 div (col 1 and col 2 style)
    float:left;clear:both; width:100%; << clear both, double width (spans over 2)
    <div>
    <div style="float:left; width:50;">col1</div><div style="float:left;width:50%;">col2</div>
    <div style="float:left;clear:both; width=100%;">Spans over 2 cols</div>
    </div>The div might look more complicated, but if you refrain from styling in the tags them selves, you can define different styles in the .css file.
    You need the clear:both to start a new line with the divs that float.
    I usually run a dedicated "new line" div, without content.. (exception beeing the html-entities version of ' ' (& nbsp ; << without the spaces)).
    eg.:
    <div style="cls"> </div>Parsing out the values from the PL SQL you do like so:
    begin
    declare
       cursor c_search is 
    Select ul.meaning,
    rqa.submission_date,
    rqa.location_num
    from
    cfa_rqa_doc_submit_dates rqa,
    cfa_user_lookups ul
    where
    rqa.location_num in (Select location_num from cfa_current_locations_mv
    where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
    and
    ul.lookup_type_id='1269'
    and
    to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
    and
    rqa.submission_date >= (SYSDATE-365)
    and ul.lookup_ID= rqa.document_type_id
    begin  
    htp.p('<div style="width:80%;">');
    for v_search in c_search loop
    htp.p('<div style="float:left;clear:none;">'||v_search.location_num||'</div>');
    htp.p('<div style="float:left;clear:none;">'||v_search.submission_date||'</div>');
    end loop;
    htp.p('</div>');
      end;
    end;Ps. hope I understood you correctly, also this code is untested.. but I hope it can still help.
    Edited by: Olav Alexander Mjelde on May 12, 2010 9:36 AM

  • How can I display a column heading vertically?

    Hi,
    I try to display verticaly a column heading. Is it possible on Siebel on Demand?
    ex : NAME = N
    A
    M
    E
    Thanks for your answer
    Regards

    Hi,
    I try to display verticaly a column heading. Is it possible on Siebel on Demand?
    ex : NAME = N
    A
    M
    E
    Thanks for your answer
    Regards

  • How do I display my columns, like "date added" in the new iTunes?

    I updated iTunes. I like to play the music I most recently added first. I had this all sorted into neat columns in the old iTunes and now I cannot seem to sort by "date added" or "date modified".

    If you don't see anything when you connect your ipod it's meybe something wrong with the USB cable, If you have another you can try that.
    try to shut down or restart your ipod and then connect it.

  • How could i display yahoo mail in Portal UWL

    Hi,
    Can any one tell me how can i diaplay my yahoo mail in Portal UWL any connector is avilable to connect Portal to yahoo server.
    thanks in advance
    Chitta

    Hi Chittya,
    You can crate a URL iview by selecting the URL Iview template while creating a new iview. Pass the URL of your internet address in the URL Iview wizard. For more information on how to create and use URL Iviews check  <a href="http://help.sap.com/saphelp_nw70/helpdata/en/4c/eee2bedf3b4082b14a933e5ee63472/frameset.htm">this</a> helpful link.
    Regards,
    Ankit
    Reward points if helpful.

Maybe you are looking for

  • How to update or delete records in a Complex View in Forms?

    Hi, I have a requirement to create a Form by using Complex View. Insertion is possible but updation and deletion is not working properly . I got FRM-40501 Error. I need How to update or delete records in a Complex View in Forms? Thanks & Regards, Har

  • How to enable Adobe PDF Printer in Acrobat Pro 9.4??

    I cannot print pdf documents in Acrobat 9.4!! Major Problem!! Running a new PC with Windows 7 (64 bit)  and Office pro 2010 + firefox 3.6.13. New version of Acrobat 9.4. was installed. ** The Problem is I am unable to print/save any PDF files because

  • Periodic error about contract when try to restart my NRPE daemon

    Hi everyone, i have an embarrassing problem with my NRPE daemon on my solaris x86. i am doing a lot of change in my NRPE configuration file and i always need to restart it. sometimes, the restart didn't work and the services become "maintenance". Her

  • Problem: load SQL Server 'varbinary' data

    Source database: SQL Server 2000 OS: Windows 2003 (SP1) Oracle: 10g (R2) Datatype Mapping: SQL Server 'varbinary(1000)' to oracle 'BLOB' With the help of OMWB, I created the oracle database schema for a SQL Server DB (offline capture). I have problem

  • Dynamic Changes in Smart Form ( From External Source )

    Dear Sap Folks ,             Whether the SF layout attributes can be changed from the external loading program dynamically . Please give your views on this topic. Thanks in advance . Best Regards, Raj