JcomboBox master, change the values of all jComboBoxes on a Jatable

Hello Guys,
I have one doubt, I'm using a single JcomboBox that must change all the Jcomboboxes of a jtable to the same value of the master jcombobox.
I have the attached code, but It doesn´t work, I dont know where could be the issue :S, could any body help me?
The master jComboBox is named: combo1 and this need to change all the comboboxes named: comboBox on the jtable called tbl.
You can find the code here:
http://www.javaclub.com.mx/code/ComboBoxTable.java
http://www.javaclub.com.mx/code/ComboBoxTable.txt
package comboBox;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.Component;
import java.awt.event.*;
public class ComboBoxTable {
     private static JComboBox combo1;
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception evt) {}
JFrame f = new JFrame("Combo Box Table");
final JTable tbl = new JTable(new ComboBoxTableModel());
// Create the combo box editor
JComboBox comboBox = new JComboBox(ComboBoxTableModel.getValidStates());
comboBox.setEditable(true);
DefaultCellEditor editor = new DefaultCellEditor(comboBox);
// Assign the editor to the second column
TableColumnModel tcm = tbl.getColumnModel();
tcm.getColumn(1).setCellEditor(editor);
// Set column widths
tcm.getColumn(0).setPreferredWidth(200);
tcm.getColumn(1).setPreferredWidth(100);
// Set row heighht
tbl.setRowHeight(20);
tbl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
tbl.setPreferredScrollableViewportSize(tbl.getPreferredSize());
     combo1=new JComboBox();
combo1.setBounds(350,10,80,20);
combo1.addItem("On order");
combo1.addItem("In stock");
combo1.addItem("Out of print");
combo1.setVisible(true);
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
     TableColumn col = tbl.getColumnModel().getColumn(1);
     col.setCellRenderer(new MyComboBoxRenderer(ComboBoxTableModel.getValidStates()));
