java - JScrollPane always clears my Panel -


Hi .. I have a JPNL, and in this content I added some other custom panels and give them the location etc. So now I've added JScrollPane to ContentPanel and whenever I scroll it down, it clears my content panel, but the panel is still there but it is not visible ...

How can I see them again?

To add a panel to the content panel, this is my code. There are some settings for X, Y, J space because I have a fixed window.

  Private zeros reload contentpanel () {int x = -200, y = 0, j = 1, line = 4; Event Panel Panel = Faucet; Int i; (I = 0; i & lt; this.images.size (); i ++) {panel = new event panel (this.images.get (i) .getAbsolutePath (), this.images.get (i ) .getName ()); Panel.setLocation (x + (j * 200), y); J ++; If (I == line) {x = -200; Y = = 205; J = 1; Line + = 5; } This.contentPanel.add (panel); } This.repaint (); }  

thanks

It seems that you have a layout manager properly .

this.setLayout (New Flow Layout ()) After creating your Jeffram (I'm guessing inside my constructor) add the following (for example): );

This will definitely not be the best layout manager for what you are trying to do, but bypassing the displayed component add to stop the call Will give

You will also need to read more about it

Also, it is not really appropriate to extend the jaffrum. This is a better practice to treat Jeffrey as a member of your class, like all other components.


Comments