コード例 #1
0
 private static boolean compatibilityCheck(TexturePack tp, String compatible) {
   return (compatible.equalsIgnoreCase(I18N.getLocaleString("MAIN_ALL"))
       || tp.isCompatible(compatible));
 }
コード例 #2
0
  public TexturepackPane() {
    super();
    model = new TexturePackListModelAdapter();

    setLayout(null);

    texturePacks = new JList(model);
    texturePacks.setCellRenderer(new TexturePackCellRenderer());

    texturePacks.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            TexturePack pack = (TexturePack) texturePacks.getSelectedValue();
            if (pack != null) {
              String packs = "";
              if (pack.getCompatible() != null) {
                packs += "<p>This texture pack works with the following packs:</p><ul>";
                for (String name : pack.getCompatible()) {
                  packs += "<li>" + ModPack.getPack(name).getName() + "</li>";
                }
                packs += "</ul>";
              }
              LaunchFrame.updateTpInstallLocs(pack.getCompatible());
              File tempDir =
                  new File(
                      OSUtils.getDynamicStorageLocation(),
                      "TexturePacks" + File.separator + pack.getName());
              textureInfo.setText(
                  "<html><img src='file:///"
                      + tempDir.getPath()
                      + File.separator
                      + pack.getImageName()
                      + "' width=400 height=200></img> <br>"
                      + pack.getInfo()
                      + packs);
              textureInfo.setCaretPosition(0);
            }
          }
        });

    filter = new JButton(I18N.getLocaleString("FILTER_SETTINGS"));
    filter.setBounds(5, 5, 105, 25);
    filter.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            TexturePackFilterDialog filter = new TexturePackFilterDialog(instance);
            filter.setVisible(true);
          }
        });
    add(filter);

    String filterTextColor =
        LauncherStyle.getColorAsString(LauncherStyle.getCurrentStyle().filterTextColor);
    String filterInnerTextColor =
        LauncherStyle.getColorAsString(LauncherStyle.getCurrentStyle().filterInnerTextColor);

    String typeLblText = "<html><body>";
    typeLblText += "<strong><font color=rgb\"(" + filterTextColor + ")\">Filter: </strong></font>";
    typeLblText += "<font color=rgb\"(" + filterInnerTextColor + ")\">" + compatible + "</font>";
    typeLblText += "<strong><font color=rgb\"(" + filterTextColor + ")\"> / </strong></font>";
    typeLblText += "<font color=rgb\"(" + filterInnerTextColor + ")\">" + resolution + "</font>";
    typeLblText += "</body></html>";

    typeLbl = new JLabel(typeLblText);
    typeLbl.setBounds(115, 5, 295, 25);
    typeLbl.setHorizontalAlignment(SwingConstants.CENTER);
    add(typeLbl);

    texturePacksScroll = new JScrollPane();
    texturePacksScroll.setBounds(-3, 30, 420, 353);
    texturePacksScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    texturePacksScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    texturePacksScroll.setWheelScrollingEnabled(true);
    texturePacksScroll.setOpaque(false);
    texturePacksScroll.setViewportView(texturePacks);
    texturePacksScroll.getVerticalScrollBar().setUnitIncrement(19);
    add(texturePacksScroll);

    textureInfo = new JEditorPane();
    textureInfo.setEditable(false);
    textureInfo.setContentType("text/html");
    textureInfo.addHyperlinkListener(
        new HyperlinkListener() {
          @Override
          public void hyperlinkUpdate(HyperlinkEvent event) {
            if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              OSUtils.browse(event.getURL().toString());
            }
          }
        });
    textureInfo.setBounds(420, 210, 410, 90);
    textureInfo.setBackground(UIManager.getColor("control").darker().darker());
    add(textureInfo);

    JScrollPane infoScroll = new JScrollPane();
    infoScroll.setBounds(410, 25, 430, 357);
    infoScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    infoScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    infoScroll.setWheelScrollingEnabled(true);
    infoScroll.setViewportView(textureInfo);
    infoScroll.setOpaque(false);
    add(infoScroll);
  }
コード例 #3
0
 public void updateLocale() {
   filter.setText(I18N.getLocaleString("FILTER_SETTINGS"));
 }
コード例 #4
0
 private static boolean resolutionCheck(TexturePack tp, String resolution) {
   return (resolution.equalsIgnoreCase(I18N.getLocaleString("MAIN_ALL"))
       || tp.getResolution().equalsIgnoreCase(resolution));
 }