public static void main(String[] args) {
   if (args.length == 0) usageError();
   if (args[0].equals("cross")) {
     try {
       UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else if (args[0].equals("system")) {
     try {
       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else if (args[0].equals("motif")) {
     try {
       UIManager.setLookAndFeel("com.sun.java." + "swing.plaf.motif.MotifLookAndFeel");
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else usageError();
   // Note the look & feel must be set before
   // any components are created.
   run(new LookAndFeel(), 300, 300);
 }
Ejemplo n.º 2
0
  private void initLookAndFeelAplicacion(String loolAndFeelStr) {

    if (lookAndFeel != null) {
      if (loolAndFeelStr.equals("Metal")) {
        lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
        //  an alternative way to set the Metal L&F is to replace the
        // previous line with:
        // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel";

      } else if (loolAndFeelStr.equals("System")) {
        lookAndFeel = UIManager.getSystemLookAndFeelClassName();
      } else if (loolAndFeelStr.equals("Motif")) {
        lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
      } else if (loolAndFeelStr.equals("GTK")) {
        lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
      } else if (loolAndFeelStr.equals("Nimbus")) {
        lookAndFeel = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
      } else {
        System.err.println("Valor inesperado para LOOKANDFEEL especificado: " + lookAndFeel);
        lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName();
      }

      try {

        UIManager.setLookAndFeel(lookAndFeel);

        // If L&F = "Metal", set the theme

        if (lookAndFeel.equals("Metal")) {
          if (THEME.equals("DefaultMetal")) {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
          } else if (THEME.equals("Ocean")) {
            MetalLookAndFeel.setCurrentTheme(new OceanTheme());
          } else {
            MetalLookAndFeel.setCurrentTheme(new TestTheme());
          }

          UIManager.setLookAndFeel(new MetalLookAndFeel());
        }
      } catch (ClassNotFoundException e) {
        System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel);
        System.err.println("Did you include the L&F library in the class path?");
        System.err.println("Using the default look and feel.");
      } catch (UnsupportedLookAndFeelException e) {
        System.err.println(
            "Can't use the specified look and feel (" + lookAndFeel + ") on this platform.");
        System.err.println("Using the default look and feel.");
      } catch (Exception e) {
        System.err.println(
            "Couldn't get specified look and feel (" + lookAndFeel + "), for some reason.");
        System.err.println("Using the default look and feel.");
        e.printStackTrace();
      }
    }
  }
Ejemplo n.º 3
0
 public static void main(String[] args) throws Exception {
   if (args.length > 0) {
     DATABASE_FILE = Paths.get(args[0]);
   }
   UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   launch(args);
 }
 private static void setLookAndFeel(String os) {
   if (os == null) {
     os = System.getProperty("os.name");
   }
   os = os.trim().toLowerCase();
   try {
     if (os.contains("windows")) {
       UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
     } else if (os.contains("mac")) {
       UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
     } else if (os.contains("javametal")) {
       UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
     } else if (os.contains("weblookandfeel")) {
       WebLookAndFeel.install();
     } else {
       UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
     }
   } catch (ClassNotFoundException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   } catch (InstantiationException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   } catch (IllegalAccessException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   } catch (UnsupportedLookAndFeelException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   }
 }
Ejemplo n.º 5
0
 public static void main(String args[]) {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
   }
   SwingUtilities.invokeLater(QLearning::new);
 }
Ejemplo n.º 6
0
  public static void main(String[] args) {

    // Get the System Look and Feel
    try {
      // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }

    // Instantiate the Gooseget main frame
    GooseGet ggget = new GooseGet();
    ggget.setSize(900, 600);

    // Keep in the middle of the Screen
    Dimension screenSize1 = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension swinSize = ggget.getSize();
    swinSize.height =
        ((swinSize.height > screenSize1.height) ? screenSize1.height : swinSize.height);
    swinSize.width = ((swinSize.width > screenSize1.width) ? screenSize1.width : swinSize.width);
    ggget.setLocation(
        (screenSize1.width - swinSize.width) / 2, (screenSize1.height - swinSize.height) / 2);
    ggget.setVisible(true);
  }
Ejemplo n.º 7
0
  public static String getDefaultLookAndFeelClassName() {
    switch (UiMode.getCurrentUiMode()) {
      case SWING:
        String className = UIManager.getSystemLookAndFeelClassName();

        // if the default look and feel is the cross-platform one, we might
        // need to correct this choice. E.g. - KDE, where GTK look and feel
        // would be much more appropriate
        if (className.equals(UIManager.getCrossPlatformLookAndFeelClassName())) {

          // if the current platform is Linux and the desktop manager is
          // KDE, then we should try to use the GTK look and feel
          try {
            if (System.getProperty("os.name").contains("Linux")
                && (System.getenv("KDE_FULL_SESSION") != null)) {
              // check whether the GTK look and feel class is
              // available -- we'll get CNFE if it is not and it will
              // not be set
              Class.forName(LookAndFeelType.GTK.getClassName());

              className = LookAndFeelType.GTK.getClassName();
            }
          } catch (ClassNotFoundException e) {
            ErrorManager.notifyDebug(
                ResourceUtils.getString(UiUtils.class, RESOURCE_FAILED_TO_FORCE_GTK), e);
          }
        }

        return className;
      default:
        return null;
    }
  }
Ejemplo n.º 8
0
 public static void setJavaLookAndFeel() {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
     System.out.println("Error setting Java LAF: " + e);
   }
 }
Ejemplo n.º 9
0
  // Member Methods.
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
    }

    // This application uses the model/view/controller
    // pattern. The controller is responsible for routing
    // messages between the view (GUI objects) and the
    // model (back-end objects).
    // Create the model, view and controller objects.

    // TaskManager model "runs" the jobs.
    TaskManager taskManager = new TaskManager();

    taskManager.start();

    // Create the top-level container and add contents to it.
    JFrame frame = new JFrame("Task Demo");
    taskdemo app = new taskdemo();

    app.createComponents(frame.getContentPane());

    // Finish up setting up the frame and show it.
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            // The window is going away NOW. Just exit.
            System.exit(0);
          }
        });
    frame.pack();
    frame.setVisible(true);
  }
