Register and join over 40,000 other developers!
Recent Topics
-
The Game You Are Waiting For?
WendellHarper - Dec 06 2020 01:21 PM
-
Quora and Reddit Backlinks
WendellHarper - Dec 06 2020 01:14 PM
-
Delete account
pindo - Jul 23 2020 01:33 AM
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

3 replies to this topic
#1
Posted 22 May 2011 - 10:35 AM
Hello,
How is possible to make JButtons who have same ImageIcon and are consecutive to change for example image when you click one of them?
Consecutive i mean(1s are JButtons with same image):
0000000
0010000
0010010
0000010
1000010
0000000
or
0000000
0000000
1111000
0000000
0001100
0000000
How is possible to make JButtons who have same ImageIcon and are consecutive to change for example image when you click one of them?
Consecutive i mean(1s are JButtons with same image):
0000000
0010000
0010010
0000010
1000010
0000000
or
0000000
0000000
1111000
0000000
0001100
0000000
"Programming is like **. One mistake and you have to support it for the rest of your life."
-Michael Sinz
#2
Posted 26 May 2011 - 06:52 AM
?!?! I don't really get what you mean..
#3
Posted 23 February 2012 - 03:52 PM
Is that Binary ......... (~_^)

#4
Posted 23 February 2012 - 04:18 PM
You could subclass JButton with MyJButton and give it a special attribute like :
On creation of each MyJButton object, set the name of the icon. Example: icon1.gif
Then when a button is clicked, you'll have to decide whether or not consecutive buttons have the same icon name.
Example:
If you want to save some time (and NOT extend JButton), you can use JButton's setName(...) and getName() methods.
String iconName ...
On creation of each MyJButton object, set the name of the icon. Example: icon1.gif
Then when a button is clicked, you'll have to decide whether or not consecutive buttons have the same icon name.
Example:
//when a button is clicked this.changeIcon(...); for( each neighbor of clicked_button ) if( neighbor.iconName = this.iconName ) neighbor.changeIcon(...)
If you want to save some time (and NOT extend JButton), you can use JButton's setName(...) and getName() methods.
Also tagged with one or more of these keywords: jbutton
Language Forums →
Java →
Java JButton issueStarted by Jib7312, 02 Oct 2013 ![]() |
|
![]() |
||
Language Forums →
Java →
JButton event handlingStarted by Animus, 21 Jan 2013 ![]() |
|
![]() |
||
Tutorial Forums →
Java Tutorials →
JButton apocalypse: Death of the JButton - next gen guiStarted by UniBrain, 08 Jan 2013 ![]() |
|
![]() |
||
Language Forums →
Java →
(help) calling a jframe form from another jframe form by clicking on jbutton .Started by metagoth, 06 Mar 2012 ![]() |
|
![]() |
||
Tutorial Forums →
Java Tutorials →
Java GUI | JFrame,JButtons,JLabels and Layouts| :DStarted by SirJames, 23 Feb 2012 ![]() |
|
![]() |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download