combo1.addActionListener(actionListener);
f.add(combo1);
f.getContentPane().add(new JScrollPane(tbl), "Center");
f.pack();
f.setSize(500, 300);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
f.setVisible(true);
class ComboBoxTableModel extends AbstractTableModel {
// Implementation of TableModel interface
public int getRowCount() {
return data.length;
public int getColumnCount() {
return COLUMN_COUNT;
public Object getValueAt(int row, int column) {
return data[row][column];
public Class getColumnClass(int column) {
return (data[0][column]).getClass();
public String getColumnName(int column) {
return columnNames[column];
public boolean isCellEditable(int row, int column) {
return column == 1;
public void setValueAt(Object value, int row, int column) {
if (isValidValue(value)) {
data[row][column] = value;
fireTableRowsUpdated(row, row);
// Extra public methods
public static String[] getValidStates() {
return validStates;
// Protected methods
protected boolean isValidValue(Object value) {
if (value instanceof String) {
String sValue = (String)value;
for (int i = 0; i < validStates.length; i++) {
if (sValue.equals(validStates)) {
return true;
return false;
protected static final int COLUMN_COUNT = 2;
protected static final String[] validStates = {
"On order", "In stock", "Out of print"
protected static final String[] validStatesMaster = {
     "On order", "In stock", "Out of print"
protected Object[][] data = new Object[][] {
{ "Core Java Volume 1", validStates[0] },
{ "Core Java Volume 2", validStates[0] },
{ "Core Web Programming", validStates[0] },
{ "Core Visual Basic 5", validStates[0] },
{ "Core Java Foundation Classes", validStates[0] }
protected static final String[] columnNames = {
"Book Name", "Status"
class MyComboBoxRenderer extends JComboBox implements TableCellRenderer {
     public MyComboBoxRenderer(String[] items) {
     super(items);
     public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
     boolean hasFocus, int row, int column) {
          System.out.println("in");
     if (isSelected) {
     setForeground(table.getSelectionForeground());
     super.setBackground(table.getSelectionBackground());
     } else {
     setForeground(table.getForeground());
     setBackground(table.getBackground());
     setSelectedItem(value);
     return this;
Many thanks in advance!!!

Hi,
the tables are only fictitious.
any_table can have
any_col1 number,
any_col2 varchar2(10)
any_col3 number
my_tab can have
my_col1 number,
my_col2 varchar2(10)
my_col3 number
In the program-code the structure of the collection-type is the same of the table in that I want to write the data.
Thanks
Michael

Similar Messages

  • How to change the value of Valuation class.

    dear friends:
    i want to change the value of Valuation class in the material master .but system  warning info occurs .
    The valuation class cannot be changed
    Message no. M3 368
    Diagnosis
    You wanted to change the valuation class. However, this is not possible because one or more of the following already exist for the material:
    Valuated stocks in the current period or in the previous period
    Open purchase orders or delivery schedule lines
    Production orders for which a goods movement has already taken place
    System Response
    Your change is reset by the system.
    Procedure
    If valuated stocks already exist, you can change the valuation class only as follows:
    a) Post the stocks of the material to an interim account.
    b) Change the valuation class in the material master record.
    c) Post the stocks of the material back to their original account.
    If open purchase orders already exist, you can only change the valuation class if you first flag the corresponding purchase order items for deletion.
    If production orders exist for which a goods movement has already taken place, you can only change the valuation class if you first set the status of the production orders to Deleted.
    Procedure for System Administration
    In Customizing for the Material Master, you can switch the check for open purchase orders and/or for production orders to a warning. You do this in Define Attributes of System Messages by assigning the message type Warning to message MM 326 and/or MM 327 respectively. However, first ensure organizationally that further processing of the open purchase orders or production orders cannot result in inconsistencies.

    To resolve SAP error message M3 368 I would suggest that you refer to SAP note number 1967543. This note outlines the issue and a resolution to it:
    Please have a look at the description of the error M3 368. This error may occur if one or more of the following already exist for the material:
    1. Valuated stocks in the current period or in the previous period
    2. Open purchase orders or delivery schedule lines
    3. Production orders for which a goods movement has already taken place
    Resolution:
    If you have valuated stocks in the current period or in the previous period, you will get message "Stocks already exist.". You have to clear all the stocks both in current period and previous period. Please have a look at SAP Note 30656, it shows an example on how to clear the stocks in
    previous period. You can use transaction MIGO to execute this step.
    If you have open purchase orders or delivery schedule lines, you will get message "Purchase orders already exist.". You can find related purchase orders after you click 'Display Error' button. Please delete them in transaction ME22N.
    If you have production orders for which a goods movement has already taken place, you will get message "Production orders already exist.". Please archive these production orders. You need to set deletion flag for these orders firstly and go to SARA, use archiving object PP_ORDER to archive
    these orders.
    Kind regards,
    James

  • Changing the value of a control in a subvi

    I think the answer is out there somewhere but I've read through many threads found with searches similar to this topic so sorry to repost...
    I would like to change the value of a top-level VI control from a sub-vi.  The data is being used as a parameter, I was thinking about using a local/global but I've seen this discouraged.  Is there a way I can do it with references, property, or invoke nodes (or some other suggested method) ?
    I am guessing that if I am not using globals I will need to wire into the sub-vi?
    Dave

    I'd like to clarify what I am trying to do a bit more...
    The sub-vi has a control of the same type as the top-level vi.  The inital control value is being passed into the sub-vi from the top-level vi.  The sub-vi uses the control value in several places through local variables (reading and writing to it)
    I would like to modify the vi so the top-level vi control value changes whenever the sub-vi changes the control value that is passed to it.
    My last attempt was to make a refnum control in the sub-vi (by dragging from top-level block diagram to sub front panel) and then creating a property node from that refnum control.  Using the property node "value" did not give me the value of the control from the top-level vi as I had hoped.  Wiring it to a terminal that was expecting the same type of control (a cluster of two numerics) caused a wiring conflict.
    I noticed elsewhere in the code that the programmer used a text file to save options (unfortunately the control I am working on was not originially included in the options).  There is a vi that, when called, either reads or writes to the text file.  From a C/C++ programming perspective it seems quite odd to me not to just keep all this data in memory and pass it around.  Is using a file to store variables a typical practice in LV programming (even when they are retrieved multiple times during program execution) ?

  • I cannot change the value in about:newtab from "newtab" to "blank." The dialog is displayed but when I click Ok, the value is not changed.

    I cannot change the value in about:newtab from "newtab" to "blank." The dialog is displayed but when I click Ok, the value is not changed.
    ===Answer===
    Comment on usual method and solution, by a forum Moderator.
    As long as there are no confounding factors, such as certain extensions, or a user.jsfile the procedure is as follows
    # Open a new tab and type "about:config" in the address bar.
    # In the Search bar type: "newtab"
    # Locate and double click "browser.newtab.url"
    # In the "Enter String Value" box change "'''about:newtab'''" to "'''about:blank'''" and click OK.
    # Verify that the value has changed and now all new tabs will be blank.
    See post under by ''pirate048'' [/questions/976589?page=2#answer-509482] ~J99

    Have to say that I rather agree with Mark..all we want is a simple, unadorned clean page that doe not track and show usage!! WHY NOT!! Is it too simple for developers..we aren't all (nor do we want to be!) software experts! Come on Mozilla..tidy up and clean up..it might be a quicker programme too!!

  • How do I change the value of the Order By field in an MP3 file?

    good day Guys,
    I'm new here in the forum and I have a question that is "breaking" the order of my songs and my head too ...
    How do I change the value of the Order By field in an MP3 file?
    for example, in the photo below, the song "The Bad Touch" is coming BEFORE the song "A Little Respect", this happens because of the Name field to Order ...
    My "problem" is in the photo below, the "tab" Order, iTunes will not let me erase what is written in the "Sort As" ...
    I've been "collecting" several songs over SEVERAL years
    I'm currently with more than 1,500 songs on HD and several backups on DVDs and external hard drives and I think, download it again, will be a "little" laborious and boring
    I DON'T WANT to be filling the tags of songs (name, singer, CD, year, etc.)
    I have used the program Mp3tag to remove the music tags
    I've tried to download the song again and go through Mp3tag program as if it were a new song
    I've changed the music access permissions, folder and even entire hard drive (my Windows has only one user)
    I've tried to catch the song again, from a previous backup
    I've tried to create a copy of the file at iTunes own
    I've tried to create a new music file in a music recording program
    NOTHING of what I did above resolved
    -> I'm using Windows 7 64-bit Ultimate
    -> I'm using iTunes 12.1.1.4 for 64-bit Windows
    -> My iPad is the third generation (a little old, I know) with Wi-Fi and 3G, but it has served me VERY WELL
    -> The iPad is updated with iOS 8.1.3 and is not unlocked
    I'm sorry for the GIANT post, but well, I think I could explain as much as possible and for my English, too bad, by the way, I'm from Brazil and I'm using Google translator
    Hugs and await answers,
    Paulo Ricardo

    hello turingtest2,
    my language is Brazilian Portuguese (there are some little differences between Brazilian Portuguese and the Portuguese of Portugal, but nothing that interferes with the script)
    at this time, I'm managing songs manually, I don't know if this will interfere with the execution of a script or command
    as I picked up this iPad recently, I still don't understand how to set up the iTunes Music Library and the person who gave me, told me it was easier to put the songs manually
    as you said, in my iTunes, 95% of the songs are with ALL the blank fields, including the Name to Sort field, only songs that begin with a/an/the standing with the Name to Sort field filled with name of the song, without the a/the
    I do not know what to do...
    I want to learn to ride the iTunes Music Library, that my work is less
    you know any site that teaches create/manage my iTunes Music Library?
    this site/forum may be in English, no problem
    thanks for all your help and the help of others who responded to my request

  • How can I change the value in a stepper cell

    In Numbers 2.3 I was able to change the value in a stepper cell by highlighting the value and using the arrow keys to increase or decrease the value. This was a very easy way to input data. Numbers 3.0 when I do this is moves to another cell
    Is there a way to get the use of the arrow keys to change the values in 3.0?
    Thanks

    I use number to keep a running daily tally of the productivity of the members of my group. As each member performs certain tasks, all I had to do was click the up arrow and add to it. IE Jim made 4 widgets yesterday and then made 4 today, I would just hit the up 4 times total 8.
    I guess the good news is when I upgraded to Numbers 3.0, It did not delete Numbers 2.3
    I will continue to use 2.3 until it no longer works, I guess
    Thanks for the replies

  • How to change the Value of a Varible while debugging in ECC 6.0

    Hi all,
    How can i change   and Save the Value of a varible while debugging a FM in ECC 6.0.
    I can able to change the Value of a variable by clicking the Pencil Icon (Change icon) which is there next to that value
    But i am not able to save that value
    Please give the suggestions
    Thanks in Advance
    Regards
    Ajay

    Ajay,
    I think you are changing more than one variable value at a time...this things generally happen in this case.
    Go step by step.....
    Press on the pencil button
    value filed becomes editable
    change the value
    and at once press the enter
    the ediatble field automatically becomes non editable, and hence retain the changed value.
    Pooja

  • How to change the value of finished goods

    Hi
    Finished goods Material has been created with MB1C Mvt type 561. Valuation has taken from  Material master standard price. can we change the value of the same. Can any body help me.
    rgds
    Raghu shetty

    Hi,
    If the valuation is from standard price, then you must run a new product costing (tcode CK40N). Check in forums of controlling (CO) and production (PP). I think that you have PP, ie: BOM, routes, and so on.
    If the valuation is from variables prices (check it in table MBEW in field VPRSV) then run MR21 and set the new price (check it in MM forum)
    I hope this helps you
    Regards,
    Eduardo

  • Probleme changing the value of a variable in movieclip from my scene

    Hello,
    i have a probleme changing the value of a variable in movieclip from my scene. i explain: I have combobox on my scene containing categories, and in the scene i load an xml file containing links to php files that work with the combobox.
    Also on the scene i have a movieclip "filmstrip", inside this movieclip on the first frame i have a script loading the php file selected in the scene . i use a load() function with a variable "theUrl" inside like this : T.load(theUrl);.
    In my scene i want to change the value of "theUrl" inside the movieClip filmstrip. I tried filmstrip.theUrl = url; But it doesnt work
    the xml file
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <slideshow>
    <area title1="10 Last updated" link1="link1.php"/>
    <area title1="special" link1="link2.php"/>
    </slideshow>
    here is the code on my scene:
    var link1:Array = new Array();
    var LINK:String;
    var url:String;
    var whoOn:Number;
    whoOn=0;
    var x:XML = new XML();
    x.ignoreWhite = true;
    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
    _root.link1.push(photos[i].attributes.link1);
    url=link1[whoOn];
    filmstrip.theUrl=url;//<<--HERE
    x.load("category.xml");
    var cbListener:Object = new Object();
    cbListener.change = function(event_obj:Object) {
    trace(select.selectedItem.label);
    if (select.selectedItem.label == "Last updated") {
    whoOn=0;
    } else if (select.selectedItem.label == "Special") {
    whoOn=1;
    url=link1[whoOn];
    filmstrip.theUrl=url; //<<-----HERE  
    select.addEventListener("change",cbListener);
    here is the code inside the movie clip "filmstrip"
    var T:XML = new XML();
    T.ignoreWhite = true;
    T.onLoad = function(xml) {
    etc etc etc }
    T.load(theUrl);    //<<---HERE it still undefined

    YESSSS . Thanks you very much Kglad it wotk i put all in a function inside the filmstrip function Tload(theUrl){etc ect}and in the root i call it like this filmstrip.Tload(theUrl);   and it works
    code in the root var link1:Array = new Array();
    var LINK:String;
    var url:String;
    var whoOn:Number;
    whoOn=0;
    var x:XML = new XML();
    x.ignoreWhite = true;
    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
    _root.link1.push(photos[i].attributes.link1);
    url=link1[whoOn];
    theUrl=url;
    filmstrip.Tload(theUrl);//<<--HERE
    x.load("category.xml");
    var cbListener:Object = new Object();
    cbListener.change = function(event_obj:Object) {
    trace(select.selectedItem.label);
    if (select.selectedItem.label == "Last updated") {
    whoOn=0;
    } else if (select.selectedItem.label == "Special") {
    whoOn=1;
    url=link1[whoOn];
    theUrl=url;
    filmstrip.Tload(theUrl);//<<-----HERE
    select.addEventListener("change",cbListener);

  • How to Change the Value Field Type of a Value Field

    Hi,
    How can I change the value field type from Currency to Quantity of a value field? I have tried to do it in KEA6. I can change the value field and its description, but not the value field type from currency to qty. If I change this config, is there any other changes that I need to make so there is no side issue of this change?

    Hi Prem,
    Once you created value field as quantity or currency, you can not change this nature of value field. Based on this, system creates lots of data and tables. For this reason system will not allow any changes in quantity or currency.
    Alternative way is to remove the old value field and  create a new value field assign to operating concern and put all your seetings.
    Please let me know if you require any clarifications.
    Thank you,
    Regards,
    Santosh
    Reward points if helpful.

  • How to change the value of Label in runtime

    Hi All,
    I want to change the value of the Label in runtime. Is it possible to change? If so then can you please let me know how to do it?
    Regards,
    Raghu

    Hi Ram,
    Check the below thread
    Dialog program - label problem
    The above thread has been updated just couple of hours ago only
    if it is Standard Screen then try using SHD0 Tcode , but this donot dynamically change the Field labels
    for more info go through Transaction Variants might be helpful,
    This demands Field Exits to be implemented
    Cheerz
    Ram

  • How to change the value of  COMPANY_NAME in "Subject:%COMPANY_NAME% Welcome to SAP Sourcing

    Hi All,
    Can some tell me How will I change the value of COMPANY_NAME which will reflect in subject of Final mail.
    For more clear picture the subjectis"
    Subject:%COMPANY_NAME% Welcome to SAP Sourcing .
    The change vlaue of COMPANY_NAME should refleat in final subject of the mail.
    Please help me in urgent.
    Thanks
    peeyush ranjan

    Hello Peeyush,
    Because I am unaware of your exact config, I'll try to provide a generic answer:
    1. Go to Setup -> Mail Configurations
    2. Identify the Mail Configuration for the Company you want to change
    3. Click on the highlighted Company link
    4. Change the highlighted Name:
    Regards,
    Bogdan

  • How to change the value in an Integer object?

    Hi,
    Is it possible to change the value that is contained in an Integer object.
    I know Integer objects are immutable. So it might not be possible to chage to value in an integer object once its been initalized a value @ the time of construction.
    Also does autoboxing and unboxing feature of 1.5 help acheive this?
    Please let me know of any other alternative
    Thanks
    Deepak

    Tried the autoboxing and unboxing feature doesnt
    help.It doesn't help in general. But in this special case it doesn't help because it doesn't anything to do with it. Do you really know what you're doing?
    So across the function its not changing the value.
    As I have created an object of Integer class and
    passed a reference of that object into the chage()
    ,So any changes should have been reflected
    acrosss method calls.?Since you let the newly created parameter-reference a point to a new Integer object: no. Why? You have two references to I(31). Then you move one reference to I(33). Why should 31 get another value?
    Does the the java compiler creates a new Integer
    object each time it does autoboxing Not necessarily. Some values are pooled. Actualy, the JVM does it. The compiler never creates any object.
    so that the value
    is lost across method calls?That's not the compiler's or the JVM's fault. It's all a misconception of yours.
    Is there any means to achieve this?What for?
    int a = 0;
    a = change(a);
    int change (final int i) {
      return i + 12;
    }Does exactly what you want, without side-effects.

  • How to change the value from one input control to another input control?

    Hi Experts,
    I want to change the value from  one input control to another input control. For Example if i change month in first tab. it should reflect in second tab also. How should we acheive through input control or some other option.
    Here I attached screen shot.Please help me for this

    Hi,
    It is not possible to have Input controll in all tabs that will be set from another .
    But There is one workaround .
    Follow the link below .
    http://davidlai101.com/blog/2013/08/13/web-intelligence-input-control-that-affects-all-tabs/

  • I want to change the value of a text and this text is called by another text value..

    i have a txt_blk1 up to txt_blk32 and i also have a txt_we  .. if the text_we.text has a value of 1 to 32  how can i change the value of txt_block0-32.text to 0.. the text we already generates its own value so i dont have to use for loop.  i've tried to use  _root["txt_blk"+txt_we.text] = 0; im using actionscript 2 .. can someone help me

    i'm sorry sir.. its just that im on a hurry and i need all the help that i can get for my thesis.. so while i havent figure out what to do for this problem.. i have to move to another problem just to save time. and another thing is i don't really know where did i go wrong..
    this is the code i've put inside the chips
    on (press) {
                        blocknum=32;
              for(i=1;i<=blocknum;i++){
                        if (this.hitTest(_root["block"+i])) {
                                            this._x=_root["block"+i]._x;
                                            this._y=_root["block"+i]._y;
                                            trace("Source "+i)
                                            _root.txt_recent.text = i;
                                            break;
                                  /*if (this._x==_root["block"+i]._x and this._y==_root["block"+i]._y) {
                                            _root.txt_recent.text = i;
                                            trace("block "+i);
                                            break;
              startDrag(this);
              //tempx=this._x;
              //tempy=this._y;
    on (release) {
              blocknum=32;
              for(i=1;i<=blocknum;i++){
                                  if (this.hitTest(_root["block"+i])) {
                                            trace("des1:"+parseInt(_root.txt_recent.text)+3 );
                                            trace("des2:"+parseInt(_root.txt_recent.text)+4 );
                                            trace("des3:"+parseInt(_root.txt_recent.text)+5 );
                                            trace("des4:"+parseInt(_root.txt_recent.text)-3 );
                                            trace("des5:"+parseInt(_root.txt_recent.text)-4 );
                                            trace("des6:"+parseInt(_root.txt_recent.text)-5 );
                                            if(i==parseInt(_root.txt_recent.text)+3 or i==parseInt(_root.txt_recent.text)+4 or
                                               i==parseInt(_root.txt_recent.text)+5 or i==parseInt(_root.txt_recent.text)-3 or
                                               i==parseInt(_root.txt_recent.text)-4 or i==parseInt(_root.txt_recent.text)-5) {
                                                      this._x=_root["block"+i]._x;
                                                      this._y=_root["block"+i]._y;
                                                      _root.txt_we.text = _root.txt_recent.text;
                                                      _root["txt_blk"+txt_we.text].text = 0;
                                                      _root.txt_recent.text = i;
                                                      break;
                                            else{
                                                      this._x=_root["block"+_root.txt_recent.text]._x;
                                                      this._y=_root["block"+_root.txt_recent.text]._y;
                                                      break;
    and this is the code i putted on the block13
    all block have corresponding txt_blk according to its number:
    onClipEvent(enterFrame) {
                        chipnum=24;
                        for(i=1;i<=chipnum;i++){
            if (this.hitTest((_root["chip"+i]))) {
                                  _root.txt_blk13.text = i;

Maybe you are looking for