Ejemplo n.º 10
0
 public static void main(String[] args) {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
   }
   MainFrame mainFrame = new MainFrame();
 }
Ejemplo n.º 11
0
 public static void main(String args[]) {
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
   }
   JFrame mainscreenGUIframe = new Main_ScreenGUIFrame();
   mainscreenGUIframe.setVisible(true);
 }
Ejemplo n.º 12
0
  public static void main(String[] args) {
    // set the look and feel
    try {
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
    }

    ServerFrontend frontEnd = new ServerFrontend();
  }
Ejemplo n.º 13
0
 // Window theme settings
 private static void installLnF() {
   try {
     String lnfClassname = PREFERRED_LOOK_AND_FEEL;
     if (lnfClassname == null) lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();
     UIManager.setLookAndFeel(lnfClassname);
   } catch (Exception e) {
     System.err.println(
         "Cannot install " + PREFERRED_LOOK_AND_FEEL + " on this platform:" + e.getMessage());
   }
 }
Ejemplo n.º 14
0
  /**
   * Init look and feel. If parameter is empty string, no initialization will be done. If parameter
   * is null, try to use plasticxp (jwindows on Windows), but don't show an error message, if it
   * fails. Otherwise use parameter as class name or shortcut as decoumented in the GoGui reference,
   * and show message on failure.
   */
  public static void initLookAndFeel(String laf) {
    // Disables renaming mode in Sun Java 1.5, which makes using the
    // JFileChooser a pain and is also enabled for open dialogs
    // for no good reason. Unfortunately that sacrifices the new directory
    // button, which is useful for save dialogs
    UIManager.put("FileChooser.readOnly", Boolean.TRUE);
    if ("".equals(laf)) return;
    boolean showError = true;
    if (laf == null) {
      showError = false;
      if (Platform.isWindows()) laf = "system";
      else if (Platform.isMac()) laf = "quaqua";
      else if (Platform.isUnix()) laf = "plasticxp";
      else return;
    }
    if ("cross".equals(laf)) laf = UIManager.getCrossPlatformLookAndFeelClassName();
    else if ("gtk".equals(laf)) laf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
    else if ("motif".equals(laf)) laf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
    else if ("jwindows".equals(laf)) laf = "com.jgoodies.looks.windows.WindowsLookAndFeel";
    else if ("plasticxp".equals(laf)) laf = "com.jgoodies.looks.plastic.PlasticXPLookAndFeel";
    else if ("quaqua".equals(laf)) laf = "ch.randelshofer.quaqua.QuaquaLookAndFeel";
    else if ("system".equals(laf)) laf = UIManager.getSystemLookAndFeelClassName();
    else if ("windows".equals(laf)) laf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    if (laf.equals("com.jgoodies.looks.plastic.PlasticXPLookAndFeel")) {
      UIManager.put("jgoodies.useNarrowButtons", Boolean.FALSE);
      UIManager.put("ScrollBar.maxBumpsWidth", Integer.valueOf(19));
    }
    try {
      UIManager.setLookAndFeel(laf);
      if (laf.equals("ch.randelshofer.quaqua.QuaquaLookAndFeel")) {
        // Auto-generation of badged icons does not work in Quaqua
        // 3.7.2 (the GoGui app icon shows filled white), and Apple
        // style guide says that alert icons badged with app icon
        // should be used only in rare cases anyway
        Object icon = LookAndFeel.makeIcon(GuiUtil.class, "gogui-64x64.png");
        UIManager.put("OptionPane.errorIcon", icon);
        UIManager.put("OptionPane.informationIcon", icon);
        UIManager.put("OptionPane.questionIcon", icon);
        UIManager.put("OptionPane.warningIcon", icon);
      }
    } catch (ClassNotFoundException e) {
      handleLookAndFeelError(showError, laf);

    } catch (InstantiationException e) {
      handleLookAndFeelError(showError, laf);

    } catch (IllegalAccessException e) {
      handleLookAndFeelError(showError, laf);

    } catch (UnsupportedLookAndFeelException e) {
      handleLookAndFeelError(showError, laf);
    }
  }
Ejemplo n.º 15
0
 private static void changeUI(boolean system) {
   try {
     // Set System L&F
     //      UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
     UIManager.setLookAndFeel(
         system
             ? UIManager.getSystemLookAndFeelClassName()
             : UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 16
0
 /**
  * PENDING: JW - this is about toggling the LF, does nothing to update the UI. Check all tests
  * using this method to see if they make sense!
  *
  * @param system
  */
 public static void setSystemLF(boolean system) {
   String lfName =
       system
           ? UIManager.getSystemLookAndFeelClassName()
           : UIManager.getCrossPlatformLookAndFeelClassName();
   try {
     UIManager.setLookAndFeel(lfName);
   } catch (Exception e1) {
     LOG.info("exception when setting LF to " + lfName);
     LOG.log(Level.FINE, "caused by ", e1);
   }
 }
Ejemplo n.º 17
0
  public void initGui()
      throws ClassNotFoundException, InstantiationException, IllegalAccessException,
          UnsupportedLookAndFeelException {
    System.setProperty("prism.lcdtext", "false");
    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    app = new DesktopClientGui(services, runtimeConfiguration);

    cancelButton =
        new ButtonType(getResources().getString("updateCancel"), ButtonBar.ButtonData.CANCEL_CLOSE);
    updateButton =
        new ButtonType(getResources().getString("updateStart"), ButtonBar.ButtonData.APPLY);
  }
Ejemplo n.º 18
0
  public MainFrame() {
    super("P2 Auto Update and Automatic Build Test");

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      System.out.println("Error loading System Look and Feel: " + e.getMessage());
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } catch (Exception ex) {
        System.out.println("Error loading CrossPlatform Look and Feel: " + e.getMessage());
      }
    }

    LabelOne one = new LabelOne();
    LabelTwo two = new LabelTwo();
    LabelThree three = new LabelThree();
    LabelFour four = new LabelFour();

    JPanel mainPanel = new JPanel();
    GroupLayout layout = new GroupLayout(mainPanel);
    mainPanel.setLayout(layout);

    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup()
            .addComponent(one)
            .addComponent(two)
            .addComponent(three)
            .addComponent(four));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(one)
            .addComponent(two)
            .addComponent(three)
            .addComponent(four));

    this.addWindowListener(this);

    this.add(mainPanel);
    this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    this.pack();
    this.setVisible(true);
  }
Ejemplo n.º 19
0
  /**
   * On Mac OS X there is no text field for regexes with the default look and feel {@link
   * JFileChooser}. Therefore on Mac OS X the {@link MacHackedFileChooserPanel} gets the
   * UIManager.getCrossPlatformLookAndFeelClassName()
   *
   * @return
   */
  private MacHackedFileChooserPanel getFileChooserWithLookAndFeel() {
    MacHackedFileChooserPanel fileChooser = null;
    if (System.getProperty("os.name").equals("Mac OS X")) {
      LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        fileChooser = new MacHackedFileChooserPanel();
        UIManager.setLookAndFeel(lookAndFeel);
      } catch (Exception e) {
        // mac hack
      }
    }

    return (fileChooser != null) ? fileChooser : new MacHackedFileChooserPanel();
  }
