Look  n feel of a gui

how can i change the look n feel of a GUI? to make it OS independent

I dont understand what you mean unless you are using java1.1 awt component and if thats the case try using swing components

Similar Messages

  • GUI Look and Feel

    Hi,
    I am developing GUI's with SWING and I am developing on a Windows XP machine and all my code no matter what I do looks like Windows frames. Is there a trick to get everything to look like "metal" look and feel? I tried numerous techniques that the java tutorials say will alter it but it never does... Is it somthing with XP?
    Thanks,
    Ben

    After a bit of peliminary swing hacking...
    overide javax.swing.plaf.metal.MetalTitlePane.SystemMenuBar.createActions() to return a subclass of the exisiting Maximise action that sets to corrected dimensions.
    subclass createTitlePane in MetalRootPaneUI to return your new class
    then set the metal UI to use your new new RootPaneUI and stand back and feel smug!
    I don't need to do this, but this should work!
    HOWEVER... exactly how you decode where on teh screen the taskbar starts/ends is anybody's guess.

  • Weblogic Workshop GUI look and feel

    Hi all,
    Does anyone know where I can find a library to import a similar look and feel that this application has? It's quite impressive for a java gui!
    Thanks for your help.//

    After a bit of peliminary swing hacking...
    overide javax.swing.plaf.metal.MetalTitlePane.SystemMenuBar.createActions() to return a subclass of the exisiting Maximise action that sets to corrected dimensions.
    subclass createTitlePane in MetalRootPaneUI to return your new class
    then set the metal UI to use your new new RootPaneUI and stand back and feel smug!
    I don't need to do this, but this should work!
    HOWEVER... exactly how you decode where on teh screen the taskbar starts/ends is anybody's guess.

  • Windows look and feel instead, in InternalFrameDemo.java

    Hi all, I am learning swing and I am trying to modify the
    InternalFrameDemo.java source from
    http://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#InternalFrameDemo
    My idea is to add the line
    JFrame.setDefaultLookAndFeelDecorated(true); in the constructor, but it doesn't work
    and I don't understand why.
    Could somebody please help me?
    Kindest regards,
    Lasse
    public InternalFrameDemo() {
    super("InternalFrameDemo");
    //Make the big window be indented 50 pixels from each edge
    //of the screen.
    int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset,
    screenSize.width - inset*2,
    screenSize.height - inset*2);
    //FDoesn't work
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Set up the GUI.
    desktop = new JDesktopPane(); //a specialized layered pane
    createFrame(); //create first "window"
    setContentPane(desktop);
    setJMenuBar(createMenuBar());
    //Make dragging a little faster but perhaps uglier.
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    }

    Uh I think you're mistaken. Whenever in doubt or something doesn't work as expected, check the javadocs. The link to the javadocs can usually be found really easily by typing "java 6 classname". In this case:
    http://docs.oracle.com/javase/6/docs/api/javax/swing/JFrame.html
    If you want to set the Windows look & feel as your thread title suggests, this was not the method you were looking for as the javadocs will tell you. That method controls if a frame is decorated or not (as the name suggests), which it is by default. Setting it to true will not change anything.
    So what then? You type into Google "java swing windows look and feel". Without quotes of course.

  • Applet and Skin Look And Feel 0.3.1

    I have downloaded Skin Look And Feel 0.3.1.
    It is very good but I have some problems with applets.
    Can anyone help me with this?
    The exception stack trace is:
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.util.PropertyPermission debug.skinlf read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         at com.l2fprod.gui.plaf.skin.SkinUtils.<clinit>(SkinUtils.java)
         at com.l2fprod.gui.plaf.skin.impl.gtk.GtkImage.getImage(GtkImage.java:109)
         at com.l2fprod.gui.plaf.skin.impl.gtk.GtkImage.getImage(GtkImage.java:94)
         at com.l2fprod.gui.plaf.skin.impl.gtk.GtkPersonality.<init>(GtkPersonality.java:95)
         at com.l2fprod.gui.plaf.skin.impl.gtk.GtkSkin.init(GtkSkin.java:142)
         at com.l2fprod.gui.plaf.skin.impl.gtk.GtkSkin.<init>(GtkSkin.java:134)
         at com.l2fprod.gui.plaf.skin.SkinLookAndFeel.loadSkin(SkinLookAndFeel.java:644)
         at projectx.AppletX.init(AppletX.java:41)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Thaks

    Hi,
    This will be fixed in the upcoming SkinLF release. you can check out the latest version from sourceforge.net/projects/skinlf (see Contribute section at www.L2FProd.com), it contains the fix.
    Next release will be available end of next week.
    Best,
    -fred

  • Configurable look and feel

    Hello Java masters,
    This is not question, but I just like to tell you about something I find today while answering other forum writers question...
    http://www.javadesktop.org/articles/synth/index.htmlHe lets you configure look and feels using configuration file, and "plug in" custom renderers (like gradient paint filling etc).
    He looks very powerful but I haven't read about him in the press - so thought I would (how do you say...) "give him a shout out".
    Yardedoo!

    Azureus uses a different graphical toolkit for Java (SWT I think its called) which can more easily take on the native look and feel of either GTK (Gnome's primary toolkit) or QT (KDE's toolkit) depending on whats running.
    Most Java apps just use the Swing GUI toolkit (Java's own), which only takes on the look and feel of GTK stuff... totally ignoring QT to fend for itself =\. I use gtk-qt-engine to get GTK apps to imitate KDE's appearance, not sure if Java's Swing is affected by that though.

  • Look And Feel: Metal Themes

    Hello,
    I have two basic questions I can't find the answer to. I hope someone can help.
    From my understanding of Java 1.5 you now have 2 basic themes to them metal look and feel, they are "Ocean" (the default) and "Steel". Is this understanding correct?
    My second question is, I can switch between Look & Feels, ie. default to system, how do you switch between themes though? I want to use "Steel" but can't !
    Thanks,
    Alan

    How to Set the Lood and Feel:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/p
    laf.htmlThat actually doesn't tell you how to do what he's asking.. at least not from what I saw.
    Here's how to set the metal theme in 1.5:
    import javax.swing.plaf.metal.*;
    public static final String STEEL_THEME_CLASS = "javax.swing.plaf.metal.DefaultMetalTheme";
    public static final String OCEAN_THEME_CLASS = "javax.swing.plaf.metal.OceanTheme";
    public void changeMetalTheme(String themeName) {
       try {
          MetalTheme theme = (MetalTheme)Class.forName(themeName).newInstance();
          MetalLookAndFeel.setCurrentTheme(theme);
       catch (Exception e) { e.printStackTrace(); }
    }Note that if you do this after you've created your GUI, you'll have to call SwingUtilities.updateComponentTreeUI() on all top-level windows.

  • Migrating sapgui look and feel settings of sapgui to new notebook.

    Hi,
    We are migrating from XP to Vista and SAPGui 640 to 710. (new notebooks are assigned to the users)
    I copied saplogon.ini to the new notebook to preserve the links to the servers.
    Some users have customized the look and feel of their SAPGui.  How can I copy the settings of their SAPGui to the new notebook (like the visual design, color settings and font size that the user have set in their sapgui.)
    thanks,
    Roel

    Hello Roel,
    The windows vista version itself gives a new dimension to the look and feel. So I guess nothing must have been editted on SAPGUI screen.
    And more of SAP GUI 640 to 700 look and features are also different.
    Kindly request you to check with the user who has changed and got the looks as you found on his screen.
    If you are looking for the changed screen after SAP gui login, where the main screen appears.
    Then I would suggest, you go through thsi link below -
    Change SAPGUI initial login screen
    http://www.sap-img.com/basis/changing-the-sapgui-logo-on-the-right-hand-side.htm
    Do let me know if this resolved your issue.
    Thank you.
    Regards,
    Manomeet Mohapatra
    Award points if helpful **

  • [SOLVED] Java GTK look and feel

    I opened a thread recently about replacing the ugly swing buttons in Java applications. After successfully modifying my ~/.bashrc, all was well. However, these new changes were only present when run from a terminal. I assumed it was because my desktop was still running a bash session that hadn't loaded the new options yet, so I restarted.
    Symptom: Java apps launched from the GUI still have old swing buttons, but have the GTK look and feel when launched from a terminal.
    My .bashrc additions:
    # Java stuff
    export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
    I use SLiM for a graphical login experience. Could this be affecting it? I'm not sure what happens differently behind the scenes when using a login manager other than that CTRL+ALT+F7 brings me to my GUI when I use one (because all 6 TTYs are still TTYs).
    Last edited by 2mac (2014-01-02 20:51:35)

    I had a similar issue where .xinitrc wasn't working to set an environment variable. I put mine in ~/.config/openbox/environment and it worked. If you run openbox try that. If using a different window manager maybe try /etc/environment I am unsure of how slim functions though maybe there are config files for it. I think slim is on it's way out though (already lacks some compatibility with systemd; they may fix it though upstream I have no idea). But yeah try the environment file way and see if that does it (assuming you have tested your command from the shell and it works how you want).

  • Emty topic window in Nimbus Look and Feel

    I have Java applications using OHJ. When we swith to Nimbus Look and Feel our topic Windows is blank. Helps work correctli in other look and feels. If I print topic it's is printed correctly, so information is there but it is not visible.

    AndrewThompson64 wrote:
    No, I'd say it is a pity that you did not initially use layouts when creating the code in Netbeans. There is no point blaming the tool. Well, some of this code is almost 10 years old (and i didn't write it), and back then nobody used layouts correctly. Even now java layouts are a pain to use compared with other GUI layouts (FLEX, HTML). Our customer just wants a prettier GUI on top of this legacy java app.
    We looked at incrementally using JavaFX to slowly change out screens, but it doesn't support integration with a regular java application (why?)
    Even with a unsupported workaround i cannot open a modal dialogs from JavaFX. I think they are targeting JavaFX at the wrong market, it is usless as a RIA and will never beat out Flash. They should have targeted it as a Swing replacement. Just my 2 cents.
    >
    That seems a shoddy 'solution'. Even the current code under the current PLAF might fail on another screen size, resolution, default font size or a number of other factors..This is true, unfortunately the code base is very very large (300k lines).

  • Having trouble setting the look and feel

    hi, i've almost finished my app and am trying to improve it's appearance. I'm trying to change the look and feel but i can't seem to get any changes to take effect. i've been reading through the tutorial on L&F but obviously am not 'getting' something.
    At the moment all I'm trying to do, is to add the line below. I'm not totally sure where to put it though. I've tried putting it in the main method and nothing happens. I've also tried putting i the CreateandShowGUI() method and that doesn't seem to do anything either.
    Where should it go?
    try {
            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        } catch (Exception e) {
            System.err.println("Could not initialize java.awt Metal lnf");
        }

    Put it before you start assembling your GUI, ie. instantiating and adding components.
    Cheers
    DB

  • 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

  • Setting Look n' Feel for non subcomponents

    Hi, I have a GUI selection on my main application frame that will let the user choose a look n' feel. When that is chosen, the event is fired and the following method is called. Selection is one of course,
    "javax.swing.plaf.metal.MetalLookAndFeel"
    "com.sun.java.swing.plaf.motif.MotifLookAndFeel" OR
    "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
    void updateLookAndFeel(String selection) {
    try {
    UIManager.setLookAndFeel(selection);
    SwingUtilities.updateComponentTreeUI(this);
    catch (Exception ex) {
    ex.printStackTrace();
    This updates all components that are contained within this frame. In addition, all newly created frames also use the new look and feel. However, any frames that I created before this call continue to have the old look n' feel. An explicit call to repaint from outside those frames would be a tedious fix for the non-static frames , but I also have some that are large and used often that I keep static for speed. Is there a way to update these non-contained frames? Please don't tell me to put listeners on them :-)

    I will restrain myself from commenting on the practice of subclassing frame...
    If you have a reference to those frames already in your main class, control all the l&f logic in there (where it should be) and then just do something like this:
    SwingUtilities.updateComponentTreeUI( frame1 );
    SwingUtilities.updateComponentTreeUI( frame2 );
    SwingUtilities.updateComponentTreeUI( frame3 );Or better yet, keep all your application's created frames in a collection and iterate through it.

  • Customizing Look and Feel

    Is there a way to customize the "look and feel" of the OID webtool?
    Also, is there any way to change what is displayed as a result of performing a search? Specifically, I'd like to extend the searchable fields to include businessCategory.
    Any help would be greatly appreciated.

    Hi,
    I assume you are talking about the OID in iAS 9.0.2 and on this release it's not possible.
    It should be possible in 10G, but I'm not sure.
    We gave up and has developed our own GUI's for the OID application.
    Steffen

  • JComboBox Lost Listener on Look and Feel change

    When the user change the Look And Feel on the Fly , any Listener that is done using
    myComboBox.getEditor().getEditorComponent().addXXXListener
    is lost
    I'm using Windows XP Service Pack 2, java 6 build 105
    Does someone have any inputs why this happen or how this can be "fixed" or maybe prevent. Do I'm doing something wrong?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    /* ComboBoxDemo2.java requires no other files. */
    public class ComboBoxDemo2 extends JPanel
                               implements ActionListener {
        static JFrame frame;
        JLabel result;
        String currentPattern;
        public ComboBoxDemo2() {
            setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
            String[] patternExamples = {
                     "dd MMMMM yyyy",
                     "dd.MM.yy",
                     "MM/dd/yy",
                     "yyyy.MM.dd G 'at' hh:mm:ss z",
                     "EEE, MMM d, ''yy",
                     "h:mm a",
                     "H:mm:ss:SSS",
                     "K:mm a,z",
                     "yyyy.MMMMM.dd GGG hh:mm aaa"
            currentPattern = patternExamples[0];
            //Set up the UI for selecting a pattern.
            JLabel patternLabel1 = new JLabel("Enter the pattern string or");
            JLabel patternLabel2 = new JLabel("select one from the list:");
            JComboBox patternList = new JComboBox(patternExamples);
            patternList.setEditable(true);
            patternList.addActionListener(this);
    //-------------------------------- XXX------------------------------------------
    //      This KeyListener it is lost when the user change the theme on the fly       
            patternList.getEditor().getEditorComponent().addKeyListener(new KeyAdapter()
            public void keyPressed(KeyEvent e)
             System.out.println(" Key pressed is "+e.getKeyCode());     
            //Create the UI for displaying result.
            JLabel resultLabel = new JLabel("Current Date/Time",
                                            JLabel.LEADING); //== LEFT
            result = new JLabel(" ");
            result.setForeground(Color.black);
            result.setBorder(BorderFactory.createCompoundBorder(
                 BorderFactory.createLineBorder(Color.black),
                 BorderFactory.createEmptyBorder(5,5,5,5)
            //Lay out everything.
            JPanel patternPanel = new JPanel();
            patternPanel.setLayout(new BoxLayout(patternPanel,
                                   BoxLayout.PAGE_AXIS));
            patternPanel.add(patternLabel1);
            patternPanel.add(patternLabel2);
            patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
            patternPanel.add(patternList);
            JPanel resultPanel = new JPanel(new GridLayout(0, 1));
            resultPanel.add(resultLabel);
            resultPanel.add(result);
            patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
            resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
            add(patternPanel);
            add(Box.createRigidArea(new Dimension(0, 10)));
            add(resultPanel);
            setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
            reformat();
        } //constructor
        public void actionPerformed(ActionEvent e) {
             System.out.println("Action Event");                
            JComboBox cb = (JComboBox)e.getSource();
            String newSelection = (String)cb.getSelectedItem();
            currentPattern = newSelection;
            reformat();
        /** Formats and displays today's date. */
        public void reformat() {
             try {
            Date today = new Date();
            SimpleDateFormat formatter =
               new SimpleDateFormat(currentPattern);
                String dateString = formatter.format(today);
                result.setForeground(Color.black);
                result.setText(dateString);
            }catch (IllegalArgumentException iae) {     
            System.out.println("Ilegal argument Exception");   
            catch (Exception e) {
            System.out.println("Argument Exception");                
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            final JFrame frame = new JFrame("ComboBoxDemo2");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new ComboBoxDemo2();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setLayout(new BorderLayout());      
            //frame.setContentPane(newContentPane,BorderLayout.CENTER);
            JMenuBar menuBar = new JMenuBar();
            JMenu theme = new JMenu("Theme");
            ButtonGroup bttnGroup = new ButtonGroup();
            JCheckBoxMenuItem metal = new JCheckBoxMenuItem("Metal");
            bttnGroup.add(metal);
            metal.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e){
              try{
              UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
              SwingUtilities.updateComponentTreeUI(frame);
              }catch(Exception a){a.printStackTrace();}
              theme.add(metal);
            JCheckBoxMenuItem system = new JCheckBoxMenuItem("System");
            bttnGroup.add(system);
            system.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e){
              try{
              UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              SwingUtilities.updateComponentTreeUI(frame);
              }catch(Exception a){a.printStackTrace();}
            theme.add(system);
            menuBar.add(theme);     
            frame.setJMenuBar(menuBar);
            JToolBar jtb = new JToolBar();
            jtb.add(newContentPane);
            frame.add(jtb, BorderLayout.PAGE_START);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

    Thanks to both Rodney_McKay and jasper for their replys and ideas
    This code is working fine
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.util.*;
    import java.text.SimpleDateFormat;
    /* ComboBoxDemo2.java requires no other files. */
    public class ComboBoxDemo2 extends JPanel
                               implements ActionListener {
        static JFrame frame;
        JLabel result;
        String currentPattern;
        private JComboBox patternList = new JComboBox();
        public ComboBoxDemo2() {
            setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
            String[] patternExamples = {
                     "dd MMMMM yyyy",
                     "dd.MM.yy",
                     "MM/dd/yy",
                     "yyyy.MM.dd G 'at' hh:mm:ss z",
                     "EEE, MMM d, ''yy",
                     "h:mm a",
                     "H:mm:ss:SSS",
                     "K:mm a,z",
                     "yyyy.MMMMM.dd GGG hh:mm aaa"
            currentPattern = patternExamples[0];
            //Set up the UI for selecting a pattern.
            JLabel patternLabel1 = new JLabel("Enter the pattern string or");
            JLabel patternLabel2 = new JLabel("select one from the list:");
            patternList = new JComboBox(patternExamples){
            public void updateUI(){
            System.out.println("UPDATE UI");
            super.updateUI();     
            changeUIAddEditorListener();
            changeUIAddEditorListener();
            patternList.setEditable(true);
            patternList.addActionListener(this);
            //Create the UI for displaying result.
            JLabel resultLabel = new JLabel("Current Date/Time",
                                            JLabel.LEADING); //== LEFT
            result = new JLabel(" ");
            result.setForeground(Color.black);
            result.setBorder(BorderFactory.createCompoundBorder(
                 BorderFactory.createLineBorder(Color.black),
                 BorderFactory.createEmptyBorder(5,5,5,5)
            //Lay out everything.
            JPanel patternPanel = new JPanel();
            patternPanel.setLayout(new BoxLayout(patternPanel,
                                   BoxLayout.PAGE_AXIS));
            patternPanel.add(patternLabel1);
            patternPanel.add(patternLabel2);
            patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
            patternPanel.add(patternList);
            JPanel resultPanel = new JPanel(new GridLayout(0, 1));
            resultPanel.add(resultLabel);
            resultPanel.add(result);
            patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
            resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
            add(patternPanel);
            add(Box.createRigidArea(new Dimension(0, 10)));
            add(resultPanel);
            setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
            reformat();
        } //constructor
        public void actionPerformed(ActionEvent e) {
             System.out.println("Action Event");                
            JComboBox cb = (JComboBox)e.getSource();
            String newSelection = (String)cb.getSelectedItem();
            currentPattern = newSelection;
            reformat();
        /** Formats and displays today's date. */
        public void reformat() {
             try {
            Date today = new Date();
            SimpleDateFormat formatter =
               new SimpleDateFormat(currentPattern);
                String dateString = formatter.format(today);
                result.setForeground(Color.black);
                result.setText(dateString);
            }catch (IllegalArgumentException iae) {     
            System.out.println("Ilegal argument Exception");   
            catch (Exception e) {
            System.out.println("Argument Exception");                
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            final JFrame frame = new JFrame("ComboBoxDemo2");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new ComboBoxDemo2();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setLayout(new BorderLayout());      
            //frame.setContentPane(newContentPane,BorderLayout.CENTER);
            JMenuBar menuBar = new JMenuBar();
            JMenu theme = new JMenu("Theme");
            ButtonGroup bttnGroup = new ButtonGroup();
            JCheckBoxMenuItem metal = new JCheckBoxMenuItem("Metal");
            bttnGroup.add(metal);
            metal.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e){
              try{
              UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
              SwingUtilities.updateComponentTreeUI(frame);
              }catch(Exception a){a.printStackTrace();}
              theme.add(metal);
            JCheckBoxMenuItem system = new JCheckBoxMenuItem("System");
            bttnGroup.add(system);
            system.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent e){
              try{
              UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              SwingUtilities.updateComponentTreeUI(frame);
              }catch(Exception a){a.printStackTrace();}
            theme.add(system);
            menuBar.add(theme);     
            frame.setJMenuBar(menuBar);
            JToolBar jtb = new JToolBar();
            jtb.add(newContentPane);
            frame.add(jtb, BorderLayout.PAGE_START);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
       public void changeUIAddEditorListener() {
       patternList.getEditor().getEditorComponent().addKeyListener(new KeyAdapter()
       public void keyPressed(KeyEvent e)
       System.out.println(" Key pressed is "+e.getKeyCode());     
    }

Maybe you are looking for

  • Problem in date functions

    Using: Jdev 11.1.1.5.0-adfbc problem description: problem in function not properly working Resource: this is my vo query which is based on one eo SELECT LegalDocDetailsEO.LDD_BE,        LegalDocDetailsEO.LDD_UNIT,        LegalDocDetailsEO.LDD_SUPLR_I

  • Ipad camera connection kit - photo or videos not show

    Good day, I have an ipad2 32gig. I have renamed my photo's and video according.  And have created the DCIM folder. I plug in my SD card the photo application opens but no photos or videos show.  Please help!!!!!!!

  • What line can I add to prefs.js (firefox v22) ensure that 3rd party cookies are allowed?

    I'm running a program with selenium and it was working fine, then I updated to firefox version 22 and now its throwing my error saying 3rd party cookies need to be enabled. Is there a line of code I can add to prefs.js in order to ensure that 3rd par

  • Variable selections not appearing while executing query

    hi, am using 3 variables in my query all 3 are ready for input, but still when am testing it in another username, the system does'nt give the selection options and the query is executed automatically. 1 of the variables use company as characteristic.

  • Will the video iAds work on iOS 4-5?

    I know that the video iAds as seen in itunes radio will work on iOS 7, but will they work on iOS 4-5 platforms?