How to forbid Column-Moving in a JTable ?

Hi,
anyone knoyw how to forbid the Column-Moving in a JTable ??
I have a JTable that works fine, but it is still allowed to move the columns. And i want to forbid that.
This: JTableHeader header = new JTableHeader();
header.setResizingAllowed(false);
header.setReorderingAllowed(false);
did not work :-\
Maybe someone has some ideas and could help me?
Thx and have a nice day
Avalon

>
Where's your thread, GoldieDork? You do nothing
besides trolling.no I don't, I ask Java questions but no one answers them apart from the database question where dave and jverd and rage were all nice to me and I was happy that we could all be friends cos they helped me but then they started cussing me again so thats why I no longer talk to those guys.
I dont know where my thread is now, Sun probably deleted it

Similar Messages

  • 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);

  • How to display column header of a JTable in JScrollpane's RowHeader

    Can anyone tell me if it's possible to display the colum headers of a JTable which acts as the row headers of a JScrollpane object?
    If the answer is yes, could he/she point me to the right direction?
    Thanks,

    I'm guessing the answer is no because the column header is layed out horizontally and a row header is layed out vertically. But it should be easy enough to test:
    scrollPane.setRowHeaderView(table.getTableHeader());
    Its not hard to create your own row header. Search the forum using "+setrowheaderview +camickr" to find examples I've posted.

  • How To Delete Columns In JTable?

    Hi,
    I created a JTable and added values through DefaultTableModel. I Have JButton to add columns if need. I have another JButton to remove columns by entering the columns header.. eg: If there are three columns like A,B,C, If i need to remove column "C" means. I just click the remove button and enter the column header in the dilaog box eg: "C". and the columns will deleted. It is working properly. but if i add a new column means the removed columns also getting added and the datas are also in that same column. how delete a column and it's data in a single shot.
    How to add network drivers in a save as dialog box. I have using my code in Windows and also in mac os.
    Thanks in Advance
    by,
    Mohan

    One possibility would be to use a DefaultTableModel to store the data but have JTable access it through your own table model which mapped the columns and altered the column count etc..Why go to all that trouble. If you just want to hide a column, then remove the TableColumn from the TableColumnManager.
    The requirement was to remove the data as well.
    Implementing AbstractTableModel is really less hassle than it looks. Generally you only have to override getColumnName, getValueAt, getRowCount, getColumnCount and (usually) getColumnClass.Nobody said it was difficult, by why reimplement everything from scratch? Just extend DTM to add your new functionality.

  • How to change the particular column background  color in jTable?

    I am woking with a project, in which I am using a jTable. Then
    How to change the particular column background color in jTable?

    Use a custom Renderer. This is the JTable tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • 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);

  • Remove Column Headers from a JTable in a JScrollPane

    Hi,
    I'm just wondering how to remove the column headers from a JTable in a JScrollPane.

    Here are two ways to do it, with different visual outcomes...
    import javax.swing.*;
    public class Test {
        public static void main(String[] args) {
            Object[][] rowData = {{"A", "B"}, {"C", "D"}};
            Object[] columnNames = {"col 1", "col 2"};
            JTable table1 = new JTable(rowData, columnNames);
            table1.getTableHeader().setVisible(false);
            JScrollPane sp1 = new JScrollPane(table1);
            JTable table2 = new JTable(rowData, columnNames);
            final JScrollPane sp2 = new JScrollPane(table2);
            JPanel contentPane = new JPanel();
            contentPane.add(sp1);
            contentPane.add(sp2);
            final JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(contentPane);
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    sp2.setColumnHeader(null);
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • Select row and column from header in jtable

    hello i have a problem to select row and column from header in jtable..
    can somebody give me an idea on how to write the program on it.

    Hi Vicky Liu,
    Thank you for your reply. I'm sorry for not clear question.
    Answer for your question:
    1. First value of Open is item fiels in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
    * I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
    2. the picture for detail of my report
    Detail for Red number:
    1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
    espression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
    2. tb_TOTAL1 group on item_part = 1
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
    3. tb_TOTAL2 group on item_part = 3 or item_part = 4
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
    4. tb_TOTAL3 group on item_part = 2
    expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
    5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
    expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
    I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
    My custom code:
    Dim Shared prev_close As Double
    Dim Shared now_close As Double
    Dim Shared now_open As Double
    Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
        now_close = TOTAL3 + NowOpening
        prev_close = now_close
        Return now_close
    End Function
    Public Function GetOpening(Month as String,NowOpen as Double)
        If Month = "1" Then
            now_open = NowOpen
        Else    
            now_open = prev_close
        End If
        Return now_open
    End Function
    Thanks alot for your help!
    Regards
    Panda A

  • Replicate column changes into other JTable(s)?

    I have a set of tabs in a JTabbedPane which show the results of a database query from a number of (allegedly) identical databases. Each tab contains a JScrollPane which contains a JTable. All the JTables share the same table model and the data is not editable.
    If the user changes a column (e.g. resizing or moving it) in one JTable I would like the change to be automatically replicated on the equivalent column in the other JTables.
    Is there a simple way to do this?

    Hi,
    Every change in one table produces special event , you should add a "listener" to reflect changes.

  • How to set columns for Zip Codes?

    I am new to iMac and in my first week using trial version of Numbers. I work in sales and we do lots of mailings using merging of data and addresses for post cards, labels, etc.
    I cannot see how to set columns to a zip code setting. All zips entered beginning with a 0 drop the front 0. I tried calling the column as Text, but it did not help. I can type a ' in from of the 0 and it works, but this takes an insane amount of time and will not work for us.
    How do you deal with Zip Codes? Are there labeling options for mailing built into Numbers? I really want to dump all MS products but will have to drop mac and return buy Office if this is not correctable.
    Thank you,
    Brownie

    Hello
    Setting the column format to text do the trick on my french version too.
    With AppleWorks, I was accustomed to use a zeroSlashed so it remained in my zip codes when I moved codes here and there.
    Yvan KOENIG (from FRANCE jeudi 13 septembre 2007 17:44:38)

  • How to make column headers in table in PDF report appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp

    Hi my name is vishal
    For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
    Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.SqlClient;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using System.Diagnostics;
    using System.IO;
    namespace DRRS_CSharp
    public partial class frmPDF : Form
    public frmPDF()
    InitializeComponent();
    private void button1_Click(object sender, EventArgs e)
    Document doc = new Document(PageSize.A4.Rotate());
    var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    doc.SetMargins(50, 50, 50, 50);
    doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
    doc.Open();
    PdfPTable table = new PdfPTable(6);
    table.TotalWidth =530f;
    table.LockedWidth = true;
    PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
    cell.Colspan = 6;
    cell.HorizontalAlignment = 0;
    table.AddCell(cell);
    Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
    para.Alignment = Element.ALIGN_CENTER;
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
    png.ScaleToFit(105f, 105f);
    png.Alignment = Element.ALIGN_RIGHT;
    SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
    SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
    conn.Open();
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    table.AddCell("Reprocessing Date");
    table.AddCell("Patient Name");
    table.AddCell("Dialyzer(Manufacturer,Size)");
    table.AddCell("No.of Reuse");
    table.AddCell("Verification");
    table.AddCell("DialyzerID");
    while (dr.Read())
    table.AddCell(dr[2].ToString());
    table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
    table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
    table.AddCell("@count".ToString());
    table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
    table.AddCell(dr[0].ToString());
    dr.Close();
    table.SpacingBefore = 15f;
    doc.Add(para);
    doc.Add(png);
    doc.Add(table);
    doc.Close();
    System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
    if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
    var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
    else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
    this.Close();
    The above code executes well with no problem at all!
    As you can see the file to which i create and save and open my pdf report is
    AssignedDialyzer.pdf.
    The column headers of table in pdf report from c# windows forms using iTextSharp are
    "Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
    "DialyzerID".
    However the problem i am facing is after execution and opening of document is my
    column headers in table in pdf report from
    c# and datas in it all appear in bold.
    I have browsed through net regarding to solve this problem but with no success.
    What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
    Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
    I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
    Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
    If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
    vb6,adodb with ms access using iTextSharp?
    I have approached Sound Forge.Net for help but with no success.
    I hope anyone/someone truly understands what i am trying to ask!
    I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
    Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
    I hope i get a reply in terms of solving this problem.
    vishal

    Hi,
    About iTextSharp component issue , I think this case is off-topic in here.
    I suggest you consulting to compenent provider.
    http://sourceforge.net/projects/itextsharp/
    Regards,
    Marvin
    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.

  • I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    I gifted a ringtone to my sister that I purchased from the iTunes store, and it is on her phone, but we can't figure out how to get it moved to her ringtones.  Can anyone help?

    Edit > Preferences.  Select the check box for Ringtones, this will add them to the listing in iTunes. 
    Not sure that really answers your question though.

  • How to get column values on item added event receiver

    Hi,
    I have two columns in a document library and one is people or group column and the other one is choice column with check boxes.
    I want to know how to read column values on Item Added event receiver, so that I can create if statements based on those values.
    Thank you,
    AA.

    Hi AOK2013, 
    Have you had a look at this Microsoft tutorial: http://msdn.microsoft.com/en-us/library/office/gg981880(v=office.14).aspx
    Essentially, you want to use the AfterProperties property to access the changed field value. 
    E.g. 
    var personvalue = properties.AfterProperties["YourPersonFieldName"]
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • How to forbid any further changes for PO (QTY and price ) after it has been

    Hi,
    How to forbid any further changes for PO (QTY and price ) after it has been done GR and LIV? Thanks.

    Hi,
    Price anyway cannot be changed once GR is posted on the PO item, it can be changed only by cancelling the GR, the same applies to IR too.
    But quantity can be changed at any time.
    So if you are looking at blocking qty too, then a customized message through save exit is the option, I am not aware of any standard SAP messages that can be configured to achieve this..
    Ramesh

  • How to forbid any further changes for PO (QTY and price )?

    Hi,
       How to forbid any further changes for PO (QTY and price ) after it has been done GR and LIV? Thanks.

    Better to post this in logistic forum.
    THere will be some config option to do so but normal FI perosn would need to dig deep, a MM perosn should answer quickly.
    Reg
    Hein

Maybe you are looking for