Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 15-04-2009
Member
 
Join Date: Apr 2009
Posts: 55
JButton does not work in java swing

I am working on Java swings. I have a case wherein I have a JButton present inside a JTable.

I have also written a ButtonRenderer for the same.The problem is that whenever I place i click on the JButton created it does not open anything,the window remains still and nothing happens.

How could I get rid of this.please help.
Reply With Quote
  #2  
Old 15-04-2009
Member
 
Join Date: Oct 2008
Posts: 167
Re: JButton does not work in java swing

Code:
button.setOpaque(false);
button.setFocusPainted(false);
button.setBorderPainted(false);
button.setContentAreaFilled(false);
setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
setBorder(null) might work, but there is a bug sun explaining it is by design that the UI set a border on a component unless the client sets a non-null border which does not implement the UIResource interface.

Rather than the JDK itself setting the border to an EmptyBorder when null is passed in, the clients should set an EmptyBorder themselves (a very easy workaround). That way there is no confusion about who's doing what in the code.
Reply With Quote
  #3  
Old 15-04-2009
Member
 
Join Date: Jan 2009
Posts: 140
Re: JButton does not work in java swing

It is on the frame but you are not working with it. You need to call the setVisible(false) to the Frame which is shown and not to the just created one.
Reply With Quote
  #4  
Old 15-04-2009
Member
 
Join Date: Jan 2009
Posts: 143
Re: JButton does not work in java swing

You need to write a cell editor in addition to the cell renderer. If you're not using a cell editor for the cell with the button, I don't see how that could be.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "JButton does not work in java swing"
Thread Thread Starter Forum Replies Last Post
How to handle JButton Click Event in Java Swing Kungfu Pandey Software Development 3 20-01-2012 12:13 PM
JButton to send command to Java console Fox28 Software Development 6 21-07-2010 10:03 AM
Print in java using Swing Sheenas Software Development 3 18-11-2009 09:50 AM
Java Swing and MySQL shelton141 Software Development 1 22-09-2009 08:50 AM
Java swing help with repaint() grudge Software Development 4 23-07-2009 03:41 PM


All times are GMT +5.5. The time now is 03:24 PM.