swing - Java graphics object and scrolling - easiest way to do it? -


I'm working on a game that has a chatbox, but despite looking into it, for the right thing) , I can not understand the best way to create a custom 'scroll panel' for a 'text box' draw on graphics This awesome painting presentation type shows what I'm trying to do:

< Img src = "https://i.stack.imgur.com/b4v2I.png" alt = "Enter image details here">

If I have more on this Can give information you have, please ask me the best way I can explain how it is.

EDIT: OK, to give more information on it, JPNL uses the game to display the game. It has been done through override of Paint Component in JPNL. I'm not sure that with this, it is possible to add a new component to attract it. If that is the case, then it can work, I should be able to place it in a particular place. If you have to add a new component to do this, then it will work and I will feel like a stupid.

option 1) Use JTextArea organized in JScrollPane. Option 2) Use a JList held in an JScrollPane JTextArea is a little easier, but JList works better and is more responsive if it needs to keep a lot of data Tutorial can be found here:

Note that after the quick scan of the swing tutorial you have a lot of this question Could be quick reply, and for future reference, I have included a link for them .


Edit
Consider these options for a better solution:

  • Remember that your GUI is a Can use more than JPNL, and in fact, often many .
  • Just use your drawing JPanel for drawing, nothing more.
  • In other words, not do any other components.
  • Make it border layout. Place the ceant in another zeppel, which, of course, uses a border layout.
  • Place your other non-graphic control structures in JPanels that come from the same border -Jonnell described above. In this way your control structures, such as your JSCLPAN, are displayed in the GUI, but are not much and the drawing covers JP Penal.
  • By using the main JPNL in your top-level window, or if you need a more complex GUI in any other JPNL, then add your border layout.
  • You use these sub-JPNs to make your own layout, so that there is a pleasant scene in the whole GUI which is easy to change and enhance.

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -