Example #1
0
  public MainFrame(String title, UserFrontEnd ptheApp) {
    super(title);
    theApp = ptheApp;
    // identify the OS

    if (theApp.runningOSX()) initForOSX(); // OSX specific inits
    else if (theApp.runningWindows()) { // Windows specific inits
      initForWindows();
    } else if (theApp.runningLinux()) {
      initForLinux();
    } else {
      JOptionPane.showMessageDialog(
          this,
          "Phylontal doesn't recognize your operating system (yet!)",
          "Operating System unknown",
          JOptionPane.WARNING_MESSAGE);
    }

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    // add tabbed pane
    tabbedView = new JTabbedPane(JTabbedPane.TOP);
    tabbedView.addChangeListener(this);

    tabbedView.addTab("Project", projectTab = new ProjectTab(theApp));
    tabbedView.addTab("Matcher", matcherTab = new MatcherTab(theApp));

    int matchIndex = tabbedView.indexOfComponent(matcherTab);
    tabbedView.setToolTipTextAt(matchIndex, "Disabled until a project is specified");
    tabbedView.setEnabledAt(matchIndex, false);

    int projectIndex = tabbedView.indexOfComponent(projectTab);
    tabbedView.setToolTipTextAt(projectIndex, "Create or Load a project; specify components");

    currentTabComponent = tabbedView.getSelectedComponent();
    if (currentTabComponent instanceof TabView) {
      resetMenuBar();
      JMenuBar tmpBar = ((TabView) currentTabComponent).initializeMenus();
      if (tmpBar != null) {
        menuBar = tmpBar;
        setJMenuBar(menuBar);
      }
    }

    Container content = getContentPane(); // get content pane
    content.setLayout(new BorderLayout());
    content.add(tabbedView, BorderLayout.CENTER);

    // add icons

    // add preferences Dialog

    preferencesDialog = new PreferencesDialog(this);
  }
Example #2
0
 public void enableTab(TabView view, String toolTip) {
   int index = tabbedView.indexOfComponent(view);
   if (index != -1) {
     tabbedView.setEnabledAt(index, true);
     tabbedView.setToolTipTextAt(index, toolTip);
   }
 }
Example #3
0
  /**
   * Builds the tabbed pane with the server preferences
   *
   * @return panel with server preferences tabs
   */
  protected JPanel buildTabbedServerPreferences() {
    JPanel pnl = new JPanel(new BorderLayout());

    JTabbedPane tpServerPreferences = getTabPane();
    pnlAuthPreferences = new AuthenticationPreferencesPanel();
    tpServerPreferences.add(wrapVerticallyScrollablePanel(pnlAuthPreferences));
    pnlProxyPreferences = new ProxyPreferencesPanel();
    tpServerPreferences.add(wrapVerticallyScrollablePanel(pnlProxyPreferences));

    tpServerPreferences.setTitleAt(0, tr("Authentication"));
    tpServerPreferences.setTitleAt(1, tr("Proxy settings"));
    tpServerPreferences.setToolTipTextAt(
        0, tr("Configure your identity and how to authenticate at the OSM server"));
    tpServerPreferences.setToolTipTextAt(1, tr("Configure whether to use a proxy server"));

    pnl.add(tpServerPreferences, BorderLayout.CENTER);
    return pnl;
  }
Example #4
0
 /** Updates title of content tabs with the number of thep they contain. */
 public void updateContentTabsTitle() {
   int i = 0;
   for (AnalysisGUICommon guiCommon : analysisPlugins) {
     String name = guiCommon.getDisplayName();
     CheckListTable clt = guiCommon.getCheckListTable();
     tabbedPane.setTitleAt(i, name + " [" + clt.getStepNumber() + "]");
     tabbedPane.setToolTipTextAt(
         i, name + ": " + clt.getStepNumber() + " element" + (clt.getStepNumber() > 1 ? "s" : ""));
     i++;
   }
 }
Example #5
0
  protected WMSPanel addNewPanel(final JTabbedPane tabPane) {
    final WMSPanel wmsPanel = new WMSPanel(null); // the null indicates not to register the panel
    wmsPanel.initialize(this.controller);
    wmsPanel.getJPanel().putClientProperty("WMS_PANEL", wmsPanel);
    tabPane.putClientProperty(wmsPanel.getURLString(), wmsPanel);

    tabPane.addTab("New Server", wmsPanel.getJPanel());
    tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
    tabPane.setToolTipTextAt(tabbedPane.getSelectedIndex(), "Server WMS Contents");

    wmsPanel.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("NewServer")) {
              String serverLocation = (String) evt.getNewValue();

              if (WWUtil.isEmpty(serverLocation)) return;
              //
              //                    // Check to see if it's already open.
              //                    for (int i = 0; i < tabbedPane.getTabCount(); i++)
              //                    {
              //                        JPanel jp = (JPanel) tabbedPane.getTabComponentAt(i);
              //                        if (jp != null)
              //                        {
              //                            WMSPanel wp = (WMSPanel)
              // jp.getClientProperty("WMS_PANEL");
              //                            if (wp != null &&
              // wp.getURLString().equalsIgnoreCase(serverLocation))
              //                            {
              //                                tabbedPane.setSelectedIndex(i); // make it the
              // visible one
              //                                return;
              //                            }
              //                        }
              //                    }

              try {

                addNewPanel(tabPane).contactWMSServer(serverLocation);
              } catch (URISyntaxException e) {
                e.printStackTrace(); // TODO
              }
            }
          }
        });

    return wmsPanel;
  }
  private void addInformationPanel() {
    // Create UI elements for connection information.
    JPanel informationPanel = new JPanel();
    informationPanel.setLayout(new BorderLayout());

    // Add the Host information
    JPanel connPanel = new JPanel();
    connPanel.setLayout(new GridBagLayout());
    connPanel.setBorder(BorderFactory.createTitledBorder("Connection information"));

    JLabel label = new JLabel("Host: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    JFormattedTextField field = new JFormattedTextField(connection.getServiceName());
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(
        field, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the Port information
    label = new JLabel("Port: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    field = new JFormattedTextField(connection.getPort());
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(
        field, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the connection's User information
    label = new JLabel("User: "******"Creation time: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    field = new JFormattedTextField(new SimpleDateFormat("yyyy.MM.dd hh:mm:ss:SS aaa"));
    field.setMinimumSize(new java.awt.Dimension(150, 20));
    field.setMaximumSize(new java.awt.Dimension(150, 20));
    field.setValue(creationTime);
    field.setEditable(false);
    field.setBorder(null);
    connPanel.add(
        field, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));

    // Add the connection's creationTime information
    label = new JLabel("Status: ");
    label.setMinimumSize(new java.awt.Dimension(150, 14));
    label.setMaximumSize(new java.awt.Dimension(150, 14));
    connPanel.add(
        label, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 21, 0, new Insets(0, 0, 0, 0), 0, 0));
    statusField = new JFormattedTextField();
    statusField.setMinimumSize(new java.awt.Dimension(150, 20));
    statusField.setMaximumSize(new java.awt.Dimension(150, 20));
    statusField.setValue("Active");
    statusField.setEditable(false);
    statusField.setBorder(null);
    connPanel.add(
        statusField,
        new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 10, 2, new Insets(0, 0, 0, 0), 0, 0));
    // Add the connection panel to the information panel
    informationPanel.add(connPanel, BorderLayout.NORTH);

    // Add the Number of sent packets information
    JPanel packetsPanel = new JPanel();
    packetsPanel.setLayout(new GridLayout(1, 1));
    packetsPanel.setBorder(BorderFactory.createTitledBorder("Transmitted Packets"));

    statisticsTable =
        new DefaultTableModel(
            new Object[][] {
              {"IQ", 0, 0}, {"Message", 0, 0}, {"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}
            },
            new Object[] {"Type", "Received", "Sent"}) {
          private static final long serialVersionUID = -6793886085109589269L;

          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }
        };
    JTable table = new JTable(statisticsTable);
    // Allow only single a selection
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    packetsPanel.add(new JScrollPane(table));

    // Add the packets panel to the information panel
    informationPanel.add(packetsPanel, BorderLayout.CENTER);

    tabbedPane.add("Information", new JScrollPane(informationPanel));
    tabbedPane.setToolTipTextAt(4, "Information and statistics about the debugged connection");
  }
  private void addAdhocPacketPanel() {
    // Create UI elements for sending ad-hoc messages.
    final JTextArea adhocMessages = new JTextArea();
    adhocMessages.setEditable(true);
    adhocMessages.setForeground(new Color(1, 94, 35));
    tabbedPane.add("Ad-hoc message", new JScrollPane(adhocMessages));
    tabbedPane.setToolTipTextAt(3, "Panel that allows you to send adhoc packets");

    // Add pop-up menu.
    JPopupMenu menu = new JPopupMenu();
    JMenuItem menuItem = new JMenuItem("Message");
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            adhocMessages.setText(
                "<message to=\"\" id=\""
                    + StringUtils.randomString(5)
                    + "-X\"><body></body></message>");
          }
        });
    menu.add(menuItem);

    menuItem = new JMenuItem("IQ Get");
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            adhocMessages.setText(
                "<iq type=\"get\" to=\"\" id=\""
                    + StringUtils.randomString(5)
                    + "-X\"><query xmlns=\"\"></query></iq>");
          }
        });
    menu.add(menuItem);

    menuItem = new JMenuItem("IQ Set");
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            adhocMessages.setText(
                "<iq type=\"set\" to=\"\" id=\""
                    + StringUtils.randomString(5)
                    + "-X\"><query xmlns=\"\"></query></iq>");
          }
        });
    menu.add(menuItem);

    menuItem = new JMenuItem("Presence");
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            adhocMessages.setText(
                "<presence to=\"\" id=\"" + StringUtils.randomString(5) + "-X\"/>");
          }
        });
    menu.add(menuItem);
    menu.addSeparator();

    menuItem = new JMenuItem("Send");
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!"".equals(adhocMessages.getText())) {
              AdHocPacket packetToSend = new AdHocPacket(adhocMessages.getText());
              connection.sendPacket(packetToSend);
            }
          }
        });
    menu.add(menuItem);

    menuItem = new JMenuItem("Clear");
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            adhocMessages.setText(null);
          }
        });
    menu.add(menuItem);

    // Add listener to the text area so the popup menu can come up.
    adhocMessages.addMouseListener(new PopupListener(menu));
  }
  private void addBasicPanels() {
    JSplitPane allPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    allPane.setOneTouchExpandable(true);

    messagesTable =
        new DefaultTableModel(
            new Object[] {"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"}, 0) {
          private static final long serialVersionUID = 8136121224474217264L;

          public boolean isCellEditable(int rowIndex, int mColIndex) {
            return false;
          }

          public Class<?> getColumnClass(int columnIndex) {
            if (columnIndex == 2 || columnIndex == 3) {
              return Icon.class;
            }
            return super.getColumnClass(columnIndex);
          }
        };
    JTable table = new JTable(messagesTable);
    // Allow only single a selection
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // Hide the first column
    table.getColumnModel().getColumn(0).setMaxWidth(0);
    table.getColumnModel().getColumn(0).setMinWidth(0);
    table.getTableHeader().getColumnModel().getColumn(0).setMaxWidth(0);
    table.getTableHeader().getColumnModel().getColumn(0).setMinWidth(0);
    // Set the column "timestamp" size
    table.getColumnModel().getColumn(1).setMaxWidth(300);
    table.getColumnModel().getColumn(1).setPreferredWidth(90);
    // Set the column "direction" icon size
    table.getColumnModel().getColumn(2).setMaxWidth(50);
    table.getColumnModel().getColumn(2).setPreferredWidth(30);
    // Set the column "packet type" icon size
    table.getColumnModel().getColumn(3).setMaxWidth(50);
    table.getColumnModel().getColumn(3).setPreferredWidth(30);
    // Set the column "Id" size
    table.getColumnModel().getColumn(5).setMaxWidth(100);
    table.getColumnModel().getColumn(5).setPreferredWidth(55);
    // Set the column "type" size
    table.getColumnModel().getColumn(6).setMaxWidth(200);
    table.getColumnModel().getColumn(6).setPreferredWidth(50);
    // Set the column "to" size
    table.getColumnModel().getColumn(7).setMaxWidth(300);
    table.getColumnModel().getColumn(7).setPreferredWidth(90);
    // Set the column "from" size
    table.getColumnModel().getColumn(8).setMaxWidth(300);
    table.getColumnModel().getColumn(8).setPreferredWidth(90);
    // Create a table listener that listen for row selection events
    SelectionListener selectionListener = new SelectionListener(table);
    table.getSelectionModel().addListSelectionListener(selectionListener);
    table.getColumnModel().getSelectionModel().addListSelectionListener(selectionListener);
    allPane.setTopComponent(new JScrollPane(table));
    messageTextArea = new JTextArea();
    messageTextArea.setEditable(false);
    // Add pop-up menu.
    JPopupMenu menu = new JPopupMenu();
    JMenuItem menuItem1 = new JMenuItem("Copy");
    menuItem1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Get the clipboard
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            // Set the sent text as the new content of the clipboard
            clipboard.setContents(new StringSelection(messageTextArea.getText()), null);
          }
        });
    menu.add(menuItem1);
    // Add listener to the text area so the popup menu can come up.
    messageTextArea.addMouseListener(new PopupListener(menu));
    JPanel sublayout = new JPanel(new BorderLayout());
    sublayout.add(new JScrollPane(messageTextArea), BorderLayout.CENTER);

    JButton clearb = new JButton("Clear All Packets");

    clearb.addActionListener(
        new AbstractAction() {
          private static final long serialVersionUID = -8576045822764763613L;

          @Override
          public void actionPerformed(ActionEvent e) {
            messagesTable.setRowCount(0);
          }
        });

    sublayout.add(clearb, BorderLayout.NORTH);
    allPane.setBottomComponent(sublayout);

    allPane.setDividerLocation(150);

    tabbedPane.add("All Packets", allPane);
    tabbedPane.setToolTipTextAt(0, "Sent and received packets processed by Smack");

    // Create UI elements for client generated XML traffic.
    final JTextArea sentText = new JTextArea();
    sentText.setWrapStyleWord(true);
    sentText.setLineWrap(true);
    sentText.setEditable(false);
    sentText.setForeground(new Color(112, 3, 3));
    tabbedPane.add("Raw Sent Packets", new JScrollPane(sentText));
    tabbedPane.setToolTipTextAt(1, "Raw text of the sent packets");

    // Add pop-up menu.
    menu = new JPopupMenu();
    menuItem1 = new JMenuItem("Copy");
    menuItem1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Get the clipboard
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            // Set the sent text as the new content of the clipboard
            clipboard.setContents(new StringSelection(sentText.getText()), null);
          }
        });

    JMenuItem menuItem2 = new JMenuItem("Clear");
    menuItem2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            sentText.setText("");
          }
        });

    // Add listener to the text area so the popup menu can come up.
    sentText.addMouseListener(new PopupListener(menu));
    menu.add(menuItem1);
    menu.add(menuItem2);

    // Create UI elements for server generated XML traffic.
    final JTextArea receivedText = new JTextArea();
    receivedText.setWrapStyleWord(true);
    receivedText.setLineWrap(true);
    receivedText.setEditable(false);
    receivedText.setForeground(new Color(6, 76, 133));
    tabbedPane.add("Raw Received Packets", new JScrollPane(receivedText));
    tabbedPane.setToolTipTextAt(2, "Raw text of the received packets before Smack process them");

    // Add pop-up menu.
    menu = new JPopupMenu();
    menuItem1 = new JMenuItem("Copy");
    menuItem1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Get the clipboard
            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
            // Set the sent text as the new content of the clipboard
            clipboard.setContents(new StringSelection(receivedText.getText()), null);
          }
        });

    menuItem2 = new JMenuItem("Clear");
    menuItem2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            receivedText.setText("");
          }
        });

    // Add listener to the text area so the popup menu can come up.
    receivedText.addMouseListener(new PopupListener(menu));
    menu.add(menuItem1);
    menu.add(menuItem2);

    // Create a special Reader that wraps the main Reader and logs data to the GUI.
    ObservableReader debugReader = new ObservableReader(reader);
    readerListener =
        new ReaderListener() {
          public void read(final String str) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    if (EnhancedDebuggerWindow.PERSISTED_DEBUGGER
                        && !EnhancedDebuggerWindow.getInstance().isVisible()) {
                      // Do not add content if the parent is not visible
                      return;
                    }

                    int index = str.lastIndexOf(">");
                    if (index != -1) {
                      if (receivedText.getLineCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
                        try {
                          receivedText.replaceRange("", 0, receivedText.getLineEndOffset(0));
                        } catch (BadLocationException e) {
                          e.printStackTrace();
                        }
                      }
                      receivedText.append(str.substring(0, index + 1));
                      receivedText.append(NEWLINE);
                      if (str.length() > index) {
                        receivedText.append(str.substring(index + 1));
                      }
                    } else {
                      receivedText.append(str);
                    }
                  }
                });
          }
        };
    debugReader.addReaderListener(readerListener);

    // Create a special Writer that wraps the main Writer and logs data to the GUI.
    ObservableWriter debugWriter = new ObservableWriter(writer);
    writerListener =
        new WriterListener() {
          public void write(final String str) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    if (EnhancedDebuggerWindow.PERSISTED_DEBUGGER
                        && !EnhancedDebuggerWindow.getInstance().isVisible()) {
                      // Do not add content if the parent is not visible
                      return;
                    }

                    if (sentText.getLineCount() >= EnhancedDebuggerWindow.MAX_TABLE_ROWS) {
                      try {
                        sentText.replaceRange("", 0, sentText.getLineEndOffset(0));
                      } catch (BadLocationException e) {
                        e.printStackTrace();
                      }
                    }

                    sentText.append(str);
                    if (str.endsWith(">")) {
                      sentText.append(NEWLINE);
                    }
                  }
                });
          }
        };
    debugWriter.addWriterListener(writerListener);

    // Assign the reader/writer objects to use the debug versions. The packet reader
    // and writer will use the debug versions when they are created.
    reader = debugReader;
    writer = debugWriter;
  }
Example #9
0
  public BorderDemo() {
    super(new GridLayout(1, 0));

    // Keep references to the next few borders,
    // for use in titles and compound borders.
    Border blackline, raisedetched, loweredetched, raisedbevel, loweredbevel, empty;

    // A border that puts 10 extra pixels at the sides and
    // bottom of each pane.
    Border paneEdge = BorderFactory.createEmptyBorder(0, 10, 10, 10);

    blackline = BorderFactory.createLineBorder(Color.black);
    raisedetched = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
    loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    raisedbevel = BorderFactory.createRaisedBevelBorder();
    loweredbevel = BorderFactory.createLoweredBevelBorder();
    empty = BorderFactory.createEmptyBorder();

    // First pane: simple borders
    JPanel simpleBorders = new JPanel();
    simpleBorders.setBorder(paneEdge);
    simpleBorders.setLayout(new BoxLayout(simpleBorders, BoxLayout.Y_AXIS));

    addCompForBorder(blackline, "line border", simpleBorders);
    addCompForBorder(raisedetched, "raised etched border", simpleBorders);
    addCompForBorder(loweredetched, "lowered etched border", simpleBorders);
    addCompForBorder(raisedbevel, "raised bevel border", simpleBorders);
    addCompForBorder(loweredbevel, "lowered bevel border", simpleBorders);
    addCompForBorder(empty, "empty border", simpleBorders);

    // Second pane: matte borders
    JPanel matteBorders = new JPanel();
    matteBorders.setBorder(paneEdge);
    matteBorders.setLayout(new BoxLayout(matteBorders, BoxLayout.Y_AXIS));

    ImageIcon icon = createImageIcon("images/wavy.gif", "wavy-line border icon"); // 20x22
    Border border = BorderFactory.createMatteBorder(-1, -1, -1, -1, icon);
    if (icon != null) {
      addCompForBorder(border, "matte border (-1,-1,-1,-1,icon)", matteBorders);
    } else {
      addCompForBorder(border, "matte border (-1,-1,-1,-1,<null-icon>)", matteBorders);
    }
    border = BorderFactory.createMatteBorder(1, 5, 1, 1, Color.red);
    addCompForBorder(border, "matte border (1,5,1,1,Color.red)", matteBorders);

    border = BorderFactory.createMatteBorder(0, 20, 0, 0, icon);
    if (icon != null) {
      addCompForBorder(border, "matte border (0,20,0,0,icon)", matteBorders);
    } else {
      addCompForBorder(border, "matte border (0,20,0,0,<null-icon>)", matteBorders);
    }

    // Third pane: titled borders
    JPanel titledBorders = new JPanel();
    titledBorders.setBorder(paneEdge);
    titledBorders.setLayout(new BoxLayout(titledBorders, BoxLayout.Y_AXIS));
    TitledBorder titled;

    titled = BorderFactory.createTitledBorder("title");
    addCompForBorder(
        titled, "default titled border" + " (default just., default pos.)", titledBorders);

    titled = BorderFactory.createTitledBorder(blackline, "title");
    addCompForTitledBorder(
        titled,
        "titled line border" + " (centered, default pos.)",
        TitledBorder.CENTER,
        TitledBorder.DEFAULT_POSITION,
        titledBorders);

    titled = BorderFactory.createTitledBorder(loweredetched, "title");
    addCompForTitledBorder(
        titled,
        "titled lowered etched border" + " (right just., default pos.)",
        TitledBorder.RIGHT,
        TitledBorder.DEFAULT_POSITION,
        titledBorders);

    titled = BorderFactory.createTitledBorder(loweredbevel, "title");
    addCompForTitledBorder(
        titled,
        "titled lowered bevel border" + " (default just., above top)",
        TitledBorder.DEFAULT_JUSTIFICATION,
        TitledBorder.ABOVE_TOP,
        titledBorders);

    titled = BorderFactory.createTitledBorder(empty, "title");
    addCompForTitledBorder(
        titled,
        "titled empty border" + " (default just., bottom)",
        TitledBorder.DEFAULT_JUSTIFICATION,
        TitledBorder.BOTTOM,
        titledBorders);

    // Fourth pane: compound borders
    JPanel compoundBorders = new JPanel();
    compoundBorders.setBorder(paneEdge);
    compoundBorders.setLayout(new BoxLayout(compoundBorders, BoxLayout.Y_AXIS));
    Border redline = BorderFactory.createLineBorder(Color.red);

    Border compound;
    compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);
    addCompForBorder(compound, "compound border (two bevels)", compoundBorders);

    compound = BorderFactory.createCompoundBorder(redline, compound);
    addCompForBorder(compound, "compound border (add a red outline)", compoundBorders);

    titled =
        BorderFactory.createTitledBorder(
            compound, "title", TitledBorder.CENTER, TitledBorder.BELOW_BOTTOM);
    addCompForBorder(
        titled, "titled compound border" + " (centered, below bottom)", compoundBorders);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Simple", null, simpleBorders, null);
    tabbedPane.addTab("Matte", null, matteBorders, null);
    tabbedPane.addTab("Titled", null, titledBorders, null);
    tabbedPane.addTab("Compound", null, compoundBorders, null);
    tabbedPane.setSelectedIndex(0);
    String toolTip =
        new String(
            "<html>Blue Wavy Line border art crew:<br>&nbsp;&nbsp;&nbsp;Bill Pauley<br>&nbsp;&nbsp;&nbsp;Cris St. Aubyn<br>&nbsp;&nbsp;&nbsp;Ben Wronsky<br>&nbsp;&nbsp;&nbsp;Nathan Walrath<br>&nbsp;&nbsp;&nbsp;Tommy Adams, special consultant</html>");
    tabbedPane.setToolTipTextAt(1, toolTip);

    add(tabbedPane);
  }
  private void makeFrame(final Editor editor) {
    dialog = new JFrame(title);
    dialog.setMinimumSize(new Dimension(750, 500));
    tabbedPane = new JTabbedPane();

    makeAndShowTab(false, true);

    tabbedPane.addTab("Libraries", null, librariesContributionTab.panel, "Libraries");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    tabbedPane.addTab("Modes", null, modesContributionTab.panel, "Modes");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    tabbedPane.addTab("Tools", null, toolsContributionTab.panel, "Tools");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    tabbedPane.addTab("Examples", null, examplesContributionTab.panel, "Examples");
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

    tabbedPane.addTab("Updates", null, updatesContributionTab.panel, "Updates");
    tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);

    tabbedPane.setUI(new SpacedTabbedPaneUI());
    tabbedPane.setBackground(new Color(0x132638));
    tabbedPane.setOpaque(true);

    for (int i = 0; i < 5; i++) {
      tabbedPane.setToolTipTextAt(i, null);
    }

    makeAndSetTabComponents();

    tabbedPane.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent e) {
            for (int i = 0; i < 4; i++) {
              tabLabels[i].setBackground(new Color(0x2d4251));
              tabLabels[i].setForeground(Color.WHITE);
            }
            updateTabPanel.setBackground(new Color(0x2d4251));
            updateTabLabel.setForeground(Color.WHITE);
            int currentIndex = tabbedPane.getSelectedIndex();
            if (currentIndex != 4) {
              tabbedPane
                  .getTabComponentAt(tabbedPane.getSelectedIndex())
                  .setBackground(new Color(0xe0fffd));
              tabbedPane
                  .getTabComponentAt(tabbedPane.getSelectedIndex())
                  .setForeground(Color.BLACK);
            } else {
              updateTabPanel.setBackground(new Color(0xe0fffd));
              updateTabLabel.setForeground(Color.BLACK);
            }
            getActiveTab().contributionListPanel.scrollPane.requestFocusInWindow();
            //        // When the tab is changed update status to the current selected panel
            //        ContributionPanel currentPanel = getActiveTab().contributionListPanel
            //          .getSelectedPanel();
            //        if (currentPanel != null) {
            //          getActiveTab().contributionListPanel.setSelectedPanel(currentPanel);
            //        }
          }
        });

    //    tabbedPane.setSize(450, 400);
    setLayout();

    restartButton = new JButton(Language.text("contrib.restart"));
    restartButton.setVisible(false);
    restartButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            Iterator<Editor> iter = editor.getBase().getEditors().iterator();
            while (iter.hasNext()) {
              Editor ed = iter.next();
              if (ed.getSketch().isModified()) {
                int option =
                    Messages.showYesNoQuestion(
                        editor,
                        title,
                        Language.text("contrib.unsaved_changes"),
                        Language.text("contrib.unsaved_changes.prompt"));

                if (option == JOptionPane.NO_OPTION) return;
                else break;
              }
            }

            // Thanks to http://stackoverflow.com/a/4160543
            StringBuilder cmd = new StringBuilder();
            cmd.append(
                System.getProperty("java.home")
                    + File.separator
                    + "bin"
                    + File.separator
                    + "java ");
            for (String jvmArg : ManagementFactory.getRuntimeMXBean().getInputArguments()) {
              cmd.append(jvmArg + " ");
            }
            cmd.append("-cp ")
                .append(ManagementFactory.getRuntimeMXBean().getClassPath())
                .append(" ");
            cmd.append(Base.class.getName());

            try {
              Runtime.getRuntime().exec(cmd.toString());
              System.exit(0);
            } catch (IOException e) {
              e.printStackTrace();
            }
          }
        });

    Toolkit.setIcon(dialog);
    registerDisposeListeners();

    dialog.pack();
    dialog.setLocationRelativeTo(null);
  }
Example #11
0
 /**
  * handles property change events
  *
  * @param evt the event
  * @see TagMergeModel
  * @see ListMergeModel
  * @see PropertiesMergeModel
  */
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (evt.getPropertyName().equals(TagMergeModel.PROP_NUM_UNDECIDED_TAGS)) {
     int newValue = (Integer) evt.getNewValue();
     if (newValue == 0) {
       tabbedPane.setTitleAt(1, tr("Tags"));
       tabbedPane.setToolTipTextAt(1, tr("No pending tag conflicts to be resolved"));
       tabbedPane.setIconAt(1, mergeComplete);
     } else {
       tabbedPane.setTitleAt(
           1, trn("Tags({0} conflict)", "Tags({0} conflicts)", newValue, newValue));
       tabbedPane.setToolTipTextAt(
           1,
           trn(
               "{0} pending tag conflict to be resolved",
               "{0} pending tag conflicts to be resolved", newValue, newValue));
       tabbedPane.setIconAt(1, mergeIncomplete);
     }
     updateResolvedCompletely();
   } else if (evt.getPropertyName().equals(ListMergeModel.FROZEN_PROP)) {
     boolean frozen = (Boolean) evt.getNewValue();
     if (evt.getSource() == nodeListMerger.getModel() && my instanceof Way) {
       if (frozen) {
         tabbedPane.setTitleAt(2, tr("Nodes(resolved)"));
         tabbedPane.setToolTipTextAt(
             2, tr("Merged node list frozen. No pending conflicts in the node list of this way"));
         tabbedPane.setIconAt(2, mergeComplete);
       } else {
         tabbedPane.setTitleAt(2, tr("Nodes(with conflicts)"));
         tabbedPane.setToolTipTextAt(2, tr("Pending conflicts in the node list of this way"));
         tabbedPane.setIconAt(2, mergeIncomplete);
       }
     } else if (evt.getSource() == relationMemberMerger.getModel() && my instanceof Relation) {
       if (frozen) {
         tabbedPane.setTitleAt(3, tr("Members(resolved)"));
         tabbedPane.setToolTipTextAt(
             3,
             tr(
                 "Merged member list frozen. No pending conflicts in the member list of this relation"));
         tabbedPane.setIconAt(3, mergeComplete);
       } else {
         tabbedPane.setTitleAt(3, tr("Members(with conflicts)"));
         tabbedPane.setToolTipTextAt(
             3, tr("Pending conflicts in the member list of this relation"));
         tabbedPane.setIconAt(3, mergeIncomplete);
       }
     }
     updateResolvedCompletely();
   } else if (evt.getPropertyName().equals(PropertiesMergeModel.RESOLVED_COMPLETELY_PROP)) {
     boolean resolved = (Boolean) evt.getNewValue();
     if (resolved) {
       tabbedPane.setTitleAt(0, tr("Properties"));
       tabbedPane.setToolTipTextAt(0, tr("No pending property conflicts"));
       tabbedPane.setIconAt(0, mergeComplete);
     } else {
       tabbedPane.setTitleAt(0, tr("Properties(with conflicts)"));
       tabbedPane.setToolTipTextAt(0, tr("Pending property conflicts to be resolved"));
       tabbedPane.setIconAt(0, mergeIncomplete);
     }
     updateResolvedCompletely();
   } else if (PropertiesMergeModel.DELETE_PRIMITIVE_PROP.equals(evt.getPropertyName())) {
     for (IConflictResolver resolver : conflictResolvers) {
       resolver.deletePrimitive((Boolean) evt.getNewValue());
     }
   }
 }
Example #12
0
  /** Refreshes the GUI including locale-based resource strings. */
  protected void refreshGUI() {
    setTitle(ToolsRes.getString("LibraryManager.Title")); // $NON-NLS-1$

    okButton.setText(ToolsRes.getString("Tool.Button.Close")); // $NON-NLS-1$
    addButton.setText(ToolsRes.getString("LibraryManager.Button.Add")); // $NON-NLS-1$
    removeButton.setText(ToolsRes.getString("LibraryManager.Button.Remove")); // $NON-NLS-1$
    moveUpButton.setText(ToolsRes.getString("LibraryTreePanel.Button.Up")); // $NON-NLS-1$
    moveDownButton.setText(ToolsRes.getString("LibraryTreePanel.Button.Down")); // $NON-NLS-1$
    allButton.setText(ToolsRes.getString("LibraryManager.Button.All")); // $NON-NLS-1$
    noneButton.setText(ToolsRes.getString("LibraryManager.Button.None")); // $NON-NLS-1$
    clearCacheButton.setText(ToolsRes.getString("LibraryManager.Button.ClearCache")); // $NON-NLS-1$
    setCacheButton.setText(ToolsRes.getString("LibraryManager.Button.SetCache")); // $NON-NLS-1$

    addButton.setToolTipText(
        ToolsRes.getString("LibraryManager.Button.Add.Tooltip")); // $NON-NLS-1$
    removeButton.setToolTipText(
        ToolsRes.getString("LibraryManager.Button.Remove.Tooltip")); // $NON-NLS-1$
    moveUpButton.setToolTipText(
        ToolsRes.getString("LibraryTreePanel.Button.Up.Tooltip")); // $NON-NLS-1$
    moveDownButton.setToolTipText(
        ToolsRes.getString("LibraryTreePanel.Button.Down.Tooltip")); // $NON-NLS-1$
    allButton.setToolTipText(
        ToolsRes.getString("LibraryManager.Button.All.Tooltip")); // $NON-NLS-1$
    noneButton.setToolTipText(
        ToolsRes.getString("LibraryManager.Button.None.Tooltip")); // $NON-NLS-1$
    clearCacheButton.setToolTipText(
        ToolsRes.getString("LibraryManager.Button.ClearCache.Tooltip")); // $NON-NLS-1$
    setCacheButton.setToolTipText(
        ToolsRes.getString("LibraryManager.Button.SetCache.Tooltip")); // $NON-NLS-1$

    nameLabel.setText(
        ToolsRes.getString("LibraryManager.Label.Name") + ":"); // $NON-NLS-1$ //$NON-NLS-2$
    pathLabel.setText(
        ToolsRes.getString("LibraryManager.Label.Path") + ":"); // $NON-NLS-1$ //$NON-NLS-2$
    collectionsTitleBorder.setTitle(
        ToolsRes.getString("LibraryManager.Title.MenuItems") + ":"); // $NON-NLS-1$ //$NON-NLS-2$
    importsTitleBorder.setTitle(
        ToolsRes.getString("LibraryManager.Title.Import") + ":"); // $NON-NLS-1$ //$NON-NLS-2$
    searchTitleBorder.setTitle(
        ToolsRes.getString("LibraryManager.Title.Search") + ":"); // $NON-NLS-1$ //$NON-NLS-2$
    cacheTitleBorder.setTitle(
        ToolsRes.getString("LibraryManager.Title.Cache") + ":"); // $NON-NLS-1$ //$NON-NLS-2$
    int k = tabbedPane.indexOfComponent(collectionsPanel);
    if (k > -1) {
      tabbedPane.setTitleAt(k, ToolsRes.getString("LibraryManager.Tab.MyLibrary")); // $NON-NLS-1$
      tabbedPane.setToolTipTextAt(
          k, ToolsRes.getString("LibraryManager.Tab.MyLibrary.Tooltip")); // $NON-NLS-1$
    }
    k = tabbedPane.indexOfComponent(importsPanel);
    if (k > -1) {
      tabbedPane.setTitleAt(k, ToolsRes.getString("LibraryManager.Tab.Import")); // $NON-NLS-1$
      tabbedPane.setToolTipTextAt(
          k, ToolsRes.getString("LibraryManager.Tab.Import.Tooltip")); // $NON-NLS-1$
    }
    k = tabbedPane.indexOfComponent(searchPanel);
    if (k > -1) {
      tabbedPane.setTitleAt(k, ToolsRes.getString("LibraryManager.Tab.Search")); // $NON-NLS-1$
      tabbedPane.setToolTipTextAt(
          k, ToolsRes.getString("LibraryManager.Tab.Search.Tooltip")); // $NON-NLS-1$
    }
    k = tabbedPane.indexOfComponent(cachePanel);
    if (k > -1) {
      tabbedPane.setTitleAt(k, ToolsRes.getString("LibraryManager.Tab.Cache")); // $NON-NLS-1$
      tabbedPane.setToolTipTextAt(
          k, ToolsRes.getString("LibraryManager.Tab.Cache.Tooltip")); // $NON-NLS-1$
    }

    resizeLabels();

    pathField.setForeground(LibraryTreePanel.defaultForeground);
    if (tabbedPane.getSelectedComponent() == collectionsPanel) {
      nameField.setEditable(true);
      int i = collectionList.getSelectedIndex();
      moveDownButton.setEnabled(i < library.pathList.size() - 1);
      moveUpButton.setEnabled(i > 0);
      if (i > -1 && library.pathList.size() > i) {
        removeButton.setEnabled(true);
        String path = library.pathList.get(i);
        pathField.setText(path);
        pathField.setCaretPosition(0);
        String name = library.pathToNameMap.get(path);
        nameField.setText(name);
        boolean unavailable =
            path.startsWith("http:") && !LibraryBrowser.webConnected; // $NON-NLS-1$
        Resource res = unavailable ? null : ResourceLoader.getResourceZipURLsOK(path);
        if (res == null) {
          pathField.setForeground(LibraryTreePanel.darkRed);
        }
      } else {
        removeButton.setEnabled(false);
        nameField.setEditable(false);
        nameField.setText(null);
        nameField.setBackground(Color.white);
        pathField.setText(null);
        pathField.setBackground(Color.white);
      }
    } else if (tabbedPane.getSelectedComponent() == importsPanel) {
      nameField.setEditable(false);
      int i = guestList.getSelectedIndex();
      moveDownButton.setEnabled(i < library.importedPathList.size() - 1);
      moveUpButton.setEnabled(i > 0);
      if (i > -1 && library.importedPathList.size() > i) {
        removeButton.setEnabled(true);
        String path = library.importedPathList.get(i);
        pathField.setText(path);
        pathField.setCaretPosition(0);
        String name = library.importedPathToLibraryMap.get(path).getName();
        nameField.setText(name);
        boolean unavailable =
            path.startsWith("http:") && !LibraryBrowser.webConnected; // $NON-NLS-1$
        Resource res = unavailable ? null : ResourceLoader.getResourceZipURLsOK(path);
        if (res == null) {
          pathField.setForeground(LibraryTreePanel.darkRed);
        }
      } else {
        removeButton.setEnabled(false);
        nameField.setText(null);
        nameField.setBackground(Color.white);
        pathField.setText(null);
        pathField.setBackground(Color.white);
      }
    }
    nameField.setBackground(Color.white);
    pathField.setBackground(Color.white);
  }
Example #13
0
  public static void createTabItem(ActionContext actionContext) {
    Thing self = (Thing) actionContext.get("self");
    JTabbedPane parent = (JTabbedPane) actionContext.get("parent");

    Thing thing = self.getThing("Component@0");
    if (thing != null) {
      try {
        Bindings bindings = actionContext.push();
        bindings.put("parent", null);

        for (Thing child : thing.getChilds()) {
          Component c = (Component) child.doAction("create", actionContext);
          if (c != null) {
            int index = parent.getTabCount();
            parent.setComponentAt(index, c);

            Color background = AwtCreator.createColor(thing, "background", actionContext);
            if (background != null) {
              parent.setBackgroundAt(index, background);
            }

            Icon disabledIcon = SwingCreator.createIcon(thing, "disabledIcon", actionContext);
            if (disabledIcon != null) {
              parent.setDisabledIconAt(index, disabledIcon);
            }

            Integer displayedMnemonicIndex =
                JavaCreator.createInteger(thing, "displayedMnemonicIndex");
            if (displayedMnemonicIndex != null) {
              parent.setDisplayedMnemonicIndexAt(index, displayedMnemonicIndex);
            }

            Boolean enabled = JavaCreator.createBoolean(thing, "enabled");
            if (enabled != null) {
              parent.setEnabledAt(index, enabled);
            }

            Color foreground = AwtCreator.createColor(thing, "foreground", actionContext);
            if (foreground != null) {
              parent.setForeground(foreground);
            }

            Icon icon = SwingCreator.createIcon(thing, "icon", actionContext);
            if (icon != null) {
              parent.setIconAt(index, icon);
            }

            Integer mnemonic = AwtCreator.createMnemonic(thing, "mnemonic");
            if (mnemonic != null) {
              parent.setMnemonicAt(index, mnemonic);
            }

            Boolean selected = JavaCreator.createBoolean(thing, "selected");
            if (selected != null && selected) {
              parent.setSelectedIndex(index);
            }

            String title = JavaCreator.createText(thing, "title", actionContext);
            if (title != null) {
              parent.setTitleAt(index, title);
            }

            String toolTipText = JavaCreator.createText(thing, "toolTipText", actionContext);
            if (toolTipText != null) {
              parent.setToolTipTextAt(index, toolTipText);
            }
            break;
          }
        }
      } finally {
        actionContext.pop();
      }
    }
  }
  private void initComponents() {
    okButton = new JButton();
    cancelButton = new JButton();
    resetButton = new JButton();

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(translate("advancedSettings.dialog.title"));
    setModal(true);
    setPreferredSize(new Dimension(800, 500));

    okButton.setText(AppStrings.translate("button.ok"));
    okButton.addActionListener(this::okButtonActionPerformed);

    cancelButton.setText(AppStrings.translate("button.cancel"));
    cancelButton.addActionListener(this::cancelButtonActionPerformed);

    resetButton.setText(AppStrings.translate("button.reset"));
    resetButton.addActionListener(this::resetButtonActionPerformed);

    Container cnt = getContentPane();
    cnt.setLayout(new BorderLayout());
    // cnt.add(new JScrollPane(configurationTable),BorderLayout.CENTER);

    JPanel buttonsPanel = new JPanel(new BorderLayout());

    JPanel buttonsLeftPanel = new JPanel(new FlowLayout());
    buttonsLeftPanel.add(resetButton, BorderLayout.WEST);

    buttonsPanel.add(buttonsLeftPanel, BorderLayout.WEST);

    JPanel buttonsRightPanel = new JPanel(new FlowLayout());
    buttonsRightPanel.add(cancelButton);
    buttonsRightPanel.add(okButton);
    buttonsPanel.add(buttonsRightPanel, BorderLayout.EAST);

    cnt.add(buttonsPanel, BorderLayout.SOUTH);

    JTabbedPane tabPane = new JTabbedPane();

    JComboBox<SkinSelect> skinComboBox = new JComboBox<>();
    skinComboBox.setRenderer(
        new SubstanceDefaultListCellRenderer() {

          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            SubstanceDefaultListCellRenderer cmp =
                (SubstanceDefaultListCellRenderer)
                    super.getListCellRendererComponent(
                        list,
                        value,
                        index,
                        isSelected,
                        cellHasFocus); // To change body of generated methods, choose Tools |
                                       // Templates.
            final SkinSelect ss = (SkinSelect) value;
            cmp.setIcon(
                new Icon() {

                  @Override
                  public void paintIcon(Component c, Graphics g, int x, int y) {
                    Graphics2D g2 = (Graphics2D) g;
                    g2.setRenderingHint(
                        RenderingHints.KEY_INTERPOLATION,
                        RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                    g2.setRenderingHint(
                        RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
                    g2.setRenderingHint(
                        RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                    try {
                      Class<?> act = Class.forName(ss.getClassName());
                      SubstanceSkin skin = (SubstanceSkin) act.newInstance();
                      Color fill =
                          skin.getColorScheme(
                                  DecorationAreaType.GENERAL,
                                  ColorSchemeAssociationKind.FILL,
                                  ComponentState.ENABLED)
                              .getBackgroundFillColor();
                      Color hilight =
                          skin.getColorScheme(
                                  DecorationAreaType.GENERAL,
                                  ColorSchemeAssociationKind.FILL,
                                  ComponentState.ROLLOVER_SELECTED)
                              .getBackgroundFillColor();
                      Color border =
                          skin.getColorScheme(
                                  DecorationAreaType.GENERAL,
                                  ColorSchemeAssociationKind.BORDER,
                                  ComponentState.ENABLED)
                              .getDarkColor();
                      g2.setColor(fill);
                      g2.fillOval(0, 0, 16, 16);
                      g2.setColor(hilight);
                      g2.fillArc(0, 0, 16, 16, -45, 90);
                      g2.setColor(border);
                      g2.drawOval(0, 0, 16, 16);

                    } catch (ClassNotFoundException
                        | InstantiationException
                        | IllegalAccessException ex) {
                      // no icon
                    }
                  }

                  @Override
                  public int getIconWidth() {
                    return 16;
                  }

                  @Override
                  public int getIconHeight() {
                    return 16;
                  }
                });
            return cmp;
          }
        });
    skinComboBox.addItem(new SkinSelect(OceanicSkin.NAME, OceanicSkin.class.getName()));
    Map<String, SkinInfo> skins = SubstanceLookAndFeel.getAllSkins();
    for (String skinKey : skins.keySet()) {
      SkinInfo skin = skins.get(skinKey);
      skinComboBox.addItem(new SkinSelect(skin.getDisplayName(), skin.getClassName()));
      if (skin.getClassName().equals(Configuration.guiSkin.get())) {
        skinComboBox.setSelectedIndex(skinComboBox.getItemCount() - 1);
      }
    }

    Map<String, Component> tabs = new HashMap<>();
    getCategories(componentsMap, tabs, skinComboBox, getResourceBundle());

    String catOrder[] =
        new String[] {
          "ui",
          "display",
          "decompilation",
          "script",
          "format",
          "export",
          "import",
          "limit",
          "update",
          "debug",
          "other"
        };

    for (String cat : catOrder) {
      if (!tabs.containsKey(cat)) {
        continue;
      }

      tabPane.add(translate("config.group.name." + cat), tabs.get(cat));
      tabPane.setToolTipTextAt(
          tabPane.getTabCount() - 1, translate("config.group.description." + cat));
    }

    cnt.add(tabPane, BorderLayout.CENTER);
    pack();
  }