Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default How to implement a push-pin component

    I hope this is the right forum for this question. My apologies if not. I am wondering if anyone knows how to implement a pushpin component, i.e. a toggle switch that has the appearance of a push pin that you see on a lot of applications.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default

    JToggleButton with setIcon / setPressedIcon?

    db

  3. #3
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default

    Oh I see. So I would create an icon instead of using the default button image?

  4. #4
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default

    I created an icon and selected it for the "icon" property. I see it in the "Preview Design". But when I actually run the program, there is nothing there. What else do I need to do?

    Never mind, I figured it out. The image can not be a .icon or .bmp
    Last edited by madroadbiker; 05-19-2011 at 05:41 PM.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default

    Looking forward to the time when you'll want to package your program and all its resources in an executable jar, go through this tutorial now.
    How to Use Icons (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

    db

  6. #6
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default

    Thanks for the tutorial link. A bit off the topic but since you mentioned it, doesn't launch4j do the java to .exe sufficiently? Is there a better method?

Similar Threads

  1. How to call a class when push Button?
    By Lund01 in forum New To Java
    Replies: 3
    Last Post: 03-17-2011, 06:38 AM
  2. A little push using Semaphones
    By kendel in forum New To Java
    Replies: 0
    Last Post: 03-08-2011, 02:23 PM
  3. Stack (push/pop/top)
    By sehudson in forum New To Java
    Replies: 1
    Last Post: 03-08-2011, 02:40 AM
  4. Stack push/pop/peek operations
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:03 AM
  5. SWT push button
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-31-2007, 01:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •