Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (789)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JPanel - JList -> JScrollPane  (Read 3830 times)
0 Members and 1 Guest are viewing this topic.
Offline Phibedy

Senior Devvie

Medals: 9

« Posted 2012-06-22 23:33:09 »

we got a list, that is to big, to be shown at once. That´s why we would like to replace it with a ScrollPane, but the ScrollPane never appears.
Could it be, that it isn´t possible use "this.setLayout(null);" in the construktor, some say, that I have to usw a Layout Manager, is that true?
best regards Phibedy
Offline Eli Delventhal

JGO Kernel

Medals: 42
Projects: 11
Exp: 10 years

Game Engineer

« Reply #1 - Posted 2012-06-22 23:43:28 »

You're right you can't do that. Just don't call setLayout() at all and it will use the default of a FlowLayout.

See my work:
OTC Software
Offline ReBirth
« Reply #2 - Posted 2012-06-23 08:39:31 »

By never appears, you mean the scroll bar? update the policies for both horizontal and vertical bars.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Phibedy

Senior Devvie

Medals: 9

« Reply #3 - Posted 2012-06-23 08:48:23 »

thx for for answers Smiley
@ Eli Delventhal: If I remove "setLayout" the buttons are centered on the top of the Jpanel  Huh
If I dont use Layout.set(null), what else should I do, to be able to set buttons on coordinates?

@ ReBirth: Yes I mean the scrollbar.
Offline ReBirth
« Reply #4 - Posted 2012-06-23 09:01:45 »


"scroller" is JScrollPane. You can set it to alwasy show.

Offline Phibedy

Senior Devvie

Medals: 9

« Reply #5 - Posted 2012-06-23 09:24:11 »

Thx, works great  Grin

But I got another problem:

public static Icon getIcon(String path) {
      Icon icon = null;
      icon = new ImageIcon(path);
      return icon;

At first, I call the method getIcon, after that, I replace the Icon in the directory and call the method again, but it always returns the old Icon not the one that I pasted.
If I don´t call it at first and replace the Icon in the directory and then call the method, it returns the new Icon that I pasted.
best regards Phibedy
Offline CaptainJester

JGO Knight

Medals: 12
Projects: 2
Exp: 14 years

Make it work; make it better.

« Reply #6 - Posted 2012-06-23 11:20:13 »

You have to call invalidate() on your JFrame. The docs say to call validate() but it never works for me.

Pages: [1]
  ignore  |  Print  

hadezbladez (2595 views)
2018-11-16 13:46:03

hadezbladez (928 views)
2018-11-16 13:41:33

hadezbladez (2549 views)
2018-11-16 13:35:35

hadezbladez (499 views)
2018-11-16 13:32:03

EgonOlsen (3675 views)
2018-06-10 19:43:48

EgonOlsen (4028 views)
2018-06-10 19:43:44

EgonOlsen (2439 views)
2018-06-10 19:43:20

DesertCoockie (3246 views)
2018-05-13 18:23:11

nelsongames (3292 views)
2018-04-24 18:15:36

nelsongames (4262 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!