• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 22:03
CEST 04:03
KST 11:03
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Weekly Cups (Aug 18-24): herO dethrones MaxPax6Maestros of The Game—$20k event w/ live finals in Paris31Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195
StarCraft 2
General
#2: Serral - Greatest Players of All Time #1: Maru - Greatest Players of All Time I hope balance council is prepping final balance Geoff 'iNcontroL' Robinson has passed away Aligulac - Europe takes the podium
Tourneys
Esports World Cup 2025 Sparkling Tuna Cup - Weekly Open Tournament Maestros of The Game—$20k event w/ live finals in Paris WardiTV Mondays RSL: Revival, a new crowdfunded tournament series
Strategy
Custom Maps
External Content
Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below
Brood War
General
BSL Polish World Championship 2025 20-21 September BGH Auto Balance -> http://bghmmr.eu/ ASL Season 20 Ro24 Groups Flash On His 2010 "God" Form, Mind Games, vs JD No Rain in ASL20?
Tourneys
[Megathread] Daily Proleagues [IPSL] CSLAN Review and CSLPRO Reimagined! [ASL20] Ro24 Group F [ASL20] Ro24 Group D
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1115 users

help on making a blackjack game on java!

Blogs > Dark_Luster
Post a Reply
Dark_Luster
Profile Blog Joined May 2007
Korea (South)438 Posts
May 26 2009 23:10 GMT
#1
i'm thinking of using swing.
if someone can help me on this via aim or what not
or just someone that's good at java,
i'll happily give money as a tutoring fee.
please PM me! thank you.

#1 Horangee fan
micronesia
Profile Blog Joined July 2006
United States24698 Posts
May 26 2009 23:21 GMT
#2
What is swing?

Are you planning on a full gui?
ModeratorThere are animal crackers for people and there are people crackers for animals.
Mastermind
Profile Blog Joined April 2008
Canada7096 Posts
May 26 2009 23:46 GMT
#3
On May 27 2009 08:21 micronesia wrote:
What is swing?

Are you planning on a full gui?

lol, swing is a library in Java for making GUIs.
Dark_Luster
Profile Blog Joined May 2007
Korea (South)438 Posts
May 26 2009 23:53 GMT
#4
yeah. swing is like what i need to make my game look better
instead of using objectdraw or what not.
please someone, help!
#1 Horangee fan
Archaic
Profile Blog Joined March 2008
United States4024 Posts
Last Edited: 2009-05-27 00:13:18
May 27 2009 00:03 GMT
#5
I remember going through this...
I'll say start with an array of every single card value, being 2S, 2C, 2H, 2D, 3S, etc. etc.
Then, get an image for each card, or simply create a container field to just hold the text value.
(int)(Math.random()*52) to get a random card for dealing, and have each one have a value.
i.e.
switch(getActionListener.getText().charAt(0)){
case A: int value 11; break;
case 2: int value = 2; break;
case 3: int value = 3; break;
......
case 9: int value = 9; break;
Default: int value =10;
}

if(value==11 && total+value>21)
value=1;

total+=value;


This probably isn't the whole method, but it might help you get started...

EDIT: You don't actually need the suits, at least not in blackjack. Second, you'd have to create a filter so there are no repeats.
Dark_Luster
Profile Blog Joined May 2007
Korea (South)438 Posts
May 27 2009 00:44 GMT
#6
i don't exactly know how to use images for each card.
archaic, would you know how to make this whole blackjack game byyourself?

#1 Horangee fan
King K. Rool
Profile Blog Joined May 2009
Canada4408 Posts
Last Edited: 2009-05-27 01:31:02
May 27 2009 01:29 GMT
#7
lol. I remember doing this in grade 12.

Here's some additions to what Archaic said:

I used suits since you can name your card image files to be 1_heart.jpg or whatever, and be able to get/create the correct image simply by what part of the array you're at (or 2-d array, depending on whatever clever way you want to do the array). Modular arithmetic and constants should make this pretty simple.

Also, instead of a filter you can use 2-3 collections for deck, discarded, and on table (or w/e smart way of implementing this you choose) and simply move objects around. I'd use integers, since you really only will ever need to have 5-6 card objects at max.

