Ejemplo n.º 1
0
  public void setSpecificTaskPane(JPanel contents, String title, Icon icon) {
    if (currentSpecificTaskPane != null) {
      taskPaneContainer.remove(currentSpecificTaskPane);
    }
    currentSpecificTaskPane = new JXTaskPane();
    currentSpecificTaskPane.setLayout(new BorderLayout());
    currentSpecificTaskPane.setTitle(title);
    currentSpecificTaskPane.setIcon(icon);
    // contents.setOpaque(false);
    SwingUtilities.updateComponentTreeUI(contents);
    // currentSpecificTaskPane.setOpaque(false);
    currentSpecificTaskPane.add(contents, BorderLayout.CENTER);

    // this.mainTaskPane.setExpanded(false);
    taskPaneContainer.add(currentSpecificTaskPane);
  }
Ejemplo n.º 2
0
  public static void main(String[] args) {
    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            boolean hasLafSpecified = false;
            try {
              hasLafSpecified = (System.getProperty("swing.defaultlaf") != null);
            } catch (Throwable t) {
              // JNLP sandbox
            }

            // LAFAdapter.startWidget();

            try {
              if (!hasLafSpecified) {
                out(" CREATING LAF ");
                long time0 = System.currentTimeMillis();
                LookAndFeel laf = new SubstanceGeminiLookAndFeel();
                long time1 = System.currentTimeMillis();
                out(" LAF CREATED " + (time1 - time0));
                out(" SETTING LAF ");
                long time2 = System.currentTimeMillis();
                UIManager.setLookAndFeel(laf);
                long time3 = System.currentTimeMillis();
                out(" LAF SET " + (time3 - time2));
              }
            } catch (Exception e) {
              e.printStackTrace();
            }

            SubstanceLookAndFeel.setToUseConstantThemesOnDialogs(true);
            UIManager.put(SubstanceLookAndFeel.TABBED_PANE_CLOSE_BUTTONS_PROPERTY, Boolean.TRUE);
            UIManager.put(SubstanceLookAndFeel.SHOW_EXTRA_WIDGETS, Boolean.TRUE);
            // try {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);

            long time2 = System.currentTimeMillis();

            // UIManager.put("Button.defaultButtonFollowsFocus",
            // Boolean.TRUE);

            Check c = new Check();
            c.addComponentListener(
                new ComponentAdapter() {
                  @Override
                  public void componentResized(ComponentEvent e) {
                    super.componentResized(e);
                    ((JFrame) e.getComponent()).getRootPane().repaint();
                  }
                });
            c.setPreferredSize(new Dimension(820, 560));
            c.setMinimumSize(new Dimension(150, 100));
            c.pack();
            Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            // center the frame in the physical screen
            c.setLocation((d.width - c.getWidth()) / 2, (d.height - c.getHeight()) / 2);

            c.setVisible(true);
            c.setDefaultCloseOperation(
                System.getProperty("javawebstart.version") != null
                    ? JFrame.EXIT_ON_CLOSE
                    : JFrame.DISPOSE_ON_CLOSE);
            long time3 = System.currentTimeMillis();
            out("App " + (time3 - time2));

            // Thread cpuTracker = new Thread() {
            // @Override
            // public void run() {
            // OperatingSystemMXBean bean = ManagementFactory
            // .getOperatingSystemMXBean();
            // while (true) {
            // System.out.println(bean.getSystemLoadAverage());
            // try {
            // Thread.sleep(5000);
            // } catch (Throwable t) {
            // t.printStackTrace();
            // }
            // }
            // };
            // };
            // cpuTracker.setDaemon(true);
            // cpuTracker.start();
          }
        });
  }