Added: 2 years ago
From: thenewboston
Views: 44,041
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (55)

Sign In or Sign Up now to post a comment!
  • Never mind earlier post. Forgot to import javax.swing.event.*.

  • list.addListSelectionListener(­... is throwing an error.

    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: javax.swing.JList.addListSelec­tionListener at JavaTutorial.Gui.init(Gui.java­:29) at JavaTutorial.Tutorial.main(Tut­orial.java:18)

    Have checked the code and the imports and all looks good. Help?

  • getContentPane().setBackground­(colors[list.getSelectedIndex(­)]);

    this is the line which u " cant see" put this in ;)

  • @princekhurana14 thanks Greg :D

  • great tutorials for beginners..

  • You could to learn list (Nodos, punteros)... respond me please!!!!

  • woo 38 thousand :D Our graduating class is diminishing!

  • list.setVisibleRowCount(colorn­ames.length);

    he he got here little smarter thx to you bucky ;D <3

  • RED WHITE AND BLUE...AND BLACK

  • If you think purple is cool, add "magenta" to the two lists ;-)

  • list.setVisibleRowCount(colorN­ames.length);

    I used colorNames.length instead of counting the number of items I put in the parameters. Cause if you have like 12345 different items it would be a pain to count them out!

  • @fbakersj

    The problem with that is that your screen wouldn't fit all of the items in. If you had 10000 items in the list then you would still only set the visible row count to a number like 20 so that people could only see that many at a time but have the choice to scroll down further.

  • @fbakersj nice alternative haha i didnt think of that, thanks! :D

  • careful not to hold left mouse and move around the list cuz u can get seizures

  • After the beginner tutorials im goin to game devolopment thx bucky!

  • Comment removed

  • Best Program you have taught us! Soo COOL!

  • Who knows what does it do?

    new JScrollPane(list);

  • @elmira1986elmira

    I think it makes the list Scrollable (try it out by setting setVisibleRowCount(2) - you'll get a scroll bar)

    I'm just wondering why I can't put there JList

  • Wow. It is very hard to find a very good Java tutorial online without download for free online. I really thank you for this because this is very helpful and a great source to learn Java from.

  • WHY YOUTUBE WHY DO YOU KEEP F*CKING YOUR WEBSITE UP

  • bucky, the world is getting smart!!

  • the thing i didnt understand is how you did

    list.addListSelectionListener(­new ListSelectionListener(){method­{getContent....}});

    you made a method inside the list.addListSelectionListener(­new method)..... how does that work?

  • @xxmannylee1992xx He made an anonymous class.

  • @xxmannylee1992xx He explained it a few vids back Check them out hope this helps

  • Lol "In People language..."

  • i hope this year I become a java programmer I can see a very good explaining I just need time to study your tutorials thanks ...so much actually this is not me I mean the user name , my user name is lmozabeth

  • i hope this year I become a java programmer I can see a very good explaining I just need time to study your tutorials thanks ...so much

  • Amazing tutorials! I sometimes wish they would be a little more than 9 minutes.

    Thanks for sharing!

  • เดี๋ยวผมได้เรียนแน่นอนครับ  ปี1

  • @nikjaza yes

  • woah, go fullscreen with the java program you just made, hold down the mouse, and scroll up and down over the colors, it freaks out your eyes, try it!

  • the line num from 21 -24, i can't understood , plz anyone help me!

  • @athimaddy apparently in JList there is a method getSelectedIndex() which returns the position number of what is selected (counting from the top of the list -> 0,1,2,3...) so Bucky used that number(read: method) to automatically chose a color from "colors" array

  • hi mate.. one good thing bout ur tutorials apart from  many is u make things look easy..

  • fantastic!

  • realy thanks very much

  • hi Bucky, how many compilers are installed in your BRAIN LOL>

    peace your one of the best :P!

  • Awesome man...

  • Change this in line.no17!  list.setVisibleRowCount(1); this is cool!

  • Nice tutorial, however it could be a bit more precise. For example the 1 through 4, if it's an array it starts at 0... still good job and much needed.

  • very cool...and understandable..subscribed

  • I think you're going to put MIT out of business.

    : ]

  • I had problems seeing the end of get....Index line and had to figure out how it looks. But more importantly if the values in both arrays were congruent. If you click a color and the colors didn't match it would display the wrong color.

  • good

  • Dear bucky ..i never really understand java till i saw your vid's man..i was majoring in CS back in 1999 and i dropped out (u know 3rd world universities) but after 10 years u resurrected the the love of programming in me .

    u were able to make me understand what professors couldn't possibly get in my head .

    RESPECT

    N.B: can you tell where u were educated ?

    coz i'm planning to study in the US ; and your advise on this issue is highly appreciated ...keep up the good work :P

  • Awesome!

  • @kh503335 I studied Chemical Engineering in a 3rd World Country Uni, and my professors made me hate the degree i was working for and i never developed any respect for them!

    In my final year, I wanted to know how programs worked - so i came looking for Java tutorials. I found thenewboston - he got my respect within a week. Three months later, i wish i had gone into computer science with Bucky as my professor!

    Bucky, you da man!

  • @kh503335 did he response?

  • @kh503335 he dropped out of university, he's a self taught man.

  • Great vid keep 'em coming.

  • Wow finally after 71 tutorials done ! Man you put alot of effort onto your videos awesome job !

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more