edit: Showing images are simple enough, you can extend JPanel or use JButton with ImageIcons I believe (or some sort of Image object, I forget). Are you a beginner to swing?
Dark_Luster
Profile Blog Joined May 2007
Korea (South)438 Posts
May 27 2009 02:15 GMT
#8
yeah. like total beginner. the only information i know is that swing will let you
use own images in the applet. =o=;;;
will someone just help me out via AIM or something?
i just have a couple of questions.
#1 Horangee fan
GHOSTCLAW
Profile Blog Joined February 2008
United States17042 Posts
May 27 2009 02:51 GMT
#9
your best bet is to keep posting questions either in this thread or to create a new blog post for each set of questions. Forums are good and allow you to see different viewpoints from many different people.
PhotographerLiquipedia. Drop me a pm if you've got questions/need help.
EsX_Raptor
Profile Blog Joined February 2008
United States2801 Posts
May 27 2009 03:48 GMT
#10
start by making the cards, the deck, the shuffler, the hands and when you're done with your tools, just put them all together.

java is an oop language and that's the way it should be done.
King K. Rool
Profile Blog Joined May 2009
Canada4408 Posts
May 27 2009 14:46 GMT
#11
Don't have aim, and I'm at work too. Just post whatever questions you have here. I look at TL every couple hours or so, and I'll try to answer whatever questions you have.
R3condite
Profile Joined August 2008
Korea (South)1541 Posts
May 27 2009 16:05 GMT
#12
On May 27 2009 09:44 Dark_Luster wrote:
i don't exactly know how to use images for each card.
archaic, would you know how to make this whole blackjack game byyourself?


u need the picture files... also is it juts the GUI u r having trouble w/ or the nonGUI version as well?
ggyo...
Dark_Luster
Profile Blog Joined May 2007
Korea (South)438 Posts
May 27 2009 20:38 GMT
#13
okay so i got the card,hand,blacjackhand,deck, and blackjackgui(this is the applet)
right now as a rough draft, the cards in my hand are shown as
just a box with (number/suit) how can i replace these with
the actual pictures of the cards?
#1 Horangee fan
h3r1n6
Profile Blog Joined September 2007
Iceland2039 Posts
Last Edited: 2009-05-27 21:32:23
May 27 2009 21:31 GMT
#14
I hate doing anything gui related in Java

It's been some time since I did that, from what I recall is that Swing has some class for Logos/Pictures, but you can also use a JButton and replace it with a picture. This way you automatically have a way to listen for clicks on that card.
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
SEL S2 Championship: Ro16
CranKy Ducklings118
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft238
SpeCial 157
RuFF_SC2 94
ProTech85
Nina 66
StarCraft: Brood War
Artosis 890
Nal_rA 279
Sharp 70
Icarus 11
Dota 2
monkeys_forever1041
League of Legends
JimRising 459
Counter-Strike
Stewie2K721
Super Smash Bros
hungrybox523
Mew2King14
Other Games
tarik_tv16181
summit1g8577
shahzam629
C9.Mang0328
ViBE235
Maynarde131
kaitlyn9
ROOTCatZ2
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• OhrlRock 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki5
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift3983
• Stunt258
Upcoming Events
The PondCast
7h 57m
WardiTV Summer Champion…
8h 57m
herO vs MaxPax
Clem vs Classic
Replay Cast
21h 57m
LiuLi Cup
1d 8h
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
1d 13h
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
Big Brain Bouts
1d 13h
Iba vs GgMaChine
TriGGeR vs Bunny
Reynor vs Classic
Serral vs Clem
BSL Team Wars
1d 16h
Team Hawk vs Team Dewalt
BSL Team Wars
1d 16h
Team Hawk vs Team Bonyth
SC Evo League
2 days
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
Maestros of the Game
2 days
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[ Show More ]
[BSL 2025] Weekly
2 days
SC Evo League
3 days
Maestros of the Game
3 days
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
3 days
Team Bonyth vs Team Sziky
BSL Team Wars
3 days
Team Dewalt vs Team Sziky
Monday Night Weeklies
4 days
Replay Cast
4 days
Sparkling Tuna Cup
5 days
Replay Cast
6 days
Liquipedia Results

Completed

CSL Season 18: Qualifier 1
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
Acropolis #4 - TS1
CSL Season 18: Qualifier 2
SEL Season 2 Championship
WardiTV Summer 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
Skyesports Masters 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.