Results 1 to 3 of 3
  1. #1
    petec is offline Member
    Join Date
    Feb 2014
    Location
    Near Buffalo NY
    Posts
    33
    Rep Power
    0

    Default Button Colors Differ in XP Verses Win8

    I created a GUI with NetBeans.
    When I run the program in XP and the program changes the button colors, the whole button changes color. In this case, from "background" to "Green".
    When I run the program under Windows 8 only the border of the button becomes green.

    See attached.

    NetBeans seems to use the Look and Feel "nimbus". I single stepped through the program on both computers and it looks like a request for nimbus does not cause an exception on either computer.

    Any ideas?

    Thanks,

    pete
    Attached Thumbnails Attached Thumbnails Button Colors Differ in XP Verses Win8-buttoncolors-xp.jpg   Button Colors Differ in XP Verses Win8-buttoncolorswin8.jpg  

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default Re: Button Colors Differ in XP Verses Win8

    What happened when you used a different look and feel? Where is your SSCCE?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    petec is offline Member
    Join Date
    Feb 2014
    Location
    Near Buffalo NY
    Posts
    33
    Rep Power
    0

    Default Re: Button Colors Differ in XP Verses Win8

    I didn't change the LAF. I even used the same compiled jar file on the two computers and get the different button effect. Below is what NetBeans created.


    Java Code:
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
             * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
             */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName()); // was commented out.  Now maybe XP and Win8 will display the same
                        javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
    
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    ev= new Everything2UI();
                    ev.setVisible(true);
                }           
            });      
        }    public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
             * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
             */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName()); // was commented out.  Now maybe XP and Win8 will display the same
                        javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(Everything2UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
    
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    ev= new Everything2UI();
                    ev.setVisible(true);
                }           
            });      
        }

Similar Threads

  1. How does HashMap differ from HashTable?
    By guest_user in forum New To Java
    Replies: 1
    Last Post: 08-12-2011, 05:05 PM
  2. we use the differ[1:ProcessBean,2:DTO], usage/reusage always?
    By lse123 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 01-21-2010, 08:15 PM
  3. How does the several 'development kit's ' differ?
    By javaamateur in forum New To Java
    Replies: 3
    Last Post: 10-09-2009, 02:46 PM
  4. Outcome differ from Netbeans and Java Web Start
    By bongia in forum New To Java
    Replies: 1
    Last Post: 11-06-2007, 02:35 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
  •