Line of text in two rows in a check box

Greets
Ive been working in a poll, and i use a check box in some part, but de question its to long to put it in
i have the same problem with the text box, but with the command 
 it can be possible to put a long question in two rows, but that command line doesnt work with check boxes
there are any form to make a long question of one row, into a two row question in check box component??

There is a multiline button example you can adapt for checkboxes on my blog.
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Similar Messages

  • Check box - text at the bottom of the check box

    Hi Apex folks,
    I came across a different requirement where as i need to place the check box text in break line at the bottom of the check box. Say I have a check box item X . which having following items
    STATIC:
    A - I am good;1
    B - I am ok ;2
    C- I am bad;3
    D- I am confused;4
    I have to display the text in the bottom of the check box and the text like "A" at the first line and " I am good" at the second line . Is there any possibility to achieve that.
    Thanks
    Karthik

    Karthik C wrote:
    I came across a different requirement where as i need to place the check box text in break line at the bottom of the check box. Say I have a check box item X . which having following items
    STATIC:
    A - I am good;1
    B - I am ok ;2
    C- I am bad;3
    D- I am confused;4
    I have to display the text in the bottom of the check box and the text like "A" at the first line and " I am good" at the second line . Is there any possibility to achieve that.I have to pick option D...
    Do you mean like this?
    [ ]        [ ]       [ ]        [X]
    A          B         C          D
    I am good  I am OK   I am bad   I am confusedIf so, why? If not, show us the required layout.
    Help us to help you. When you have a problem you should provide as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.

  • Bold line possible between every two rows?

    hi,
    the data in my JTable is set up in a way that two rows form one block, one record really. an example to clarify:
    row1: James O'Connor 45yrs old etc...
    row2: 12 Parklane Oxford UK
    row3: Neil Thompson 32yrs old etc...
    row4: 78 Main Street Manchester UK
    I would like to accentuate the fact that row1 and row2 form one record,
    as do row3 and row4, and i would like to accentuate this fact using a bold line between row2 and row3, between row4 and row5, and so on, rather than inserting an empty row each time.
    can you do this in a JTable?
    rgds,
    koen

    Hi,
    You can create your own TableCellRenderer for all the even-rows and then give those renderers an extra thick border at the bottom.
    grtz
    Hugo

  • Delete the rows if the check box is selected.

    Dear all,
    i have a block (not database block). i added a check box to the same block. now i want to delete the row against which the check box is selected.
    i wrote the following code in when-button-pressed trigger.
    IF Checkbox_Checked('CHK_DEL') THEN
         delete from fa_01_11
         where as_id = :as_id;
    END IF;
    commit;
    but when i select only one check box it delete the all rows from the table if the condition is satisfied.
    here is the data in my table
    as_id year month
    63     2006     4     0     -1183.92     1
    63     2006     5     0     -1183.92     1
    63     2006     6     0     -1183.92     1
    63     2006     7     0     -1183.92     1
    63     2006     8     0     -1183.92     1
    63     2006     9     0     -1183.92     1
    63     2006     10     0     -1183.92     1
    63     2006     11     0     -1183.92     1
    63     2006     12     0     -1183.92     1
    what's the proble?
    Regards:
    Muhammad Nadeem
    Message was edited by:
    Muhammad Nadeem

    You need to run the code for each record and you need to find something which is unique. as_id is not unique.
    untested:
    declare
      last_rec boolean := false;
      deleted boolean := false;
    begin
      first_record;
      loop
        deleted := false;
        last_rec := :system.last_record = 'TRUE';
        IF Checkbox_Checked('CHK_DEL') THEN
          delete from fa_01_11
            where as_id = :as_id
            and year = :year
            and month = :month;
          clear_record;
          deleted := true;
        END IF;
        exit when last_rec;
        if not deleted then
          next_record;
        end if;
      end loop;
      commit;
    end;

  • Deletion of single or multiple rows by selecting check boxes?

    Hi ,
    I want to delete a row or no of rows  in a table by selecting the check boxes.COuld any one suggest me how to do this?
    Regards,
    Ram

    Following is the JavaScript sample you may have to tweak the code to fit your situation....
    // Invoke the Instance Manager to remove the current instance of the detail subform.
    _<SubformName/RowSOMName>.removeInstance(index of the object to remove)
    //_Section2Detail.removeInstance(this.parent.index); //in my case I have a delete button next to each row when clicked that will pass the index of the parent(row index as it is part of that row).
    // Invoke the recalculate method to update the form calculations.
    xfa.form.recalculate(1);

  • New line for Text in a row

    Hi Guys 
    i have a Row Data with below Text in Sqlserver 2008 
    Email:[email protected] University,Bachelors,1986---University of Virginia School of Law,Doctor of Jurisprudence,1991---French,Working---Italan,Fluenty---Phone:zzz zzz zzzz
    out put required as new column 
    Email:[email protected]
    Wesleyan University,Bachelors,1986
    University of Virginia School of Law,Doctor of Jurisprudence,1991
    French,Working
    Italan,Fluenty
    Phone:zzz zzz zzzz
    Regards
    Bhasker 
    hi

    Hello,
    You can also use a UDF to split the text with string and return a table.
    --create UDF splitstring()
    CREATE FUNCTION dbo.splitstring ( @stringToSplit VARCHAR(MAX),@delimiter nvarchar(10))
    RETURNS
    @returnList TABLE ([Name] [nvarchar] (500))
    AS
    BEGIN
    DECLARE @name NVARCHAR(255)
    DECLARE @pos INT
    WHILE CHARINDEX(@delimiter, @stringToSplit)>0
    BEGIN
    SELECT @pos = CHARINDEX(@delimiter, @stringToSplit)
    SELECT @name = SUBSTRING(@stringToSplit, 1, @pos-1)
    INSERT INTO @returnList
    SELECT @name
    SELECT @stringToSplit = SUBSTRING(@stringToSplit, @pos+len(@delimiter), LEN(@stringToSplit)-@pos)
    END
    INSERT INTO @returnList
    SELECT @stringToSplit
    RETURN
    END
    declare @string varchar(MAX)='Email:[email protected] University,Bachelors,1986---University of Virginia School of Law,Doctor of Jurisprudence,1991---French,Working---Italan,Fluenty---Phone:zzz zzz zzzz'
    select * from splitstring(@string,'---')
    --drop UDF
    drop function splitstring
    Reference:http://stackoverflow.com/questions/10914576/tsql-split-string
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • JTable header : text = two-rows, onClick action = sorting

    Hi guys.
    I want to create a JTable where the user can have the data sorted by clicking upon a column's header. The code below shows the table I describe (you can click upon a column and sorting is performed).
    import javax.swing.JFrame;
    import java.awt.HeadlessException;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.util.Vector;
    import javax.swing.table.DefaultTableModel;
    //--------- TableSorter ----------
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.*;
    //---------- Table Height - Column Width
    import javax.swing.table.TableColumn;
    import java.awt.FontMetrics;
    import javax.swing.JTable;
    import java.awt.Dimension;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Test extends JFrame {
      JPanel jPanel1 = new JPanel();
      JPanel jPanel2 = new JPanel();
      JButton jButton1 = new JButton();
      FlowLayout flowLayout1 = new FlowLayout();
      BorderLayout borderLayout1 = new BorderLayout();
      BorderLayout borderLayout2 = new BorderLayout();
      //------------- MY VARIABLES -------------
      String[] columnNames_objectArr = new String[] {
          "Col1",
          "Column 2",
          "Column 3",
          "C4",
          "Col5",
          "Col 6",
      Vector columnNames_vector = new Vector();
      private Vector data_vector = new Vector();
      private Object[][] data_objectArr;
      public TableHeight_ColumnWidth tcw;
      private int totalTableWidth = 0, totalTableHeight = 0;
      private JComboBox jcmbxData = new JComboBox(
          new String[] {"Not Configured", "Switch", "Modem"});
      private int maxVisibleRows = 51;
      TableSorter model;
      private JTable table;
      JScrollPane jScrollPane1;
      public Test(String[] args) throws HeadlessException {
        try {
          jbInit();
          setupGUI();
          launchGUI();
        catch(Exception e) {
          e.printStackTrace();
      private void jbtnClose_actionPerformed(ActionEvent e) {
        dispose();
      private void launchGUI() {
        pack();
        setVisible(true);
        setResizable(false);
      private void setupGUI() {
        columnNames_vector.addElement("Col1");
        columnNames_vector.addElement("Column 2");
        columnNames_vector.addElement("Column 3");
        columnNames_vector.addElement("C4");
        columnNames_vector.addElement("Col5");
        columnNames_vector.addElement("Col 6");
        Vector row_data1 = new Vector();
        Vector row_data2 = new Vector();
        Vector row_data3 = new Vector();
        Vector row_data4 = new Vector();
        Vector row_data5 = new Vector();
        Vector row_data6 = new Vector();
        row_data1.add("Mary");
        row_data1.add("Campioneato");
        row_data1.add("Snowboarding");
        row_data1.add(new Integer(578987899));
        row_data1.add(new Boolean(false));
        row_data1.add("Not Configured");
        row_data2.add("Alison");
        row_data2.add("Huml");
        row_data2.add("Rowing");
        row_data2.add(new Integer(3));
        row_data2.add(new Boolean(true));
        row_data2.add("Switch");
        row_data3.add("Ka");
        row_data3.add("Walrath");
        row_data3.add("Knitting");
        row_data3.add(new Integer(2));
        row_data3.add(new Boolean(false));
        row_data3.add("Modem");
        row_data4.add("Sharon");
        row_data4.add("Zakhouras");
        row_data4.add("Speed reading");
        row_data4.add(new Integer(20));
        row_data4.add(new Boolean(true));
        row_data4.add("Switch");
        row_data5.add("Philip");
        row_data5.add("Milner");
        row_data5.add("Pool");
        row_data5.add(new Integer(10));
        row_data5.add(new Boolean(false));
        row_data5.add("Not Configured");
        data_vector.add(row_data1);
        data_vector.add(row_data2);
        data_vector.add(row_data3);
        data_vector.add(row_data4);
        data_vector.add(row_data5);
        model = new TableSorter(new SortTableModel(data_vector, columnNames_vector));
        table = new JTable(model);
        tcw = new TableHeight_ColumnWidth(model, table);
        jScrollPane1 = new JScrollPane(table);
        model.setTableHeader(table.getTableHeader());
        jPanel1.add(jScrollPane1, BorderLayout.CENTER);
        //Add a JComboBox as a cellEditor...
        DefaultCellEditor dce = new DefaultCellEditor(jcmbxData);
        table.getColumnModel().getColumn(5).setCellEditor(dce);
        //..... add the IPJPanel as cellEditor.....
        tcw.fixTableLook(maxVisibleRows);
      private void jbInit() throws Exception {
        this.getContentPane().setLayout(borderLayout2);
        jPanel1.setLayout(borderLayout1);
        jPanel2.setLayout(flowLayout1);
        jButton1.setText("Close");
        jPanel1.setBorder(BorderFactory.createRaisedBevelBorder());
        this.getContentPane().add(jPanel1, BorderLayout.CENTER);
        this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
        jPanel2.add(jButton1, null);
        jButton1.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jbtnClose_actionPerformed(e);
      public static void main( String[] args ) {
        new Test(args);
      public boolean getScrollableTracksViewportHeight() {
        Component parent = getParent();
        if (parent instanceof JViewport) {
          return parent.getHeight() > getPreferredSize().height;
        return false;
      //------------------ MY TABLE MODEL ------------------
      public class SortTableModel extends DefaultTableModel {
        private boolean DEBUG = false;
        public SortTableModel(Object[][] data, String[] columnNames) {
          super(data, columnNames);
        public SortTableModel(Vector data, Vector columnNames) {
          super(data, columnNames);
      //------------------ TABLE SORTER -----------------------
      public class TableSorter extends AbstractTableModel {
          protected TableModel tableModel;
          public static final int DESCENDING = -1;
          public static final int NOT_SORTED = 0;
          public static final int ASCENDING = 1;
          private Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
          public final Comparator COMPARABLE_COMAPRATOR = new Comparator() {
              public int compare(Object o1, Object o2) {
                  return ((Comparable) o1).compareTo(o2);
          public final Comparator LEXICAL_COMPARATOR = new Comparator() {
              public int compare(Object o1, Object o2) {
                  return o1.toString().compareTo(o2.toString());
          private Row[] viewToModel;
          private int[] modelToView;
          private JTableHeader tableHeader;
          private MouseListener mouseListener;
          private TableModelListener tableModelListener;
          private Map columnComparators = new HashMap();
          private List sortingColumns = new ArrayList();
          public TableSorter() {
              this.mouseListener = new MouseHandler();
              this.tableModelListener = new TableModelHandler();
          public TableSorter(TableModel tableModel) {
              this();
              setTableModel(tableModel);
          public TableSorter(TableModel tableModel, JTableHeader tableHeader) {
              this();
              setTableHeader(tableHeader);
              setTableModel(tableModel);
          private void clearSortingState() {
              viewToModel = null;
              modelToView = null;
          public TableModel getTableModel() {
              return tableModel;
          public void setTableModel(TableModel tableModel) {
              if (this.tableModel != null) {
                  this.tableModel.removeTableModelListener(tableModelListener);
              this.tableModel = tableModel;
              if (this.tableModel != null) {
                  this.tableModel.addTableModelListener(tableModelListener);
              clearSortingState();
              fireTableStructureChanged();
          public JTableHeader getTableHeader() {
              return tableHeader;
          public void setTableHeader(JTableHeader tableHeader) {
              if (this.tableHeader != null) {
                  this.tableHeader.removeMouseListener(mouseListener);
                  TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
                  if (defaultRenderer instanceof SortableHeaderRenderer) {
                      this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
              this.tableHeader = tableHeader;
              if (this.tableHeader != null) {
                  this.tableHeader.addMouseListener(mouseListener);
                  this.tableHeader.setDefaultRenderer(
                          new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
          public boolean isSorting() {
              return sortingColumns.size() != 0;
          private Directive getDirective(int column) {
              for (int i = 0; i < sortingColumns.size(); i++) {
                  Directive directive = (Directive)sortingColumns.get(i);
                  if (directive.column == column) {
                      return directive;
              return EMPTY_DIRECTIVE;
          public int getSortingStatus(int column) {
              return getDirective(column).direction;
          private void sortingStatusChanged() {
              clearSortingState();
              fireTableDataChanged();
              if (tableHeader != null) {
                  tableHeader.repaint();
          public void setSortingStatus(int column, int status) {
              Directive directive = getDirective(column);
              if (directive != EMPTY_DIRECTIVE) {
                  sortingColumns.remove(directive);
              if (status != NOT_SORTED) {
                  sortingColumns.add(new Directive(column, status));
              sortingStatusChanged();
          protected Icon getHeaderRendererIcon(int column, int size) {
              Directive directive = getDirective(column);
              if (directive == EMPTY_DIRECTIVE) {
                  return null;
              return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
          private void cancelSorting() {
              sortingColumns.clear();
              sortingStatusChanged();
          public void setColumnComparator(Class type, Comparator comparator) {
              if (comparator == null) {
                  columnComparators.remove(type);
              } else {
                  columnComparators.put(type, comparator);
          protected Comparator getComparator(int column) {
              Class columnType = tableModel.getColumnClass(column);
              Comparator comparator = (Comparator) columnComparators.get(columnType);
              if (comparator != null) {
                  return comparator;
              if (Comparable.class.isAssignableFrom(columnType)) {
                  return COMPARABLE_COMAPRATOR;
              return LEXICAL_COMPARATOR;
          private Row[] getViewToModel() {
              if (viewToModel == null) {
                  int tableModelRowCount = tableModel.getRowCount();
                  viewToModel = new Row[tableModelRowCount];
                  for (int row = 0; row < tableModelRowCount; row++) {
                      viewToModel[row] = new Row(row);
                  if (isSorting()) {
                      Arrays.sort(viewToModel);
              return viewToModel;
          public int modelIndex(int viewIndex) {
              return getViewToModel()[viewIndex].modelIndex;
          private int[] getModelToView() {
              if (modelToView == null) {
                  int n = getViewToModel().length;
                  modelToView = new int[n];
                  for (int i = 0; i < n; i++) {
                      modelToView[modelIndex(i)] = i;
              return modelToView;
          // TableModel interface methods
          public int getRowCount() {
              return (tableModel == null) ? 0 : tableModel.getRowCount();
          public int getColumnCount() {
              return (tableModel == null) ? 0 : tableModel.getColumnCount();
          public String getColumnName(int column) {
              return tableModel.getColumnName(column);
          public Class getColumnClass(int column) {
              return tableModel.getColumnClass(column);
          public boolean isCellEditable(int row, int column) {
              return tableModel.isCellEditable(modelIndex(row), column);
          public Object getValueAt(int row, int column) {
              return tableModel.getValueAt(modelIndex(row), column);
          public void setValueAt(Object aValue, int row, int column) {
              tableModel.setValueAt(aValue, modelIndex(row), column);
          // Helper classes
          private class Row implements Comparable {
              private int modelIndex;
              public Row(int index) {
                  this.modelIndex = index;
              public int compareTo(Object o) {
                  int row1 = modelIndex;
                  int row2 = ((Row) o).modelIndex;
                  for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
                      Directive directive = (Directive) it.next();
                      int column = directive.column;
                      Object o1 = tableModel.getValueAt(row1, column);
                      Object o2 = tableModel.getValueAt(row2, column);
                      int comparison = 0;
                      // Define null less than everything, except null.
                      if (o1 == null && o2 == null) {
                          comparison = 0;
                      } else if (o1 == null) {
                          comparison = -1;
                      } else if (o2 == null) {
                          comparison = 1;
                      } else {
                          comparison = getComparator(column).compare(o1, o2);
                      if (comparison != 0) {
                          return directive.direction == DESCENDING ? -comparison : comparison;
                  return 0;
          private class TableModelHandler implements TableModelListener {
              public void tableChanged(TableModelEvent e) {
                  // If we're not sorting by anything, just pass the event along.
                  if (!isSorting()) {
                      clearSortingState();
                      fireTableChanged(e);
                      return;
                  // If the table structure has changed, cancel the sorting; the
                  // sorting columns may have been either moved or deleted from
                  // the model.
                  if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
                      cancelSorting();
                      fireTableChanged(e);
                      return;
                  // We can map a cell event through to the view without widening
                  // when the following conditions apply:
                  // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
                  // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
                  // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
                  // d) a reverse lookup will not trigger a sort (modelToView != null)
                  // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
                  // The last check, for (modelToView != null) is to see if modelToView
                  // is already allocated. If we don't do this check; sorting can become
                  // a performance bottleneck for applications where cells
                  // change rapidly in different parts of the table. If cells
                  // change alternately in the sorting column and then outside of
                  // it this class can end up re-sorting on alternate cell updates -
                  // which can be a performance problem for large tables. The last
                  // clause avoids this problem.
                  int column = e.getColumn();
                  if (e.getFirstRow() == e.getLastRow()
                          && column != TableModelEvent.ALL_COLUMNS
                          && getSortingStatus(column) == NOT_SORTED
                          && modelToView != null) {
                      int viewIndex = getModelToView()[e.getFirstRow()];
                      fireTableChanged(new TableModelEvent(TableSorter.this,
                                                           viewIndex, viewIndex,
                                                           column, e.getType()));
                      return;
                  // Something has happened to the data that may have invalidated the row order.
                  clearSortingState();
                  fireTableDataChanged();
                  return;
          private class MouseHandler extends MouseAdapter {
              public void mouseClicked(MouseEvent e) {
                  JTableHeader h = (JTableHeader) e.getSource();
                  TableColumnModel columnModel = h.getColumnModel();
                  int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                  int column = columnModel.getColumn(viewColumn).getModelIndex();
                  if (column != -1) {
                      int status = getSortingStatus(column);
                      if (!e.isControlDown()) {
                          cancelSorting();
                      // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
                      // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
                      status = status + (e.isShiftDown() ? -1 : 1);
                      status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
                      setSortingStatus(column, status);
          private class Arrow implements Icon {
              private boolean descending;
              private int size;
              private int priority;
              public Arrow(boolean descending, int size, int priority) {
                  this.descending = descending;
                  this.size = size;
                  this.priority = priority;
              public void paintIcon(Component c, Graphics g, int x, int y) {
                  Color color = c == null ? Color.GRAY : c.getBackground();
                  // In a compound sort, make each succesive triangle 20%
                  // smaller than the previous one.
                  int dx = (int)(size/2*Math.pow(0.8, priority));
                  int dy = descending ? dx : -dx;
                  // Align icon (roughly) with font baseline.
                  y = y + 5*size/6 + (descending ? -dy : 0);
                  int shift = descending ? 1 : -1;
                  g.translate(x, y);
                  // Right diagonal.
                  g.setColor(color.darker());
                  g.drawLine(dx / 2, dy, 0, 0);
                  g.drawLine(dx / 2, dy + shift, 0, shift);
                  // Left diagonal.
                  g.setColor(color.brighter());
                  g.drawLine(dx / 2, dy, dx, 0);
                  g.drawLine(dx / 2, dy + shift, dx, shift);
                  // Horizontal line.
                  if (descending) {
                      g.setColor(color.darker().darker());
                  } else {
                      g.setColor(color.brighter().brighter());
                  g.drawLine(dx, 0, 0, 0);
                  g.setColor(color);
                  g.translate(-x, -y);
              public int getIconWidth() {
                  return size;
              public int getIconHeight() {
                  return size;
          private class SortableHeaderRenderer implements TableCellRenderer {
              private TableCellRenderer tableCellRenderer;
              public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) {
                  this.tableCellRenderer = tableCellRenderer;
              public Component getTableCellRendererComponent(JTable table,
                                                             Object value,
                                                             boolean isSelected,
                                                             boolean hasFocus,
                                                             int row,
                                                             int column) {
                  Component c = tableCellRenderer.getTableCellRendererComponent(table,
                          value, isSelected, hasFocus, row, column);
                  if (c instanceof JLabel) {
                      JLabel l = (JLabel) c;
                      l.setHorizontalTextPosition(JLabel.LEFT);
                      int modelColumn = table.convertColumnIndexToModel(column);
                      l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
                  return c;
          private class Directive {
              private int column;
              private int direction;
              public Directive(int column, int direction) {
                  this.column = column;
                  this.direction = direction;
      //-------------- FIX TABLE'S HEIGHT & COLUMN WIDTH ---------
      public class TableHeight_ColumnWidth {
        private TableSorter sorter;
        private FontMetrics fm;
        private JTable table;
        private int numOfRows = 0, totalTableHeight = 0, totalTableWidth = 0;
         * Constructor --- it needs the model as well the JTable as parameters
         * @param sorter - the model
         * @param table - the JTable created based on the model
        public TableHeight_ColumnWidth(TableSorter sorter, JTable table) {
          this.sorter = sorter;
          this.table = table;
          this.fm = table.getFontMetrics(table.getFont());
          this.numOfRows = table.getRowCount();
         * Calculates the width of each column according to the String it contains
         * @param col = the desired column
         * @param fm = the FontMetrics of this column
         * @return - the width of the single column
        public int determineColumnWidth(TableColumn col, FontMetrics fm) {
          int headerWidth = fm.stringWidth((String)col.getHeaderValue());
          int columnNumber = col.getModelIndex();
          int max = headerWidth;
          int columnWidth = 0;
          String cell = "";
          Integer cell_int = new Integer(0);
          Short cell_short = new Short((short)0);
          for (int i = 0; i != sorter.getRowCount(); i++) {
            Object obj = (Object) sorter.getValueAt(i, columnNumber);
            if (obj instanceof String) {
              cell = (String)sorter.getValueAt(i, columnNumber);
            else if (obj instanceof Integer) {
              cell_int = (Integer)sorter.getValueAt(i, columnNumber);
              cell = String.valueOf(cell_int.intValue());
            else if (obj instanceof Short) {
              cell_short = (Short) sorter.getValueAt(i, columnNumber);
              cell = String.valueOf(cell_short.shortValue());
            columnWidth = fm.stringWidth(cell) + 5;
            if (columnWidth > max) {
              max = columnWidth;
          return max + 5;
         * Calculates the total width of the table according to the width of each
         * column.
         * @return - totalTableWidth
        private int fixColumnWidth () {
          int totalTableWidth = 0;
          TableColumn c = null;
          int cw = 0;
          for (int i = 0; i < table.getColumnCount(); i++) {
            c = table.getColumn(table.getColumnName(i));
            cw = this.determineColumnWidth(c, fm);
            c.setPreferredWidth(cw);
            totalTableWidth = totalTableWidth + cw;
            c.setMinWidth(cw);
          return totalTableWidth;
         * Calculates the height of the table according to the height of each row
         * multiplied by 51 (by default) or by the totalRowsCount.
         * @return - totalTableHeight
        private int fixTableHeight(int maxVisibleRows) {
          int rowHeight = table.getRowHeight();
          //Show maxVisibleRows rows maximum
          if (numOfRows > maxVisibleRows) {
            totalTableHeight = rowHeight * maxVisibleRows;
          else {
            totalTableHeight = rowHeight * numOfRows;
          return totalTableHeight;
         * Sets up the table according to the totalTableWidth and totalTableHeight
        public void fixTableLook(int maxVisibleRows) {
          table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
          totalTableWidth = this.fixColumnWidth();
          totalTableHeight = this.fixTableHeight(maxVisibleRows);
          table.setPreferredScrollableViewportSize(new Dimension(totalTableWidth, totalTableHeight));
    }Also, I want some column headers to display their text in two-rows. But by using the HTML technique look at the result in comparison with the previous table I had!
    import javax.swing.JFrame;
    import java.awt.HeadlessException;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.util.Vector;
    import javax.swing.table.DefaultTableModel;
    //--------- TableSorter ----------
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.*;
    //---------- Table Height - Column Width
    import javax.swing.table.TableColumn;
    import java.awt.FontMetrics;
    import javax.swing.JTable;
    import java.awt.Dimension;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Test extends JFrame {
      JPanel jPanel1 = new JPanel();
      JPanel jPanel2 = new JPanel();
      JButton jButton1 = new JButton();
      FlowLayout flowLayout1 = new FlowLayout();
      BorderLayout borderLayout1 = new BorderLayout();
      BorderLayout borderLayout2 = new BorderLayout();
      //------------- MY VARIABLES -------------
      String[] columnNames_objectArr = new String[] {
          "Col1",
          "Column 2",
          "Column 3",
          "C4",
          "Col5",
          "Col 6",
      Vector columnNames_vector = new Vector();
      private Vector data_vector = new Vector();
      private Object[][] data_objectArr;
      public TableHeight_ColumnWidth tcw;
      private int totalTableWidth = 0, totalTableHeight = 0;
      private JComboBox jcmbxData = new JComboBox(
          new String[] {"Not Configured", "Switch", "Modem"});
      private int maxVisibleRows = 51;
      TableSorter model;
      private JTable table;
      JScrollPane jScrollPane1;
      public Test(String[] args) throws HeadlessException {
        try {
          jbInit();
          setupGUI();
          launchGUI();
        catch(Exception e) {
          e.printStackTrace();
      private void jbtnClose_actionPerformed(ActionEvent e) {
        dispose();
      private void launchGUI() {
        pack();
        setVisible(true);
        setResizable(false);
      private void setupGUI() {
        columnNames_vector.addElement("<html>Col1</html>");
        columnNames_vector.addElement("<html>Column 2</html>");
        columnNames_vector.addElement("<html>Column 3<br>Second Row</html>");
        columnNames_vector.addElement("<html>C4</html>");
        columnNames_vector.addElement("<html>Col5</html>");
        columnNames_vector.addElement("<html>Col 6</html>");
        Vector row_data1 = new Vector();
        Vector row_data2 = new Vector();
        Vector row_data3 = new Vector();
        Vector row_data4 = new Vector();
        Vector row_data5 = new Vector();
        Vector row_data6 = new Vector();
        row_data1.add("Mary");
        row_data1.add("Campioneato");
        row_data1.add("Snowboarding");
        row_data1.add(new Integer(578987899));
        row_data1.add(new Boolean(false));
        row_data1.add("Not Configured");
        row_data2.add("Alison");
        row_data2.add("Huml");
        row_data2.add("Rowing");
        row_data2.add(new Integer(3));
        row_data2.add(new Boolean(true));
        row_data2.add("Switch");
        row_data3.add("Ka");
        row_data3.add("Walrath");
        row_data3.add("Knitting");
        row_data3.add(new Integer(2));
        row_data3.add(new Boolean(false));
        row_data3.add("Modem");
        row_data4.add("Sharon");
        row_data4.add("Zakhouras");
        row_data4.add("Speed reading");
        row_data4.add(new Integer(20));
        row_data4.add(new Boolean(true));
        row_data4.add("Switch");
        row_data5.add("Philip");
        row_data5.add("Milner");
        row_data5.add("Pool");
        row_data5.add(new Integer(10));
        row_data5.add(new Boolean(false));
        row_data5.add("Not Configured");
        data_vector.add(row_data1);
        data_vector.add(row_data2);
        data_vector.add(row_data3);
        data_vector.add(row_data4);
        data_vector.add(row_data5);
        model = new TableSorter(new SortTableModel(data_vector, columnNames_vector));
        table = new JTable(model);
        tcw = new TableHeight_ColumnWidth(model, table);
        jScrollPane1 = new JScrollPane(table);
        model.setTableHeader(table.getTableHeader());
        jPanel1.add(jScrollPane1, BorderLayout.CENTER);
        //Add a JComboBox as a cellEditor...
        DefaultCellEditor dce = new DefaultCellEditor(jcmbxData);
        table.getColumnModel().getColumn(5).setCellEditor(dce);
        //..... add the IPJPanel as cellEditor.....
        tcw.fixTableLook(maxVisibleRows);
      private void jbInit() throws Exception {
        this.getContentPane().setLayout(borderLayout2);
        jPanel1.setLayout(borderLayout1);
        jPanel2.setLayout(flowLayout1);
        jButton1.setText("Close");
        jPanel1.setBorder(BorderFactory.createRaisedBevelBorder());
        this.getContentPane().add(jPanel1, BorderLayout.CENTER);
        this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
        jPanel2.add(jButton1, null);
        jButton1.addActionListener(new ActionListener() {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

    First of all I found out that when I set the column's header like this:
    columnNames_vector.addElement("<html>Column 3<br>Second Row</html>"); //In the setupGUI() methodthe TableHeight_ColumnWidth.determineColumnWidth(TableColumn col, FontMetrics fm) method calculates the column's width by counting <html>, </html>, <br> characters as well. So I added a check to reject these characters and not count them for the column's width.
    As for the header's height:
    I found that when the first column's header is set to display two-lines, then the height of the rest columns headers is set to display two-lines as well. In other words, the height of the first column's header affects the height of the whole JTableHeader.
    I found that the BasicTableHeaderUI.getHeaderHeight() method is called, within which there are these comments:
              // If the header value is empty (== "") in the
              // first column (and this column is set up
              // to use the default renderer) we will
              // return zero from this routine and the header
              // will disappear altogether. Avoiding the calculation
              // of the preferred size is such a performance win for
              // most applications that we will continue to
              // use this cheaper calculation, handling these
              // issues as `edge cases'. Should I override a class and if so which one? I am so confused! If anyone has any idea about how to set the header's height according to the cell's height that is the maximum among all, please let me know.

  • Line Item Text ( Accounting Doc ) From Billing

    Hi Experts,
    As i know in Standard process, the Line item text FI Doc ( Accounting Document ) from billing doesn't have any value ( please correct me if i am wrong ).
    But in my case there is value in line item text ( billing doc no )
    i already check and not found any substistution or userexit, i try to search in customizing but dont have any clue where this text from. please advice where do i have to look.
    Thanks,
    Ricko

    Hello Burak,
    Thanks for reply, as i told in the message
    right now, there is value in my line item text
    it should be blank, but i couldnt find any customizing or anything that cause my line item text filled with billing document number. do you have any idea ?
    Thanks,
    RIcko
    Edited by: Chapii on Mar 19, 2010 5:24 AM

  • Printing two lines of text in Print Module

    Is it possible to print two, or more lines of text, say on a contact sheet, such as filename and caption. If so, how?

    Lightroom automatically wraps text under the thumbnail in contact sheets. The Text Template Editor does not allow you to enter line breaks. So, if your Filename is long enough to fill the first line, the caption will start with the second. If not, you can tweak the template somehow so that it looks the way you want.

  • How to hide the grid lines between two rows in a ALv? Please help!

    Hi Experts,
             I have a ABAP ALV(reuse alv grid FM) report.
    The last field in the ALV is "Description" which can contain data of size more than 130 chars.
    Since the max field length in ALV grid is 130 chars hence I am splitting this field value whenever the field length is more than 130 chars.
    After splitting I am generating duplicate rows but with different "Description" field values ( each contains the splitted values".
    For example:
    Name| City | Description                             |
    Hari|HK    |Employee responsible for time management |
    Hari|HK    |and issue resolution                     |
    Now I want to hide the grid line between these two rows
    and just for Description field.
    In other words I want ALV to display like this:
    Name| City | Description                             |
    Hari|HK    |Employee responsible for time management |
    Hari|HK    |and issue resolution                     |
    How can I acheive this?
    Please provide some sample code.
    Please help. I will be really greatfull to your help.
    Thanks
    Gopal

    Hi Rich,
          If that is the case then atleast how can I hide the complete row grid line?
    Please give some sample code.
    Thanks
    Gopal

  • I don't want a new row for each line of text

    I have exported a pdf document which is a table full of text in columns (by month). The conversion seems to react randomly so that in some places several lines of text in a column are converted to just one cell (great, just what I want) and then in others, a block of text gets split into a row for each line of text --- very annoying ...
    What would make this happen? Is there a workaround so that you can tell the conversion how to react to blocks of text?
    hope someone can help

    For optimal export the PDF needs to be a well-formed tagged PDF.
    The basic PDF page content has no format, styling, rows, columns,  etc. 
    Just objects painted to the PDF page at a specified  location. 
    You can return to the authoring file, clean that up to support accessible PDF output, then post process the PDF with Acrobat XI Pro to finalize making the PDF PDF/UA compliant. Export of that would be better.
    You can manually tag the PDF such that it is PDF/UA compliant than export from that . This would provide you better export. 
    You can clean up the export you already have. 
    Be well...

  • How to display multiple lines of texts in a single rows in ALV

    Hi,
    I have a unique requirement in which i have to display multiple lines if texts for a single rows in ALV Grid. Right now in my output it is coming in single line which is not visible fully because that text is more than 255 character. So i want to display the test by splitting into multiple lines and show it on output. Please suggest some solution for this if this is possible in ALV.
    Thanks,
    Raghav

    Hi Raghavendra,
    Its not possible to display multiple line in one row of an alv, but i think you can acheive it by splitting the whole text into multiple sub-text.
    For example, if your requirement is as below:
    Field #1          Field #2
    1                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(200 characters)
    2                    yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(220 character)
    then you can break Field#2 value into say 50 character and then populate the internal table with repetative entries of Field#1 and the finally sort it by Field#1 value... as a result of which you output will be somewhat as below:
    Field#1          Field#2
    1                   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    2                   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyy           
    Hope it will help you in meeting your requirement.
    Regards,
    Shradha

  • Dont want to show the divided line between two rows in a Grid.

    Hello Friends,
    I want a Grid in which I want multiple rows but i dont want to show the divided line between two rows.
    It is just like a grid on Territories form(Administrator->SetUp->General->Territories)
    Thanks.

    Mithun,
    The component you're talking about is not a grid, and that component is not exposed by the UI API so you cannot use it.
    Regards,
    Vítor Vieira

  • Ask split long text into two line into same cell for ALV

    Dear All,
    Is it possible split long text into two line into same cell for ALV display data?
    Regards,
    Luke
    Moderator message: please search for information before asking.
    Edited by: Thomas Zloch on Feb 24, 2011 10:12 AM

    Keep options: Select the paragraph, then CtrlAltK (Mac: CmdOptK, I
    think).
    If you want the paragraphs in pairs, create two paragraph styles. Style
    A has keep options set to start on a new page, and also, its Next Style
    is style B.
    Style B has no keep options, but it's Next Style is Style A.
    Select all the text.
    From the flyout menu of the paragraph styles palette, apply Style A
    "then next style."
    Now all paragraphs will be alternating -- style A, style B, style A, etc.
    Now do what I wrote initially, and you'll have pairs of paragraph in
    separate text frames.

  • Is it possible to have two rows of text fields per entry in a tabular form?

    Hi,
    I'm constructing a tabular form with several text fields for each entry, and I have just been advised we need twice as many text fields now as the requirements have changed.
    Anyway I am running out of real estate on the page without having to use horizontal scroll bars, and am wondering if it is possible to arrange the text fields into two rows in the tabular form for data entry. I have successfully done this for display as text fields, but not sure if it can be done in this instance.
    Any help would be greatly appreciated.
    Application Express 4.1.1.00.23
    Greg
    Edited by: Snowman on Nov 30, 2012 12:02 PM

    Snowman wrote:
    Hi,
    I'm constructing a tabular form with several text fields for each entry, and I have just been advised we need twice as many text fields now as the requirements have changed.In the first place I'd strongly recommend not using tabular forms: +{thread:id=850889}+.
    Anyway I am running out of real estate on the page without having to use horizontal scroll bars, and am wondering if it is possible to arrange the text fields into two rows in the tabular form for data entry. I have successfully done this for display as text fields, but not sure if it can be done in this instance.If you must, create a custom named column template and base the tabular form report on this: {message:id=10399762}

Maybe you are looking for

  • Upgraded to Desktop 6.2.2, now 755P crashes

    I've been a happy treo user for years. A few days ago, I had a problem. I upgraded Palm Desktop to 6.2.2 and synched my 755P. Somewhere in the process (it might have been from the download page), I got a message that some programs might be incompatib

  • Importing and Editing AAC files

    I am using Soundtrack Pro 2.0.2 and have imported a 5.1 channel .aac file. I am, however, unable to edit that file in STP. I can see all 5 channels but they are all greyed out, meaning I cannot individually do anything with those tracks. When I copy

  • Workaround for MaxTransactionSize in db-adapter?

    Hi there, Is there a workaround for the option MaxTransactionSize? This option doesn't work for a db-adapter reading from a table in an microsoft sql2000 server. I tried to create an adapter using custom sql, but this results in an outboundAdapterSer

  • Goodbye N900 for now...

    so i got a upgrade on thursday and well i debated whether to wait to get the N8 or get a sony x10 in the end i went for a HTC desire and i tell ya its a weird but good change, Except for contact transferring. lol I let my friend buy the N900 of me fo

  • Problems using a Single Ipod on two computers

    I have my home computer with a huge library and my office computer with minimal songs. I recently brought my ipod to work and hooked it up to the work computer. It installed and synced ok, I can see my ipod and all the songs... but everything is grey