// Djava.library.path="C:\opencv\build\java\x64"
  public static void main(String[] args) {
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

    for (javax.swing.UIManager.LookAndFeelInfo info :
        javax.swing.UIManager.getInstalledLookAndFeels()) {
      if ("Nimbus".equals(info.getName())) {
        try {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
        } catch (ClassNotFoundException ex) {
          Logger.getLogger(AnalisadorTickets.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
          Logger.getLogger(AnalisadorTickets.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
          Logger.getLogger(AnalisadorTickets.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
          Logger.getLogger(AnalisadorTickets.class.getName()).log(Level.SEVERE, null, ex);
        }
        break;
      }
    }

    TelaPrincipal tela = new TelaPrincipal();
    tela.setLocationRelativeTo(null);
    tela.setTitle("Analisador de Tickets");
    tela.setVisible(true);
  }
  /** @param args the command line arguments */
  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());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(DatosGasolinera.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new DatosGasolinera("root", "manager").setVisible(true);
          }
        });
  }
Exemple #3
0
  /**
   * Loads the menu with the available look and feels for the application
   *
   * @return l and f menu
   */
  JMenu buildLookAndFeelMenu() {
    String activeLookAndFeelName = UIManager.getLookAndFeel().getName();

    // ButtonGroup buttonGroup = new ButtonGroup();
    JMenu lfMenu = new JMenu();

    lfMenu.setText(rb.getString("Menu.LookAndFeel.Name"));
    lfMenu.setMnemonic(jgnash.ui.util.Resource.getMnemonic("Menu.LookAndFeel.Mnemonic"));

    lfMenu.add(buildSubstanceMenu());

    List<String> lookAndFeels = new ArrayList<>();

    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
      if (isLookAndFeelAvailable(info.getClassName())) {
        lookAndFeels.add(info.getClassName());
      }
    }

    for (String lookAndFeel : KNOWN) {
      if (isLookAndFeelAvailable(lookAndFeel)) {
        lookAndFeels.add(lookAndFeel);
      }
    }

    Collections.sort(lookAndFeels);

    for (String lookAndFeel : lookAndFeels) {
      try {
        Class<?> lnfClass = Class.forName(lookAndFeel);
        LookAndFeel newLAF = (LookAndFeel) lnfClass.newInstance();

        JRadioButtonMenuItem button = new JRadioButtonMenuItem();

        button.setText(newLAF.getName());
        button.setActionCommand(lookAndFeel);
        button.setName(newLAF.getName());

        button.addActionListener(
            e -> {
              Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
              pref.put(LF, e.getActionCommand());

              restartUI();
            });

        lfButtonGroup.add(button);

        lfMenu.add(button);

        if (newLAF.getName().equals(activeLookAndFeelName)) {
          button.setSelected(true);
        }
      } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        Logger.getLogger(ThemeManager.class.getName()).log(Level.WARNING, null, e);
      }
    }

    return lfMenu;
  }
  /** Creates new form Eleminator */
  public Eleminator() {
    getContentPane().add(MTP, BorderLayout.CENTER);
    try {
      String nativeLook = UIManager.getSystemLookAndFeelClassName();
      UIManager.setLookAndFeel(nativeLook);
      SwingUtilities.updateComponentTreeUI(this);
    } catch (Exception e) {
    }

    try {
      File custDir = new File(System.getProperty("user.home") + "/" + "WorkSpace.dat");
      ObjectInputStream In = new ObjectInputStream(new FileInputStream(custDir));
      workingDirectory = new File(((WorkSpace) In.readObject()).getWorkSpace());
    } catch (Exception ex) {
      workingDirectory = new File(System.getProperty("user.home"));
    }

    initComponents();
    LookAndFeelInfo[] li = UIManager.getInstalledLookAndFeels();

    for (int i = 0; li.length > i; i++) { // For more themes

      themeComboBox.addItem(new ThemeItem(li[i].getName(), li[i].getClassName()));
    }

    setBounds(0, 0, 640, 480);
    setTitle("eLEMinator");
    URL imageURL = getClass().getClassLoader().getResource("verifier/lem.jpg");
    Image lem = Toolkit.getDefaultToolkit().getImage(imageURL);
    setIconImage(lem);
  }
