• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing components and browsers

 
Jerome McKenzie
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm presently doing a chess project for school where users can log on to my site, i came up with a way of making each square a Panel(using FlowLayout()) and then add a JLabel with the chess piece as it's icon...the problem is browsers do not support swing...What do I do??? (anyone, everyone please help!!!)
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have JRE installed?
Plus, why don't you use GridLayout? A chess boards looks like a table already (8X8), so with GridLayout it's going to be easier to manipulate.
- Alex
 
Jerome McKenzie
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...i should have explained myself better...
i have a large Panel which has a gridlayout all 64 panels are layed out in 8X8 formation each panel uses flowlayout (so the label automatically finds the center of the panel it occupies)
problems:
----------
1 - One of the requirements of the projects is that I must show the user the illusion of a "drag n' drop" (how am i going to do that one?)
2 - I need a kind of plug-in for the browser so the applet and have Swing components

- URGENT AS HELL, Jerry
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The plugin is at the sun site.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To create the illusion of drag and drop, this is a rough summary of what I did. I created a mouseListener on my panel. Then when I pressed on the mousebutton, as long as It was pressed, I would remove(label), add(label), panel.repaint() with the bounds of the label being set to my mouse pointer. So I would also get the pointer position of x and y on the grid. It worked pretty well actually.
------------------
Happy Coding,
Gregg Bolinger
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic