I understand so much, but I know so little-swing

ok here is the code it works great, but now I want to add a scrollpane with a large text feild that a user can immplment at the touch of a button, I got this far with a lot of help, only it was too much help and now that I am on my own I am soooooo confused. Please work with me so I can really learn how to do this for myself, if that could happen life would be good. I understand so much, but I know so little it seems when it comes to writing my own code, Thank you so much, Charlie

> ok here is the code it works great, but now I want to add a scrollpane with a large text feild that a user can immplment at the touch of a button

First you have to define the scroll pane as a variable and a text area (I guess you are talking about a text area and not a text field). Then while you initialize the scroll pane add the text area to it. Do something like the following:

Now I am not sure I undertand what exactly you mean when you say "a user can implement at the touch of a button". Do you want it to open in a new window when a user clicks a button. If so then you will have to add a button in the same way you do with the rest of the buttons, and when this button is clicked load a new window. You will have to define a new JFrame and add a new JPanel to this frame. Then add your jscrollpane to this jpanel. Otherwise, if you just want it displayed with the rest of the components, just add it like you do with the rest of them.

now that I have defined , and placed the equippment, It compiles, now what more do I have to do just to see the textarea and scrol, I won;t worry about extra buttons at the moment. thank you (must implement?)

> JTextArea area;>>>Okay I think that is defined right<<<<<<<<<<<<
> JScrollPane scrollPane;>>>Okay I think that is defined right<<<<<<<<<<

Yes this is define and you do it right :)

Right from what I can see you are trying to change the layout to accomodate the text area. This might not be necessary if you want the text area to be launched in a new window at the push of a button. I am not sure what you mean in the following:

> I want to add a scrollpane with a large text feild that a user can immplment at the touch of a button

Do you want the text area to display in a new window when a use clicks a button or do you want it to display in the new window with ther rest of the buttons and text fields?

Now that I am thinking about it the simplest solution would be to define a new Panel and to add your text area to this new panel. To do this you will need:

1) define the variables like you did with text area and scroll pane

JTextArea area;
JScrollPane scrollPane;

2) Initialize these variables in the public Hw_prog1()

area = new JTextArea(5, 10); // 5 rows and 10 columns
scrollPane = new JScrollPane(area); // add the text area to the scroll pane

3) Define a new Panel where you have the rest of the panels, lets call the new panel File6

Panel File6 = new Panel();

4) In the constructor ( public Hw_prog1()) add a new FlowLayout (lets call it layout6 for convenience) and set this layout to the new panel. Then add the scroll pane to the panel. This code should be before the line setVisible(true); and after where you declared and added File5 to the pane. Then as a last step add the new panel to the pane.

Featured Post

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application.
For the purposes of this article, I will be u…

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…

How to fix incompatible JVM issue while installing Eclipse
While installing Eclipse in windows, got one error like above and unable to proceed with the installation.
This video describes how to successfully install Eclipse.
How to solve incompa…