Exemple #5
0
 public Results() {
   setResults();
   createScore();
   setUndecorated(true);
   // <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());
         break;
       }
     }
   } catch (ClassNotFoundException ex) {
     java.util.logging.Logger.getLogger(Results.class.getName())
         .log(java.util.logging.Level.SEVERE, null, ex);
   } catch (InstantiationException ex) {
     java.util.logging.Logger.getLogger(Results.class.getName())
         .log(java.util.logging.Level.SEVERE, null, ex);
   } catch (IllegalAccessException ex) {
     java.util.logging.Logger.getLogger(Results.class.getName())
         .log(java.util.logging.Level.SEVERE, null, ex);
   } catch (javax.swing.UnsupportedLookAndFeelException ex) {
     java.util.logging.Logger.getLogger(Results.class.getName())
         .log(java.util.logging.Level.SEVERE, null, ex);
   }
   // </editor-fold>
   initComponents();
   this.scoreBar.setMaximum(this.startSize);
 }
  protected JComponent createLookAndFeelControl() {
    JPanel panel = new JPanel();

    JLabel label = new JLabel("Current Look and Feel");
    lookAndFeelComboBox = new JComboBox();
    label.setLabelFor(lookAndFeelComboBox);
    panel.add(label);
    panel.add(lookAndFeelComboBox);

    // Look for toolkit look and feels first
    UIManager.LookAndFeelInfo lookAndFeelInfos[] = UIManager.getInstalledLookAndFeels();
    lookAndFeelsMap = new HashMap<String, String>();
    for (UIManager.LookAndFeelInfo info : lookAndFeelInfos) {
      String name = info.getName();
      // workaround for problem where Info and name property don't match on OS X
      if (name.equals("Mac OS X")) {
        name = OSXLookAndFeelName;
      }
      // workaround for bug where Nimbus classname is incorrect
      lookAndFeelsMap.put(
          name,
          name.equals("Nimbus")
              ? "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"
              : info.getClassName());
      lookAndFeelComboBox.addItem(name);
    }
    lookAndFeelComboBox.setSelectedItem(UIManager.getLookAndFeel().getName());
    lookAndFeelComboBox.addActionListener(new ChangeLookAndFeelAction());

    return panel;
  }
