How to open a new frame from an existing frame?
I had create a form of student data.It has Grade,submitt,exit.
Now I want when I click Grades there should be a new window that asks me what grade should be entered.
The new grades should be calculated and show inside the old window.
My problem is I am not getting how to open a new window when the grade button hasbeen clicked so,that new grades can be entered.
Are you talking about Swing?
JFrame frame = new JFrame("Grades");
frame.setVisible(true);
Maybe I don't understand your question? Are you asking how to open a window or how to handle a button event?
http://java.sun.com/docs/books/tutorial/uiswing/events/index.html
you can have a series of JOptionPanes which ask you for each piece of data,
for example:
String studentID = JOptionPAne.showInputDialog(null, "enter student Id");
//more of the same until you have each piece of data you want
//do whatever you were going to do with the studentId string
thats the simplest way of doing!
> thats the simplest way of doing!
No, that is the laziest way of doing it.
How annoyed would the user gets if a new dialog popped up for each field they had to enter?
Instead use a JDialog or something similar to present all the fields to the user at once. You can make it a modal dialog if you need it to be.