September 03, 2010, 10:59:51 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Clickable banners in your application  (Read 2350 times)
0 Members and 1 Guest are viewing this topic.
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« on: January 01, 2008, 06:33:14 PM »

I've wrote a class that you can use to create clickable banners in your application(s)
For more info here: http://www.engineeringser...annerlinkclass-available/

Download the ClickableBannerLink.class here: http://www.engineeringser...ClickableBannerLink.class
Demo of how to use the class:

Code
GeSHi (inno):
  1. package engineeringserver.comUtilityPackage;
  2. public class Main {
  3. /*--------------------------------------------------------------------------
  4. //    Author List:
  5. //      deAppel                    <creator>
  6. //
  7. //    Description:
  8. //        Load a remote banner with / without a custom link
  9. //        This version requires firefox to be located in: C:\\Program Files\\Mozilla Firefox\\firefox.exe
  10. //        Ark de Appel - www.engineeringserver.com
  11. //    ----------------------------------------------------------------------*/
  12. public static void main(String[] args){
  13. String custLink = "http://www.engineeringserver.com/blog/";
  14. String custBanner ="http://img407.imageshack.us/img407/9509/javacommunityqa8.png";
  15.  
  16. ClickableBannerLink cb1 = new ClickableBannerLink();
  17. cb1.copyRight();
  18.  
  19. ClickableBannerLink cb2 = new ClickableBannerLink();
  20. cb2.setTitle("Custom banner with default link: http://www.engineeringserver.com");
  21. cb2.setBanner("http://www.engineeringserver.com/Software/dp3ymc9afw1ajv3tezsa.png");
  22.  
  23. ClickableBannerLink cb3 = new ClickableBannerLink();
  24. cb3.setTitle("Custom banner with custom link: " + custLink);
  25. cb3.setBannerWithLink(custBanner,custLink);
  26. }
  27. }
  28.  
  29.  
Created by GeSHI 1.0.7.20


Update
Here are three demo's to demonstrate that you can use custom banners, links and can place the banner anywhere in your container.

Code
GeSHi (java):
  1. package engineeringserver.comUtilityPackage;
  2. import java.awt.Color;
  3. import java.awt.Container;
  4.  
  5. import javax.swing.JButton;
  6. import javax.swing.JFrame;
  7. import javax.swing.JLabel;
  8. import javax.swing.JTextField;
  9. import javax.swing.WindowConstants;
  10.  
  11. public class Demo1 extends JFrame{
  12. /*--------------------------------------------------------------------------
  13. // Author List:
  14. //  deAppel <Creator>
  15. //
  16. // Description:
  17. // Load a remote banner with / without a custom link
  18. // This version requires firefox to be located in: C:\\Program Files\\Mozilla Firefox\\firefox.exe
  19. // Ark de Appel - www.engineeringserver.com
  20. // ----------------------------------------------------------------------*/
  21.  
  22. // http://www.engineeringserver.com/blog/2008/01/01/clickablebannerlinkclass-available/
  23. ClickableBannerLink cb2 = new ClickableBannerLink("http://www.engineeringserver.com/Software/banner.gif");
  24. JLabel nameLbl = new JLabel("Name");
  25. JTextField nameTf = new JTextField();
  26. JLabel adressLbl = new JLabel("Password");
  27. JTextField adressTf = new JTextField();
  28. JButton submitBtn = new JButton("Submit");
  29.  
  30. public static void main(String[] args){
  31. Demo1 m = new Demo1();
  32. ClickableBannerLink cb1 = new ClickableBannerLink();
  33. cb1.copyRight();
  34. m.showGui();
  35. }
  36.  
  37. public void showGui(){
  38. try {
  39. setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  40. getContentPane().setLayout(null);
  41. {
  42. setTitle("Demo1 - www.engineeringserver.com");
  43. getContentPane().add(nameLbl);
  44. nameLbl.setBounds(7, 77, 105, 21);
  45. getContentPane().add(nameTf);
  46. nameTf.setBounds(105, 77, 371, 21);
  47.  
  48. getContentPane().add(adressLbl);
  49. adressLbl.setBounds(7, 105, 105, 21);
  50. getContentPane().add(adressTf);
  51. adressTf.setBounds(105, 105, 371, 21);
  52.  
  53. getContentPane().add(submitBtn);
  54. submitBtn.setBounds(399, 133, 77, 28);
  55.  
  56. getContentPane().add(cb2);
  57. cb2.setBounds(7, 7, 475, 67);
  58. }
  59. Color bg = new Color(233, 233, 234);
  60. Container c = getContentPane();
  61. c.setBackground(bg);
  62. setLocationRelativeTo(null);
  63. setSize(500, 200);
  64. setResizable(false);
  65. setVisible(true);
  66. } catch (Exception e) {
  67. e.printStackTrace();
  68. }
  69. }
  70. }
  71.  
