Changing look and feel with radio buttons

k this is the code that i have so far, Yes i read the tutorial and stuff but it doesnt seem to make any sense and all. tell me what else i need in this code to do what i want, its the action performed part i didnt put the other code, what else do i need??? but well...you will see grips of duke dollars to whom can do it
public void actionPerformed(ActionEvent e)
String actionCommand = e.getActionCommand();
if(actionCommand.equals("Metal"))
try
UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel" );
catch (Exception ex)
else if(actionCommand.equals("Windows"))
try
UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
catch (Exception ex)
else if(actionCommand.equals("Motif"))
try
UIManager.setLookAndFeel( "com.sun.java.swing.plaf.motif.MotifLookAndFeel");
catch (Exception ex)
}

While not in the tutorial, I have found several other things necessary to get the look and feel change to be complete. Here is the code I'm using after I set the look and feel. It seems to do a pretty good job of sync'ing everything together.
            SwingUtilities.updateComponentTreeUI(TDba.getFrame());
            TDba.getFrame().pack();
            Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
            Integer w = new Integer((int)(dim.width * .8));
            Integer h = new Integer((int)(dim.height * .8));           
            TDba.getFrame().setSize(w.intValue(), h.intValue());
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Losing Title Bar when changing Look and Feel on the fly

    Hello,
    I have an option in my Swing app for the user to change the Look & Feel on the fly by selecting from a radio button list. The look and feel is changed when the user make the selection, however the Windows Title Bar disappears. Any ideas what I'm missing?
    private void setLook(String mode)
    String lookAndFeelClassName = null;
    UIManager.LookAndFeelInfo looks[] = UIManager.getInstalledLookAndFeels();
    for (int i = 0; i < looks.length; i++)
    if (mode.equalsIgnoreCase(looks.getName()))
    lookAndFeelClassName = looks[i].getClassName();
    break;
    try
    m_view.dispose();
    UIManager.setLookAndFeel(lookAndFeelClassName);
    SwingUtilities.updateComponentTreeUI(m_view);
    m_view.setVisible(true);
    catch (Exception e)
    JOptionPane.showMessageDialog(m_view, "Can't change look and feel:" + lookAndFeelClassName, "Invalid PLAF", JOptionPane.ERROR_MESSAGE);

    You are disposing the view. My guess is that this is your problem. Try creating a new one instead of just showing the old disposed one

  • Event on changing Look and Feel

    I want to know what event is fired when I change Look and Feel.
    Thanks,
    Pati

    Ideally you'll be using the UIManager.setLookAndFeel() to change the installed LookAndFeel. In the UIManager, the installed LNF is bound to a JavaBeans property using the SwingPropertyChangeSupport with the key: "lookandfeel". Any time this changes, a PropertyChangeEvent will be fired to the PropertyChangeListeners registered with the UIManager. You can simply add a PropertyChangeListener to the UIManager and listen for events that are bound to that particular property, such as...
        UIManager.addPropertyChangeListener( new PropertyChangeListener() {
            public void propertyChange( PropertyChangeEvent e ) {
                if( "lookAndFeel".equals( e.getPropertyName() ) ) {
                    System.out.println( "look and feel changed" );
        });The event encapsulates the new value and the old value so you can do whatever you need with that information.
    I used an anonymous inner class mostly as an example - You may need to consider a cleaner design for your purposes.
    Hope this helps!
    Matt

  • How can we remove the space after changing look and feel to generic

    Hi
    I want to remove the space which left blank after changing look and feel to generic in formsweb.cfg file.
    Can anybody help me to remove this blank space.

    Hi,
    can you be more specific on teh space you mean?
    Frank

  • Changing look and feel for one INSTANCE of a component

    I am trying to change the look and feel of just ONE instance of a component. In particular, I want to change the color of the JScrollBar thumb on a certain JScrollPane. I want this change to not affect any other component, either before or after. How can I do this?? Any help would be much appreciated.
    AC

    Hi acalvin3!
    I have a solution. Use the UIManagers database. You should overwrite the default settings for the resource you want to change, the code is self explaining:
          UIManager.put( "Button.margin", commonMargin );
          UIManager.put( "Button.focusInputMap", commonInputMap );
          UIManager.put( "Button.font", buttonFont );To reset values you only have to use
          UIManager.put( "Button.margin", null );
          UIManager.put( "Button.focusInputMap", null );
          UIManager.put( "Button.font", null );Set values before you create your component and reset values immedeately after you created your component, otherwise you may affect other components too.
    With following code you can find out default values for the whole UIManagers database:
          Hashtable defaultProps = UIManager.getDefaults();
          Enumeration enum = defaultProps.keys();
          while (enum.hasMoreElements()) {
             Object key = enum.nextElement();
             System.out.println( "key: '" + key + "'\t value: '" + defaultProps.get(key) + "'" );
          }You just have to look for the output for the component you want to change the look and feel.
    Have fun...

  • Extending JComboBox  behavior and changing look and feel

    In order to change JComboBox behavior, usually we will extend the MetalComboBoxUI or WindowsComboBoxUI (for example: for controlling the popup width)
    The problem arise when we want to be able to change the pluggable look and feel: all components got the new look and feel except for the comboboxes.
    A dirty solution can be extending our ComboBoxUI from the new look and feel library but in the case of jgoodies it is even impossible because PlasticComboBoxUI is final
    Any ideas?

    In order to change JComboBox behavior, usually we will extend the MetalComboBoxUI or WindowsComboBoxUI (for example: for controlling the popup width).
    The problem arise when we want to be able to change the pluggable look and feel: all components got the
    new look and feel except for the comboboxes. A dirty solution can be extending our ComboBoxUI from
    the new look and feel library but in the case of jgoodies it is even impossible because PlasticComboBoxUI is final
    My best suggestion: request the L&F provider to make his combo box homogeneous with the other components.

  • Changing Look and feel of template pagelets

    Hello,
    I have a requirement to show different look and feel for different template pagelets.
    Something like:
    Related links - Grey Header
    Related Content - Blue Header
    Other pagelets - Red Header
    I was able to acheive this very easily for homepage pagelets by cloning PORTAL_HP_COMPONENT.
    But looks like PORTAL_HP_COMPONENT HTML is not used for template pagelets.
    Does anyone have any idea which HTML is used to build Template pagelets?
    Otherwise how to meet the above requirement?
    Many Thanks for your help.
    Best Regards,
    Ekta

    Each pagelet has a unique ID based on the CREF ID. Rather than change the HTML template, an alternate option is to add this information to your stylesheet. Look in PeopleTools > Utilities > PeopleTools Options for your stylesheet name. I recommend cloning this one, adding a new free form stylesheet with override information, and then updating the PeopleTools Options to use your new stylesheet.
    I don't believe template pagelets have a common HTML definition. Instead, the "wrapper" HTML depends on the use location. For example, Workcenter pagelets use a different HTML definition than Intelligent Context and Related Content pagelets.

  • NetBeans: Dinamically changing Look and Feel Problem

    Hi there, Java lovers.
    I need some help here!
    I love java, and I used to program my graphical user interfaces by hand. In my applications, there is a dropdown for the user to chose the desired look and feel. Then I save the selected option to a file and on the startup I do something like this:
                UIManager.setLookAndFeel(savedUserSelectedLookAndFeel);That always worked really fine. The look and feel would change and everything worked really well.
    However, programing GUI by hand is really a PITA. So I was seduced by Netbeans. I am using Netbeans 6.0 on Windows XP, and I designed the GUIs really fast now.
    The problem is, the system look and feel works really well, but when I change the look and feel of my application to a different one (Java/Motif/etc..) the look and feel changes but the components positions and sizes becomes all messed up. It really becomes impossible to work with a different look and feel because some components are outside of frames.
    I believe the cause of this is because Netbeans generates the code automatically using Grids and stuff like that, and by doing so, the change of the look and feel becomes messed up. This is a thing that would not happen with my manually created code.
    This is really troubling me. Does someone has the same problem. Is there something I can do? Or do I need to create my GUIs by hand like before?

    Oyashiro-sama (&#23569;&#12375;&#26085;&#26412;&#35486;&#12434;&#30693;&#12387;&#12390;&#12356;&#12427;&#12375;&#12289;&#12381;&#12435;&#12394;&#12300;&#27096;&#12301;&#12387;&#12390;&#12356;&#12358;&#20351;&#12356;&#26041;&#12399;&#12385;&#12423;&#12387;&#12392;&#22793;&#12381;&#12358;&#12391;&#12377;&#12397;&#12288;(^_-) &#12300;&#20887;&#35527;&#12301;&#12387;&#12390;&#12356;&#12358;&#38996;&#25991;&#23383;&#12391;&#12377;&#12290;&#65289;
    Sorry for the delay in reply, but one problem for you is that this is not a NetBeans users forum, thus you will not necessarily receive speedy replies here to your NetBeans questions. The best place to send NetBeans questions is:
    [email protected]
    [email protected] (for NetBeans API issues)
    As for your question, you seem to already know quite a bit about NetBeans UI Look and Feel programming, but have you seen these:
    WORKING WITH SWING LOOK AND FEEL:
    http://java.sun.com/developer/JDCTechTips/2004/tt0309.html#1
    Java GUI Swing Programming Using NetBeans 5 (should apply to NetBeans 6):
    http://wiki.netbeans.org/JavaGUISwingProgrammingUsingNetBeans5
    Regards,
    -Brad Mayer

  • How to change look and feel on different pages

    Hi,
    I'm new to oracle portal, i want to chnage the look and feel dynamically,
    for example:
    when i entry page A,i want to use look and feel "RED",when i entry page B,i want to use look and feel "BLUE".
    what should I do in my programming or configuration ?
    thanks!!
    Edited by: user11361456 on 2009-7-6 下午7:16
    Edited by: user11361456 on 2009-7-6 下午7:33

    For a quick result, you can use Portal Templates with Portal Styles
    For a better but slower result, you can write HTML templates (page skins), with your own CSS.
    In both cases, you assign the template to the page. You can also use Portal Templates to mantain the structure of the pages, and Page Skins to change the look.

  • Changing Look and Feel

    I finally figured out how to change the look and feel of an application, but now I'm trying to figure out how the user can change it during run time. I was thinking that when the user chooses a "look" the program could just reload and send the lookAndFeel (such as com.sun.java.swing.plaf.windows.WindowsLookAndFeel) to the main's arguments, but I'm not sure how I could do this exactly... any push in the right direction would be great.. thanks.

    thanks! I tried using the SwingUtilities.updateComponentTreeUI method, and it worked for the most part, but for some reason now when I use this code:
    try {
         UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
         SwingUtilities.updateComponentTreeUI(this);
         pack();
    catch (Exception e) {
    }The frame seems to turn into a JWindow... as in the title bar disappears.... I'm not sure why it's doing that...

  • Changing Look and Feel of Annual Appraisal document

    Hi all,
    I have the requirement to change the look and feel of Annual Appraisal document.
    I need to add a header to the first column in Appraisal document.
    I am confused as to where the changes are to be made (In HAP_DOCUMENT,Annual template or BSP code)
    Have checked most of the blogs and threads in forums,but no help yet.
    Please let me know where the changes have to made and how?
    Thanks and Regards,
    Sumangala

    Hi,
    Thanks for the reply.
    I checked "Document_header.htm" as you mentioned.
    It agian points to few other header files such as "Document_header_appraisee.htm","Document_header_appraiser.htm" .
    When i go and check these files,  the code refers to settings no of columns,rows. No link to Header text anywhere.
    From where these headers are set actually.Any configuration in template or header text are written in the code only?
    and also curious to know what this line refers to
    "<%= otr(PAOC_HAP_DOCUMENT_UI/TEXT_ADDITIONAL) %> <%= APPLICATION->doc-S_HEADER_TEXTS-OTHER_TYPE_TXT %>"
    Regards,
    Sumangala

  • Changing Look and Feel programatically ??

    Hi,
    Is there a way in WLP815 to apply a look and feel programatically may be by using desktop backing or some other way?
    I tried to use LookAndFeel.setSkin() in desktop backing preRender method to change the skin from 'default' to say 'custom',
    To my surprise, It is rendering images from 'custom' and CSS styles from 'default' skin. Hmmmm.
    I even cleared the cache on my browser. But no luck :-(
    Does any one had this issue and know a work around?
    Thanks in advance!
    -Subba

    I use following code in header backing "init":
    LookAndFeel lookAndFeel = LookAndFeel.getLookAndFeel(request);
    lookAndFeel.setSkin(newskin);
    lookAndFeel.setSkeleton(newskeleton);
    lookAndFeel.reinit();

  • Changing Look and Feel of JFileChooser

    HI,
    How to change the look and of the JFileChooser?
    I am trying to apply the styles from the CSS. My intention is to put the JFileChooser component as applet.
    Solution pls.
    Thanx.

    JFileChooser is in fact a dialog and it cannot be used as an applet. Nor you can apply CSS styles to it.

  • Upgrade to JDeveloper 11.1.2.1 changes look and feel of application

    I am developing an application that I started in JDeveloper 11.1.1.5.0, and I have since upgraded to JDeveloper 11.1.2.1. I migrated the project into the newer version. Since doing so, there are changes to the style of the application. I feel like it's related to a skin, because it's consistent throughout the application. I had a white background, now I have a background that's a type of gradient that goes from white to blue. My buttons, when rolling over them turn blue. Can you please tell me how I can get back the styles I had in the old version?
    Nevermind...I figured it out. I had to find the correct skin-family to put in the trinidad-config.xml file.
    Edited by: HDGeek on Oct 28, 2011 10:08 AM

    Hi,
    did you check the setting of the skinFamily name in trinidad-config.xml ?
    Frank

  • Problem in JButton while changing look and feel to CDE/Motif

    In my application i'm using JButtons placed in JToolbar. I've setIcons for the JButtons. The top of the icons i.e the JButtons get hided while i changing the look & feel to CDE/Motif. But again if i change the look & feel to Metal, no problem is there. Expecting a favourable response from someone well versed / faced such problems earlier problems.
    Cheers
    sunil s

    Sounds suspiciously like you are setting absolute sizes for your buttons or elsewhere in application. Can you post code snippets showing how you layout your application.
    Cheers
    DB

Maybe you are looking for