JTable - Tri-state row sorting?

I am trying to (easily) have some way to make the third click on a JTable column header make the column unsorted again. Since our tables are simple, we just use setAutoCreateRowSorter(true) on our tables, but we have a request to be able to remove sorting once you have sorted a column.
TLDR:
First click on column header: sort ascending
Second click on column header: sort descending
Third click on column header: remove sorting <------------ this is what we want.
Does anyone know of a quick way to accomplish this?

Check out the Sorting and Filtering section of the JTable tutorial.
TL;DR:
For more sophisticated kinds of sorting, subclass TableRowSorter or its parent class javax.swing.DefaultRowSorter.
To specify the sort order and sort precedence for columns, invoke setSortKeys.
Edit- I don't know why that link tag is broken, but here it is by itself for easy copy-pasting (I know some Puerto Ricans who used to think that was a single word):
http://download.oracle.com/javase/tutorial/uiswing/components/table.html

Similar Messages

  • Front Row sorting issues

    Hello,
    I know this issue has been posted several times and without any real solutions. But I'm going to ask again anyway in case the magical hacking gnomes have found a work-around.
    I have many sorting issues. There seems to be a lot of kvetching on here already about how Front Row sorts TV shows. But not only do my shows come up backwards within seasons, in some cases seasons themselves are out of order. For example, I have all 3 seasons of 30 Rock (purchased through iTMS) and they go season 1, season 3, season 2. Several other shows with multiple seasons are the same.
    But I also have a music sorting issue. The first part of this issue has to do with compilations. I've got several compilations in my library, and in iTunes I've sorted them by Various Artists rather than individual artists. In Front Row, if I scroll down to "V," there is no "Various Artists" like you might expect but instead a list of all the artists in all the compilations completely out of order. (Actually, they're ordered by their track number on the different albums. Yeah. That makes sense.) I could deal with these artists showing up in their normal places alphabetically, but not all lumped together under V.
    The other issue has to do with albums with one artist who has some tracks that feature other artists. Kanye West's "Graduation" is a good example. About half the tracks on the album are him "featuring Jamie Foxx," for example. So I put "Kanye West" in the sort field of this album so it displays properly in iTunes. Not only does this seem to have no effect on how things are sorted in Front Row, but there's actually multiple "Kanye West"s now, each one identical, as well as multiple "Kanye West feat. Jamie Foxx," lines and all the other multiple artist track. Uh...what?
    So I know that Front Row for some ridiculous reason is (a) not customizable and (b) operates under completely different sorting rules than iTunes (which makes no sense), but if anyone has any advice or tips or comments or whatever, that would be greatly appreciated.
    I've considered switching to a different media management program, but what I like about Front Row is its simplicity. I don't really feel like learning a whole new system (let alone getting my wife to buy into that idea). I've got better ways to spend my time. So, it's a trade off, I guess.
    Anyway, Apple Gods? Are you out there? Are you listening?

    I can't believe we're still banging on about the sorting problems. Apple have seen fit to provide a number of features to allow the user to get iTunes working the way they like, e.g. grouping compilation artists and the use of sort fields. I think you can now even keep compilation artists grouped on the iPod. But why oh why do they then totally ignore this for the AppleTV and Front Row (which look like the same codebase to me)?
    I have hundreds of genuine Artists that I want to see listed in the Artists' list, but not the thousands of others that appear on compilations. They don't even sort the artists by the Artist Sort field that they themselves provide in iTunes. This makes a nonsense of trying to use either the ATV or Front Row.
    Playlists are no help as they simply lump all contained tracks in one great list. Useless.
    The annoying thing is, they can get it right. iTunes just gets better and better in this regard, each release sorting out more of the omissions of earlier versions. But ATV and Front Row - nope, nothing. Still just as stupid as always. Just what will it take to convince Apple to 'sort' (ha) this out? How can they justify such entirely different ways of working on their different products?

  • JTable: re-select rows

    I have a JTable with many rows and X number of cols.
    The user selects some rows.
    I call getSelectedRows() to find out what rows have been selected.
    I do some stuff and sort the rows. This loses the selection and the selected rows can be different numbers now.
    How can I re-select the right rows....there is no setRowSelection(Object o).

    You'll need to figure out how to map from original to new row indices. Then use javax.swing.JTable.addRowSelectionInterval(int, int) to reselect. The Java tutorial provides a class called TableSorter that handles sorting and maintains an index map.

  • When I print a photo to my epson printer, it comes out larger than the original photo - so the photo prints beyond the borders. Tried readjusting all sorts of things but nothing helps. I had this same problem with my Canon. any ideas?

    When I print a photo to my epson printer, it comes out larger than the original photo - so the photo prints beyond the borders. Tried readjusting all sorts of things but nothing helps. I had this same problem with my Canon. any ideas?

    Crop to the print size before pringing
    LN

  • Is there a way to separate raw files from jpegs that are in one folder after downloading from camera when you shoot both together. I tried arrange or sort  by kind but that does not work. It arranges all folders but not the files in the folder., Is there

    Is there a way to separate raw files from jpegs that are in one folder after downloading from camera when you shoot both together. I tried arrange or sort  by kind but that does not work. It arranges all folders but not the files in the folder., Is there a way to separate raw files from jpegs that are in one folder after downloading from camera when you shoot both together. I tried arrange or sort  by kind but that does not work. It arranges all folders but not the files in the folder.

    Bridge will do the job. View > Sort > ByType. Then you can choose a group of one type and put the files in a separate folder.

  • How to find out if JTable's selected row is visible?

    Hello there,
    Given:
    a JTable is inserted into a JScrollPane and the number of rows in the table is greater than the vieport size.
    A random row within the table gets programmatically selected.
    How to find out if the selected row is visible in a JTable visible area?
    Your help will be greatly appreciated.
    Tim

    That will make the row visible, but not answer whether it was visible
    in the first place. Try something like:
    public boolean isRowVisible( JTable table, int row ) {
        Rectangle rect = table.getBounds();
        int rowHeight = table.getRowHeight();
        int viewHeight = table.getParent().getHeight();
        int max = rect.y - viewHeight + 1;
        int rowPos = - rowHeight * row;
        return ( rect.y >= rowPos && rowPos > max );
    }assuming all rows have the same height.
    : jay

  • Tri - State Checkbox in pdf form

    Hi all,
    I'm using Adobe Acrobat 9 Standard to create forms. I want to include a tri state checkbox (Checked / Un-Unchecked / Crossed) in my form. There is an option to add checkboxes but they are only bi state ( Checked & Un Checked). Do you have any idea how to solve this?
    Best Regards,
    Sameer

    I don't think it can be done, but why not ask in the Acrobat forum. This is the Reader forum. Acrobat users are more likely to come up with a method that might work than Reader users that do not use Acrobat.

  • Tri - State Checkbox in a pdf form

    Hi all,
    I'm using Adobe Acrobat 9 Standard to create forms. I want to include a tri state checkbox (Checked / Un-Unchecked / Crossed) in my form. There is an option to add checkboxes but they are only bi state ( Checked & Un Checked). Do you have any idea how to solve this?
    Best Regards,
    Sameer

    It doesn't meet your 'design spec' Sameer, but I think many of us would just include two (Y,N) or three (Y,N,N/a) checkboxes against each question and assign them all the same name (eg 'Q1'), but ticks to the Y and N/a, and a cross to the 'N', and different export values so that only one of them can be checked.
    I usually include the boxes in the original file and add a slightly bigger 'no border' checkbox in Acrobat, as I think they look better if the 'tick' is bigger than the box rather than just filling it (much like it would if done in pen and ink), but that's just a personal preference.

  • ERROR:MapLib:973 - Tri-state buffers are not supported in this architecture.

    Hi,
    I face a ERROR:MapLib:973 problem with inout port in a pcore component.
    I need ton instantiate an inout port at the top level to communicate wih my peripherical.
    This inout port is driven by an XPS IP core (pcore).
    The .mpd is  :
    PORT fdata = "", DIR = INOUT , VEC = [31:0], ENABLE=SINGLE, THREE_STATE = TRUE,TRI_I = fdata_I, TRI_O = fdata_O, TRI_T = fdata_T
    PORT fdata_I = "", DIR = I , VEC = [31:0]
    PORT fdata_O = "", DIR = O , VEC = [31:0]
    PORT fdata_T = "", DIR = O
    The .vhd is :
    fdata_o : out std_logic_vector(31 downto 0);
    fdata_i : in std_logic_vector(31 downto 0);
    fdata_t : out std_logic ;
    I got ERROR:MapLib:973 - Tri-state buffers are not supported in this architecture messages for each
    signals of my fdata PORT, while mapping !
    Thanks for you help.

    What device are you targeting, and what version of the software are you using?
    I target a xc7k325t-fbg676-2.
    I use ISE 14.3 form platgen to xst and 14.7 from map to bitgen.
    What does your top level HDL (verilog or VHDL) file look like (where the IO must be instantiated)?
    It is a .vhd in whitch i wrapp my top XPS core, described by .mhs
    The problematic IO port is instantiated into the mb_core.vhd (generated by XPS).
    If i open it, i could see that the tool correctly infer the corresponding IOBUF's :
    component mapping :
    fdata_I => FX3_DQ_I,
    fdata_O => FX3_DQ_O,
    fdata_T => FX3_DQ_T,
    One IOBUF infered:
    iobuf_1 : IOBUF
    port map (
    I => FX3_DQ_O(31),
    IO => FX3_DQ(31),
    O => FX3_DQ_I(31),
    T => FX3_DQ_T
    Top level port :
    FX3_DQ : inout std_logic_vector(31 downto 0);
    THEN FX3_DQ  signal is dirrectly branched in my upper level (top level) vhd file, with the same name.
    What do your constraints file look like (where the pin number and names get declared)?
    The port is only constrained in .ucf, like that:
    NET FX3_DQ[0] LOC = "B24"| IOSTANDARD = LVCMOS33 ;
    NET FX3_DQ[31] LOC = "G26"| IOSTANDARD = LVCMOS33 ;#Bank 14
     

  • Tri-State checkbox in ADF

    Something similar to this
    http://shamsmi.blogspot.com/2008/12/tri-state-checkbox-using-javascript.html
    values: true, false, null
    Jdev 11.1.2.3
    Thanks

    Any plans?
    It is part of javafx, available on OpenFaces http://openfaces.org/demo/selectbooleancheckbox/SelectBooleanCheckbox_general.jsf
    and primafaces http://code.google.com/p/primefaces-extensions/source/browse/primefaces-extensions/trunk/src/main/java/org/primefaces/extensions/component/tristatemanycheckbox/TriStateManyCheckboxRenderer.java?r=1355

  • Tri-state check boxes

    I have a requirement to create tri-state check boxes. The check-box is supposed to show an aggregate value from multiple sources, so it may show "entirely on", "entirely off" or "mixed". The appearance for "mixed" (as seen in many word-processors when formatting large section of text, or when installing only some sub-components of a component of Windows,) should be a check on a gray background.
    Currently my best effort has been to create a JPanel containing two JCheckBox objects stacked with an OverlayLayout. One has no text and is transparent to the mouse, it is just the check part. The other is partically obscured by the first, but provides the label and response to clicks. The latter updates the former with its state, but the former may be set to "mixed", which is simulated by disabling it.
    This is a very ugly way of acheiving what I want. It does give consistently correct results across PLAFs, but it has a tendency to flicker because the functional JCheckBox doesn't like being obscured. It also doesn't show shading in the box while the mouse button is held down over it, because this occurs in the obscured component, not the puppet component shown. Is there an existing component with the functionality I desire? Alternatively is there some way to create a new component without having to extend every PLAF that I want to use with it? Trying to figure out how to add new components in the same look and feel is quite intimidating.
    Many thanks,
    Andrew Wilson.

    The Follwoing code will work out for you i have read in an article
    import javax.swing.*;
    import javax.swing.event.ChangeListener;
    import javax.swing.plaf.ActionMapUIResource;
    import java.awt.event.*;
    * Maintenance tip - There were some tricks to getting this code
    * working:
    * 1. You have to overwite addMouseListener() to do nothing
    * 2. You have to add a mouse event on mousePressed by calling
    * super.addMouseListener()
    * 3. You have to replace the UIActionMap for the keyboard event
    * "pressed" with your own one.
    * 4. You have to remove the UIActionMap for the keyboard event
    * "released".
    * 5. You have to grab focus when the next state is entered,
    * otherwise clicking on the component won't get the focus.
    * 6. You have to make a TristateDecorator as a button model that
    * wraps the original button model and does state management.
    public class TristateCheckBox extends JCheckBox {
    /** This is a type-safe enumerated type */
    public static class State { private State() { } }
    public static final State NOT_SELECTED = new State();
    public static final State SELECTED = new State();
    public static final State DONT_CARE = new State();
    private final TristateDecorator model;
    public TristateCheckBox(String text, Icon icon, State initial){
    super(text, icon);
    // Add a listener for when the mouse is pressed
    super.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
    grabFocus();
    model.nextState();
    // Reset the keyboard action map
    ActionMap map = new ActionMapUIResource();
    map.put("pressed", new AbstractAction() {
    public void actionPerformed(ActionEvent e) {
    grabFocus();
    model.nextState();
    map.put("released", null);
    SwingUtilities.replaceUIActionMap(this, map);
    // set the model to the adapted model
    model = new TristateDecorator(getModel());
    setModel(model);
    setState(initial);
    public TristateCheckBox(String text, State initial) {
    this(text, null, initial);
    public TristateCheckBox(String text) {
    this(text, DONT_CARE);
    public TristateCheckBox() {
    this(null);
    /** No one may add mouse listeners, not even Swing! */
    public void addMouseListener(MouseListener l) { }
    * Set the new state to either SELECTED, NOT_SELECTED or
    * DONT_CARE. If state == null, it is treated as DONT_CARE.
    public void setState(State state) { model.setState(state); }
    /** Return the current state, which is determined by the
    * selection status of the model. */
    public State getState() { return model.getState(); }
    * Exactly which Design Pattern is this? Is it an Adapter,
    * a Proxy or a Decorator? In this case, my vote lies with the
    * Decorator, because we are extending functionality and
    * "decorating" the original model with a more powerful model.
    private class TristateDecorator implements ButtonModel {
    private final ButtonModel other;
    private TristateDecorator(ButtonModel other) {
    this.other = other;
    private void setState(State state) {
    if (state == NOT_SELECTED) {
    other.setArmed(false);
    setPressed(false);
    setSelected(false);
    } else if (state == SELECTED) {
    other.setArmed(false);
    setPressed(false);
    setSelected(true);
    } else { // either "null" or DONT_CARE
    other.setArmed(true);
    setPressed(true);
    setSelected(true);
    * The current state is embedded in the selection / armed
    * state of the model.
    * We return the SELECTED state when the checkbox is selected
    * but not armed, DONT_CARE state when the checkbox is
    * selected and armed (grey) and NOT_SELECTED when the
    * checkbox is deselected.
    private State getState() {
    if (isSelected() && !isArmed()) {
    // normal black tick
    return SELECTED;
    } else if (isSelected() && isArmed()) {
    // don't care grey tick
    return DONT_CARE;
    } else {
    // normal deselected
    return NOT_SELECTED;
    /** We rotate between NOT_SELECTED, SELECTED and DONT_CARE.*/
    private void nextState() {
    State current = getState();
    if (current == NOT_SELECTED) {
    setState(SELECTED);
    } else if (current == SELECTED) {
    setState(DONT_CARE);
    } else if (current == DONT_CARE) {
    setState(NOT_SELECTED);
    /** Filter: No one may change the armed status except us. */
    public void setArmed(boolean b) {
    /** We disable focusing on the component when it is not
    * enabled. */
    public void setEnabled(boolean b) {
    setFocusable(b);
    other.setEnabled(b);
    /** All these methods simply delegate to the "other" model
    * that is being decorated. */
    public boolean isArmed() { return other.isArmed(); }
    public boolean isSelected() { return other.isSelected(); }
    public boolean isEnabled() { return other.isEnabled(); }
    public boolean isPressed() { return other.isPressed(); }
    public boolean isRollover() { return other.isRollover(); }
    public void setSelected(boolean b) { other.setSelected(b); }
    public void setPressed(boolean b) { other.setPressed(b); }
    public void setRollover(boolean b) { other.setRollover(b); }
    public void setMnemonic(int key) { other.setMnemonic(key); }
    public int getMnemonic() { return other.getMnemonic(); }
    public void setActionCommand(String s) {
    other.setActionCommand(s);
    public String getActionCommand() {
    return other.getActionCommand();
    public void setGroup(ButtonGroup group) {
    other.setGroup(group);
    public void addActionListener(ActionListener l) {
    other.addActionListener(l);
    public void removeActionListener(ActionListener l) {
    other.removeActionListener(l);
    public void addItemListener(ItemListener l) {
    other.addItemListener(l);
    public void removeItemListener(ItemListener l) {
    other.removeItemListener(l);
    public void addChangeListener(ChangeListener l) {
    other.addChangeListener(l);
    public void removeChangeListener(ChangeListener l) {
    other.removeChangeListener(l);
    public Object[] getSelectedObjects() {
    return other.getSelectedObjects();
    then compile this code
    in another class file
    import javax.swing.*;
    import java.awt.*;
    public class TristateCheckBoxTest {
    public static void main(String args[]) throws Exception {
    JFrame frame = new JFrame("TristateCheckBoxTest");
    frame.getContentPane().setLayout(new GridLayout(0, 1, 5, 5));
    final TristateCheckBox swingBox = new TristateCheckBox(
    "Testing the tristate checkbox");
    swingBox.setMnemonic('T');
    frame.getContentPane().add(swingBox);
    frame.getContentPane().add(new JCheckBox(
    "The normal checkbox"));
    UIManager.setLookAndFeel(
    UIManager.getSystemLookAndFeelClassName());
    final TristateCheckBox winBox = new TristateCheckBox(
    "Testing the tristate checkbox",
    TristateCheckBox.SELECTED);
    frame.getContentPane().add(winBox);
    final JCheckBox winNormal = new JCheckBox(
    "The normal checkbox");
    frame.getContentPane().add(winNormal);
    // wait for 3 seconds, then enable all check boxes
    new Thread() { {start();}
    public void run() {
    try {
    winBox.setEnabled(false);
    winNormal.setEnabled(false);
    Thread.sleep(3000);
    winBox.setEnabled(true);
    winNormal.setEnabled(true);
    } catch (InterruptedException ex) { }
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.show();
    this will give you all the check boxes...
    All The Best

  • NY Tri-State Area Users: Does Q104.3 work

    I am thinking of buying a radio remote for my iPod 5G or nano, but I only listen to one station: Q104.3 and I was playing with one of the horrendous Zunes at gamestop in my local mall and it didn't seem like it could connect to Q104.3
    I was wondering if, there is any iPod Radio Remote in the New York tri-state area users (preferably central jersey) on this forum who can tell me if 104.3 works with the accessory.
    MBP 17" 2.33GHz 2GB, iMac Core Duo 17" 1.83GHz 1GB   Mac OS X (10.4.8)   iPod Nano 2G 4GB, iPod Shuffle 2G 1GB, iPod 5.5g 30GB

    Just wanted to give an update. The menlo park apple store was out of stock of the radio remote for over 2 days and as I suspected, they added the new earphones to them. I was told that I could buy it and try it outside since inside there's apparently a steel ceiling and if it didn't work I could get my money back, but it did work (though 105.5 which is a New Jersey station, did not play, interestingly, but i'm not worried cause I love Q104.3).
    BTW there is a $5 student discount on this at the apple store (dunno about online) for students who want to buy this fine product.
    MBP 17" 2.33GHz 2GB, iMac Core Duo 17" 1.83GHz 1GB   Mac OS X (10.4.8)   iPod Nano 2G 4GB, iPod Shuffle 2G 1GB, iPod 5.5g 30GB

  • Tri-state pin

    Hi! I'm working with a PCI-MIO-16E-1 DAQ and i want to know if a PFI pin as an output is set to tri-state and to use their corresponding special function signal i have to make a routing, or it's set automaticaly to output the corresponding special function.
    For example, if i connect an encoder to the PFI7/STARTSCAN pin and set the STARTSCAN signal to be internal, i have the STARSCAN as an output in that pin?
    That could damage the encoder?
    Tanks!

    Hello;
    When you have a PFI line working as an Output, the signal which is being generated internally on the board will be output on that pin. So, using the StartScan signal as example, if you set that one to be internal, the pin will output that signal, and if you connect that to an encoder, keep in mind that the signal will be output to the encoder.
    Hope this helps.
    Filipe

  • Can labview digital waveform editor provide tri state option

    hi
    Could anybody who have used labview digital waveform editor
    would let me know whether, the package supports the
    tri state opertaion also.
    rags

    Currently the LabVIEW Digital Waveform Editor does not provide tri state functionality. 
    Minh Tran
    Applications Engineer
    National Instruments

  • Why is my JTable row sort is not working?

    Hey all,
    I wrote the following code for a JTable and I'm trying to use a table sorter to sort the first column content alphabetically, for now. Later, I'd like to use the third column and sort the table's rows based on ascending dates.
    For some reason, my comparator is not being called at all and I'm not sure what I'm doing wrong. I'm using JDK 6, which allows me to use a TableRowSorter. It is the first time I'm using this, so I may not know how to use it correctly. Does anybody have any idea what I'm doing wrong?
    Please advice.
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.util.Comparator;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableRowSorter;
    public class MyTable {
         JTable table;
         public MyTable() {
              JFrame frame = new JFrame("My Table");
              JPanel panel = new JPanel(new BorderLayout());
              table = createTable();
              panel.add(table.getTableHeader(), BorderLayout.NORTH);
              panel.add(table);
              frame.getContentPane().add(panel);
              frame.setSize(new Dimension(400,150));
              frame.setVisible(true);
         private JTable createTable()
              Object [][] data = {{"Nazli", "Shahi", "Wed, Mar 31, 1982"},{"Nima", "Sohrabi", "Thu, Jul 15, 1982"},
                                    {"Farsheed", "Tari", "Mon, Jun 13, 1967"}, {"Anousheh", "Modaressi", "Tue, Sep 18, 1964"}};
              String [] columnNames = {"First Name","Last Name","DOB"};
              DefaultTableModel model = new DefaultTableModel(data, columnNames);
              table = new JTable(model);
              TableRowSorter sorter = new TableRowSorter(model);
            sorter.setComparator(0, new MyComparator());
             table.setRowSorter(sorter);
              return table;
         private class MyComparator implements Comparator {
              public int compare(Object s1, Object s2) {
                   String first = s1.toString();
                   String second = s2.toString();               
                   System.err.println("returning "+(first.substring(0, 1)).compareTo(second.substring(0, 1)));
                   return (first.substring(0, 1)).compareTo(second.substring(0, 1));
         public static void main(String[] args) {
              MyTable test = new MyTable();
    }

    Alrite, so now I have Date objects in the model instead of String objects. Now, my question is, how can I actually sort the Date column with the latest dates showing on top and earlier dates showing on the bottom?
    The table provides a default Comparator to sort dates. You just need to tell the table what type of data is stored in each column. This is done by overriding the getColumnClass() method of JTable or TableModel.
    Camickr, you once said that the table provides a default Comparator to sort dates. and I just need to tell the table what type of data is stored in each column. This is done by overriding the getColumnClass() method of JTable or TableModel.
    With the current code that I have in getColumnClass I am not able to compare anything yet. Is there anything else I need to do? I'm a bit clueless, so I'd appreciate your help.
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.util.Date;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    public class MyTable {
        JTable table;
        DefaultTableModel model;
        public MyTable() {
            JFrame frame = new JFrame("My Table");
            JPanel panel = new JPanel(new BorderLayout());
            table = createTable();
            panel.add(table.getTableHeader(), BorderLayout.NORTH);
            panel.add(table);
            frame.getContentPane().add(panel);
            frame.setSize(new Dimension(400,150));
            frame.setVisible(true);
        private JTable createTable() {
            Object [][] data = {{"Nazli", "Sh", new Date(192837429L)},{"Nima", "So", new Date(1293847L)},
                                {"Farsheed", "T", new Date(9872347892L)}, {"Anousheh", "M", new Date(234321234L)}};
            String [] columnNames = {"First Name","Last Name","DOB"};
            model = new MyTableModel(data, columnNames);
            table = new JTable(model);
            return table;
        public static void main(String[] args) {
            MyTable test = new MyTable();
        private class MyTableModel extends DefaultTableModel {
             public MyTableModel(Object [][] data, String [] columnNames) {
                  super(data, columnNames);
             public Class getColumnClass(int column) {
                  System.err.println(column);
                  if(column==2)
                       return getValueAt(column, 2).getClass();
                  else
                       return Object.class;
    }

Maybe you are looking for

  • Excel_Work​bookClose in excel2000.​fp generates unwanted "Save As" prompt.

    Hi, I created a LabWindows/CVI application that is developed and built on: Windows XP Pro SP3 Labwindows/CVI 2009 Version 9.1.1 Microsoft Excel 2000 The application generates a report using excel2000.fp activex functions. We've been running successfu

  • Apple TV 'Trailers' App stops starts all other streaming fine, why?

    Hello, Just bought an Apple TV (I think that makes it 3rd generation?). Netflix streams fine, movie previews from itunes stream fine but when I use the Trailers app built in to the Apple TV it stops and starts a couple of times through the majority o

  • Controlling one timeline using an object in another?

    Hello! I'd be very grateful if someone could help me out with this. I have two layers - each contains a different object. Each of these objects have things happening on their own timelines. At a certain point on object A's timeline, I want the user t

  • Out of memory process

    Dear All, ORA-04030: out of process memory when trying to allocate nn bytes. I am trying to do consolidated report for all projects, i am getting above error. .Net - 2005 CR 11.5 R2 I created datatable and passing to crviewer.  I am fetching data aro

  • Wireless speakers and Extigy external sound ca

    I have recently purchased the Saitek A250 wireless speaker system with transmitter. The transmitter only plugs into a USB port. I do not have a sound card other than the external Extigy sound card, which, of course doesn't have a USB port. Does anyon