Created by GeSHI 1.0.7.20
Code
GeSHi (java):
  1.  
  2. package engineeringserver.comUtilityPackage;
  3.  
  4. import java.awt.Color;
  5. import java.awt.Container;
  6.  
  7. import javax.swing.JFrame;
  8. import javax.swing.WindowConstants;
  9.  
  10. public class Demo2 extends JFrame{
  11. //http://i25.photobucket.com/albums/c61/bang_bang_youredead/pwned.gif
  12. //http://www.engineeringserver.com/Software/gif_dancinggir.gif
  13. ClickableBannerLink cb2 = new ClickableBannerLink("http://i25.photobucket.com/albums/c61/bang_bang_youredead/pwned.gif"
  14. , "http://microsoft.com");
  15.  
  16.  
  17. public static void main(String[] args){
  18. Demo2 d2 = new Demo2();
  19. d2.showGui();
  20. ClickableBannerLink cb1 = new ClickableBannerLink();
  21. cb1.copyRight();
  22. }
  23.  
  24. public void showGui(){
  25. try {
  26. setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  27. getContentPane().setLayout(null);
  28. {
  29. setTitle("Demo2 - www.engineeringserver.com");
  30. getContentPane().add(cb2);
  31. cb2.setBounds(7, 7, 437,330);
  32. }
  33. Color bg = new Color(233, 233, 234);
  34. Container c = getContentPane();
  35. c.setBackground(bg);
  36. setLocationRelativeTo(null);
  37. setSize(460, 380);
  38. setResizable(false);
  39. setVisible(true);
  40. } catch (Exception e) {
  41. e.printStackTrace();
  42. }
  43. }
  44.  
  45. }
Created by GeSHI 1.0.7.20
Code
GeSHi (java):
  1.  
  2. package engineeringserver.comUtilityPackage;
  3.  
  4. import java.awt.Color;
  5. import java.awt.Container;
  6.  
  7. import javax.swing.ImageIcon;
  8. import javax.swing.JFrame;
  9. import javax.swing.JLabel;
  10. import javax.swing.WindowConstants;
  11.  
  12. public class Demo3 extends JFrame{
  13. //http://i25.photobucket.com/albums/c61/bang_bang_youredead/pwned.gif
  14. //http://www.engineeringserver.com/Software/gif_dancinggir.gif
  15. ClickableBannerLink cb2 = new ClickableBannerLink("http://www.engineeringserver.com/Software/banner.gif"
  16. , "http://microsoft.com");
  17. ClickableBannerLink cb3 = new ClickableBannerLink("http://www.engineeringserver.com/Software/stump.gif");
  18. ClickableBannerLink cb4 = new ClickableBannerLink("http://www.engineeringserver.com/Software/gif_dancinggir.gif");
  19. ClickableBannerLink cb5 = new ClickableBannerLink("http://skyscraper.fortunecity.com/thrise/338/gkan.gif",
  20. "http://dragonballz.com/");
  21.  
  22. public static void main(String[] args){
  23. Demo3 d3 = new Demo3();
  24. d3.showGui();
  25. ClickableBannerLink cb1 = new ClickableBannerLink();
  26. cb1.copyRight();
  27. }
  28.  
  29. public void showGui(){
  30. try {
  31. setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  32. getContentPane().setLayout(null);
  33. {
  34. setTitle("Demo3 - www.engineeringserver.com");
  35. getContentPane().add(cb2);
  36. cb2.setBounds(7, 280, 469, 63);
  37.  
  38. getContentPane().add(cb3);
  39. cb3.setBounds(203, 147, 133, 105);
  40.  
  41. getContentPane().add(cb4);
  42. cb4.setBounds(7, 63, 147, 112);
  43.  
  44. getContentPane().add(cb5);
  45. cb5.setBounds(336, 49, 273, 91);
  46.  
  47.  
  48.  
  49. }
  50. //Color bg = new Color(233, 233, 234);
  51. Container c = getContentPane();
  52. //c.setBackground(bg);
  53. setLocationRelativeTo(null);
  54. setSize(600, 400);
  55. setResizable(false);
  56. setVisible(true);
  57. } catch (Exception e) {
  58. e.printStackTrace();
  59. }
  60. }
  61.  
  62. }
  63.  
Created by GeSHI 1.0.7.20

Screenshot:
http://img252.imageshack.us/img252/9953/demoallyo1.png
Clickable banners in your application


Updated version 2: http://www.engineeringser...ClickableBannerLinkV2.rar , the other one i released does't work when you want to add the banner in your own container (JFrame etc..)
« Last Edit: January 02, 2008, 06:20:11 PM by HappyFace » Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Javaforums.net/forum :: A friendly community for software developers and students that want to learn Java!
« on: January 01, 2008, 06:33:14 PM »

 Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #1 on: January 02, 2008, 11:57:39 AM »

See above ^ after the update ^
« Last Edit: January 02, 2008, 05:51:44 PM by HappyFace » Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
intorseattido
Junior Member
*

Reputation: 0
Offline Offline
Posts: 1
Referrals: 0

Awards
« Reply #2 on: January 03, 2008, 01:03:36 PM »

Glory to God in highest heaven,
Who unto man His Son hath given;
While angels sing with tender mirth,
A glad new year to all the earth
We will open the book. Its pages are blank. We are going to put words on them ourselves. The book is called "Opportunity" and its first chapter is New Year's Day.
A merry Christmas to everybody! A happy New Year to the world!
Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #3 on: January 04, 2008, 08:37:30 AM »

Obsolette due old code. But it still works in case you want to use it. wink
Continue here to discuss about the reusable ads component: http://www.engineeringser...nnerlinkclass-t881.0.html

topic locked.
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
Javaforums.net/forum :: A friendly community for software developers and students that want to learn Java!
   

 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.396 seconds with 35 queries.

Google visited last this page Yesterday at 11:18:41 AM