Using JSlider as table component

Ive been having some problems using JSlider in tables... Ive written several cell editors and renderers but this is the only one that gives me problems. Here is simplified code that i think should work but doesn't:
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JSlider;
import javax.swing.table.TableColumn;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.AbstractTableModel;
import java.awt.FlowLayout;
import java.awt.Component;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
* A main frame with a table in it... wish it had sliders...
public class TestSliderTable extends JFrame
    /** Creates new TestSliderTable */
    public TestSliderTable()
        addWindowListener(new WindowAdapter()
            public void windowClosing()
                System.exit(0);
        setUpTable();
    private void setUpTable()
        JTable table = new JTable(new SomeDumbTableModel())
            public TableCellRenderer getCellRenderer(int row, int column)
                return new JSliderTableCellRenderer();
        JPanel panel = new JPanel();
        panel.setLayout(new FlowLayout());
        panel.add(table);
        setContentPane(panel);
        pack();
    public static void main(String[] args)
        TestSliderTable frame = new TestSliderTable();
        frame.setVisible(true);
* A simple cell renderer that should render sliders...
class JSliderTableCellRenderer extends JSlider
    implements TableCellRenderer
    /** Creates new JSliderTableCellRenderer */
    public JSliderTableCellRenderer()
        super(0, 10, 5);
    public Component getTableCellRendererComponent(JTable table, Object value,
                                                    boolean p3, boolean p4,
                                                    int row, int column)
        int newValue = ((Integer)value).intValue();
        setValue(newValue);
        return this;
* a simple table model with Integers as values...
class SomeDumbTableModel extends AbstractTableModel
    public SomeDumbTableModel() { }
    public int getRowCount() { return 10; }
    public int getColumnCount() { return 1; }
    public Object getValueAt(int row, int column) { return new Integer(row); }
}Anyone have similar problems or know anyway around this?

Have you tried this:
http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/editableatomiccontrols/jtable/jtableslidereditor.html
Cheers,
Joris

