Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 添加自定义外观&;感觉使用Netbeans吗_Java_Swing_Netbeans_Look And Feel_Synthetica - Fatal编程技术网

Java 添加自定义外观&;感觉使用Netbeans吗

Java 添加自定义外观&;感觉使用Netbeans吗,java,swing,netbeans,look-and-feel,synthetica,Java,Swing,Netbeans,Look And Feel,Synthetica,我需要一些帮助。我正在试验JavaL&Fs,我完全不知道如何让Netbeans真正改变外观。我使用的是Synthetica Blue Ice L&F,在NetBeans使用Nimbus LF编码的编码中,我注释了Nimbus集合,这是我插入的内容(从原始编码中提取): 在NetBeans插入自己的外观编码的地方,我已经注释掉了它,它看起来像这样: public static void main(String args[]) { /* Set the Nimbus look a

我需要一些帮助。我正在试验JavaL&Fs,我完全不知道如何让Netbeans真正改变外观。我使用的是Synthetica Blue Ice L&F,在NetBeans使用Nimbus LF编码的编码中,我注释了Nimbus集合,这是我插入的内容(从原始编码中提取):

在NetBeans插入自己的外观编码的地方,我已经注释掉了它,它看起来像这样:

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 {
               UIManager.addAuxiliaryLookAndFeel(new SyntheticaBlueIceLookAndFeel());
               UIManager.setLookAndFeel(new SyntheticaBlueIceLookAndFeel());
          } catch (Exception e) {
               e.printStackTrace();
          }

//          try {
//               for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                    JOptionPane.showMessageDialog(null, info.getClassName());
//                    if ("Nimbus".equals(info.getName())) {
//                         javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                         break;
//                    }
//               }
//          } catch (ClassNotFoundException ex) {
//               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//          } catch (InstantiationException ex) {
//               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//          } catch (IllegalAccessException ex) {
//               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//          }
//          }
//          catch (Exception e){
//               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, e);
//          }

          //</editor-fold>

          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
               public void run() {
                    new MainMenu().setVisible(true);
               }
          });
     }
我注意到在设计调色板中有一个外观标签。为什么Synthetica没有显示在那里?

似乎在尝试使用它之前需要先调用1

  • LookAndFeel
    添加到辅助外观列表中。辅助外观告诉多路复用外观,在创建多路复用UI时,除了默认的
    LookAndFeel
    类之外,组件实例还将使用哪些
    LookAndFeel
    类。只有在创建新的UI类或在组件实例上更改默认外观时,更改才会生效

    似乎在尝试使用前需要先呼叫1

  • LookAndFeel
    添加到辅助外观列表中。辅助外观告诉多路复用外观,在创建多路复用UI时,除了默认的
    LookAndFeel
    类之外,组件实例还将使用哪些
    LookAndFeel
    类。只有在创建新的UI类或在组件实例上更改默认外观时,更改才会生效


    @Johan Brink寻求更好的帮助,请尽快发布一个简短的、可运行的、可编译的,因为您的代码行没有谈论任何重要的内容。我尝试添加Aux外观,但仍然不起作用。在构造函数中,我添加了另一行:
    UIManager.addAuxiliaryLookAndFeel(新的syntheticalblueicelookandfeel()),我也将其复制到自动创建的外观部分。然而,仍然不能工作。“我正在用一个蹩脚的智能手机打字……”这不是我们的问题。如果您现在无法发布SSCCE,请在可以的时候与我们联系。我似乎已经找到了问题所在。有一句话我从来没有评论过。我将为SSCCE编辑这个问题。@Johan Brink为了获得更好的帮助,请尽快发布一个简短的、可运行的、可编译的,因为您的代码行没有谈论任何重要的内容。我尝试添加Aux外观,但仍然不起作用。在构造函数中,我添加了另一行:
    UIManager.addAuxiliaryLookAndFeel(新的syntheticalblueicelookandfeel()),我也将其复制到自动创建的外观部分。然而,仍然不能工作。“我正在用一个蹩脚的智能手机打字……”这不是我们的问题。如果您现在无法发布SSCCE,请在可以的时候与我们联系。我似乎已经找到了问题所在。有一句话我从来没有评论过。我将为SSCCE编辑这个问题。
    
    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 {
                   UIManager.addAuxiliaryLookAndFeel(new SyntheticaBlueIceLookAndFeel());
                   UIManager.setLookAndFeel(new SyntheticaBlueIceLookAndFeel());
              } catch (Exception e) {
                   e.printStackTrace();
              }
    
    //          try {
    //               for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    //                    JOptionPane.showMessageDialog(null, info.getClassName());
    //                    if ("Nimbus".equals(info.getName())) {
    //                         javax.swing.UIManager.setLookAndFeel(info.getClassName());
    //                         break;
    //                    }
    //               }
    //          } catch (ClassNotFoundException ex) {
    //               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //          } catch (InstantiationException ex) {
    //               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //          } catch (IllegalAccessException ex) {
    //               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    //               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //          }
    //          }
    //          catch (Exception e){
    //               java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, e);
    //          }
    
              //</editor-fold>
    
              /* Create and display the form */
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        new MainMenu().setVisible(true);
                   }
              });
         }
    
    javax.swing.plaf.metal.MetalLookAndFeel
    javax.swing.plaf.nimbus.NimbusLookAndFeel
    com.sun.java.swing.plaf.motif.MotifLookAndFeel
    com.sun.java.swing.plaf.windows.WindowsLookAndFeel
    com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel