#Help Moving a Text Area and advice on Scrollbars

32 messages · Page 1 of 1 (latest)

shrewd wing
#

I am a new Java user and have been working on a password manager project. I have completed functionality for reading data and storing it, but I need help creating my output window that displays all the user info.

I am mainly struggling with moving a text area. I experimented with creating rigid areas but I am at a loss and just need some guidance. My title label is supposed to go above my text area.

Attached is an image of my current output window(1st), an image of my final goal example output window(2nd), and the snippet of code for the output window creation(3rd).

normal warrenBOT
#

This post has been reserved for your question.

Hey @shrewd wing! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

shrewd wing
#

Here is the code:

onyx basin
#

but I need help creating my output window that displays all the user info.
Which part of that is the problem?

shrewd wing
#

Need to move the text area below the Title Label. Here is the current output window:

#

Using a rigid area I can move both together lower on the screen, but I want to have the JLabel (Company Username Pass) above the text area.

onyx basin
#

With title label, you mean the Company/Username/Passwprd line?

shrewd wing
#

Yes

#

Sorry for the confusion there.

onyx basin
#

Where did you add textArea to the panel?

#

oh, via scroll

#
        panel.add(scroll);
        panel.add(titleLabel);
#

maybe try reversing the order of these operations?

shrewd wing
#

That fixed it! I was confused why panel.add(textArea); broke everything. I didn't know that scroll was connected to the textArea. So I only need to add scroll instead of both things.

#

Last issue I have is the scrollbar. I want the text area to stay at a certain size and the scrollbar display the data at the bottom. Here is an image of my professor's example:

#

Here is where mine is at:

onyx basin
#

maybe try restricting the size of the scroll pane?

shrewd wing
#

I didn't even know you could do that.

onyx basin
shrewd wing
#

Thank you so much for all the help. Everything is working now.

normal warrenBOT
shrewd wing
#

and once I want to append the textArea I just use .append right?

onyx basin
#

I guess

normal warrenBOT
shrewd wing
#

Subbed

#

Close