Zolf
asked on
cannot type anthing in JTextField
hello there,
I have a JDialog form in which i cannot type anthing.what could be the reason
cheers
zolf
Please post code
ASKER
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class Frm_add_edit_city extends JDialog
{
JButton JBUpdate = new JButton();
JButton JBReset = new JButton();
JButton JBCancel = new JButton();
JLabel JLPic1 = new JLabel();
JLabel JLBanner = new JLabel("Please fill required fields.");
JLabel JLCEngName = new JLabel("City Name:");
JLabel JLCFarName = new JLabel("City Name:");
JLabel JLCPrefix = new JLabel("City Prefix:");
JTextField JTFCEngName = new JTextField();
JTextField JTFCFarName = new JTextField();
JTextField JTFCPrefix = new JTextField();
Dimension screen = Toolkit.getDefaultToolkit(
boolean ADDING_STATE;
public Frm_add_edit_city(boolean ADD_STATE,JFrame OwnerForm)
{
super(OwnerForm,true);
ADDING_STATE = ADD_STATE;
if(ADD_STATE==true)
{
JLPic1.setIcon(new ImageIcon("images/bNew.png
setTitle("Add New City");
JBUpdate.setText("Update")
}
else
{
}
JPanel JPContainer = new JPanel();
JPContainer.setLayout(null
//-- Add the JLPic1
JLPic1.setBounds(5,5,32,32
JPContainer.add(JLPic1);
//-- Add the JLBanner
JLBanner.setBounds(55,5,26
JLBanner.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLBanner);
//******************** Start adding of input field
//-- Add Id Input Field
JLCEngName.setBounds(5,50,
JLCEngName.setFont(new Font("Dialog",Font.PLAIN,1
JTFCEngName.setBounds(110,
JTFCEngName.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLCEngName
JPContainer.add(JTFCEngNam
//-- Add Name Input Field
JLCFarName.setBounds(5,72,
JLCFarName.setFont(new Font("Dialog",Font.PLAIN,1
JTFCFarName.setBounds(110,
JTFCFarName.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLCFarName
JPContainer.add(JTFCFarNam
//-- Add Contact Name Input Field
JLCPrefix.setBounds(5,94,1
JLCPrefix.setFont(new Font("Dialog",Font.PLAIN,1
JTFCPrefix.setBounds(110,9
JTFCPrefix.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLCPrefix)
JPContainer.add(JTFCPrefix
//******************** End adding of input field
//-- Add the JBUpdate 5,318,105,25
JBUpdate.setBounds(5,135,1
JBUpdate.setFont(new Font("Dialog", Font.PLAIN, 12));
JBUpdate.setMnemonic(KeyEv
JBUpdate.addActionListener
JBUpdate.setActionCommand(
JPContainer.add(JBUpdate);
//-- Add the JBReset
JBReset.setBounds(112,135,
JBReset.setFont(new Font("Dialog", Font.PLAIN, 12));
JBReset.setMnemonic(KeyEve
JBReset.addActionListener(
JBReset.setActionCommand("
JPContainer.add(JBReset);
//-- Add the JBCancel
JBCancel.setBounds(212,135
JBCancel.setFont(new Font("Dialog", Font.PLAIN, 12));
JBCancel.setMnemonic(KeyEv
JBCancel.addActionListener
JBCancel.setActionCommand(
JPContainer.add(JBCancel);
getContentPane().add(JPCon
setSize(325,200);
setResizable(false);
setLocation((screen.width - 325)/2,((screen.height-383
}
private boolean RequiredFieldEmpty()
{
if(JTFCEngName.getText().e
{
JOptionPane.showMessageDia
JTFCEngName.requestFocus()
return true;
}
else
{
return false;
}
}
private void clearFields()
{
JTFCEngName.setText("");
JTFCFarName.setText("");
JTFCPrefix.setText("");
}
ActionListener JBActionListener = new ActionListener(){
public void actionPerformed(ActionEven
{
String srcObj = e.getActionCommand();
if(srcObj=="update")
{
if(RequiredFieldEmpty()==f
{
if(ADDING_STATE == true)
{
}
else
{
}
}
}else if(srcObj=="reset"){
clearFields();
}else if(srcObj=="cancel"){
dispose();
}
}
};
}
ASKER
what is EDT
your textfield could be not editable (like objects told) or it could be not enabled.
txtField.setEditable(true) ;
txtField.setEnabled(true);
...
Or you create another JDialog in modal mode and not display it.
Bye, Giant.
txtField.setEditable(true)
txtField.setEnabled(true);
...
Or you create another JDialog in modal mode and not display it.
Bye, Giant.
the problems more likely to be with how you use the dialog, rather than in the dialog itself.
> what is EDT
Event Dispatch Thread
The thread that handles gui processing
> if(srcObj=="update")
btw, that (and others) should use equals() not ==
> what is EDT
Event Dispatch Thread
The thread that handles gui processing
> if(srcObj=="update")
btw, that (and others) should use equals() not ==
ASKER
thanks for that equals but how do i solve my textfield problem
hard to say without seeing how your using the dialog
ASKER
I call that class Frm_add_edit_city(true,JFP arentFrame ,"",""); in another class which extends JInternalFrame
private JToolBar createToolbar()
{
final JToolBar tb = new JToolBar();
//.. create tool bar buttons
JButton b1 = new JButton("Add City", testIcon);
b1.setFocusPainted(false);
b1.setToolTipText("Test toolbar button : icon + text");
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven t ae)
{
JDialog JDAdd = new Frm_add_edit_city(true,JFP arentFrame ,"","");
JDAdd.show();
}
});
private JToolBar createToolbar()
{
final JToolBar tb = new JToolBar();
//.. create tool bar buttons
JButton b1 = new JButton("Add City", testIcon);
b1.setFocusPainted(false);
b1.setToolTipText("Test toolbar button : icon + text");
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven
{
JDialog JDAdd = new Frm_add_edit_city(true,JFP
JDAdd.show();
}
});
Try setting modal to false when you create the JDIalog
Try
JDialog JDAdd = new Frm_add_edit_city(true,JFP arentFrame ,"","");
JDAdd.setModal(false);
JDAdd.setVisible(true);
JDialog JDAdd = new Frm_add_edit_city(true,JFP
JDAdd.setModal(false);
JDAdd.setVisible(true);
I see:
Frm_add_edit_city(true,JFP arentFrame ,"","");
but no method in your class with 4 parameters
only 2:
Frm_add_edit_city(boolean ADD_STATE,JFrame OwnerForm)
In this manner the method used to create is the super (without your settings)
Frm_add_edit_city(true,JFP
but no method in your class with 4 parameters
only 2:
Frm_add_edit_city(boolean ADD_STATE,JFrame OwnerForm)
In this manner the method used to create is the super (without your settings)
That can't be what you're running, you don't have a match ctor.
ASKER
no,does not help changing to
JDAdd.setModal(false);
JDAdd.setVisible(true);
gaints2 that is correct in my code it takes 4 parameters, i pasted wrong
public Frm_add_edit_city(boolean ADD_STATE,JFrame OwnerForm,String srcCN,String srcSQL)
{
You have:
>super(OwnerForm,true);
try to use:
super(OwnerForm,false);
instead.
>super(OwnerForm,true);
try to use:
super(OwnerForm,false);
instead.
ASKER
in my main class which extends JFrame and uses
//Set up the GUI.
desktop = new JDesktopPane();
setContentPane(desktop);
then when u select a menuitem this methids gets called:
protected void createFrame()
{
frame = new MyInternalFrame(this); //this class extends JInternalFrame
frame.setVisible(true); //necessary as of 1.3
desktop.add(frame);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoEx
}
then in this class MyInternalFrame I have a toolbar with this
private JToolBar createToolbar()
{
final JToolBar tb = new JToolBar();
//.. create tool bar buttons
JButton b1 = new JButton("Add City", testIcon);
b1.setFocusPainted(false);
b1.setToolTipText("Test toolbar button : icon + text");
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven
{
////JOptionPane.showConfir
JDialog JDAdd = new Frm_add_edit_city(true,JFP
JDAdd.setModal(false);
JDAdd.setVisible(true);
//JDAdd.show();
}
});
tb.add(b1);
In your Frm_add_edit_city class you have:
>super(OwnerForm,true);
try to specify "false" instead.
>super(OwnerForm,true);
try to specify "false" instead.
> JFParentFrame
where does that get defined?
what happens if you pass null there instead?
where does that get defined?
what happens if you pass null there instead?
ASKER
it does not help gaint
>super(OwnerForm,true);
try to specify "false" instead.
ASKER
objects i defined a JFrame in TreeTableInternalFrame
JFrame JFParentFrame;
public TreeTableInternalFrame(fin
{
super("InternalFrame",
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
Dimension deskSize = frame.getDesktop().getSize
setSize((int)deskSize.getW
//Set the window's location.
setLocation(10, 10);
JFParentFrame = frame;
I'd suggest simplifying things by stripping it down to the basics until you can pinpoint whats causing it.
for example, remove all the fields from the dialog except a single text field.
and try creating the dialog from different sections in your code, and see if that makes a difference.
Once you can create a simple example that works (or doesn't), it'll be a lot easier to pinpoint the cause.
for example, remove all the fields from the dialog except a single text field.
and try creating the dialog from different sections in your code, and see if that makes a difference.
Once you can create a simple example that works (or doesn't), it'll be a lot easier to pinpoint the cause.
To debug try to use a JOptionPane in the createToolBar method instead of JDialog:
String text = JOptionPane.showInputDialo g(JFParent Frame, "Debugging");
Do you can modify the textField in this OptionPanel?
String text = JOptionPane.showInputDialo
Do you can modify the textField in this OptionPanel?
ASKER
no even using JOptionPane i cannot type anything.
String text = JOptionPane.showInputDialo
i have got a feeling i am messing with the JFParentFrame,i am not calling the corrent window
what happens if you pass null instead of parent frame?
ASKER
when i do this too
String text = JOptionPane.showInputDialo
i cannot type
try this:
EventQueue.invokeLater(new Runnable()
{
public void run()
{
String text = JOptionPane.showInputDialo g(null, "Debugging");
}
});
EventQueue.invokeLater(new
{
public void run()
{
String text = JOptionPane.showInputDialo
}
});
ASKER
Does not help.on simple forms i have made it to work,but when i try to complicate it,it does not work.
ASKER
do you want me to send the complete code for the 3 class
Does the dialog work by itself, ie if you just create one directly from main
ASKER
I tried this in main()
EventQueue.invokeLater(new
{
public void run()
{
String text = JOptionPane.showInputDialo
}
});
but still i cannot type in it.....
Do you have other jTextField in your application? Do you can change them?
If in the main you cannot do (like you told before) seems a GUI system problem.
If in the main you cannot do (like you told before) seems a GUI system problem.
ASKER
i dont have any JTextField in my application.
i dont understand.i cannot also start from scratch becasue i have written loads of code to do other things.
please help
ASKER
but when i enter default values in the JTextfield like this
JTextfield jtf = new JTextfield("hello there");
and i see the result in the JDialog.but i cannot again delete it.
I have a doubt. Are you sure the code you are using is the one you are debugging?
If you use something like Eclipse, JBuilder, NetBeans,... try to debug step by step and see if you pass from the code we are commenting.
>do you want me to send the complete code for the 3 class
As last chance, do you can publish the code on some site we can see it? (here the thread can became really big)
If you use something like Eclipse, JBuilder, NetBeans,... try to debug step by step and see if you pass from the code we are commenting.
>do you want me to send the complete code for the 3 class
As last chance, do you can publish the code on some site we can see it? (here the thread can became really big)
ASKER
i use eclipse.i will try to debug
thank you all guys for your help
ASKER
hello there,
when i try to debug the application.when it reaches line
public Frm_add_edit_city(boolean ADD_STATE,final JFrame OwnerForm,String srcCN,String srcSQL)
{
super(OwnerForm,true);
the eclipse degugger shows this when initialising the above class:what does it mean is it correct
Frm_add_edit_city[dialog0,
ASKER
this is the three classes which i am using,i have only shown the bits which is related to that Textfield.please help
public class PictMenuFrameDemo extends JFrame
implements ActionListener {
public static final String DEFAULT_PROPERTY_FILE = "db.properties";
JDesktopPane desktop;
MyInternalFrame frame = null;
TreeTableInternalFrame tframe = null;
private ImageIcon menuOneIm = null;
private ImageIcon menuTwoIm = null;
private ImageIcon menuTreeIm = null;
private ImageIcon smenuOneIm = null;
private ImageIcon smenuTwoIm = null;
Connection connect = null;
public PictMenuFrameDemo() {
super("PictMenuFrameDemo")
//Make the big window be indented 50 pixels from each edge
//of the screen.
int inset = 50;
Dimension screenSize = Toolkit.getDefaultToolkit(
setBounds(inset, inset,
screenSize.width - inset*2,
screenSize.height - inset*2);
//Set up the GUI.
desktop = new JDesktopPane(); //a specialized layered pane
createFrame();
setContentPane(desktop);
// create menu
setJMenuBar(createMenuBar(
// create db connection
initConnection();
//Make dragging a little faster but perhaps uglier.
desktop.setDragMode(JDeskt
}
protected void createFrame()
{
tframe = new TreeTableInternalFrame(thi
tframe.setVisible(true);
desktop.add(tframe);
try {
tframe.setSelected(true);
} catch (java.beans.PropertyVetoEx
}
----------------------
public class TreeTableInternalFrame extends JInternalFrame
{
private ImageIcon testIcon;
private ImageIcon cityIcon;
private ImageIcon coIcon;
private ImageIcon dslamIcon;
private ImageIcon linecardIcon;
private DefaultMutableTreeNode lastSelectedNode;
private JTree tree;
private JTable cityTable;
private JTable coTable;
private JTable dslamTable;
private JTable linecardTable;
private JTabbedPane tabPane;
private JPopupMenu treePopupMenu;
private Vector cityCollect;
private Vector coCollect;
private Vector dslamCollect;
private Vector linecardCollect;
PictMenuFrameDemo JFParentFrame;
public TreeTableInternalFrame(fin
{
super("InternalFrame",
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
Dimension deskSize = frame.getDesktop().getSize
setSize((int)deskSize.getW
//Set the window's location.
setLocation(10, 10);
JFParentFrame = frame;
//get database result in to collections
initCollections(frame.getD
//set layout for frame content panel
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
//create toolbar
JToolBar toolbar = createToolbar(); //this method is described below where i call a JDialog
cp.add(toolbar, BorderLayout.NORTH);
// create popup menu for tree
treePopupMenu = createPopupMenu();
// create tree element
createAndInitTree();
JScrollPane jsp = new JScrollPane(tree, JScrollPane.VERTICAL_SCROL
JScrollPane.HORIZONTAL_SCR
//create tab panel
tabPane = new JTabbedPane();
JPanel cityPane = new JPanel(new BorderLayout());
createCityTable();
JScrollPane jspCity = new JScrollPane(cityTable, JScrollPane.VERTICAL_SCROL
JScrollPane.HORIZONTAL_SCR
cityPane.add(jspCity, BorderLayout.CENTER);
tabPane.addTab(" City ", cityIcon, cityPane);
JPanel coPane = new JPanel(new BorderLayout());
createCoTable();
JScrollPane jspCo = new JScrollPane(coTable, JScrollPane.VERTICAL_SCROL
JScrollPane.HORIZONTAL_SCR
coPane.add(jspCo, BorderLayout.CENTER);
tabPane.addTab(" Co ", coIcon, coPane);
JPanel dslamPane = new JPanel(new BorderLayout());
createDslamTable();
JScrollPane jspDslam = new JScrollPane(dslamTable, JScrollPane.VERTICAL_SCROL
JScrollPane.HORIZONTAL_SCR
dslamPane.add(jspDslam, BorderLayout.CENTER);
tabPane.addTab(" Dslam ", dslamIcon, dslamPane);
JPanel linecardPane = new JPanel(new BorderLayout());
createlinecardTable();
JScrollPane jspLinecard = new JScrollPane(linecardTable,
JScrollPane.HORIZONTAL_SCR
linecardPane.add(jspLineca
tabPane.addTab(" Linecard ", linecardIcon, linecardPane);
}
private JToolBar createToolbar()
{
final JToolBar tb = new JToolBar();
//.. create tool bar buttons
JButton b1 = new JButton("Add City", testIcon);
b1.setFocusPainted(false);
b1.setToolTipText("Test toolbar button : icon + text");
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven
{
////JOptionPane.showConfir
//String text = JOptionPane.showInputDialo
/*EventQueue.invokeLater(n
{
public void run()
{
String text = JOptionPane.showInputDialo
}
});*/
JDialog JDAdd = new Frm_add_edit_city(true,JFP
JDAdd.setModal(false);
JDAdd.show();
}
});
tb.add(b1);
JButton b2 = new JButton(testIcon);
b2.setFocusPainted(false);
b2.setToolTipText("Test toolbar button : only icon");
b2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven
//JOptionPane.showConfirmD
String text = JOptionPane.showInputDialo
}
});
tb.add(b2);
JButton b3 = new JButton("Button 3");
b3.setFocusPainted(false);
b3.setToolTipText("Test toolbar button : only text");
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEven
JOptionPane.showConfirmDia
}
});
tb.add(b3);
// only for set same button size
int h1 = b1.getPreferredSize().heig
int h2 = b2.getPreferredSize().heig
int h = Math.max(h1, h2);
int h3 = b3.getPreferredSize().heig
h = Math.max(h, h3);
b1.setPreferredSize(new Dimension(b1.getPreferredS
b1.setMaximumSize(new Dimension(b1.getPreferredS
b2.setPreferredSize(new Dimension(b2.getPreferredS
b2.setMaximumSize(new Dimension(b2.getPreferredS
b3.setPreferredSize(new Dimension(b3.getPreferredS
b3.setMaximumSize(new Dimension(b3.getPreferredS
//----------------
tb.setFloatable(false);
return tb;
}
--------------------------
public class Frm_add_edit_city extends JDialog
{
JButton JBUpdate = new JButton(new ImageIcon("images/save.png
JButton JBReset = new JButton("Reset",new ImageIcon("images/reset.pn
JButton JBCancel = new JButton("Cancel",new ImageIcon("images/cancel.p
JLabel JLPic1 = new JLabel();
JLabel JLBanner = new JLabel("Please fill-up all the required fields.");
JLabel JLCEngName = new JLabel("City Name:");
JLabel JLCFarName = new JLabel("City Name:");
JLabel JLCPrefix = new JLabel("City Prefix:");
JTextField JTFCEngName = new JTextField("asds");
JTextField JTFCFarName = new JTextField();
JTextField JTFCPrefix = new JTextField();
Connection cnAEC;
Statement stAEC;
ResultSet rsAEC;
Dimension screen = Toolkit.getDefaultToolkit(
boolean ADDING_STATE;
public Frm_add_edit_city(boolean ADD_STATE,final JFrame OwnerForm,String srcCN,String srcSQL)
{
super(OwnerForm,true);
////cnAEC = srcCN;
ADDING_STATE = ADD_STATE;
/*try{
stAEC = cnAEC.createStatement(Resu
}catch( SQLException sqlEx){
System.out.println("\nERRO
}*/
//JCBCountry = clsPublicMethods.fillCombo
JTFCEngName.setEditable(tr
JTFCFarName.setEnabled(tru
if(ADD_STATE==true)
{
JLPic1.setIcon(new ImageIcon("images/bNew.png
setTitle("Add New City");
JBUpdate.setText("Update")
}
else
{
}
JPanel JPContainer = new JPanel();
JPContainer.setLayout(null
//-- Add the JLPic1
JLPic1.setBounds(5,5,32,32
JPContainer.add(JLPic1);
//-- Add the JLBanner
JLBanner.setBounds(55,5,26
JLBanner.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLBanner);
//******************** Start adding of input field
//-- Add Id Input Field
JLCEngName.setBounds(5,50,
JLCEngName.setFont(new Font("Dialog",Font.PLAIN,1
JTFCEngName.setBounds(110,
JTFCEngName.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLCEngName
JPContainer.add(JTFCEngNam
//-- Add Name Input Field
JLCFarName.setBounds(5,72,
JLCFarName.setFont(new Font("Dialog",Font.PLAIN,1
JTFCFarName.setBounds(110,
JTFCFarName.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLCFarName
JPContainer.add(JTFCFarNam
//-- Add Contact Name Input Field
JLCPrefix.setBounds(5,94,1
JLCPrefix.setFont(new Font("Dialog",Font.PLAIN,1
JTFCPrefix.setBounds(110,9
JTFCPrefix.setFont(new Font("Dialog",Font.PLAIN,1
JPContainer.add(JLCPrefix)
JPContainer.add(JTFCPrefix
//******************** End adding of input field
//-- Add the JBUpdate 5,318,105,25
JBUpdate.setBounds(5,135,1
JBUpdate.setFont(new Font("Dialog", Font.PLAIN, 12));
JBUpdate.setMnemonic(KeyEv
JBUpdate.addActionListener
JBUpdate.setActionCommand(
JPContainer.add(JBUpdate);
//-- Add the JBReset
JBReset.setBounds(112,135,
JBReset.setFont(new Font("Dialog", Font.PLAIN, 12));
JBReset.setMnemonic(KeyEve
JBReset.addActionListener(
JBReset.setActionCommand("
JPContainer.add(JBReset);
//-- Add the JBCancel
JBCancel.setBounds(212,135
JBCancel.setFont(new Font("Dialog", Font.PLAIN, 12));
JBCancel.setMnemonic(KeyEv
JBCancel.addActionListener
JBCancel.setActionCommand(
JPContainer.add(JBCancel);
getContentPane().add(JPCon
setSize(325,200);
setResizable(false);
setLocation((screen.width - 325)/2,((screen.height-383
}
I try to compile the code you posted but I do not find:
JBActionListener
MyInternalFrame
PictMenuFrameDemo has many many method not declared
JBActionListener
MyInternalFrame
PictMenuFrameDemo has many many method not declared
I comment many things and try your code. It goes, permits editing JTextField.
I use Eclipse 2.1.2 and java Version 1.4.2_06
I use Eclipse 2.1.2 and java Version 1.4.2_06
ASKER
Hi gaints2,
i just posted all the class that are related to opening the Jdialog form.
i am using eclipse Version: 3.1.2 and java 1.4.2
so did it work for you??i mean can you type inside those JTextfield inside the JDialog
>so did it work for you??i mean can you type inside those JTextfield inside the JDialog
Yes!
I commented the connection, the action listener not needed, and so on. It permits edit the JTextFields inside the JDialog (city,...)
Yes!
I commented the connection, the action listener not needed, and so on. It permits edit the JTextFields inside the JDialog (city,...)
ASKER
in which class did you comment those stuffs
These are the line commented:
PictMenuFrameDemo:
implements ActionListener
MyInternalFrame frame = null; and substitue by JFrame frame = null;
setJMenuBar(createMenuBar( ));
initConnection();
TreeTableInternalFrame:
Dimension deskSize = frame.getDesktop().getSize ();
setSize((int) deskSize.getWidth() - 20, (int) deskSize.getHeight() - 20); and substitued by setSize((int) 500, (int) 600);
initCollections(frame.getD BConnectio n());
treePopupMenu = createPopupMenu();
createAndInitTree();
createCityTable();
createCoTable();
createDslamTable();
createlinecardTable();
Frm_add_edit_city:
JBUpdate.addActionListener (JBActionL istener);
JBReset.addActionListener( JBActionLi stener);
JBCancel.addActionListener (JBActionL istener);
I think your problem could be find in the definition of MyInternalFrame.
Other commented lines aren't so critical for displaying.
Could you see it? OR try to comment it's creation in PictMenuFrameDemo as I did. See if something changes.
PictMenuFrameDemo:
implements ActionListener
MyInternalFrame frame = null; and substitue by JFrame frame = null;
setJMenuBar(createMenuBar(
initConnection();
TreeTableInternalFrame:
Dimension deskSize = frame.getDesktop().getSize
setSize((int) deskSize.getWidth() - 20, (int) deskSize.getHeight() - 20); and substitued by setSize((int) 500, (int) 600);
initCollections(frame.getD
treePopupMenu = createPopupMenu();
createAndInitTree();
createCityTable();
createCoTable();
createDslamTable();
createlinecardTable();
Frm_add_edit_city:
JBUpdate.addActionListener
JBReset.addActionListener(
JBCancel.addActionListener
I think your problem could be find in the definition of MyInternalFrame.
Other commented lines aren't so critical for displaying.
Could you see it? OR try to comment it's creation in PictMenuFrameDemo as I did. See if something changes.
ASKER
actually i am not using this class MyInternalFrame anywere in my code.
ASKER
i have deleted the class to make sure it is not causing the trouble. but i still could not type in the JDialog.
tell me something
PictMenuFrameDemo JFParentFrame;
public TreeTableInternalFrame(fin
{
JFParentFrame = frame;
is it same as
JFrame JFParentFrame;
public FrmCustomer(Connection srcCN,JFrame getParentFrame)
{
JFParentFrame = getParentFrame;
ASKER
is it same as
JFrame JFParentFrame;
public TreeTableInternalFrame(JFr
{
JFParentFrame = getParentFrame;
Yes they are the same if PictMenuFrameDemo and JFrame are the same.
>actually i am not using this class MyInternalFrame anywere in my code.
>i have deleted the class to make sure it is not causing the trouble.
Even in the code you have substitued all the MyInternalFrame occurrence with JFrame?
Even if you delete the class, the rebuild process rebuild all classes if they are (used) in the project.
>i have deleted the class to make sure it is not causing the trouble.
Even in the code you have substitued all the MyInternalFrame occurrence with JFrame?
Even if you delete the class, the rebuild process rebuild all classes if they are (used) in the project.
ASKER
PictMenuFrameDemo extends JFrame
>PictMenuFrameDemo extends JFrame
Ok. So the two pieces of code before are the same.
Ok. So the two pieces of code before are the same.
ASKER
i dont know what to do,i have wriiten so much code and now getting this problem is fustrating.
can i send you my complete application so you can have a look.
please help
I believe you cannot. I'll ask to moderator. Wait please.
ASKER
ok
ASKER
i have sent,could you please let me know when you receive it.
ASKER
did you receive it
Downloaded and running.
I have not the DB you are referring so I must comment all the connection you are doing.
The problem is on clicking Add New. Isn't it?
I have not the DB you are referring so I must comment all the connection you are doing.
The problem is on clicking Add New. Isn't it?
ASKER
yes
ASKER
no,when you click add new a JInternal frame opens. then when you clcik on the button in the JInternalFrame
ASKER
the buton in the JInternalframe is called add city,the jdialog opens with JTextfield in it
right! It not permit to change. I search for the bug.
ASKER
thanks mate
Find it!
In SimplePictMenu you have dispatchKeyEvent method.
If it return everytime true, the change on the windows aren't executed out.
So now I'm trying to find a way to bypass this check.
In SimplePictMenu you have dispatchKeyEvent method.
If it return everytime true, the change on the windows aren't executed out.
So now I'm trying to find a way to bypass this check.
ASKER
appreciate your help,i was workin gon this bit since yesterday.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
appreciate your help.can you please tell me what was causing the error.
You declared the SimplePictMenu class dispatching the keyEvent of your application.
So when a key was pressed the control passes from this method (dispatchKeyEvent).
In this method you simply create a new KeyEvent and return everytime true, so the GUI see this true as "the Event is terminated". In this manner the event is stopped at that point and do not go to the thread make change to your GUI.
Now the true is returned only when a doAction() is called. In all the other cases it return false and the Event can be finished by the other handler.
Hope I explain the reason in a comphrensible way.
So when a key was pressed the control passes from this method (dispatchKeyEvent).
In this method you simply create a new KeyEvent and return everytime true, so the GUI see this true as "the Event is terminated". In this manner the event is stopped at that point and do not go to the thread make change to your GUI.
Now the true is returned only when a doAction() is called. In all the other cases it return false and the Event can be finished by the other handler.
Hope I explain the reason in a comphrensible way.
:-)
Tx accepting.
Bye, Giant.
Tx accepting.
Bye, Giant.
Venabili,
allready done. I posted the modified code and the comment to better understand (I hope) the reason of modify.
:-)
P.S. This new feature (public space to share the java file) is a really good thing. Thanks.
allready done. I posted the modified code and the comment to better understand (I hope) the reason of modify.
:-)
P.S. This new feature (public space to share the java file) is a really good thing. Thanks.
Yes but:
1. This does not mean that the relevant parts should not be posted in the question as above. The questions should be really worth reading without downloading a bunch of files...
2. If we speak for one class, it is still better to post it here directly :)
1. This does not mean that the relevant parts should not be posted in the question as above. The questions should be really worth reading without downloading a bunch of files...
2. If we speak for one class, it is still better to post it here directly :)
ASKER
Thanks very much guys for your help.
or the EDT is blocked.