In single Jtable colum can have Textfield as well as Combobox

Hi guys
My requirement is I want comboboxes in some rows and textfield in some rows of SAME column. I searched lot on net but everywhere I found solution for setting editor as well as renderer for ENTIRE column.
I hope you guys understand my problem. Please reply ASAP as I want to implement urgently in my project.
thanks n Regards
Sunil

Below is the code written by Nobuo Tamemasa.
Think it will give you some hints on how to do it.
Try searching for "Nobuo Tamemasa" in any search engine,
if I not wrong there are also example written by him on different component in a single column.
Hope this help.
// File: EachRowEditorExample.java
/* (swing1.1beta3) */
//package jp.gr.java_conf.tame.swing.examples;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import jp.gr.java_conf.tame.swing.table.*;
* @version 1.0 11/09/98
public class EachRowEditorExample extends JFrame {
  public EachRowEditorExample(){
    super("EachRow Editor Example");
    DefaultTableModel dm = new DefaultTableModel();
    dm.setDataVector(
      new Object[][]{{"Name"  ,"MyName"},
                     {"Gender","Male"}},
      new Object[]{"Column1","Column2"});
    JTable table = new JTable(dm);
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("Male");
    comboBox.addItem("Female");
    EachRowEditor rowEditor = new EachRowEditor();
    rowEditor.add(1, new DefaultCellEditor(comboBox));
    table.getColumn("Column2").setCellEditor(rowEditor);
    JScrollPane scroll = new JScrollPane(table);
    getContentPane().add( scroll );
    setSize( 400, 100 );
    setVisible(true);
  public static void main(String[] args) {
    EachRowEditorExample frame = new EachRowEditorExample();
    frame.addWindowListener( new WindowAdapter() {
      public void windowClosing( WindowEvent e ) {
        System.exit(0);
// File: EachRowEditor.java
* (swing1.1beta3) jfc#91
package jp.gr.java_conf.tame.swing.table;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
  * each row TableCellEditor
  * @version 1.0 10/20/98
  * @author Nobuo Tamemasa
public class EachRowEditor implements TableCellEditor {
  protected Hashtable editors;
  protected TableCellEditor editor, defaultEditor;
   * Constructs a EachRowEditor.
   * create default editor
   * @see TableCellEditor
   * @see DefaultCellEditor
  public EachRowEditor() {
    editors = new Hashtable();
    defaultEditor = new DefaultCellEditor(new JTextField());
   * @param row    table row
   * @param editor table cell editor
  public void add(int row, TableCellEditor editor) {
    editors.put(new Integer(row),editor);
  public Component getTableCellEditorComponent(JTable table,
      Object value, boolean isSelected, int row, int column) {
    editor = (TableCellEditor)editors.get(new Integer(row));
    if (editor == null) {
      editor = defaultEditor;
    return editor.getTableCellEditorComponent(table,
             value, isSelected, row, column);
  public Object getCellEditorValue() {
    return editor.getCellEditorValue();
  public boolean stopCellEditing() {
    return editor.stopCellEditing();
  public void cancelCellEditing() {
    editor.cancelCellEditing();
  public boolean isCellEditable(EventObject anEvent) {
    return editor.isCellEditable(anEvent);
  public void addCellEditorListener(CellEditorListener l) {
    editor.addCellEditorListener(l);
  public void removeCellEditorListener(CellEditorListener l) {
    editor.removeCellEditorListener(l);
  public boolean shouldSelectCell(EventObject anEvent) {
    return editor.shouldSelectCell(anEvent);
}

Similar Messages

  • Is there a single "SDK" I can download, for a well worked J2ee env?

    There are too many "terms" for j2ee env. such as "j2eeSdk,ant,tomcat,lomboz,jboss....", I was totally confused.
    I need a simple sdk for all those functions. Is it possible?

    There are too many "terms" for j2ee env. such as
    "j2eeSdk,ant,tomcat,lomboz,jboss....", I was totally
    confused.
    I need a simple sdk for all those functions. Is it
    possible?Rubbish. First you should rather try to learn what J2EE is in the first place. "All these functions" you list sometimes aren't functions or APIs at all.
    Ant is unrelated to J2EE.
    Tomcat is a servlet container.
    JBoss is an application server.
    Lomboz is a J2EE development plug-in for Eclipse.
    None of these are necessary to develop a J2EE-based application.

  • My wife and i both have an itunes library installed on to our separate pc's, we are now de-commissioning the pc's and are moving over to a single mac mini, can we install both libraries on to the mac mini and run them as separate libraries?

    my wife and i both have an itunes library installed on to our separate pc's, we are now de-commissioning the pc's and are moving over to a single mac mini, can we install both libraries on to the mac mini and run them as separate libraries?

    graham218 wrote:
    are moving over to a single mac mini, can we install both libraries on to the mac mini and run them as separate libraries?
    Generally YES.
    It's possible to hold separate iTunes library's on a single machine.
    Generate two new folders inside the Music folder of the Mini and name them differently; e.g. man and woman.
    Copy your whole library into "man" and your wifes into "woman"
    Go to sharing in the system settings of the Mini and share the Music folder in your network.
    After copying the whole library's to the Mini you may point iTunes to the new location at startup by holding the option key (alt) at the keyboard.
    iTunes will then ask you where the library is located.
    Point it to the matching library on the Mini.
    That's all.
    Lupunus
    PS ... If you both use only the Mini you have to setup a user account for each and just copy the whole library to the Music folder in particular.
    Message was edited by: lupunus

  • Can a single tax code (v5) have more than one rate of intrest?

    can a single tax code (v5) have more than one rate of intrest?..
    v5 can it have both 4 % and 5 % ??
    (v5 comes under a condition type jipc..it is used for cst in a PO)

    in that case ,(two rates)
    if i use
    function module, CALCULATE_TAX_FROM_NET_AMOUNT
    how will get correct tax amount?
    coz i will just mention
    bukrs,
    tacode,
    amount,
    currency
    in the FUNCTION MODULE..
    also can u help me find VAT CST amounts RATES for a invoice?
    if i use the above FM i get the follwoing error
    'tacode v5 not found in procedure TAXINN'
    functional guy says configuraion is right..
    pls help..
    i need to make purchase register...

  • If I have a single, individual membership can I put Lightroom and Photoshop on both of my computers?

    If I have a single, individual membership can I put Lightroom and Photoshop on both of my computers?

    Yes. You are permitted two activations.

  • Single VLAN can have different subnets????????

    single VLAN can have different subnet

    Hi Devang,
    Yes your single vlan can have different subnet but they will not talk to each other on ip (layer 3) till the time you configure routing on your layer 3 device using secondary ip address on same logical interface.
    But your answer is yes single vlan can have different subnet.
    HTH
    Ankur

  • I have Single Edition. Can I update the content in my viewer?

    According to the FAQ -- "No. Once you publish content to the App Store with Single Edition, updates are not available to that content."
    But, within the forums people claim that you can fix typos etc. in a published Single Edition. Can someone clear this up? Would I be able to make text changes to a published Single Edition?

    What I've seen Adobe say on here in the past is that when an update the app changes the intent of the content, it is not acceptable.  However, making grammatical or typographical corrections seem to fall within a category of accepted use.
    Updating your Single Issue app to include a Spring catalog instead of the outdated Winter catalog, however, would not qualify as accepted use.
    Probably want to speak directly to your reseller or Adobe about the specifics though.

  • Single JTable Column with several diff Cell Editors

    Am trying to create a single JTable column that can have several different cell editors. Java seems to be bias to having 1 cell editor for the whole column.
    For example in 1 column can I have
    Row1 : TextBox
    Row2: Check Box
    Row3: Radio Buttons
    Row4: JColorChooser
    At the moment I can only have one CellEditor for the whole column which is not very helpful.

    the default implementation offers to provide editors per column in the tableColumn and/or editors per class type by setting default editors ( JTable.setDefaultEditor(Class class, TableCellEditor editor) ). If you look at the getCellEditor method of JTable you see that first the tablecolumns are asked for an editor, and if this doesnt succeed a default editor for the class acording to the value at the passed grid position is determined.
    If this does not fullfil your needs, you can still overwrite the getCellEditor method of JTable and return whatever editor is suitable.
    regards,
    stefan

  • I'm trying to use Mountain Lion Server so my family can have separate logins via Screen Share to their iTunes.

    Using Mountain Lion Server so my family can have separate logins and connect via Screen Share.
    Works great, each has their own home directory and permissions are perfect.
    Now setting up iTunes for each with their own Library (not shared), thus keeping multiple Libraries.
    I get this;
    This Computer is already associated with an Apple ID.
    If you download past purchases with your Apple ID, you
    cannot auto-download past purchases with a different
    Apple ID for 90 days.
    What!
    So what it is on the same computer, they are completely separate Libraries never to be mixed.
    If this works, I only need to keep one computer up and running, instead of three.
    Each can do their syncing/backup and connect to the various Airplay/AppleTVs I have around the house.
    How do I fix this.
    Thanks

    Bottom line is you can't - easily.
    You need to make sure that you log out of the server each time otherwise the ID is running. To explain, if you had a laptop with different people using it, your solution works fine. Each time someone logs in, the iTunes ID is different so it works as you can only have one person using the laptop at any one time.
    Now, turning your problem inside-out, you want people to be able to log into iTunes concurrently to use their own version of the program with their own library. This does not seem to work and you get the conflicted ID error message. Even though iTunes is running under their own login ident, I have never been able to get this working reliably and was told that iTunes is NOT a network-aware application as it is designed to be single user.
    The way I got around this was to login as XYZ and to make sure that the ID was changed in iTunes accordingly. However, it did not always work so I gave up with the whole thing.

  • Is there a limit to how many ipods you can have on one computer?

    We have 5 iPods between myself, my spouse and my kids. I manage all of our music, video and games from my iMac. I am planning to purchase the new 3G iPhone on Friday. Is there a limit to the number of devices that I can have on my iTunes account? I seem to remember getting some kind of message about 5 account authorizations when I first synced my most recently purchased iTouch. Are "accounts" related to the computer or the iPod devices?

    The "five" limit is for +number of computers+ using an iTunes Store account. It has nothing to do with the number of iPods connected to a computer.
    As far as I know, you can have as many iPods as you want connected to a single computer and one iTunes installation. There may be a computer limitation in how may iPods you can connect simultaneously, but there should not be a practical limit in how may iPods can be associated with your iTunes installation.

  • HT204053 I did not know my kids had set up an Itunes account for me with one user name and password.  then i got an i phone and set it up with a different email address and new password.  how can i get my accounts to merge so i can have all of my music on

    I did not know my kids had set up an Itunes account for me with one user name and password.  then i got an i phone and set it up with a different email address and new password.  how can i get my accounts to merge so i can have all of my music on my iphone

    Quote: "You cannot merge two or more Apple IDs into a single one. You can, however, use one Apple ID for iCloud services and another Apple ID for store purchases (including iTunes in the Cloud and iTunes Match). See “Using one Apple ID for iCloud and a different Apple ID for Store Purchases” above for details." See also Apple ID & iCloud FAQ: http://support.apple.com/kb/HT4895?viewlocale=en_US&locale=en_US
    You can set up your iCloud account on your iOS device under: "Settings > iCloud" and a other account for store purchases under "Settings > iTunes & App Stores". Unfortunately merging accounts is not possible but you could transfer all of your music manually via iTunes from your Mac or PC.

  • Can't log in with valid password, can't boot from disk, can't access disk utility, in single user mode can't reset password as appears locked in caps mode with '?' for forward slash, can anyone help?

    Can't log in with valid password, can't boot from disk, can't access disk utility, in single user mode can't reset password as appears locked in caps mode with '?' for forward slash, can anyone help?

    Which keyboard layout you were using? German, French ... I suppose your layout is reset to the default: US and you are unable to find the "?" or "/" ...
    Please have a look into the keyboard viewer, to see how the layout of your keyboard is actually.
    marek

  • Is there a max number of actions a button can have?

    I'm building an interactive matrix in InDesign (CS5.5 Mac) with stacked buttons to implement the change of state for a given spot on the grid. This is working fine in Acrobat, but when I made a "master reset" button in InDesign (setting 96 buttons to "hidden" and 96 buttons to "visible"), not all of the actions transferred to the button when opened in Acrobat.
    My question: is there a limit to the number of show/hide fields a single button can have? If so, I have a pretty good idea how to work around the limit, but want to be sure before proceeding.
    Acrobat 9 Pro, Mac OS 10.6.8.
    Thanks,
    Ben

    I highly recommend you do it with a script. Not only you won't have this
    issue with the maximum number of actions (which I have no answer for,
    sorry), but maintaining it would be MUCH easier and more straight-forward.
    Imagine you decide to change the name of one of the fields, or remove it.
    You'll have to go over all the actions and find the relevant one. In a
    script you could do it in seconds, and it would be much easier to find out
    if something went wrong.

  • What is the Max Number of Total Work Process that we can Have on  One C.I

    Hi,
    What is the Max Number of Total Work Process that we can have on a Single C.I
    Is there any Limit that We can only have Perticular Number of Total work process ?
    Or it is just Unlimited number of total work process
    Thanks & Regards
    Dan.

    from the system throughput point of view a rule of a thumb is:
    1 up to 4 sometimes 5 workprocesses per CPU.
    (one is used in Benchmarks where you have a very small number of transactions running with a small amount of database accesses)
    you can easily find it out:
    configure 4 WPs per CPU. If you have a number of WP's consuming nearly no CPU time you can reduce the number of WPs.
    regards
    Peter

  • Why a table can have only one PK ?

    Just wanted to know the reason why Oracle allows only one PK per table ?
    I came across a situation where my existing large PK which is on a single (ID) column needs an alteration to add a new column (No).
    ID column on which PK is based is now subjected to have duplication and that is the reason why i want to add a new column. The new column composition is not going to ensure uniqueness.
    So, i need to create (alter) PK on two columns now.
    It seems, in order to do that, i need to drop the existing PK and create a new one. Since this is a OLTP production database, business cannot afford to drop the existing pk.
    When i tried to create a separate PK on two columns, Oracle gave me below err:
    ORA-02260: table can have only one primary keySo, i wanted to understand why Oracle allows only one PK / table ? and considering above err, is there any way to make required changes to my PK without altering existing PK?
    (Table is a large 30 GB partition table and PK is a non partitioned global index)
    I think PROBABLY i need to drop existing PK and re-create the new one. But core intention for opening this thread is to know rational behind one pk/table concept.

    OraDBA02 wrote:
    Just wanted to know the reason why Oracle allows only one PK per table ?
    It's not exactly Oracle's fault. The ISO SQL standard requires that a "PRIMARY KEY" constraint can only be used once per table. However, a UNIQUE constraint on non-nullable columns achieves effectively the same thing as a PRIMARY KEY. You can have multiple UNIQUE constraints.
    Arguably the PRIMARY KEY constraint is unnecessary and could safely be dropped from the SQL language. In principle in the relational model a "primary" key is nothing more or less than a candidate key. All keys are equal in the relational model and there is no fundamental reason to designate a primary key at all. There is certainly no reason not to have multiple keys. In the SQL world though it is a very widely observed convention to use a PRIMARY KEY constraint for each table and to use it for all foreign key references.

Maybe you are looking for