2013-03-19 49 views
1

我得到**窗口非常薄的進度條服務器2012 **,當我使用Java的外觀和感覺:Windows Server 2012中顯示進度條太薄

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 

酒吧看行不行在Windows 7中,很薄的Windows Server 2012上
Java版本的每一個地方是(包括JDK和JRE)1.6.0_25,32位

enter image description here

下面是完整的代碼演示了問題(或文件問題) 我在JDK 1.6.0_25

package demos; 

import javax.swing.*; 
import javax.swing.plaf.metal.DefaultMetalTheme; 
import javax.swing.plaf.metal.MetalLookAndFeel; 
import java.awt.*; 

public class ProgressBarLookAndFeelDemo { 

    private void createAndShowGUI() { 
    //Create and set up the window. 
    JFrame frame = new JFrame("FrameDemo"); 
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 

    JPanel progPanel = new JPanel(); 
    progPanel.setLayout(new GridBagLayout()); 

    frame.getContentPane().add(progPanel, BorderLayout.CENTER); 

    // 
    JProgressBar progressBar = new JProgressBar(); 
    progressBar.setIndeterminate(true); 
    progPanel.add(progressBar); 

    //Display the window. 
    frame.pack(); 
    frame.setVisible(true); 
    } 

    public void showUI(String name) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException { 
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); 


    if (name.equalsIgnoreCase("system")) { 
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    } 

    javax.swing.SwingUtilities.invokeLater(new Runnable() { 
     public void run() { 
     createAndShowGUI(); 
     } 
    }); 
    } 

    public static void main(String[] args) throws 
     ClassNotFoundException, UnsupportedLookAndFeelException, 
     InstantiationException, IllegalAccessException { 


    if (args.length <1) { 
     System.out.println("usage : One argument is expected none|system"); 
     throw new IllegalArgumentException("java classname none|system"); 
    } 

    new ProgressBarLookAndFeelDemo().showUI(args[0]); 

    } 
} 

這可能是一個Windows 2012的行爲,但我看不到與之相關的任何文件。

+0

我認爲這是Java的外觀和感覺的行爲。但是,您可以自定義UI參數。 – khachik 2013-03-19 08:51:40

回答

2

我希望有不符合32B和64b版本發佈

JDK_1.6_022 32B

enter image description here

enter image description here

enter image description here

JDK_1.7_011 64B

enter image description here

enter image description here

enter image description here

從代碼

import java.awt.BorderLayout; 
import java.awt.EventQueue; 
import java.awt.GridBagLayout; 
import javax.swing.JFrame; 
import javax.swing.JPanel; 
import javax.swing.JProgressBar; 
import javax.swing.UIManager; 
import javax.swing.UIManager.LookAndFeelInfo; 
import javax.swing.UnsupportedLookAndFeelException; 
import javax.swing.WindowConstants; 

public class ProgressBarLookAndFeelDemo { 

    public ProgressBarLookAndFeelDemo() { 
     JProgressBar progressBar = new JProgressBar(); 
     progressBar.setIndeterminate(true); 

     JProgressBar progressBar1 = new JProgressBar(); 
     progressBar1.setValue(66); 

     JPanel progPanel = new JPanel(); 
     progPanel.setLayout(new GridBagLayout()); 
     progPanel.add(progressBar); 
     progPanel.add(progressBar1); 

     JFrame frame = new JFrame("Frame Demo"); 
     frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 
     frame.add(progPanel, BorderLayout.CENTER); 
     frame.pack(); 
     frame.setVisible(true); 
    } 

    public static void main(String[] args) { 
     try { 
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); 
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { 
       System.out.println(info.getName()); 
       if ("Nimbus".equals(info.getName())) { 
        UIManager.setLookAndFeel(info.getClassName()); 
        break; 
       } 
      } 
     } catch (UnsupportedLookAndFeelException e) { 
      // handle exception 
     } catch (ClassNotFoundException e) { 
      // handle exception 
     } catch (InstantiationException e) { 
      // handle exception 
     } catch (IllegalAccessException e) { 
      // handle exception 
     }/**/ 
     EventQueue.invokeLater(new Runnable() { 
      @Override 
      public void run() { 
       new ProgressBarLookAndFeelDemo(); 
      } 
     }); 
    } 
} 
+0

這不是JRE的問題。他們在其他機器上看起來不錯(贏7)。它是在Windows 2012我看到了一個區別。 – Jayan 2013-03-19 12:10:44

+0

定義什麼Win2012,版本和JDK&JRE,我周圍有3個版本,是否有與我的代碼發佈在這裏相同的問題(以減少任何可能的副作用) – mKorbel 2013-03-19 12:15:16

+0

是的。問題在於您發佈的代碼。 (僅限系統外觀) – Jayan 2013-03-19 12:19:19