Ejemplo n.º 20
0
  public static void main(String[] args) {
    try {
      // Set cross-platform Java L&F (also called "Metal")
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (UnsupportedLookAndFeelException e) {
      System.err.println(e);
    } catch (ClassNotFoundException e) {
      System.err.println(e);
    } catch (InstantiationException e) {
      System.err.println(e);
    } catch (IllegalAccessException e) {
      System.err.println(e);
    }

    String usage =
        "Usage: java -jar jubilee.jar -u <userId> [-m <max-annotations=2> -p <skip=0> -s <system-folder=system>]";
    String title = "Jubilee 2.20b";
    String userId = null;
    int maxAnn = 2;
    byte skip = 0;
    String sysDir = "system" + File.separator;

    if (args.length == 0 || args.length % 2 != 0) {
      System.err.println(usage);
      return;
    }

    for (int i = 0; i < args.length; i += 2) {
      String option = args[i];
      String value = args[i + 1];

      if (option.equals("-u")) userId = value;
      else if (option.equals("-m")) maxAnn = Integer.parseInt(value);
      else if (option.equals("-p")) skip = Byte.parseByte(value);
      else if (option.equals("-s")) sysDir = value + File.separator;
      else {
        System.err.println(usage);
        return;
      }
    }

    if (userId == null) {
      System.err.println(usage);
      return;
    }

    new JBToolkit(title, sysDir, userId, maxAnn, skip);
  }
Ejemplo n.º 21
0
  ThemeManager(final JFrame frame) {

    // this line needs to be implemented in order to make JWS work properly
    UIManager.getLookAndFeelDefaults().put("ClassLoader", frame.getClass().getClassLoader());

    try { // This could fail if JGoodies is not available
      com.jgoodies.looks.Options.setPopupDropShadowEnabled(true); // Enabled JGoodies drop shadow
    } catch (Exception e) {
      Logger.getLogger(ThemeManager.class.getName())
          .log(Level.FINE, "JGoodies L&F was not found", e);
    }

    Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);

    setLookAndFeel(pref.get(LF, UIManager.getCrossPlatformLookAndFeelClassName()));
  }
  private void init() {

    // Находим все доступные стили
    lookAndFeels = findAvailableLookAndFeels();

    for (LookAndFeelInfo lookAndFeel : lookAndFeels) {
      if (lookAndFeel.getClassName() == UIManager.getCrossPlatformLookAndFeelClassName()) {
        defaultLookAndFeel = lookAndFeel;
      }
    }

    //		System.out.println("$$$ " + defaultLookAndFeel.getClassName());

    PropertiesManager propertiesManager = PropertiesManager.getInstance();

    String name = propertiesManager.getProperty("lookandfeel.name", "");
    String className = propertiesManager.getProperty("lookandfeel.class", "");

    //		System.out.println("###################################################");
    //		System.out.println("name = " + name);
    //		System.out.println("className = " + className);

    LookAndFeelInfo lookAndFeel = new LookAndFeelInfo(name, className);

    //		System.out.println("$$$ " + lookAndFeel.getClassName());

    if (lookAndFeels.contains(lookAndFeel)) {
      lookAndFeel = lookAndFeels.get(lookAndFeels.indexOf(lookAndFeel));
    } else {
      lookAndFeel = defaultLookAndFeel;
    }

    //		System.out.println("$$$ " + lookAndFeel.getClassName());

    setLookAndFeel(lookAndFeel);

    if (FontEditor.DEBUG) {

      for (LookAndFeelInfo lookAndFeelInfo : lookAndFeels) {
        System.out.println("look & feel found -> " + lookAndFeelInfo.getName());
      }

      System.out.println("Total look & feel(s) found: " + lookAndFeels.size());
      System.out.println();
    }
  }