Similar Messages

  • How to have alternate colors in table component?

    Hi everyone,
    Using the jsf data table, you can easily set the rowClass to set alternating row colors.
    I am sure it is possible to do the same using Sun's Table Component. Please share how???
    I looked in the theme css but in vain!!!
    Thanks!

    Hi,
    Please check out the blog entry titled "Creator: How To Highlight Specific Data Table Rows" by Tor, one of Creator's engineers. This is available at:
    http://blogs.sun.com/roller/page/tor/20050113#creator_how_to_highlight_specific
    Hope this helps.
    RK

  • 'Spreadsheet Table' component formatting

    Hi,
    I have an excel "block" of data that is formatted to the client's expectation. Is it possible to capture those specific formats using the Spreadsheet Table Component (or some other)? It appears that most of my formats are lost, especially the "Wrap Text".
    Is there a way to wrap text using the Grid, List View, or Spreadsheet Table modules on Xcelsius 2008 SP3?
    Thanks in advance!
    -Phil

    I dont think you can do this with any other component except Spreadsheet one. Try playing more with the spreadsheet table component
    the only way i can think of is if you can delete all the text in that block of data and map the spreadsheet table on that - by doing  this you will have the basic structure of that block of data and then you can use lables to do the formatting
    hope it helps

  • Java script error when using a "Table" component (jsc2)

    using a table component, I get a js errors, when lodiing the HTML page, sorting rows etc.
    can some one helpe me or can some one have the same problem ?

    Hi,
    Please post JSC2 related queries at:
    https://feedbackprograms.sun.com/login.html
    Cheers
    Giri

  • Unable to make use of ALV table in a standard component.

    Hi All,
    I am enhancing a standard wd component. I want to make use of ALV table in my enhancement. I am able to add SALV_WD_TABLE in "Used components". But the same is not getting reflected in "Component Usages".
    Can anybody guide regarding this?
    Regards,
    Yugesh Adalam

    Hi yugesh,
    Sorry, for me also it is not coming in Enh mode.
    Refer this thread:
    Regarding enhancement for ALV usage Need Help!
    Ans by Thomas:
    Re: Component Usage in Enhancement
    For the ALV, you can always do the data mapping dynamically in code using the SET_DATA method of the ALV Component Interface

  • Using table component,not binding

    Hi all,
    I've been searching info about using the table component
    , adding,deleting,etc programatically, not binding to a Database how the JSC tutorial works.
    The idea is simply:
    - add and remove rows when the user fills a textbox and push a button to add the item.....
    Anyone have an example or a link with examples??
    thanks in advance!

    What I do is create a list with, say, two Person objects then use ObjectListDataProvider's setList(List) method to associate the list with the data provider's list property.
    I create the data provider in a session bean. In the bean's init method I call remove the dummy list items.
    Before you can bind this data provider's list to any components you have to build the project, then close and reopen the project. Otherwise, JSC won't detect the presence of the data provider.
    Here's an example from my program. Note that any package or import beginning with com.cfi.office refers to custom code.
    This first class is the data provider. I added a convenience method clear the list but you don't have to do that.package com.cfi.office.dataproviders;
    import com.cfi.office.schema.tables.Phone;
    import com.sun.data.provider.impl.ObjectListDataProvider;
    import java.util.ArrayList;
    import java.util.List;
    public class PhoneListDataProvider extends ObjectListDataProvider {
        public PhoneListDataProvider() {
            List phoneList = new ArrayList();
            phoneList.add(new Phone("1112223333", "444");
            phoneList.add(new Phone("5556667777", "888");
            this.setList(phoneList);
        public void clearList() {
            this.getList().clear();
            return;
    }This next code fragment is from a session bean.    public void init() {
            super.init();
            try {
                _init();
            } catch (Exception e) {
                log("BidSessionBean Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
            abContactPhoneListDP.clearList();
        private PhoneListDataProvider abContactPhoneListDP = new PhoneListDataProvider();
        public PhoneListDataProvider getAbContactPhoneListDP() {
            return this.abContactPhoneListDP;
        public void setAbContactPhoneListDP(PhoneListDataProvider abContactPhoneListDP) {
            this.abContactPhoneListDP = abContactPhoneListDP;
        }After you build the project, close it and reopen it, you should see the data provider in the binding dialog box.

  • Table component uses outdated attributes

    The text editor's table plugin [The table component] uses outdated markup for centering items vertically in a table cell:
    It renders: <td valign="middle">
    instead of using the modern:
    <td style="vertical-align:middle">
    This breaks the layout. I need to find out how to update the table plugin for the text editor.
    Anyone knows how to fix this?
    Thanks in advance,
    David

    I got a patch from Adobe support:
    You can do this change in [1] around line 672. You can change it to [3].
    Note that isIE is declared in [2] around line 67. You can remove the setAttribute all together if you want to use style attribute for all browsers.
    [1] /libs/cq/ui/widgets/source/widgets/form/rte/commands/Table.js
    [2] /libs/cq/ui/widgets/source/ext/source/ext-core/src/core/Ext.js
    [3]
    if (config.valign) {
                if (config.valign != noneConfig) {
    com.setAttribute(dom, "valign", config.valign);
                    if (!CQ.Ext.isIE){
    dom.style.verticalAlign = config.valign;
                } else {
    com.removeAttribute(dom, "valign");
                    if (!CQ.Ext.isIE){
    dom.style.verticalAlign = "";
    Regards,
      Pierre Chamoun

  • How feed many record in table component and not use append command again

    hi master
    How I feed Multiple records in table component and not use append and save command again and again
    Same as oracle grid
    I give many record and save one time
    Please give me idea how I add Multiple record and save one time not use append and save command again and again
    Thank�s
    aamir

    Hi!
    appendRow() method just add temporal row. For add them to DB commitChanges() method should be used. So you can use appendRow() method several times, fill every new row and only then use commitChanges() method. In this case all new rows will be added to DB per one time.
    Thanks,
    Roman.

  • Use table component without data provider

    Since it is very difficult to solve the browser "BACK" button problem caused by my data provider, I decide not to use data provider to populate the table.
    Does anyone know some sample code about playing around with the table component without using data provider?
    Thanks in advance,

    Unfortunately, Table Component from basic category does not work with out Data Provider. But Data Table component from standard section works with out data provider. But it does not have the frills and whistles of basic table component.
    - Winston
    http://blogs.sun.com/roller/page/winston?catname=Creator

  • Clicking a tree node does not refresh the fields in the table component

    hi all,
    I am using a tree component along with a table component in my page.so whenever i am clicking on a node it should display the relevant information of that node in the table from the database.But whenever i am doing the page is not refreshing and the old values of the textfields in the table still exist.i have written the code to populate the table in a button click event.It is working fine but the same is not working when i am clicking any node in the tree component.Can anyone provide a solution to this problem.
    Thanks and regards,
    Prasant Kumar

    Never mind... I actually found something that works...
    treeModel.nodeStructureChanged(leadSelection);

  • Table component disturbing the order of rows while displaying

    HI,
    In jspx when ever data is displayed in table,when we select last page the table component
    is displaying data which is not sorted.(values given to table are changed in output).
    This is occuring only in last page.
    EX:If i have 87 records with pagination,where 15 are displayed.
    when i select to last page the output from my query is not matching the data viewed.
    Using apache trinidad1.0.5
    Regards,
    Vin
    Edited by: vinTK on Apr 26, 2012 6:16 AM

    I think that it's a very common situation.
    No ideas?
    I think that it's interesting to create appz with great performance.

  • Problem with text direction in table component for text with two language!

    Hi,
    I want to display text in table component by binding to the one property,and also the language of this text is farsi that must be in the RTL direction.
    so i defined a direction in style of staticText component in the table.
    when the text is only in farsi language ,it works correct but when the text has one or more words in english language ,format of the text changed and the words moved in text.
    thanks

    I can not understand relation between COM and HTML elements .
    can you elaborate more ?
    All HTML elements are accesable via DOM in browsers.
    Indeed to change an element attribute in html files (in browser without server interaction) we use scripts to access DOM tree and then we change the element attribute.
    for example when you write
    document.forms[1].submit()
    you accessing the element using DOM tree.
    About Farsi problem , I think there is no solution for this problem , as you may know , when we mix RTL and LTR languages in one element text attribute , we have no control over its appearance.
    If i understand your post , you want to show both rtl and ltr in one static Text , which is not doable in simple manner.
    At least i can not offer you a simple way to solve this.

  • How to Create a Table Component Dynamically based on the Need

    Hello all,
    I have a problem i need to create dynamically tables based on the no of records in the database. How can i create the table object using java code.
    Please help.

    Winston's blog will probably be helpful:
    How to create a table component dynamically:
    http://blogs.sun.com/roller/page/winston?entry=creating_dynamic_table
    Adding components to a dynamically created table
    http://blogs.sun.com/roller/page/winston?entry=dynamic_button_table
    Lark
    Creator Team

  • How to change font size, in a table component!

    Hello,i im trying to change the font size of the text inside a table component and i want to disappear the borders of the table, i was trying to achieve this using style, but this dont work, can anybody can help me with this?
    Beltazor!

    As i recall you gotta write css styles that overide the default behaviour. There's a tutorial on the subject.

  • Problem with JDev 10g ADF table component and rangeChangeListener

    Hi,
    I'm populating an ADF table component from a backing bean and would like the range of rows be changed using custom method on the backing bean.
    I have declared table on page as shown below and the table is populated correctly. However the onRangeChanged method in the backing bean never fires when
    user hits previous or next. Any ideas of what I missed ?.
    Thanks,
    Kenneth
    <af:table emptyText="No items were found"
    value="#{companySearchBean.companies}"
    var="company" rows="20"
    first="#{companySearchBean.firstCompany}"
    rendered="#{companySearchBean.queryExecuted}"
    rangeChangeListener="#{companySearchBean.onRangeChanged}">
    <af:column sortable="false" headerText="Company Name">
    <af:outputText value="#{company.partyName}"/>
    </af:column>
    <af:column sortable="false" headerText="Party Number"
    formatType="number">
    <af:outputText value="#{company.partyFileNo}"/>
    </af:column>
    </af:table>

    Hi,
    I'm populating an ADF table component from a backing bean and would like the range of rows be changed using custom method on the backing bean.
    I have declared table on page as shown below and the table is populated correctly. However the onRangeChanged method in the backing bean never fires when
    user hits previous or next. Any ideas of what I missed ?.
    Thanks,
    Kenneth
    <af:table emptyText="No items were found"
    value="#{companySearchBean.companies}"
    var="company" rows="20"
    first="#{companySearchBean.firstCompany}"
    rendered="#{companySearchBean.queryExecuted}"
    rangeChangeListener="#{companySearchBean.onRangeChanged}">
    <af:column sortable="false" headerText="Company Name">
    <af:outputText value="#{company.partyName}"/>
    </af:column>
    <af:column sortable="false" headerText="Party Number"
    formatType="number">
    <af:outputText value="#{company.partyFileNo}"/>
    </af:column>
    </af:table>

Maybe you are looking for