Exemple #7
0
 public static void setPLAF(String s) {
   try {
     if (s.equals("TinyLAF")) {
       javax.swing.UIManager.setLookAndFeel("de.muntjak.tinylookandfeel.TinyLookAndFeel");
     } else if (s.equals("JGoodiesLAF-PlasticXP")) {
       javax.swing.UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel");
     } else if (s.equals("JGoodiesLAF-Plastic")) {
       javax.swing.UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticLookAndFeel");
     } else if (s.equals("JGoodiesLAF-Plastic3D")) {
       javax.swing.UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
     } else if (s.equals("JGoodiesLAF-ExtWindows")) {
       javax.swing.UIManager.setLookAndFeel("com.jgoodies.plaf.windows.ExtWindowsLookAndFeel");
     } else if (s.equals("System")) {
       javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
     } else {
       javax.swing.UIManager.LookAndFeelInfo[] lfinfo =
           javax.swing.UIManager.getInstalledLookAndFeels();
       for (int i = 0; i < lfinfo.length; ++i) {
         if (lfinfo[i].getName().equalsIgnoreCase(s)) {
           javax.swing.UIManager.setLookAndFeel(lfinfo[i].getClassName());
           return;
         }
       }
     }
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
  /** @param args the command line arguments */
  public static void main(String[] args) {
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(MainForm.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(MainForm.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(MainForm.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(MainForm.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    java.awt.EventQueue.invokeLater(
        new Runnable() {
          public void run() {

            Primitives.InitializePrimitives();
            MainForm fm = new MainForm();
            fm.setSize(680, 600);
            fm.setVisible(true);
            fm.setTitle("ObjectiveMedia Sample App");
          }
        });
  }
Exemple #9
0
 public void startGUI() {
   // Set the Nimbus look and feel
   try {
     for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
       if ("Nimbus".equals(info.getName())) {
         UIManager.setLookAndFeel(info.getClassName());
         break;
       }
     }
     UIManager.put("control", AMLColor.WHITE);
     UIManager.put("background", AMLColor.WHITE);
     UIManager.put("scrollbar", AMLColor.LIGHT_GRAY);
   } catch (Exception e) {
     e.printStackTrace();
   }
   // Initialize the file choosers
   ofc = new OntologyFileChooser();
   afc = new AlignmentFileChooser();
   // Create and display the GUI
   java.awt.EventQueue.invokeLater(
       new Runnable() {
         public void run() {
           userInterface = new GUI();
         }
       });
 }
  public static void main(String[] args) throws Exception {
    Timer timer = new Timer();
    timer.schedule(
        new TimerTask() {
          @Override
          public void run() {
            try {
              new Flash();
            } catch (InterruptedException e) {
            }
            System.gc();
          }
        },
        1000 * 60 * 5,
        1000 * 60 * 10);

    // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
      if ("Nimbus".equals(info.getName())) {
        UIManager.setLookAndFeel(info.getClassName());
        break;
      }
    }
    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            TaskListDialog t = new TaskListDialog();
            t.setVisible(true);
          }
        });
  }
  /** @param args the command line arguments */
  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());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(ExtendedPrintProgressDialog.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(ExtendedPrintProgressDialog.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(ExtendedPrintProgressDialog.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(ExtendedPrintProgressDialog.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the dialog */
    java.awt.EventQueue.invokeLater(
        new Runnable() {

          @Override
          public void run() {
            ExtendedPrintProgressDialog dialog =
                new ExtendedPrintProgressDialog(
                    new javax.swing.JFrame(),
                    true,
                    null,
                    null,
                    null,
                    null,
                    1,
                    false,
                    false,
                    false,
                    false);
            dialog.addWindowListener(
                new java.awt.event.WindowAdapter() {

                  @Override
                  public void windowClosing(java.awt.event.WindowEvent e) {
                    System.exit(0);
                  }
                });
            dialog.setVisible(true);
          }
        });
  }
  public ExportDialogROIs(java.awt.Frame parent, boolean modal, ImageSource imageSource) {
    super(parent, modal);
    this.imageSource = imageSource;
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(ExportDialogROIs.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    initComponents();

    File f = jFileChooserOutputDir.getFileSystemView().getDefaultDirectory();
    jFileChooserOutputDir.setCurrentDirectory(f);
    jFileChooserOutputDir.setSelectedFile(f);
    jFileChooserOutputDir.setMultiSelectionEnabled(false);
    jFileChooserOutputDir.setAcceptAllFileFilterUsed(false);
    jFileChooserOutputDir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    jTextFieldOutputDir.setText(f.getAbsolutePath());
  }
Exemple #13
0
  /** @param args the command line arguments */
  public static void main(String args[]) {

    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(Config.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(Config.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() {
            new Config(Main.getLocale()).setVisible(true);
          }
        });
  }
  /** @param args the command line arguments */
  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());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(FrameLoading.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the form */

  }
Exemple #15
0
  /** @param args the command line arguments */
  public static void main(String[] args) {
    System.out.println("Starting RecipeSearch");
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(RecipeSearchView.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    new RecipeSearchView().setVisible(true);

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  @Override
                  public void run() {
                    // This code will run before shutdown
                    System.out.println("Closing RecipeSearch");
                  }
                }));
  }
Exemple #16
0
  /**
   * Main method. Begins the GUI, and the rest of the program.
   *
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    // playSound();
    try {
      for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      Logger.getLogger(mainForm.class.getName()).log(Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the form */
    EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new mainForm().setVisible(true);
          }
        });
  }
