Reputation: 37
When the user types the text into the field and presses create. The JFrame title changes to updated user title. The JFrame title variable is in --Window.java-- and the user input is in --NewFileBox.java--. I don't know how you would implement the changes from separate files.
Upvotes: 1
Views: 2455
Reputation: 66
Try
JOptionPane.showOptionDialog(null, nfb.inputs, "Create", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new Object[]{}, null);
Arg:
*"Create" --> User define title of Dialog Box
Upvotes: 5
Reputation: 124
Change title on window. Okay so as your code stands the only place you can edit the title for your JFrame is inside the Window() Constructor try this.
public class Window implements ActionListener{
public String title = "Autumn Engine";
JFrame f;
...
public Window(){
f = new JFrame(title);
...
{
...
}
By doing that you can target the JFrame
anywhere in the Window class allowing you to make adjustments to it where ever. Also it will allow you to target the JFrame
from the Window()
ie window.f.setTitle(title)
Remove OK Button I looked and this question has been asked before here is a link JOptionPane Without Button
Upvotes: 0