7 Replies - 5968 Views - Last Post: 26 January 2014 - 02:03 PM Rate Topic: -----

#1 incredibleX   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 212
  • Joined: 01-November 13

Light Glow effect on JButton

Posted 26 January 2014 - 06:28 AM

How can i create a Light Glow effect when hover on JButton?
When i put my cursor on JButton It shoukd give a glow or spotlight you can say?
How can i do it?
I'm trying to create an app a filthy rich one and i want this effect in my program.
Please Help.
Is This A Good Question/Topic? 0
  • +

Replies To: Light Glow effect on JButton

#2 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3744
  • View blog
  • Posts: 17,121
  • Joined: 20-September 08

Re: Light Glow effect on JButton

Posted 26 January 2014 - 07:09 AM

Using THIS is probably the easiest option
Was This Post Helpful? 0
  • +
  • -

#3 incredibleX   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 212
  • Joined: 01-November 13

Re: Light Glow effect on JButton

Posted 26 January 2014 - 07:20 AM

Bro How can i implement it can i please get a simple example code?
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Light Glow effect on JButton

Posted 26 January 2014 - 07:40 AM

There is an example here that uses a timer. I don't know how effective this solution is, but it is simple/simplistic.
Was This Post Helpful? 1
  • +
  • -

#5 incredibleX   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 212
  • Joined: 01-November 13

Re: Light Glow effect on JButton

Posted 26 January 2014 - 08:22 AM

In the Example the author is using some package, which is unavailable to me.
Plus the example is incomplete.
Reason: Some pages are omitted from the book.
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Light Glow effect on JButton

Posted 26 January 2014 - 08:56 AM

The essential code you need is on that page, but if you are not able to understand and adopt it then you'll have to keep searching for something you can copy and paste.
Was This Post Helpful? 0
  • +
  • -

#7 incredibleX   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 212
  • Joined: 01-November 13

Re: Light Glow effect on JButton

Posted 26 January 2014 - 09:04 AM

I'm Not searching something to copy paste, instead i'm looking for something understandable to me.
Was This Post Helpful? 0
  • +
  • -

#8 incredibleX   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 212
  • Joined: 01-November 13

Re: Light Glow effect on JButton

Posted 26 January 2014 - 02:03 PM

I've tried adding nimbus laf to it. Although Nimbus gives my button a bit glow but that's not what i want.
I want some light on it.
Here is my code

import javax.swing.*;
import javax.swing.plaf.nimbus.NimbusLookAndFeel;

public class Button{  
 
	private static JFrame f=new JFrame("Glowing Button");
	private JButton b=new JButton("Glow");
	
	Button(){
		f.setSize(600,600);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setLayout(null);
		
		b.setBounds(200,150,200,200);
		b.setOpaque(true);
		
		f.add(B)/>;
		f.setVisible(true);
	}
	public static void main(String args[]){

		try { 
        UIManager.setLookAndFeel(new NimbusLookAndFeel());
        SwingUtilities.updateComponentTreeUI(f); 
       
  } catch(Exception e) { 
        e.printStackTrace(); 
  }
		new Button();
	}
}  


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1