Exemple #17
0
  /** Creates new form CallForm */
  public Controller() {
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      logger.log(java.util.logging.Level.SEVERE, ex.getMessage(), ex);
    }
    initComponents();
    this.setVisible(true);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          @Override
          public void windowClosing(java.awt.event.WindowEvent windowEvent) {
            if (cancelButton.isEnabled()) {
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              System.exit(0);
            }
          }
        });
  }
Exemple #18
0
  public static void main(String args[]) {
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(Main.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(Main.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(Main.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(Main.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    if (args.length != 0) {
      s = args[0];
    }
    java.awt.EventQueue.invokeLater(
        new Runnable() {
          public void run() {
            new Main().setVisible(true);
          }
        });
  }
  public static void main(String args[]) {

    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Windows".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(TelaVenda.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }

    java.awt.EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            new TelaVenda().setVisible(true);
          }
        });
  }
Exemple #20
0
 public static void main(String[] args) {
   // com.sun.java.swing.plaf.gtk.
   try {
     for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
       if ("Nimbus".equals(info.getName())) {
         UIManager.setLookAndFeel(info.getClassName());
         break;
       }
     }
     // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
   } catch (ClassNotFoundException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (InstantiationException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (UnsupportedLookAndFeelException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   board = new Board(19);
   new UiFrame(board);
 }
Exemple #21
0
  /** Sets look and feel. */
  private void setLookAndFeel() {
    try {
      // Sets system look
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      // Force Numbus (for Said happiness )
      for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }

      // Force fullScreen
      Toolkit tk = Toolkit.getDefaultToolkit();
      int xSize = ((int) tk.getScreenSize().getWidth());
      int ySize = ((int) tk.getScreenSize().getHeight() - 40);
      this.setSize(xSize, ySize);
    } catch (ClassNotFoundException
        | InstantiationException
        | IllegalAccessException
        | UnsupportedLookAndFeelException ex) {
      showErrorMessage(ex);
    }
  }
  /** Installs the JGoodies Look & Feels, if available, in classpath. */
  public final void initializeLookAndFeels() {
    // if in classpath thry to load JGoodies Plastic Look & Feel
    try {
      LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
      boolean found = false;
      for (int i = 0; i < lnfs.length; i++) {
        if (lnfs[i].getName().equals("JGoodies Plastic 3D")) {
          found = true;
        }
      }
      if (!found) {
        UIManager.installLookAndFeel(
            "JGoodies Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
      }
      String os = System.getProperty("os.name");
      FontSet fontSet = null;
      if (os.startsWith("Windows")) {
        fontSet = FontSets.createDefaultFontSet(new Font("arial unicode MS", Font.PLAIN, 12));
      } else {
        fontSet = FontSets.createDefaultFontSet(new Font("arial unicode", Font.PLAIN, 12));
      }
      FontPolicy fixedPolicy = FontPolicies.createFixedPolicy(fontSet);
      PlasticLookAndFeel.setFontPolicy(fixedPolicy);

      UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    } catch (Throwable t) {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Exemple #23
0
 private String[] getInstalledLookAndFeels() {
   UIManager.LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
   String[] lnfNames = new String[lnfs.length];
   for (int i = 0; i < lnfs.length; i++) {
     lnfNames[i] = lnfs[i].getName();
   }
   return lnfNames;
 }
Exemple #24
0
  public void initUI() {
    scrollingToBottomCheckbox.setSelected(applicationPreferences.isScrollingToBottom());
    coloringWholeRowCheckbox.setSelected(applicationPreferences.isColoringWholeRow());
    showFullCallstackCheckbox.setSelected(applicationPreferences.isShowingFullCallstack());
    showStackTraceCheckbox.setSelected(applicationPreferences.isShowingStackTrace());
    usingWrappedExceptionStyleCheckbox.setSelected(
        applicationPreferences.isUsingWrappedExceptionStyle());

    // look and feel
    {
      ArrayList<String> lookAndFeels = new ArrayList<>();
      for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        lookAndFeels.add(info.getName());
      }
      Collections.sort(lookAndFeels);
      int selectedIndex = 0;
      String lookAndFeel = applicationPreferences.getLookAndFeel();
      if (lookAndFeel == null || "".equals(lookAndFeel)) {
        lookAndFeel = UIManager.getLookAndFeel().getName();
      }
      int idx = lookAndFeels.indexOf(lookAndFeel);
      if (idx > -1) {
        selectedIndex = idx;
      } else {
        idx = lookAndFeels.indexOf(ApplicationPreferences.STARTUP_LOOK_AND_FEEL);
        if (idx > -1) {
          selectedIndex = idx;
        }
      }
      lookAndFeelCombo.setModel(
          new DefaultComboBoxModel<>(lookAndFeels.toArray(new String[lookAndFeels.size()])));
      lookAndFeelCombo.setSelectedIndex(selectedIndex);
    }

    // default condition name
    {
      List<String> conditionNames = applicationPreferences.retrieveAllConditions();
      String defaultName = applicationPreferences.getDefaultConditionName();
      int idx = conditionNames.indexOf(defaultName);
      if (idx < 0) {
        idx = 0;
      }

      defaultConditionCombo.setModel(
          new DefaultComboBoxModel<>(conditionNames.toArray(new String[conditionNames.size()])));
      defaultConditionCombo.setSelectedIndex(idx);
    }
    String appPath = applicationPreferences.getApplicationPath().getAbsolutePath();
    appPathTextField.setText(appPath);
    appPathTextField.setToolTipText(appPath);

    globalLoggingEnabledCheckbox.setSelected(applicationPreferences.isGlobalLoggingEnabled());
    loggingStatsEnabledCheckbox.setSelected(applicationPreferences.isLoggingStatisticEnabled());
    trayActiveCheckbox.setSelected(applicationPreferences.isTrayActive());
    trayActiveCheckbox.setEnabled(TraySupport.isAvailable());
    hidingOnCloseCheckbox.setSelected(applicationPreferences.isHidingOnClose());
    hidingOnCloseCheckbox.setEnabled(TraySupport.isAvailable());
  }
 public static JMenu createLookAndFeelMenu() {
   JMenu menu = new JMenu("LookAndFeel");
   ButtonGroup lookAndFeelRadioGroup = new ButtonGroup();
   for (UIManager.LookAndFeelInfo lafInfo : UIManager.getInstalledLookAndFeels()) {
     menu.add(
         createLookAndFeelItem(lafInfo.getName(), lafInfo.getClassName(), lookAndFeelRadioGroup));
   }
   return menu;
 }
Exemple #26
0
 private String getLookAndFeelClassName(String lookAndFeelName) {
   UIManager.LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
   for (int i = 0; i < lnfs.length; i++) {
     if (lookAndFeelName.equals(lnfs[i].getName())) {
       return lnfs[i].getClassName();
     }
   }
   return UIManager.getSystemLookAndFeelClassName();
 }
Exemple #27
0
  /**
   * Create the GUI and show it. For thread safety, this method should be invoked from the event
   * dispatch thread.
   */
  private static void createAndShowGUI() {
    ExceptionReporting.registerExceptionReporter();

    // Added to handle possible JDK 1.6 bug (thanks to Makoto Yui and the BaseX
    // guys).
    UIManager.getInstalledLookAndFeels();

    // Refresh views when windows are resized (thanks to the BaseX guys).
    Toolkit.getDefaultToolkit().setDynamicLayout(true);

    if (mUseSystemLookAndFeel) {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (final ClassNotFoundException
          | InstantiationException
          | IllegalAccessException
          | UnsupportedLookAndFeelException e) {
        LOGWRAPPER.error(e.getMessage(), e);
      }
    } else {
      try {
        for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
          if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
          }
        }
      } catch (final Exception e) {
        // If Nimbus is not available, you can set the GUI to another look and
        // feel.
        try {
          UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException
            | InstantiationException
            | IllegalAccessException
            | UnsupportedLookAndFeelException exc) {
          LOGWRAPPER.error(exc.getMessage(), exc);
        }
      }
    }

    // Create GUI.
    new GUI(new GUIProp());
  }
Exemple #28
0
 private static void adjustLAF()
     throws ClassNotFoundException, InstantiationException, IllegalAccessException,
         UnsupportedLookAndFeelException {
   for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
     if ("Nimbus".equals(info.getName())) {
       // UIManager.setLookAndFeel(info.getClassName());
       break;
     }
   }
 }
  /** Invoked via reflection. */
  LafManagerImpl() {
    myListenerList = new EventListenerList();

    List<UIManager.LookAndFeelInfo> lafList = ContainerUtil.newArrayList();

    if (SystemInfo.isMac) {
      if (Registry.is("ide.mac.yosemite.laf")
          && isIntelliJLafEnabled()
          && SystemInfo.isJavaVersionAtLeast("1.8")) {
        lafList.add(new UIManager.LookAndFeelInfo("Default", IntelliJLaf.class.getName()));
      } else {
        lafList.add(
            new UIManager.LookAndFeelInfo("Default", UIManager.getSystemLookAndFeelClassName()));
      }
    } else {
      if (isIntelliJLafEnabled()) {
        lafList.add(new IntelliJLookAndFeelInfo());
      } else {
        lafList.add(new IdeaLookAndFeelInfo());
      }
      for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
        String name = laf.getName();
        if (!"Metal".equalsIgnoreCase(name)
            && !"CDE/Motif".equalsIgnoreCase(name)
            && !"Nimbus".equalsIgnoreCase(name)
            && !"Windows Classic".equalsIgnoreCase(name)
            && !name.startsWith("JGoodies")) {
          lafList.add(laf);
        }
      }
    }

    lafList.add(new DarculaLookAndFeelInfo());

    myLaFs = lafList.toArray(new UIManager.LookAndFeelInfo[lafList.size()]);

    if (!SystemInfo.isMac) {
      // do not sort LaFs on mac - the order is determined as Default, Darcula.
      // when we leave only system LaFs on other OSes, the order also should be determined as
      // Default, Darcula

      Arrays.sort(
          myLaFs,
          new Comparator<UIManager.LookAndFeelInfo>() {
            @Override
            public int compare(UIManager.LookAndFeelInfo obj1, UIManager.LookAndFeelInfo obj2) {
              String name1 = obj1.getName();
              String name2 = obj2.getName();
              return name1.compareToIgnoreCase(name2);
            }
          });
    }

    myCurrentLaf = getDefaultLaf();
  }
  /** @param args the command line arguments */
  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());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(MegaDownloadUI.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(MegaDownloadUI.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(MegaDownloadUI.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(MegaDownloadUI.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /*
     * Create and display the form
     */
    java.awt.EventQueue.invokeLater(
        new Runnable() {

          @Override
          public void run() {
            new MegaDownloadUI().setVisible(true);
          }
        });

    ServerThread serverThread = null;
    try {
      Logger log = Logging.setupLog("MegaDownloadUI");
      serverThread = new ServerThread("ServerThread", Logging.setupLog("ServerThread"));
    } catch (LoggerException ex) {
      log.log(Level.SEVERE, null, ex);
    }
    serverThread.start();
  }