示例#1
0
 public void updateUI() {
   if (getUI() == null || !(getUI() instanceof WebMenuBarUI)) {
     try {
       setUI((WebMenuBarUI) ReflectUtils.createInstance(WebLookAndFeel.menuBarUI));
     } catch (Throwable e) {
       e.printStackTrace();
       setUI(new WebMenuBarUI());
     }
   } else {
     setUI(getUI());
   }
 }
示例#2
0
 @Override
 public void updateUI() {
   if (getUI() == null || !(getUI() instanceof WebComboBoxUI)) {
     try {
       setUI((WebComboBoxUI) ReflectUtils.createInstance(WebLookAndFeel.comboBoxUI));
     } catch (final Throwable e) {
       Log.error(this, e);
       setUI(new WebComboBoxUI());
     }
   } else {
     setUI(getUI());
   }
 }
示例#3
0
  private static Component createSourceButton(final WebLookAndFeelDemo owner, Example example) {
    final Class classType = example.getClass();

    WebButton sourceButton = WebButton.createIconWebButton(JarEntry.javaIcon);
    TooltipManager.setTooltip(
        sourceButton, JarEntry.javaIcon, ReflectUtils.getJavaClassName(classType), TooltipWay.up);
    sourceButton.setRolloverDecoratedOnly(true);
    sourceButton.setFocusable(false);

    sourceButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            owner.showSource(classType);
          }
        });

    return new CenterPanel(sourceButton, false, true);
  }
示例#4
0
  @Override
  public void updateUI() {
    // Update table header UI
    if (getTableHeader() != null) {
      getTableHeader().updateUI();
    }

    // Update table scroll view and UI
    configureEnclosingScrollPaneUI();

    // Update table UI
    if (getUI() == null || !(getUI() instanceof WebTableUI)) {
      try {
        setUI((WebTableUI) ReflectUtils.createInstance(WebLookAndFeel.tableUI));
      } catch (final Throwable e) {
        Log.error(this, e);
        setUI(new WebTableUI());
      }
    } else {
      setUI(getUI());
    }
  }
示例#5
0
  public static JarStructure createJarStructure(final WebProgressDialog progress) {
    // Download listener in case of remote jar-file (for e.g. demo loaded from .jnlp)
    FileDownloadListener listener =
        new FileDownloadListener() {
          private int totalSize = 0;

          @Override
          public void sizeDetermined(int totalSize) {
            // Download started
            this.totalSize = totalSize;
            updateProgress(0);
          }

          @Override
          public void partDownloaded(int totalBytesDownloaded) {
            // Some part loaded
            updateProgress(totalBytesDownloaded);
          }

          @Override
          public boolean shouldStopDownload() {
            return false;
          }

          private void updateProgress(int downloaded) {
            // Updating progress text
            progress.setText(
                "<html>Loading source files... <b>"
                    + FileUtils.getFileSizeString(downloaded, 1)
                    + "</b> of <b>"
                    + FileUtils.getFileSizeString(totalSize, 1)
                    + "</b> done</html>");
          }

          @Override
          public void fileDownloaded(File file) {
            // Updating progress text
            progress.setText("Creating source files structure...");
          }

          @Override
          public void fileDownloadFailed(Throwable e) {
            // Updating progress text
            progress.setText("Filed to download source files");
          }
        };

    // Creating structure using any of classes contained inside jar
    progress.setText("Creating source files structure...");
    List<String> extensions = Arrays.asList(".java", ".png", ".gif", ".jpg", ".txt", ".xml");
    List<String> packages = Arrays.asList("com/alee", "licenses");
    JarStructure jarStructure =
        ReflectUtils.getJarStructure(ExamplesManager.class, extensions, packages, listener);

    // Updating some of package icons
    jarStructure.setPackageIcon(
        WebLookAndFeelDemo.class.getPackage(), new ImageIcon(WebLookAndFeel.getImages().get(0)));
    for (ExampleGroup exampleGroup : getExampleGroups()) {
      jarStructure.setClassIcon(exampleGroup.getClass(), (ImageIcon) exampleGroup.getGroupIcon());
    }

    return jarStructure;
  }