Results 1 to 3 of 3
  1. #1
    tim8w is offline Member
    Join Date
    Jan 2013
    Posts
    14
    Rep Power
    0

    Cool JDialog Gradient Background

    Hi,
    I have created an AboutDialog that extends JDialog. I would like to have it have a Gradient Background, but when I add the paintCompnent function and try and call super.paintComponent, the complier is telling me that "The method paintComponent(Graphics) is undefined for the type JDialog". Any ideas how to get JDialog to have a Gradient Background? Or is it just not supported?

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

    Default Re: JDialog Gradient Background

    Read the API for JDialog (and also for the RootPaneContainer interface it implements) and you'll understand where you have to do the custom painting.

    This tutorial may also help: Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)

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

  3. #3
    tim8w is offline Member
    Join Date
    Jan 2013
    Posts
    14
    Rep Power
    0

    Default Re: JDialog Gradient Background

    db,
    I must be dense. I couldn't tell where to put the paint code from either the API or the example...

Similar Threads

  1. Gradient of an image
    By Sapan in forum Forum Lobby
    Replies: 1
    Last Post: 04-08-2011, 03:03 PM
  2. Gradient Filter problem
    By alanchan in forum Java 2D
    Replies: 0
    Last Post: 11-24-2010, 08:50 AM
  3. JComponent gradient background
    By snipered in forum AWT / Swing
    Replies: 0
    Last Post: 12-30-2008, 12:38 AM
  4. CLabel Gradient Background
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-11-2008, 04:39 PM
  5. Color gradient
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-21-2008, 08:50 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
  •