Table header disappearing

I've been scratching my heads for hours and still can't understand why this is happening. I have two JDialog. One to display the table, let's call it Dialog 1, and the other to display the row details, Dialog 2. When Dialog 2 displays on top of the table headers and you close the dialog, the column headers seems to disappear. I've checked and rechecked the code to see if there's anything funky but I can't see any problems with this. The code is displayed below.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
* Created on Mar 2, 2004
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
* @author Administrator
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
class PaymentTypeSetupDialog extends JDialog {
     private JTable paymentTable;
     private PaymentTypeListTableModel paymentModel;
     private JTextField lookup;
     private JRadioButton byCode, byAcctCode, byPaymentType;
     private ButtonGroup group;
     private JButton add, edit, delete;
     public PaymentTypeSetupDialog(JFrame parent) {
          super(parent, "Payment Setup", true);
          initialize();
          setSize(new Dimension(600, 400));
          setResizable(false);
          setVisible(true);
     public PaymentTypeSetupDialog(Dialog parent) {
          super(parent, "Payment Setup", true);
          initialize();
          setSize(new Dimension(600, 400));
          setResizable(false);
          setVisible(true);
     private void initialize() {
          Container pane = getContentPane();
          pane.add(paymentCtrls(), BorderLayout.NORTH);
          pane.add(paymentList(), BorderLayout.CENTER);
          pane.add(paymentLookup(), BorderLayout.SOUTH);
     private JToolBar paymentCtrls() {
          final JSeparator sep = new JSeparator(JSeparator.VERTICAL);
          sep.setPreferredSize(new Dimension(20, 20));
          JToolBar bar = new JToolBar();
          bar.setLayout(new FlowLayout(FlowLayout.LEFT, 4, 4));
          bar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY));
          bar.setFloatable(false);          
          bar.setRollover(true);
          add = new JButton("Add", new ImageIcon("images/Add16.gif"));
          add.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    PaymentType payment = new PaymentType();
                    PaymentDetails dialog = new PaymentDetails(PaymentTypeSetupDialog.this, payment, true);
                    if (!payment.getPaymentID().equals("")) {
                         insertTableRow(payment);
               private void insertTableRow(PaymentType payment) {
                    int index = paymentTable.getSelectedRow();
                    int size = paymentTable.getRowCount();
                    ArrayList data = new ArrayList();
                    data.add(new Boolean(payment.isEnabled()));
                    data.add(payment.getPaymentID());
                    data.add(payment.getAccountID());
                    data.add(payment.getPaymentType());
                    // if no selection or if item in last position is selected.
                    // add the new one to the end of the list, and select new one.
                    if (index == -1 || index+1 == size) {
                         paymentModel.addNewRow(size, data);
                         paymentTable.getSelectionModel().setSelectionInterval(size, size);
                    } else {
                         paymentModel.addNewRow(index, data);
                         paymentTable.getSelectionModel().setSelectionInterval(index+1, index+1);
          add.setEnabled(true);          
          add.setFocusable(false);
          bar.add(add);
          edit = new JButton("Edit", new ImageIcon("images/Edit16.gif"));
          edit.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    int row = paymentTable.getSelectedRow();
                    final PaymentType payment = new PaymentType();
                    payment.setPaymentID(paymentTable.getValueAt(row, 1).toString());
                    try {
                         DBPaymentType.getPaymentType(payment);
                    } catch (SQLException sqle) {
                         // TODO Auto-generated catch block
                         sqle.printStackTrace();
                    PaymentDetails dialog = new PaymentDetails(PaymentTypeSetupDialog.this, payment, false);
                    if (!payment.getPaymentID().equals("")) {
                         ArrayList data = new ArrayList();
                         data.add(new Boolean(payment.isEnabled()));
                         data.add(payment.getPaymentID());
                         data.add(payment.getAccountID());
                         data.add(payment.getPaymentType());
                         paymentModel.updateRow(row, data);
          edit.setEnabled(false);          
          add.setFocusable(false);
          bar.add(edit);
          delete = new JButton("Delete", new ImageIcon("images/Delete16.gif"));
          delete.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    int selection = JOptionPane.showConfirmDialog(PaymentTypeSetupDialog.this, "Are you sure you want to remove this payment type?");
                    if (selection == 0) {
                         int row = paymentTable.getSelectedRow();
                         int size = paymentTable.getRowCount();     
                         if (size == 0) { // Nobody left
                              edit.setEnabled(false);
                              delete.setEnabled(false);
                         } else {
                              PaymentType payment = new PaymentType();
                              payment.setPaymentID(paymentTable.getValueAt(row, 1).toString());
                              try {
                                   DBPaymentType.removePaymentType(payment);
                                   paymentModel.removeRow(row);
                                   if (row+1 == size) {                              
                                        row--;
                                   paymentTable.getSelectionModel().setSelectionInterval(row, row);
                              } catch (SQLException e1) {
                                   // TODO Auto-generated catch block
                                   e1.printStackTrace();
          delete.setEnabled(false);
          delete.setFocusable(false);
          bar.add(delete);
          bar.add(sep);
          JButton btn = new JButton("Exit", new ImageIcon("images/Stop16.gif"));
          btn.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    dispose();
          btn.setFocusable(false);
          bar.add(btn);
          return bar;
     private JScrollPane paymentList() {
          paymentModel = new PaymentTypeListTableModel();
          paymentTable = new JTable(paymentModel);
          paymentTable.setFocusable(false);
          paymentTable.setCellSelectionEnabled(false);
          paymentTable.setRowHeight(20);
          paymentTable.setSelectionBackground(Color.yellow);
          paymentTable.setSelectionForeground(Color.black);
          paymentTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          paymentTable.getTableHeader().setReorderingAllowed(false);
          paymentTable.getTableHeader().setResizingAllowed(false);
          paymentTable.getColumnModel().getColumn(0).setPreferredWidth(50);     
          paymentTable.getColumnModel().getColumn(1).setPreferredWidth(50);
          paymentTable.getColumnModel().getColumn(2).setPreferredWidth(50);
          paymentTable.getColumnModel().getColumn(3).setPreferredWidth(200);
          paymentTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
               public void valueChanged(ListSelectionEvent e) {
                    if (paymentTable.getRowCount() > 0) {
                         if (!edit.isEnabled())
                              edit.setEnabled(true);
                         if (!delete.isEnabled())
                              delete.setEnabled(true);
                    } else {
                         edit.setEnabled(false);
                         delete.setEnabled(false);
          paymentTable.addMouseListener(new MouseAdapter() {
               public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() == 2 && e.getButton() == 1) {
                         int row = paymentTable.getSelectedRow();
                         final PaymentType payment = new PaymentType();
                         payment.setPaymentID(paymentTable.getValueAt(row, 1).toString());
                         try {
                              DBPaymentType.getPaymentType(payment);
                         } catch (SQLException sqle) {
                              // TODO Auto-generated catch block
                              sqle.printStackTrace();
                         PaymentDetails dialog = new PaymentDetails(PaymentTypeSetupDialog.this, payment, false);
                         if (!payment.getPaymentID().equals("")) {
                              ArrayList data = new ArrayList();
                              data.add(new Boolean(payment.isEnabled()));
                              data.add(payment.getPaymentID());
                              data.add(payment.getAccountID());
                              data.add(payment.getPaymentType());
                              paymentModel.updateRow(row, data);
          JScrollPane scroll = new JScrollPane(paymentTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,       
               JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
          scroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER,paymentTable.getTableHeader());
          scroll.getViewport().setBackground(Color.white);
          return scroll;
     private JPanel paymentLookup() {
          JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 2));
          panel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
          group = new ButtonGroup();
          panel.add(new JLabel("Search"));
          lookup = new JTextField(20);
          lookup.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    if (lookup.getText().equals("")) {
                         JOptionPane.showMessageDialog(PaymentTypeSetupDialog.this, "Look up value is empty.");
                    } else {
                         int col;
                         if (byCode.isSelected()) {
                              col = 1;
                         } else if (byAcctCode.isSelected()) {
                              col = 2;
                         } else {
                              col = 3;
                         int index = paymentModel.getIndexFor(col, lookup.getText());
                         if (index != -1) {
                              paymentTable.getSelectionModel().setSelectionInterval(index, index);
          panel.add(lookup);
          byCode = new JRadioButton("Code");
          byCode.setSelected(true);
          byCode.setFocusable(false);
          group.add(byCode);
          panel.add(byCode);
          byAcctCode = new JRadioButton("Account code");
          byAcctCode.setSelected(true);
          byAcctCode.setFocusable(false);
          group.add(byAcctCode);
          panel.add(byAcctCode);
          byPaymentType = new JRadioButton("Payment type");
          byPaymentType.setFocusable(false);
          group.add(byPaymentType);
          panel.add(byPaymentType);
          return panel;
     public void setVisible(boolean visible) {
          if (visible) {
               Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
               Dimension size = getSize();
               int x;
               int y;
               x = screenSize.width / 2 - size.width / 2;
               y = screenSize.height / 2 - size.height / 2;
               setBounds(x, y, size.width, size.height);               
          super.setVisible(visible);
     class PaymentDetails extends JDialog {
          private PaymentType payment;
          private boolean newPayment;
          private JTextField code, type, image, imageUrl;
          private JComboBox accountList;
          private JCheckBox isEnabled;
          private JLabel paymentImage;
          public PaymentDetails(Dialog parent, PaymentType payment, boolean newPayment) {
               super(parent, "Payment Details", false);
               this.payment = payment;
               this.newPayment = newPayment;
               initialize();
               pack();
               setVisible(true);
          private void initialize() {
               Container pane = getContentPane();
               pane.add(paymentDetails(), BorderLayout.CENTER);
               pane.add(detailCtrls(), BorderLayout.SOUTH);
          private JPanel paymentDetails() {
               JPanel panel = new JPanel(new GridBagLayout());
               panel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
               GridBagConstraints gbc = new GridBagConstraints();
               gbc.anchor = GridBagConstraints.WEST;
               gbc.fill = GridBagConstraints.NONE;
               gbc.insets = new Insets(4, 2, 4, 2);
               JLabel label;
               gbc.gridx = 0;
               gbc.gridy = 0;
               gbc.weightx = 0;
               label = new JLabel("Code");
               panel.add(label, gbc);
               gbc.gridx++;
               gbc.weightx = 1;
               code = new JTextField(payment.getPaymentID(), 10);
               code.setEditable(newPayment);
               panel.add(code, gbc);
               gbc.gridx++;
               isEnabled = new JCheckBox("Activate", payment.isEnabled());
               panel.add(isEnabled, gbc);
               gbc.gridx = 0;
               gbc.gridy++;
               gbc.fill = GridBagConstraints.HORIZONTAL;
               label = new JLabel("Account code");
               panel.add(label, gbc);
               gbc.gridx++;
               gbc.weightx = 1;
               gbc.gridwidth = 2;
               accountList = new JComboBox(new AccountTypeListModel(payment.getAccountID()));
               panel.add(accountList, gbc);
               gbc.gridx = 0;
               gbc.gridy++;
               gbc.gridwidth = 1;
               label = new JLabel("Payment Type");
               panel.add(label, gbc);
               gbc.gridx++;
               gbc.weightx = 1;
               gbc.gridwidth = 2;
               type = new JTextField(payment.getPaymentType(), 20);
               panel.add(type, gbc);
               gbc.gridx = 0;
               gbc.gridy++;
               gbc.gridwidth = 1;
               label = new JLabel("Image");
               panel.add(label, gbc);
               gbc.gridx++;
               gbc.weightx = 1;
               gbc.gridwidth = 2;
               panel.add(paymentImage(), gbc);
               gbc.gridx = 0;
               gbc.gridy++;
               gbc.gridwidth = 1;
               label = new JLabel("Image URL");
               panel.add(label, gbc);
               gbc.gridx++;
               gbc.fill = GridBagConstraints.NONE;
               imageUrl = new JTextField(payment.getImage(), 10);
               panel.add(imageUrl, gbc);
               gbc.gridx++;
               JButton btn = new JButton("Browse");
               btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                         System.out.println("Browse image directory");
               panel.add(btn, gbc);
               return panel;
          private JScrollPane paymentImage() {
               paymentImage = new JLabel(new ImageIcon("images/Category48.gif"));
               JScrollPane scroll = new JScrollPane(paymentImage, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,       
                    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
               scroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER,paymentTable.getTableHeader());
               scroll.getViewport().setBackground(Color.white);
               scroll.setPreferredSize(new Dimension(200, 200));
               return scroll;
          private JPanel detailCtrls() {
               JPanel panel = new JPanel();
               JButton btn = new JButton("Save");
               btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                         if (code.getText().equals("")) {
                              JOptionPane.showMessageDialog(PaymentDetails.this, "Code cannot be empty.");
                         } else {
                              payment.setPaymentID(code.getText());
                              payment.setAccountID(((AccountType) accountList.getSelectedItem()).getAccountID());
                              payment.setPaymentType(type.getText());
                              payment.setImage(imageUrl.getText());
                              payment.setEnabled(isEnabled.isSelected());
                              if (newPayment) {
                                   try {
                                        DBPaymentType.addPaymentType(payment);
                                        dispose();
                                   } catch (SQLException e1) {
                                        // TODO Auto-generated catch block
                                        e1.printStackTrace();
                              } else {
                                   try {
                                        DBPaymentType.updatePaymentType(payment);
                                        dispose();
                                   } catch (SQLException e1) {
                                        // TODO Auto-generated catch block
                                        e1.printStackTrace();
               panel.add(btn);
               btn = new JButton("Cancel");
               btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                         payment.setPaymentID("");
                         dispose();
               panel.add(btn);
               return panel;
          public void setVisible(boolean visible) {
               if (visible) {
                    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                    Dimension size = getSize();
                    int x;
                    int y;
                    x = screenSize.width / 2 - size.width / 2;
                    y = screenSize.height / 2 - size.height / 2;
                    setBounds(x, y, size.width, size.height);               
               super.setVisible(visible);
}Please help!
Thx.

Hmmm...Interesting. If you add paymentTable.updateUI(); after any edits or adds, the whole column headers disappear. It only seems to happen when the 2nd modal dialog is on top of the column header. If it is not, the application works fine. I've tested this against 1.4.2 and 1.5 beta and it i get the same result.

Similar Messages

  • Table headings disappearing in pdf?

    Why are some table headings disappearing when I pdf a Frame 8 file? There is no pattern in the disappearances and each time I pdf the file, a different cell heading disappears. If I create a text box and paste that box over the heading, it shows up fine in the pdf, but that's a dumb way to work. This all started happening in the last month, after I changed computers. Thanks for the help!!

    This is the message I get right now when I save to pdf. If I print to a prn, it doesn't open at all. I used to have a tool that converted the prn automatically at my old job, but there's nothing on the new job's computer and no IT help available. I've been doing a workaround by printing the TOC and the document separately and just adding the TOC to the new pdf, but now when I'm trying to pdf a large document (without TOC) that used to pdf just fine (with TOC), I'm getting the following message. I've just pdf'd chapters 7 & 8 with no problem whatsoever.
    %%[ ProductName: Distiller ]%%
    %%[Page: 1]%%
    %%[Page: 2]%%
    %%[Page: 3]%%
    %%[Page: 4]%%
    %%[Page: 5]%%
    %%[Page: 6]%%
    %%[Page: 7]%%
    %%[Page: 8]%%
    %%[Page: 9]%%
    %%[Page: 10]%%
    %%[Page: 11]%%
    %%[Page: 12]%%
    %%[Page: 13]%%
    %%[Page: 14]%%
    %%[Page: 15]%%
    %%[Page: 16]%%
    %%[Page: 17]%%
    %%[Page: 18]%%
    %%[Page: 19]%%
    %%[Page: 20]%%
    %%[Page: 21]%%
    %%[Page: 22]%%
    %%[Page: 23]%%
    %%[Page: 24]%%
    %%[Page: 25]%%
    %%[Page: 26]%%
    %%[Page: 27]%%
    %%[ Error: undefined; OffendingCommand: pdfmark; ErrorInfo: Rect  ]%%
    Stack:
    /ANN
    /Link
    /Subtype
    /M14.9.42153.Section.Title.Chapter.8.Installing.the.batteries
    /D
    /GoToR
    /S
    /Action
    /Type
    -dict-
    /Action
    [0 0 0]
    /Border
    [7305 2337 9000 2128]
    /Rect
    -mark-
    %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
    %%[ Warning: PostScript error. No PDF file produced. ] %%

  • Table header wrap text?

    Hi,
    Is it possible to wrap the text of a table heading? I have found this question in many places always with a negative answer. Althought they are old posts and in main thread of this forum [POLL: Web Dynpro UI elements - enhancement proposals; in the first response Armin says that header text wrapping is now supported. Anyone knows how? I am working with NW7.0
    Thanks,
    Gabriel.

    Hi Gabriel,
    The header text wrapping is now supported in the SAP CE 7.1 and SAP NW 7.0 EHP 1.
    This a table column property.
    For documentation on NW 7.0 EHP 1 please refer the following link:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c4/219041d3c72e7be10000000a1550b0/frameset.htm
    Regards,
    Kartikaye

  • In SSRS , after exporting report in excel,wrap text property for cell and freeze column for SSRS table header not working in Excel

    I am working no one SSRS my table headers are freeze cangrow property is false and my report is working perfect while rendering data on RDL and i want same report after exporting in Excel also , i want my table header to be freeze and wrap text property
    to work after exporting in my report in excel but its not working ,is there any solution ? any patch ? any other XML code for different rendering ? 

    Hi Amol,
    According to your description, you find the wrap text property and fix column is not working after exporting into Excel. Right?
    In Reporting Services, when exporting to excel file, it has limitation for textbox.
    Text boxes are rendered within one Excel cell. Font size, font face, decoration, and font style are the only formatting that is supported on individual text within an Excel cell.
    Excel adds a default padding of approximately 3.75 points to the left and right sides of cells. If a text box’s padding settings are less than 3.75 points and is just barely wide enough to accommodate the text, the text may wrap in Excel.
    In this scenario, it supposed to be wrap text unless you merge cells. If cells are merged, word-wrap does not work correctly. If any merged cells exist on a row where a text box is rendered with the
    AutoSize property, autosize will not work. For the Fix Data Property, it can't be working in Excel. These are features when exporting to Excel. We can't change it because it's by design.
    Reference:
    Exporting to Microsoft Excel (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How to hide the table header if no data present

    Hi
    I need to hide the table header if no data present. Table has 5 column. if no any clolumn has data then this table section should not be display.
    i am using <?if:count(Installation_Event_S19)= 0?> but this is not work for me.
    Could you please help me out.
    Thanks
    Indrajeet Kumar

    Hi Priya,
    Thank you very much !!! its work fine.
    Thanks
    Indrajeet Kumar

  • How to add the Row count(number of rows in table)  in  the table header?

    Hi,
    I'm having a table. This table is viewed when i click on a search button.
    <b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>
    How to do this? could any one explain me with the detailed procedure to achieve this.
    Thanks & Regards,
    Suresh

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".
    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.
    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:
    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    wdContext.currentContextElement().setTableHeaderText(text);
    Maybe you want to provide a separate message for the case that there are no entries.
    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.
    Armin

  • Insert a new Dropdown UI-Element in a Table header

    Hello,
    i need to insert a Dropdown UI-element in a Table header, i was looking in the forum and the Web, BUT i didnt find anythinf that can help.
    please schow me how can I insert a DropDown UI-Element in the Header.
    thank you all

    Hello,
    You can normally create a table. Insert a table column and for the table column you need to give Dorpdown by Key / index as a cell editor.
    Thanks,
    Raju Bonagiri

  • Table Header in freezed pane when exporting SSRS report to Excel

    Hi,
    I want table Header in freezed pane when exporting SSRS report to Excel.
    Can I have the table header of tablix be present in freezed pane of excel.
    Thanks,
    Vivek Singh

    Hi Vivek,
    Please refer the following thread.
    may be u get the answer.
    How to freeze header pane in SSRS
    Regards
    msbilearning

  • How can I right-align a table header?

    Does anyone know a way to right-align a table header?
    For example, in the table below I want the word 'Price' to be right-aligned. I could set the table's 'header renderer' to be a right-aligned DefaultTableCellRenderer, but then the header would look like a cell, not a header. Why can't swing be simple, like table.getColumn(1).setAlignment(Column.RIGHT) ????
    public class TestTableHeader {
         public static void main(String[] args) throws Exception {
              JFrame frame = new JFrame("Test");
              Object[][] rowData = new Object[][] { { "General Electric", "$100.60" },
                        { "IBM", "$5.20" }, { "Wal-mart", "$17.00" } };
              JTable table = new JTable(rowData, new Object[] { "Name", "Price" });
              DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
              renderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
              table.getColumnModel().getColumn(1).setCellRenderer(renderer);
              frame.getContentPane().add(new JScrollPane(table));
              frame.setSize(400, 300);
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setVisible(true);
    }

    I modified your code an came up with a solution to the problem.
    import java.awt.Component;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableCellRenderer;
    public class TestTableHeader {     
         public static void main(String[] args) throws Exception {
              JFrame frame = new JFrame("Test");
              Object[][] rowData = new Object[][] {
                        { "General Electric", "$100.60" }, { "IBM", "$5.20" },
                        { "Wal-mart", "$17.00" } };
              JTable table = new JTable(rowData, new Object[] { "Name", "Price" });
              RightAlignRender right = new TestTableHeader().new RightAlignRender();
              table.getColumnModel().getColumn(0).setHeaderRenderer(right);
              table.getColumnModel().getColumn(1).setHeaderRenderer(right);
              frame.getContentPane().add(new JScrollPane(table));
              frame.setSize(400, 300);
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.setVisible(true);
         public class RightAlignRender extends DefaultTableCellRenderer {
              public Component getTableCellRendererComponent(JTable table,
                        Object arg1, boolean arg2, boolean arg3, int arg4, int column) {
                   Component toReturn = table.getTableHeader().getDefaultRenderer().getTableCellRendererComponent(table,
                             arg1, arg2, arg3, arg4, column);
                   switch (column) {
                   case 0:
                        ((JLabel) toReturn).setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
                        break;
                   case 1:
                        ((JLabel) toReturn).setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
                        break;
                   return toReturn;
    }

  • Table Header not getting repeated in subsequent pages

    Hi,
    I have a table and i want to table header to be repeated in subsequent pages but only till 2nd page the table header is repeated from the 3rd page onwards the table header is not repeated.
    I have selected the Header Row in hierarchy and in Pagination tab for the header row i have checked the the check box Insert Header Row in Subsequent Pages.
    After selecting the checkbox also table header is repeated only in 2 pages and not repeated after the second page.
    My table hierarchy in form is :
    TableSubform
    ---Table
    HeaderRow
    Row1
    I am using Designer 8.0 and Acrobat Reader 8.1.2
    Can you please help me in solving this issue.
    Regards,
    Bala Baskaran.s

    Hi All,
    I have selected the the check box Insert Header Row in Subsequent Pages then also the header is not getting flowed in subsequent pages only till 2nd page its getting flowed.
    I have used table wizard to create table and i have made the table subform as flowed then also table header is not repeating in subsequent pages.
    MainForm (Flowed)
    TableSubform1(Flowed)
    Table1
    HeaderRow
    Row1
    TableSubform2(Flowed)
    Table2
    HeaderRow
    Row1
    I selected TableSubform1 and in Pagination tab OverFlow Leader dropdown i selected HeaderRow, the same i did for TableSubform2 also but the table header is not getting repeated in subsequent pages.
    Please help me in solving this problem.
    Regards,
    Bala Baskaran.S

  • Button not working in a table header

    I have a custom view that implements table header. I have buttons in that view. The buttons used to work fine in SDK prior to 5. I moved directly to SDK 7, and the buttons stopped working. The action is not called anymore.
    Any help will be appreciated.
    Thanks

    Well, you have me stumped. I just replicated your code and it works fine for me:
    - (void)doStuff:(id)sender
    NSLog(@"Logo Touched!");
    - (void)viewDidLoad {
    // loadingView is a UIView that becomes the tableHeaderView
    self.tableView.tableHeaderView = loadingView;
    [loadingActivity startAnimating];
    // setup a sample button (declared in header)
    logoButton = [[UIButton alloc] initWithFrame:CGRectZero];
    [logoButton setImage:[UIImage imageNamed:@"logo_webclip.png"] forState:UIControlStateNormal];
    [logoButton addTarget:self action:@selector(doStuff:) forControlEvents:UIControlEventTouchUpInside];
    logoButton.tag = 100;
    [loadingView addSubview:logoButton];
    - (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    logoButton.frame = CGRectMake(50., 50., 64., 64.);
    That calls my target everytime it's touched... are you remembering to call the superclass for each of your overrided methods in your custom UIView? The only difference between my quick test and yours is that I didn't subclass UIView -- I just used the UIView class directly.

  • Vertical text in table heading

    Hi,
    I would like to save some space in some reports and I would like to change orientation of text in table heading.
    Is it posible to have vertical text in table heading?
    What I want is showed on this picture: [Vertical text|¨http://img179.imageshack.us/img179/234/obiverticaltext.jpg]
    Thank you for some tips.

    Hi,
    Go through this...will help you solve your requirement....http://blog.trivadis.com/blogs/andreasnobbmann/archive/2009/07/17/vertical-text-in-obiee.aspx
    Use the same code Writing-mode: tb-rl; filter: flipv fliph; in custom css style of column heading.(column properties->column format->edit format icon beside column heading->css style)
    Regards,
    Srikanth

  • Is there a way to make a "table header" a column instead of a row?

    I am making a 508 compliant pdf from a predesigned indesign document that has many tables in it. The table that I am having problems with doesn't have it's table header as a Row at the top of the table but instead a Column that runs down the left side like this example:
    To be read correctly in the pdf by screen readers the header needs to be included in the table but I don't know how to make a column a header, I have only found the option of making a row a header. Is there a way to do this or will I just have to retag and reorder the tags in the pdf after?
    Thanks!

    @Joel – ah, now I begin to understand.
    Slapbet wants to change the reading order in a two column table from:
    Usually:
    1  2
    3  4
    5  6
    to:
    1  4
    2  5
    3  6
    If so, you need two separate tables:
    One for column 1, one for column 2.
    Grouped together, anchored in a text frame with the flowing text.
    Could the every column is a single table construct work for you?
    Or is it necessary for what ever reason (besides editing) to work with a single table?
    A script could help to split every  column to a single table, making a group and anchor it to the text flow.
    Or did I misunderstand what the problem here is?
    Uwe

  • Image in a table-header

    Hello,
    I don't know why but I cannot place an image in one specific table-header.
    It works fine in my table-cells but in the table-header only the text appears.
    I thought i could place an image in a header, just like a text-string but that is not possible.
    Does anyone know how to handle that problem???
    Thank you so much

    Hi,
    either you use table.getTableHeader().setDefaultRenderer(yourRenderer) to set one renderer for all columns or you use table.getColumnModel().getColumn(index).setHeaderRenderer(yourRenderer) to set a renderer for individual columns.

  • How to add One Button to the Table Header.

    Hi,
    I would like to have few Table Header columns as Button and Other Table Header Columns as String. And each Button should have separate action. Please let me know, how can i implement this one.
    Thanks
    Mohan

    do not cross post, this is a bad habit. now do you know about www.google.com. well this is a search engine, learn how to use it before you post. i got this link with this keyword search.
    http://www.exampledepot.com/egs/javax.swing.table/pkg.html
    http://forum.java.sun.com/thread.jspa?threadID=560605&tstart=15
    hope this helps you
    regards
    Aniruddha

Maybe you are looking for

  • How do I dump Itunes 701 and go back to using a earlier version?

    The new Itunes just plain blows!!!! How do I get rid of this piece of #@#$ and go back to the version i had before i downloaded this poorly written, crappy version they cal "new and inproved"? Who did the get to test this junk software? IT IS HORRIBL

  • �using a BufferedReader object to capture text from a JTextField?

    Please i need some help with this. I was using the following line to get the data from the keyboard: BufferedReader en =new BufferedReader(new InputStreamReader(System.in)); But now i changed to get the data from an applet, where the user would type

  • Country of Orign -Canada Permit

    Hi All, Country of Origin is a required data element in determining the relavent Permit (License) for all the export Orders from Canada. Country of Orign is not being a standard attribute in determining License in GTS 7.2 We would like to appriciate

  • Import XSD to create datatypes

    Hello Everybody- I want to create a datatype that is specific for my outbound message,i have the xsd of that structure,i was trying to import the xsd to form a XI structure.Here is what i have done. 1.Right clicked datatypes and clicked on new 2.It a

  • Foreign Trade - sales/shipping

    Hi Experts, I have following two business requirements and was hoping for some clarification and guidance/help from your side: 1. Ability to ensure that the material shipped complies with Environment Agency regulations (green/amber/red list) as to wh