Can a JButton be unclickable but not disabled?
The reason I ask this I want the button to be basically disabled but not to lose it's color properties. I have a simple tic tac toe game but I want the X's and O's to be colored, if I set the buttons to disabled they lose their color.
Thanks,
Mike
I'm bored, so here
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Test extends JFrame implements ActionListener {
JPanel pnl = new JPanel(new GridLayout(3,3));
JButton [] btn = new JButton[9];
int player = 0;
Test () {
setBounds(200,200,300,300);
for(int i = 0; i< btn.length; i++)
btn[i] = new JButton(i+"");
btn.addActionListener(this);
pnl.add(btn[i]);
getContentPane().add(pnl);
setVisible(true);
public static void main(String[] args) throws Exception {
Test t = new Test();
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
JButton b = (JButton)e.getSource();
if(b.isSelected())
return;
else
b.setSelected(true);
b.setBackground(getColor(player));
player = player == 0 ? 1 : 0;
private Color getColor(int player)
if(player == 1)
return Color.BLUE;
else
return Color.RED;
~Tim
Similar Messages
-
How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions? I am fimilar with changing the setting for all network partitions(defaults write com.apple.desktopservices DSDontWriteNetworkStores true), but that is undesirable when I connect my laptop to my home network. A preferable solution would be where I could control the writing of these files based on disk format (NTFS vs HFS+).
Go to MacUpdate or CNET Downloads and search for ds_store. There are numerous utilities for preventing them from being transferred to Windows systems.
-
Using multiple desktops with a 4 finger swipe on a Mac Book Pro running Lion- is there a way that I can allow Safari open on several but not all?? Looks like I can set it for one but not others. All, one, or nothing
Hey Eric,
Thanks for taking the time. Unfortunately no that does not solve it. Same as swipe it will get me there and it will show separate programs spaced out. The issue I am having is that all my open word files are bunched up in a pile on top of each other. I can see the edges of each one but I want them to be separated from each other enough that I can visually identify what file is what.
Again, thanks for trying, it is appreciated. -
On imac 10.6.8 using current version of Aperture. How can I access the Aperture Library on my external hard drive that I use with time machine for backup? I can only access the application but not the library..
Go into Time Machine (the program not the bundle on the extrnal disk) and using Time Machine's browser go to the Folder where the library lives. You could look in the library bundle in Time Machine but that won't really tell you much,
If you want to make sure it truely has backed up your library you will need to restore it and open the restored library with Aperture.
If all this still has you confused you need to read up on Time Machine in order to get a feel for how it works, for what it is doing and for how to restore files from it. -
Why can I sync a movie but not TV shows on my nano (7th gen)?
I am using iTunes 11.0 and can sync a movie (Miracle on 34th Street) to my new ipod nano 7th gen but when I try a TV Show (a Planet Earth HD episode) or even a brief video clip taken with my camara I am told that such an action is not permitted on this ipod. So why can I sync a movie but not TV shows on my nano (7th gen)? Thank you.
Before you can sync video files, it must be converted into a format compatible with ipod. If you can’t sync a video convert it by doing the following:
In iTunes, select the video you want to convert. Do one of the following then sync again after:
1) Choose File > Create New Version > Create iPod or iPhone Version.
2) Choose File > Create New Version > Create iPad or Apple TV Version.
I hope this works. -
LR 5.6 on Mac desktop all of a sudden will not read any card from any reader but will work on my laptop. I can work on previous images but not import new ones. Even if I create a catalog on laptop and import to my desktop on a thumb drive, the images are only accessible as long as the thumb drive is inserted.
Sounds like you may need to repair the Disk Permissions on your drive where your images are stored.
-
help, are you having the same problem? iPad 2 calendar, can't get the month of March, can get days in March, but not month view. Any suggestions, thank u.
Hi melbernai - not sure if you've solved this problem yet. I had the exact same problem recently with my 2nd Gen iPod Nano. I solved it yesterday by simply updating iTunes to the most recent version, after which I could get rid of the register screen. The only other thing I needed to do to add my custom playlists was select "Manually manage music" on the screen for my iPod, since it had been in an automatic synching mode since the problem occurred.
-
Is there a way to repeat an activity in the calendar monthly on the same day, i.e., the 2nd Wednesday of each month? ( I can repeat on the date but not the day of the month.)
Not with the stock calendars app.
-
I am at capacity How can I free up space but not delete music
My Ipad is at 55.4 gb used 24 gb in music alone. 2.7 gb available so can't do anything Ipad shuts itself down and won't let me open mail, use facebook, safari.How can I free up space but not delete songs in library
Unless you are attempting to download a sizable file, 2.7 GB should be more than enough to continue fucntioning. Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps from the tray BEFORE doing the reset.
-
my ipad is freez...it only show a fome screen. but i can turn off my ipad but not shut down...and i went to my computer and i go to itune. i try to restart my ipad but it say turn off your.find my iphone..but i cant my ipad is freezing.can help me plz.
Have you tried to reset it? Hold down the sleep and home keys for about 20 seconds and see if you can get it to reboot.
-
my ipad is freez...it only show a fome screen. but i can turn off my ipad but not shut down...and i went to my computer and i go to itune. i try to restart my ipad but it say turn off your.find my iphone..but i cant my ipad is freezing.can help me plz.plz help me.................thx u
Option 1
Try force iPad into Recovery Mode. Follow step 1 to 6 very closely.
http://support.apple.com/kb/HT1808
Note: You need to be patient and repeat the above many times to recover your iPad -
Why can I receive text messages but not send?
Why can I receive text messages but not send. This has been happening for about 10 hours.
Thanks for the response. Must be smart phones. My daughter has a dumb phone and she can send out. I tried deleting my text messages on the Verizon website, but they won’t delete. It must be on their end. Chat line was busy forever, until they shut it down.
Jennifer -
¿Dear Sirs,
I can create with "Photoshop Elements 12", a PDF file of several pages?.
I can create a "pdf" file, but not of several pages.
Thank you
Valentín UriarteThis is the Photoshop Elements forum.
If you are using Acrobat, ask Here:
Acrobat -
I have a new Macbook Pro and an old Canon ip Pixma 8500. I have downloaded the software from Canon but my printer settings will still not register it. Looks like I can print a colour calendar but not a letter!
Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps. -
Where can I download lightroom 6, but NOT LR 6 CC? Only the new LR6 without any cloud features. On the dowloadsite I find only CC-downloads.
Thanks
MartinHi Martin,
Please follow the steps given in the article.
Adobe Photoshop Lightroom Help | Serialize Lightroom CC trial to activate as Lightroom 6
Hope this helps.
Regards,
Sumit Singh
Maybe you are looking for
-
When I orignally installed iTunes current update, and tried to move about the devices iTunes would crash. I uninstalled it, then reinstalled it. It seems to be stable, however as before I am not finding all of my TUnes and Movies on all my devices.
-
Hi i want cvs for solaris 9.I want to integrate it with JDev. I could not find it anywhere.I can only find it for solaris 8 & 10 Please forward me the link from where i can download it. Thanks
-
Im getting invalid coulmn index...any suggestions?...thanx in advance public static int[] getListSummary(UserDataVO userData) throws Exception { Connection connection = null; PreparedStatement pstmt = null; ResultSet resultSet = null
-
Building An Application (GUI)
I need to create an application that make use of Swing to do up the GUI. Can anyone recommend a software that helps to do to it? Preferably it would be easy to use, drag 'n drop, freeware? I don't have much time to learn to use a new IDE. Also, in th
-
LB in front of IWA IIS servers
Hi, We have configured IWA authentication scheme with OAM 10g. For this, we are using 2 instances of IIS 7 server. Both of these IIS servers are on 2 different physical machines and have been configured for IWA. Now to achieve HA, we have deployed a