java.lang.IllegalArgumentException: Identifier not found
I'm completely confused as to what is happening here. There error is when i make the super call in the constructor. What is happening?
My error is: java.lang.IllegalArgumentException: Identifier not found
Code java:
public class ButtonEditor extends DefaultCellEditor
{
protected JButton button;
private String label;
private boolean isPushed;
public ButtonEditor(JCheckBox checkBox)
{
super(checkBox);
System.out.println("Check1");
button = new JButton();
button.setOpaque(true);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
fireEditingStopped();
}
});
System.out.println("Check2");
}
public Component getTableCellEditorComponent(JTable table, Object value,boolean isSelected, int row, int column)
{
if (isSelected)
{
button.setForeground(table.getSelectionForeground());
button.setBackground(table.getSelectionBackground());
}
else
{
button.setForeground(table.getForeground());
button.setBackground(table.getBackground());
}
label = (value ==null) ? "" : value.toString();
button.setText( label );
isPushed = true; return button;
}
public Object getCellEditorValue()
{
if (isPushed)
{
System.out.println(label + ": Ouch!");
}
isPushed = false;
return new String( label ) ;
}
public boolean stopCellEditing()
{
isPushed = false;
return super.stopCellEditing();
}
protected void fireEditingStopped()
{
super.fireEditingStopped();
}
}
Re: java.lang.IllegalArgumentException: Identifier not found
Please post the full text of the error message. You have left off important info.
Please copy full text of error message and paste it here. Here is a sample:
Code :
TestSorts.java:138: cannot find symbol
symbol : variable var
location: class TestSorts
var = 2;
^
Re: java.lang.IllegalArgumentException: Identifier not found
It was a runtime. That was all I got...
Re: java.lang.IllegalArgumentException: Identifier not found
No stack trace? Only one line?
Is your code suppressing the stack trace?
Can you change it to give a stack trace?
Re: java.lang.IllegalArgumentException: Identifier not found
When I ran your code with a small test program I wrote I didn't receive an error:
Code :
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class TestButtonEditor
{
public static void main(String[] args)
{
ButtonEditor be = new ButtonEditor(new JCheckBox());
}
}
This was my output:
Check1
Check2
Hunter
Re: java.lang.IllegalArgumentException: Identifier not found
I've actually moved past this, but for curiosity reasons, my call to ButtonEditor was:
Code java:
table.getColumn(3).setCellEditor(new ButtonEditor(new JCheckBox()));
Re: java.lang.IllegalArgumentException: Identifier not found
Is your problem now solved?
Re: java.lang.IllegalArgumentException: Identifier not found
Quote:
Originally Posted by
Norm
Is your problem now solved?
Not solved, more ignored. I took my code on a detour. However, I am still curious as to what would have caused the IllegalArgumentException at runtime. Might run into it again sometime in the future and I'd like to know how to deal with it.
Re: java.lang.IllegalArgumentException: Identifier not found
I never saw the stack trace. Was there one or did your code suppress it?
Re: java.lang.IllegalArgumentException: Identifier not found
I have the same Problem with my Table. I want to insert a JCombobox in the row in the left, but i also recieve an IllegalArgumentException. Here is the code of the Class TableGUI:
Code :
ComboBoxModel cbModel = new DefaultComboBoxModel(Article.articleType.values());
JComboBox cbx_auswahl = new JComboBox(cbModel);
cbx_auswahl.setModel(cbModel);
TableAdapter adapter = new TableAdapter(dataVector);
tbl_content = new JTable(adapter);
tbl_content.setRowHeight(30);
tbl_content.setAutoCreateRowSorter(true);
tbl_content.getTableHeader().setReorderingAllowed(false);
tbl_content.getColumn(TableAdapter.AT_COLUMN).setCellEditor(new ComboBoxEditor(cbx_auswahl));
c.add(tbl_content);
now here is the Exception:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Identifier not found
at javax.swing.table.DefaultTableColumnModel.getColum nIndex(Unknown Source)
at javax.swing.JTable.getColumn(Unknown Source)
at GUI_JAXB.TableGUI.<init>(TableGUI.java:75)
at GUI_JAXB.ImportGUI.actionPerformed(ImportGUI.java: 105)
at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
...