A Java Swing Question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: A Java Swing Question

Hybrid View

  1. #1
    Dixon Guest

    A Java Swing Question


    Hi Pro Developer,

    I have a professional question about JFC pluggable look
    and feel. I need help on understanding how to create my own
    custom UI component, I've looked at the APIs but I'm not
    too good at writing code by looking at the APIs what I need
    from you is simple sample of a least how to create a custom
    button UI in which you can put a .gif button in place of
    the standard "gray" color java button. and then I need to
    know how you call that class that you already wrote from
    another program and use that class and asign it to
    different button graphic.. like that .gif or .jpg files.
    I will be very happy if you help me on this professional
    question my project is a GUI messanger using graphics
    instead of the standard java colors.

    Thanks in advance,
    and I hope to here from you soon.



  2. #2
    Paul Clapham Guest

    Re: A Java Swing Question

    I don't think it's really necessary to create your own component for this,
    when JButton already has a constructor that takes an Icon (a picture) as its
    parameter. All you need to know is how to make a GIF file into an icon, and
    that's

    frame.getToolkit().getImage("your.gif")

    where "frame" is the JFrame your components are being put into.

    But your question "how you call that class... from another program"
    indicates that you don't know Java yet. You don't call a class, you create
    objects of a class and call their methods. You might find it better to work
    on a less technical project while you are learning, then come back to Swing
    once you understand object oriented programming better.

    PC2

    Dixon <Dixtigger@yahoo.com> wrote in message news:3a7052e8@news.devx.com...
    >
    > Hi Pro Developer,
    >
    > I have a professional question about JFC pluggable look
    > and feel. I need help on understanding how to create my own
    > custom UI component, I've looked at the APIs but I'm not
    > too good at writing code by looking at the APIs what I need
    > from you is simple sample of a least how to create a custom
    > button UI in which you can put a .gif button in place of
    > the standard "gray" color java button. and then I need to
    > know how you call that class that you already wrote from
    > another program and use that class and asign it to
    > different button graphic.. like that .gif or .jpg files.
    > I will be very happy if you help me on this professional
    > question my project is a GUI messanger using graphics
    > instead of the standard java colors.
    >
    > Thanks in advance,
    > and I hope to here from you soon.
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center