Results 1 to 5 of 5

Thread: Changing the Color Theme in Java

  1. #1
    Join Date
    Jul 2006
    Posts
    339

    Changing the Color Theme in Java

    hello folks,
    I have done lot of basic programming in Java. But i haven't gone through the coding that can change the theme of my application in Java. So thought that posting here would be helpful. Please tell me how to change color theme in Java.?? Hoping that someone had understand my issue.!! Thanks in Advance for the Help..!!

  2. #2
    Join Date
    Nov 2008
    Posts
    1,192

    Re: Changing the Color Theme in Java

    The changing of the color themes is not so important with respect to the coding, so might you have not gone through.!! You can use the CustomTheme class for setting the colors and fonts to their default values in which constructor of that class sets it. The custom theme is almost similar to the metal theme. The CustomTheme class reads those values from the theme file's input stream. Following sample would help you to understand this :
    Code:
    public CustomTheme(InputStream is)
    {
        defaultColors();    
        defaultFonts();
        loadProperties(is);
    }

  3. #3
    Join Date
    Mar 2008
    Posts
    349

    Re: Changing the Color Theme in Java

    In Java, you can change the colors to match your corporate brand or other color scheme. Theme file is stored as a Java properties file in the specified format. You can change any or all of these properties before you set the look and feel. Here is coding that explains the same :
    Code:
    UIManager.put("nimbusFocus", new Color(...));
    UIManager.put("nimbusRedGrey", new Color(...));
    UIManager.put("control", new Color(...));
    
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }

  4. #4
    Join Date
    Mar 2008
    Posts
    672

    Re: Changing the Color Theme in Java

    There are many colors in the Nimbus. You will have to insert the color name or the value of the respective colors for theme in Java. All of the Nimbus properties are stored as keys in the UIManager's defaults table. But there are basically three base colors which are as follows :
    1. nimbusBase.
    2. nimbusBlueGrey.
    3. control.

    These three colors can fulfill mostly all your needs.

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Changing the Color Theme in Java

    You can give the decorative borders and window titles to the frames in Java. Since, this is not so important so many don't know how to do it.!! You can do that by adding the following lines in the main() method of the application :
    Code:
    JFrame.setDefaultLookAndFeelDecorated(true);
    JDialog.setDefaultLookAndFeelDecorated(true);
    As said before, using this will give decorative borders and window titles to the frames and dialogs of the application.

Similar Threads

  1. How to change Background color Theme of Office 2013
    By Julissa in forum Windows Software
    Replies: 3
    Last Post: 05-06-2013, 10:47 AM
  2. Theme keeps changing every time I reboot under Windows 7
    By Jai-Ho in forum Operating Systems
    Replies: 4
    Last Post: 24-10-2010, 05:13 AM
  3. Problem in changing theme in T-Mobile
    By AMISH in forum Portable Devices
    Replies: 4
    Last Post: 18-01-2010, 04:38 PM
  4. Changing color in a GIF
    By Gap meer in forum Customize Desktop
    Replies: 5
    Last Post: 10-03-2009, 10:01 PM
  5. XP Color theme with dark window background color?
    By sayeed in forum Windows XP Support
    Replies: 4
    Last Post: 27-06-2008, 01:42 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,973,191.09750 seconds with 17 queries