Java Swing create a Text Area for the Output -
Hello, I'm really new to Java programming and I've created a Java menu with a few options as well as the file selector. So in my IDE, I print the file name and path of the file that the user chooses. Is there any way that I can create text fields on my frame so that the user can see the actual output? This is how my file selector looks and how I output the results on my console.
Jeffile Chupper Selector = new Jeffile Closer (); Filef = new file ("C: /"); File named; File namespace; Chooser.setCurrentDirectory (F); Chooser.showOpenDialog (zero); Chooser.setDialogTitle ("Choose File to Play"); Chooser.setApproveButtonText ("Play"); Named = chooser.getCurrentDirectory (); Namepath = chooser.getSelectedFile (); System.out.print ("The name of the directory is" + nomir.getName ()); System.out.print ("The name of the path is" + namepath.getAbsolutePath ()); And here is the code for my menu
JFrame frame = new jframe ("menu"); Frame.setVisible (true); frame.setSize (600,400); Frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); // Add menu bar with item JMURbar bar = Browse new JMURR; Frame.setJMenuBar (bar); JMMenu Search = New JMNU ("Browse"); Bar.add (search); I have a text area so that I can output the path to the filename and my frame.
See, it explains the usage of JTextArea. It is very simple and you can do a lot of things using it. This will definitely work for you
Comments
Post a Comment