Ejemplo n.º 23
0
  private static void setupLookAndFeel() {

    // set up system Look&Feel
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      RiskUtil.printStackTrace(e);
    }

    // only do this check if there is NO sandbox
    // as otherwise we will get an exception anyway
    if (checkForNoSandbox()) {

      // check for java bug with JFileChooser
      try {

        new JFileChooser();

      } catch (Throwable th) {

        try {
          UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception e) {
          RiskUtil.printStackTrace(e);
        }
      }
    }
    /* OLD
    		// set up system Look&Feel
    		try {

    			String os = System.getProperty("os.name");
    			String jv = System.getProperty("java.version");

    			if ( jv.startsWith("1.4.2") && os != null && os.startsWith("Linux")) {
    				UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
    			}
    			else {
    				UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    			}
    		}
    		catch (Exception e) {
    			RiskUtil.printStackTrace(e);
    		}
    */
  }
Ejemplo n.º 24
0
  public static void main(String[] args) {

    try {
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception ex) {
      Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex);
    }

    JFrame frame = new JFrame("CS384 Project");
    MainFrame m = new MainFrame();
    m.initializeContainer(frame);

    frame.setJMenuBar(m.createJMenu());
    frame.pack();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Ejemplo n.º 25
0
  public static void newIDEWindow() {

    try {
      System.getProperty("com.apple.laf.useScreenMenuBar", "true");
      System.getProperty("com.apple.mrj.application.apple.menu.about.name", "IDE");
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());

    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }
    new IDEWindow("IDE");
  }
Ejemplo n.º 26
0
  public static void main(String[] args) {

    System.out.print(
        "\nReport, the universal tool for reporters will start in a few seconds, please hold the line...\n\n");

    try {
      UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) {
      log.debug("Fehler beim setzen von LookAndFeel");
    }

    LogConfigurator.configureLog();
    MainFrame mFrame = new MainFrame();
    mFrame.setSize(800, 600);
    mFrame.setVisible(true);
    String[] test = {"a", "b"};
    /*		ViewFrame frame = new ViewFrame(test);
    frame.setVisible(true);*/
  }
Ejemplo n.º 27
0
Archivo: Z.java Proyecto: adamldavis/z
 public Z() {
   addListeners();
   zfactory = new ZFactory(Z.class.getResourceAsStream("z.properties"));
   loadSettings();
   timer.schedule(
       new TimerTask() {
         @Override
         public void run() {
           Z.this.run();
         }
       },
       33,
       33);
   try {
     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
   } catch (Exception e) {
     log.error(e.getMessage(), e);
   }
 }
  public orderBtn(final int id, final JPanel content)
      throws ClassNotFoundException, InstantiationException, IllegalAccessException,
          UnsupportedLookAndFeelException {

    this.setOpaque(true);

    this.setFont(new Font("Tahoma", Font.PLAIN, 25));
    this.setForeground(Color.decode("#FFFFFF"));

    final int fetchedID = id;

    PullData pd = new PullData();

    String query = "select status from orders where orderID = " + id + ";";

    String statusCheck = pd.checkStatus(query);

    if (statusCheck.equals("UNHANDLED")) {
      this.setBackground(Color.decode("#A0124A"));
    } else {
      if (statusCheck.equals("PICKING")) {
        this.setBackground(Color.decode("#6812A0"));
      } else if (statusCheck.equals("AWAITINGDISPATCH")) {
        this.setBackground(Color.decode("#CC8400"));
      } else if (statusCheck.equals("COMPLETE")) {
        this.setBackground(Color.decode("#4AA012"));
      }
    }

    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());

    this.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            final orderPane op = new orderPane(id);
            content.removeAll();
            content.add(op);
            content.repaint();
            content.revalidate();
          }
        });
  }
Ejemplo n.º 29
0
  /** @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 ("Windows".equals(info.getName()) | "GTK+".equals(info.getName()) | "Macintosh".equals(info.getName())) {
              javax.swing.UIManager.setLookAndFeel(info.getClassName());
              break;
          }

          if ("Nimbus".equals(info.getName())) {
              javax.swing.UIManager.setLookAndFeel(info.getClassName());
          }
      }*/

      javax.swing.UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(mainInterface.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(mainInterface.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(mainInterface.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(mainInterface.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 mainInterface().setVisible(true);
          }
        });
  }
  public static void main(String[] args) {

    try {
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception e) {
      LOGGER.info("Exception in main 1 ", e);
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } catch (Exception ex) {
        LOGGER.info("Exception in main 2 ", e);
      }
    }

    frame = new LineFrame();
    frame.setVisible(true);
  }