• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating a NxN grid.

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I am new to Java AWT/Swing and have a question.
I would like to create a 10x10 grid, where each "cell" can handle mouse
events. So if I click on cell with a coord A4 then it would change color.
I was thinking of using JButtons but I want the "cells" to look more like
Excel-like in appearance. Any suggestions?? I want the end result to produce a look of a rubix cube and when clicking a cell it changes to a random color. Can JButtons accomplish this look??
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by El Durango:
Can JButtons accomplish this look??


They can look like anything you want them to look like. Consult the
Custom Painting trail of the Swing Tutorial. However, for your purposes, you could probably acheive an excel-like gui by using JLabels and setting a boarder on them. The Swing Tutorial can help you with that too.
 
El Durango
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the links.
I found out both JLabels and JButtons can accomplish what I need.
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic