Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By doWhile

Thread: help with new Swing component

  1. #1
    Proshitness is offline Member
    Join Date
    Oct 2011
    Posts
    28
    Rep Power
    0

    Default help with new Swing component

    Can someone give me a guide or explain the steps behind making a new Swing component (to be more precise displaying a part of an image and receiving input from mouse and keyboard),
    thanks to anyone who helps.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default Re: help with new Swing component

    Have you read the specific subjects in the Swing Tutorials?
    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)
    If not, I'd suggest to start there. There are step by step instructions and code examples to do exactly what you need. If you have read them, then I recommend asking a more specific question.
    Fubarable likes this.

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

    Default Re: help with new Swing component

    Quote Originally Posted by Proshitness View Post
    Can someone give me a guide or explain the steps behind making a new Swing component (to be more precise displaying a part of an image and receiving input from mouse and keyboard)
    Why do you need a new Swing component for something that can be done with JLabel, ImageIcon and MouseListener?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Proshitness is offline Member
    Join Date
    Oct 2011
    Posts
    28
    Rep Power
    0

    Default Re: help with new Swing component

    ok just one question...
    how am I suppose to use the image icon to display a part of an image?

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

    Default Re: help with new Swing component

    Load the image (see ImageIO)
    Create a subimage (see BufferedImage and, if you like, Graphics)
    Construct the icon (see ImageIcon)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Proshitness is offline Member
    Join Date
    Oct 2011
    Posts
    28
    Rep Power
    0

Similar Threads

  1. Replies: 26
    Last Post: 03-12-2012, 05:11 PM
  2. Replies: 8
    Last Post: 07-05-2011, 10:12 AM
  3. Which swing component is suitable for TextEditor...?
    By Dinesh_rockz in forum AWT / Swing
    Replies: 1
    Last Post: 02-23-2011, 05:41 AM
  4. swing component
    By cahyadiakbar in forum AWT / Swing
    Replies: 0
    Last Post: 09-22-2010, 10:40 AM
  5. Swing - Changing component default font
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-11-2008, 10:52 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
  •