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.
Asked
Active
Viewed 2,251 times
1
-
I'd love to vote up, but I don't have the required repetition. – kerperlo Jan 29 '15 at 03:22
-
You can mark their answers as correct if you are asking questions they answer. – Cody Anderson Jan 29 '15 at 03:24
-
I just did that on my questions. Thank you for helping me Hovercraft and Cody! – kerperlo Jan 29 '15 at 03:26
2 Answers
5
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

Kanagaraj
- 66
- 2
0
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

Community
- 1
- 1

Cody Anderson
- 126
- 6
-
I already tried that. For Change title - I would like for the projectName be the "newTitle". As of right now, when it's first opened the title would be blank. Until the user clicks on File -> new, then enters a name and hits create. The title changes to whatever the user input in the field. As of Remove - the only thing I heard of was using JDialog. How would I implement that into my code? I saw examples of JDialog, but still stumped. – kerperlo Jan 29 '15 at 03:36
-
-
JFrame. I think. It has the title. If not, then the window. I may be mistaken. Excuse me for my lack of knowledge. – kerperlo Jan 29 '15 at 03:47
-
-
Then it's the JFrame. Thank you. Anyway to change that? Any ideas? If not, I thank you for the support. – kerperlo Jan 29 '15 at 03:56
-
When are you trying to set the title I don't see it in your code? – Cody Anderson Jan 29 '15 at 03:57
-
That's the question. I don't know how. I had an initial though, but that didn't work out. I had in --NewFileBox-- on the function (actionPerformed), the code was "name = (projectName.getText());" but that didn't work. – kerperlo Jan 29 '15 at 04:00
-
This looks like a new question. I recommend creating a new question and asking just one question with precise detail on what is happening and what you are wanting to have happen. This question seems to be based around changing the title from an action listener. – Cody Anderson Jan 29 '15 at 04:25