Example usage for javax.swing JSeparator setOrientation

List of usage examples for javax.swing JSeparator setOrientation

Introduction

In this page you can find the example usage for javax.swing JSeparator setOrientation.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { "SwingConstants.HORIZONTAL",
        "SwingConstants.VERTICAL" }, description = "The orientation of the separator.")
public void setOrientation(int orientation) 

Source Link

Document

Sets the orientation of the separator.

Usage

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JSeparator sep = new JSeparator(JSeparator.VERTICAL);
    sep.setOrientation(JSeparator.VERTICAL);
    frame.add(sep);/*from w w  w  .  j a va 2 s. c o  m*/

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

/**
 * Mostly created by Eclipse WindowBuilder
 *//*from   w w  w .  j  ava2 s.c o m*/
private void initComponents() {
    setTitle("perfLoad - Load Profile Configurator");
    setSize(1032, 984);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    SwingUtils.setUIFontStyle(Font.PLAIN);
    {
        JMenuBar menuBar = new JMenuBar();
        menuBar.setName("menuBar");
        setJMenuBar(menuBar);
        initMenuBar(menuBar);
    }

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new MigLayout("insets 0", "[grow][]", "[25px][400][grow]"));
    {
        JToolBar toolBar = new JToolBar() {
            @Override
            protected JButton createActionComponent(final Action a) {
                JButton button = super.createActionComponent(a);
                button.setFocusable(false);
                button.setHideActionText(false);
                return button;
            }
        };
        toolBar.setName("toolBar");
        contentPane.add(toolBar, "cell 0 0 2 1,growx,aligny top");
        initToolBar(toolBar);
    }
    {
        JScrollPane spTree = new JScrollPane();
        spTree.setBorder(new CompoundBorder(
                new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profile Elements",
                        TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)),
                new EmptyBorder(4, 4, 4, 4)));
        contentPane.add(spTree, "cell 0 1,grow");
        spTree.setName("spTree");
        {
            tree = new JTree();
            tree.addKeyListener(new TreeKeyListener());
            tree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
            tree.addTreeSelectionListener(new TreeTreeSelectionListener());
            tree.setShowsRootHandles(true);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setName("tree");
            spTree.setViewportView(tree);
        }
    }
    {
        JPanel pnlMain = new JPanel();
        contentPane.add(pnlMain, "cell 1 1");
        pnlMain.setName("pnlMain");
        pnlMain.setLayout(new MigLayout("insets 0", "[664!]", "[grow][]"));
        {
            JPanel pnlLoadProfileProperties = new JPanel();
            pnlLoadProfileProperties.setBorder(new TitledBorder(null, "Load Profile Properties",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlLoadProfileProperties.setName("pnlLoadProfileProperties");
            pnlMain.add(pnlLoadProfileProperties, "flowx,cell 0 0,grow");
            pnlLoadProfileProperties
                    .setLayout(new MigLayout("insets 4", "[270,grow]8[]8[200]8[]8[200]", "[][][][grow]"));
            {
                lblName = new JLabel("Name");
                lblName.setDisplayedMnemonic('N');
                lblName.setHorizontalAlignment(SwingConstants.CENTER);
                lblName.setName("lblName");
                pnlLoadProfileProperties.add(lblName, "cell 0 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 1 0 1 4, growy");
            }
            {
                JLabel lblClient = new JLabel("Clients");
                lblClient.setName("lblClient");
                pnlLoadProfileProperties.add(lblClient, "cell 2 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 3 0 1 4, growy");
            }
            {
                lblTargets = new JLabel("Targets");
                lblTargets.setName("lblTargets");
                pnlLoadProfileProperties.add(lblTargets, "cell 4 0");
            }
            {
                txtName = new JTextField();
                lblName.setLabelFor(txtName);
                txtName.setColumns(10);
                txtName.setName("txtName");
                txtName.getDocument().addDocumentListener(dirtyListener);
                pnlLoadProfileProperties.add(txtName, "cell 0 1,growx");
            }
            {
                JScrollPane spClients = new JScrollPane();
                spClients.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spClients.setName("spClients");
                pnlLoadProfileProperties.add(spClients, "cell 2 1 1 3,grow");
                {
                    tblClients = new JCheckListTable();
                    tblClients.setName("tblClients");
                    spClients.setViewportView(tblClients);
                    spClients.setColumnHeaderView(null);
                }
            }
            {
                JScrollPane spTargets = new JScrollPane();
                spTargets.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spTargets.setName("spTargets");
                pnlLoadProfileProperties.add(spTargets, "cell 4 1 1 3,grow");
                {
                    tblTargets = new JCheckListTable();
                    tblTargets.setName("tblTargets");
                    spTargets.setViewportView(tblTargets);
                    spTargets.setColumnHeaderView(null);
                }
            }
            {
                lblDescription = new JLabel("Description");
                lblDescription.setDisplayedMnemonic('D');
                lblDescription.setName("lblDescription");
                pnlLoadProfileProperties.add(lblDescription, "cell 0 2");
            }
            {
                JScrollPane spDescription = new JScrollPane();
                spDescription.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spDescription.setName("spDescription");
                pnlLoadProfileProperties.add(spDescription, "cell 0 3,height 50:50:,grow");
                {
                    taDescription = new JTextArea();
                    taDescription.setFont(txtName.getFont());
                    lblDescription.setLabelFor(taDescription);
                    taDescription.setRows(3);
                    taDescription.setName("taDescription");
                    taDescription.getDocument().addDocumentListener(dirtyListener);
                    spDescription.setViewportView(taDescription);
                }
            }
        }
        {
            JPanel pnlCurveAssignment = new JPanel();
            pnlCurveAssignment.setBorder(new TitledBorder(null, "Active Load Curve Assignment",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlMain.add(pnlCurveAssignment, "cell 0 1,grow");
            pnlCurveAssignment.setLayout(new MigLayout("insets 4", "[grow]", "[grow][]"));
            {
                pnlCard = new JPanel();
                pnlCard.setName("pnlCard");
                pnlCurveAssignment.add(pnlCard, "cell 0 0,grow");
                cardLayout = new CardLayout(0, 0);
                pnlCard.setLayout(cardLayout);
                {
                    stairsPanel = new StairsPanel();
                    stairsPanel.setName("stairsPanel");
                    pnlCard.add(stairsPanel, "stairs");
                }
                {
                    oneTimePanel = new OneTimePanel();
                    oneTimePanel.setName("oneTimePanel");
                    pnlCard.add(oneTimePanel, "oneTime");
                }
                {
                    markerPanel = new MarkerPanel();
                    markerPanel.setName("markerPanel");
                    pnlCard.add(markerPanel, "marker");
                }
                {
                    JLabel lblNoActiveCurve = new JLabel("no active curve assignment");
                    lblNoActiveCurve.setHorizontalAlignment(SwingConstants.CENTER);
                    pnlCard.add(lblNoActiveCurve, "none");
                    lblNoActiveCurve.setName("lblNoActiveCurve");
                }
            }
            {
                btnOk = new JButtonExt("OK");
                getRootPane().setDefaultButton(btnOk);
                btnOk.setEnabled(false);
                btnOk.addActionListener(new BtnOkActionListener());
                btnOk.setMnemonic(KeyEvent.VK_O);
                btnOk.setName("btnOk");
                pnlCurveAssignment.add(btnOk, "cell 0 1,alignx right");
            }
            {
                btnCancel = new JButtonExt("Cancel");
                btnCancel.setEnabled(false);
                btnCancel.addActionListener(new BtnCancelActionListener());
                btnCancel.setMnemonic(KeyEvent.VK_C);
                btnCancel.setName("btnCancel");
                pnlCurveAssignment.add(btnCancel, "cell 0 1,alignx right");
            }
        }
    }
}

From source file:md.mclama.com.ModManager.java

/**
 * Create the frame./*from   ww w  .jav a2 s.co  m*/
 */

@SuppressWarnings("serial")
public ModManager() throws MalformedURLException {
    setResizable(false);
    setTitle("McLauncher " + McVersion);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 700, 400);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 694, 372);
    contentPane.add(tabbedPane);

    profileListMdl = new DefaultListModel<String>();
    ModListModel = new DefaultListModel<String>();
    listModel = new DefaultListModel<String>();
    getCurrentMods();

    panelLauncher = new JPanel();
    tabbedPane.addTab("Launcher", null, panelLauncher, null);
    panelLauncher.setLayout(null);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(556, 36, 132, 248);
    panelLauncher.add(scrollPane);
    profileList = new JList<String>(profileListMdl);
    profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(profileList);

    btnNewProfile = new JButton("New");
    btnNewProfile.setFont(new Font("SansSerif", Font.PLAIN, 12));
    btnNewProfile.setBounds(479, 4, 76, 20);
    panelLauncher.add(btnNewProfile);
    btnNewProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            newProfile(txtProfile.getText());
        }
    });
    btnNewProfile.setToolTipText("Click to create a new profile.");

    JButton btnRenameProfile = new JButton("Rename");
    btnRenameProfile.setBounds(479, 25, 76, 20);
    panelLauncher.add(btnRenameProfile);
    btnRenameProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            renameProfile();
        }
    });
    btnRenameProfile.setToolTipText("Click to rename the selected profile");

    JButton btnDelProfile = new JButton("Delete");
    btnDelProfile.setBounds(479, 50, 76, 20);
    panelLauncher.add(btnDelProfile);
    btnDelProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            deleteProfile();
        }
    });
    btnDelProfile.setToolTipText("Click to delete the selected profile.");

    JButton btnLaunch = new JButton("Launch");
    btnLaunch.setBounds(605, 319, 89, 23);
    panelLauncher.add(btnLaunch);
    btnLaunch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (selProfile != null) {
                LaunchFactorioWithSelectedMods(false); //dont ignore
            }
        }
    });
    btnLaunch.setToolTipText("Click to launch factorio with the selected mod profile.");

    lblAvailableMods = new JLabel("Available Mods");
    lblAvailableMods.setBounds(4, 155, 144, 14);
    panelLauncher.add(lblAvailableMods);
    lblAvailableMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblAvailableMods.setText("Available Mods: " + -1);

    txtGamePath = new JTextField();
    txtGamePath.setBounds(4, 5, 211, 23);
    panelLauncher.add(txtGamePath);
    txtGamePath.setToolTipText("Select tha path to your game!");
    txtGamePath.setFont(new Font("Tahoma", Font.PLAIN, 8));
    txtGamePath.setText("Game Path");
    txtGamePath.setColumns(10);

    JButton btnFind = new JButton("find");
    btnFind.setBounds(227, 3, 32, 23);
    panelLauncher.add(btnFind);

    txtProfile = new JTextField();
    txtProfile.setBounds(556, 2, 132, 22);
    panelLauncher.add(txtProfile);
    txtProfile.setToolTipText("The name of NEW or RENAME profiles");
    txtProfile.setText("Profile1");
    txtProfile.setColumns(10);

    lblModsEnabled = new JLabel("Mods Enabled: -1");
    lblModsEnabled.setBounds(335, 155, 95, 16);
    panelLauncher.add(lblModsEnabled);
    lblModsEnabled.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(0, 167, 211, 165);
    panelLauncher.add(scrollPane_1);
    modsList = new JList<String>(listModel);
    modsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    modsList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            String modName = util.getModVersion(modsList.getSelectedValue());
            lblModVersion.setText("Mod Version: " + modName);
            checkDependency(modsList);
            if (modName.contains(".zip")) {
                new File(System.getProperty("java.io.tmpdir") + modName.replace(".zip", "")).delete();
            }
            if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click
                addMod();
            }
            lastClickTime = System.currentTimeMillis();
        }
    });
    scrollPane_1.setViewportView(modsList);
    modsList.setFont(new Font("Tahoma", Font.PLAIN, 9));

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(333, 167, 211, 165);
    panelLauncher.add(scrollPane_2);
    enabledModsList = new JList<String>(ModListModel);
    enabledModsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    enabledModsList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            lblModVersion.setText("Mod Version: " + util.getModVersion(enabledModsList.getSelectedValue()));
            checkDependency(enabledModsList);
            if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click
                removeMod();
            }
            lastClickTime = System.currentTimeMillis();
        }
    });
    enabledModsList.setFont(new Font("SansSerif", Font.PLAIN, 10));
    scrollPane_2.setViewportView(enabledModsList);

    JButton btnEnable = new JButton("Enable");
    btnEnable.setBounds(223, 200, 90, 28);
    panelLauncher.add(btnEnable);
    btnEnable.setToolTipText("Add mod -->");

    JButton btnDisable = new JButton("Disable");
    btnDisable.setBounds(223, 240, 90, 28);
    panelLauncher.add(btnDisable);
    btnDisable.setToolTipText("Disable mod ");

    JLabel lblModsAvailable = new JLabel("Mods available");
    lblModsAvailable.setBounds(4, 329, 89, 14);
    panelLauncher.add(lblModsAvailable);
    lblModsAvailable.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JLabel lblEnabledMods = new JLabel("Enabled Mods");
    lblEnabledMods.setBounds(337, 329, 89, 16);
    panelLauncher.add(lblEnabledMods);
    lblEnabledMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblModVersion = new JLabel("Mod Version: (select a mod first)");
    lblModVersion.setBounds(4, 117, 183, 14);
    panelLauncher.add(lblModVersion);
    lblModVersion.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblRequiredMods = new JLabel("Required Mods: " + reqModsStr);
    lblRequiredMods.setBounds(6, 143, 538, 14);
    panelLauncher.add(lblRequiredMods);
    lblRequiredMods.setHorizontalAlignment(SwingConstants.RIGHT);
    lblRequiredMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JButton btnNewButton = new JButton("TEST");
    btnNewButton.setVisible(testBtnEnabled);
    btnNewButton.setEnabled(testBtnEnabled);
    btnNewButton.setBounds(338, 61, 90, 28);
    panelLauncher.add(btnNewButton);
    btnUpdate.setBounds(218, 322, 103, 20);
    panelLauncher.add(btnUpdate);

    btnUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            util.updateLauncher();
        }
    });
    btnUpdate.setVisible(false);
    btnUpdate.setFont(new Font("SansSerif", Font.PLAIN, 9));

    lblModRequires = new JLabel("Mod Requires: (Select a mod first)");
    lblModRequires.setBounds(4, 127, 317, 16);
    panelLauncher.add(lblModRequires);

    btnLaunchIgnore = new JButton("Launch + ignore");
    btnLaunchIgnore.setToolTipText("Ignore any errors that McLauncher may not correctly account for.");
    btnLaunchIgnore.setFont(new Font("SansSerif", Font.PLAIN, 11));
    btnLaunchIgnore.setBounds(556, 284, 133, 23);
    panelLauncher.add(btnLaunchIgnore);

    JButton btnConsole = new JButton("Console");
    btnConsole.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean changeto = !con.isVisible();
            con.setVisible(changeto);
            con.updateConsole();
        }
    });
    btnConsole.setBounds(335, 0, 90, 28);
    panelLauncher.add(btnConsole);

    JPanel panelDownloadMods = new JPanel();
    tabbedPane.addTab("Download Mods", null, panelDownloadMods, null);
    panelDownloadMods.setLayout(null);

    scrollPane_3 = new JScrollPane();
    scrollPane_3.setBounds(0, 0, 397, 303);
    panelDownloadMods.add(scrollPane_3);

    dlModel = new DefaultTableModel(new Object[][] {},
            new String[] { "Mod Name", "Author", "Version", "Tags" }) {
        Class[] columnTypes = new Class[] { String.class, String.class, String.class, Object.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        boolean[] columnEditables = new boolean[] { false, false, false, false };

        public boolean isCellEditable(int row, int column) {
            return columnEditables[column];
        };
    };

    tSorter = new TableRowSorter<DefaultTableModel>(dlModel);
    tableDownloads = new JTable();
    tableDownloads.setRowSorter(tSorter);
    tableDownloads.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            trow = tableDownloads.getSelectedRow();
            trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow);
            getDlModData();
            canDownloadMod = true;
        }
    });
    tableDownloads.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            trow = tableDownloads.getSelectedRow();
            trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow);
            getDlModData();
            canDownloadMod = true;
        }
    });
    tableDownloads.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    tableDownloads.setShowVerticalLines(true);
    tableDownloads.setShowHorizontalLines(true);
    tableDownloads.setModel(dlModel);
    tableDownloads.getColumnModel().getColumn(0).setPreferredWidth(218);
    tableDownloads.getColumnModel().getColumn(1).setPreferredWidth(97);
    tableDownloads.getColumnModel().getColumn(2).setPreferredWidth(77);
    scrollPane_3.setViewportView(tableDownloads);

    btnDownload = new JButton("Download");
    btnDownload.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (canDownloadMod && !CurrentlyDownloading) {
                String dlUrl = getModDownloadUrl();
                try {
                    if (dlUrl.equals("") || dlUrl.equals(" ") || dlUrl == null) {
                        con.log("Log", "No download link for mod, got... '" + dlUrl + "'");
                    } else {
                        CurrentlyDownloading = true;
                        CurrentDownload = new Download(new URL(dlUrl), McLauncher);
                    }
                } catch (MalformedURLException e1) {
                    con.log("Log", "Failed to download mod... No download URL?");
                }
            }
        }
    });
    btnDownload.setBounds(307, 308, 90, 28);
    panelDownloadMods.add(btnDownload);

    btnGotoMod = new JButton("Mod Page");
    btnGotoMod.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            util.openWebpage(modPageUrl);
        }
    });
    btnGotoMod.setEnabled(false);
    btnGotoMod.setBounds(134, 308, 90, 28);
    panelDownloadMods.add(btnGotoMod);

    pBarDownloadMod = new JProgressBar();
    pBarDownloadMod.setBounds(538, 308, 150, 10);
    panelDownloadMods.add(pBarDownloadMod);

    pBarExtractMod = new JProgressBar();
    pBarExtractMod.setBounds(538, 314, 150, 10);
    panelDownloadMods.add(pBarExtractMod);

    lblDownloadModInfo = new JLabel("Download progress");
    lblDownloadModInfo.setBounds(489, 326, 199, 16);
    panelDownloadMods.add(lblDownloadModInfo);
    lblDownloadModInfo.setHorizontalAlignment(SwingConstants.TRAILING);

    panelModImg = new JPanel();
    panelModImg.setBounds(566, 0, 128, 128);
    panelDownloadMods.add(panelModImg);

    txtFilterText = new JTextField();
    txtFilterText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            if (txtFilterText.getText().equals("Filter Text")) {
                txtFilterText.setText("");
                newFilter();
            }
        }
    });
    txtFilterText.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (!txtFilterText.getText().equals("Filter Text")) {
                newFilter();
            }
        }
    });
    txtFilterText.setText("Filter Text");
    txtFilterText.setBounds(0, 308, 122, 28);
    panelDownloadMods.add(txtFilterText);
    txtFilterText.setColumns(10);

    comboBox = new JComboBox();
    comboBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            newFilter();
        }
    });
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "No tag filter", "Vanilla", "Machine", "Mechanic",
            "New Ore", "Module", "Big Mod", "Power", "GUI", "Map-Gen", "Must-Have", "Equipment" }));
    comboBox.setBounds(403, 44, 150, 26);
    panelDownloadMods.add(comboBox);

    lblModDlCounter = new JLabel("Mod database: ");
    lblModDlCounter.setFont(new Font("SansSerif", Font.PLAIN, 10));
    lblModDlCounter.setBounds(403, 5, 162, 16);
    panelDownloadMods.add(lblModDlCounter);

    txtrDMModDescription = new JTextArea();
    txtrDMModDescription.setBackground(Color.LIGHT_GRAY);
    txtrDMModDescription.setBorder(new LineBorder(new Color(0, 0, 0)));
    txtrDMModDescription.setFocusable(false);
    txtrDMModDescription.setEditable(false);
    txtrDMModDescription.setLineWrap(true);
    txtrDMModDescription.setWrapStyleWord(true);
    txtrDMModDescription.setText("Mod Description: ");
    txtrDMModDescription.setBounds(403, 132, 285, 75);
    panelDownloadMods.add(txtrDMModDescription);

    lblDMModTags = new JTextArea();
    lblDMModTags.setFocusable(false);
    lblDMModTags.setEditable(false);
    lblDMModTags.setBorder(new LineBorder(new Color(0, 0, 0)));
    lblDMModTags.setWrapStyleWord(true);
    lblDMModTags.setLineWrap(true);
    lblDMModTags.setBackground(Color.LIGHT_GRAY);
    lblDMModTags.setText("Mod Tags: ");
    lblDMModTags.setBounds(403, 71, 160, 60);
    panelDownloadMods.add(lblDMModTags);

    lblDMRequiredMods = new JTextArea();
    lblDMRequiredMods.setFocusable(false);
    lblDMRequiredMods.setEditable(false);
    lblDMRequiredMods.setText("Required Mods: ");
    lblDMRequiredMods.setWrapStyleWord(true);
    lblDMRequiredMods.setLineWrap(true);
    lblDMRequiredMods.setBorder(new LineBorder(new Color(0, 0, 0)));
    lblDMRequiredMods.setBackground(Color.LIGHT_GRAY);
    lblDMRequiredMods.setBounds(403, 208, 285, 57);
    panelDownloadMods.add(lblDMRequiredMods);

    lblDLModLicense = new JLabel("");
    lblDLModLicense.setHorizontalAlignment(SwingConstants.RIGHT);
    lblDLModLicense.setBounds(403, 294, 285, 16);
    panelDownloadMods.add(lblDLModLicense);

    lblWipmod = new JLabel("");
    lblWipmod.setBounds(395, 314, 64, 16);
    panelDownloadMods.add(lblWipmod);

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Stop downloading");
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            CurrentDownload.cancel();
        }
    });
    btnCancel.setBounds(230, 308, 72, 28);
    panelDownloadMods.add(btnCancel);

    panelOptions = new JPanel();
    tabbedPane.addTab("Options", null, panelOptions, null);
    panelOptions.setLayout(null);
    scrollPane_4.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane_4.setBounds(0, 0, 694, 342);
    panelOptions.add(scrollPane_4);

    panel = new JPanel();
    scrollPane_4.setViewportView(panel);
    panel.setLayout(null);

    lblCloseMclauncherAfter = new JLabel("Close McLauncher after launching Factorio?");
    lblCloseMclauncherAfter.setBounds(6, 6, 274, 16);
    panel.add(lblCloseMclauncherAfter);

    lblCloseMclauncherAfter_1 = new JLabel("Close McLauncher after updating?");
    lblCloseMclauncherAfter_1.setBounds(6, 34, 274, 16);
    panel.add(lblCloseMclauncherAfter_1);

    lblSortNewestDownloadable = new JLabel("Sort newest downloadable mods first?");
    lblSortNewestDownloadable.setBounds(6, 62, 274, 16);
    panel.add(lblSortNewestDownloadable);

    tglbtnNewModsFirst = new JToggleButton("Toggle");
    tglbtnNewModsFirst.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            lblNeedrestart.setText("McLauncher needs to restart for that to work");
            writeData();
        }
    });
    tglbtnNewModsFirst.setSelected(true);
    tglbtnNewModsFirst.setBounds(281, 56, 66, 28);
    panel.add(tglbtnNewModsFirst);

    tglbtnCloseAfterUpdate = new JToggleButton("Toggle");
    tglbtnCloseAfterUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnCloseAfterUpdate.setBounds(281, 28, 66, 28);
    panel.add(tglbtnCloseAfterUpdate);

    tglbtnCloseAfterLaunch = new JToggleButton("Toggle");
    tglbtnCloseAfterLaunch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnCloseAfterLaunch.setBounds(281, 0, 66, 28);
    panel.add(tglbtnCloseAfterLaunch);

    tglbtnDisplayon = new JToggleButton("On");
    tglbtnDisplayon.setFont(new Font("SansSerif", Font.PLAIN, 10));
    tglbtnDisplayon.setSelected(true);
    tglbtnDisplayon.setBounds(588, 308, 44, 28);
    panel.add(tglbtnDisplayon);

    tglbtnDisplayoff = new JToggleButton("Off");
    tglbtnDisplayoff.setFont(new Font("SansSerif", Font.PLAIN, 10));
    tglbtnDisplayoff.setBounds(644, 308, 44, 28);
    panel.add(tglbtnDisplayoff);

    lblInfo = new JLabel("What enabled and disabled look like");
    lblInfo.setFont(new Font("SansSerif", Font.PLAIN, 10));
    lblInfo.setHorizontalAlignment(SwingConstants.TRAILING);
    lblInfo.setBounds(359, 314, 231, 16);
    panel.add(lblInfo);

    JSeparator separator = new JSeparator();
    separator.setBounds(6, 55, 676, 24);
    panel.add(separator);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(6, 27, 676, 18);
    panel.add(separator_1);

    JSeparator separator_2 = new JSeparator();
    separator_2.setBounds(6, 84, 676, 24);
    panel.add(separator_2);

    JSeparator separator_3 = new JSeparator();
    separator_3.setOrientation(SwingConstants.VERTICAL);
    separator_3.setBounds(346, 0, 16, 336);
    panel.add(separator_3);

    lblNeedrestart = new JLabel("");
    lblNeedrestart.setBounds(6, 314, 341, 16);
    panel.add(lblNeedrestart);

    tglbtnSendAnonData = new JToggleButton("Toggle");
    tglbtnSendAnonData.setToolTipText("Information regarding the activity of McLauncher.");
    tglbtnSendAnonData.setSelected(true); //set enabled by default.
    tglbtnSendAnonData.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnSendAnonData.setBounds(622, 0, 66, 28);
    panel.add(tglbtnSendAnonData);

    lblSendAnonymousUse = new JLabel("Send anonymous use data?");
    lblSendAnonymousUse.setBounds(359, 6, 251, 16);
    panel.add(lblSendAnonymousUse);

    lblDeleteOldMod = new JLabel("Delete old mod before updating?");
    lblDeleteOldMod.setBounds(359, 34, 251, 16);
    panel.add(lblDeleteOldMod);

    tglbtnDeleteBeforeUpdate = new JToggleButton("Toggle");
    tglbtnDeleteBeforeUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnDeleteBeforeUpdate.setBounds(622, 28, 66, 28);
    panel.add(tglbtnDeleteBeforeUpdate);

    tglbtnAlertOnModUpdateAvailable = new JToggleButton("Toggle");
    tglbtnAlertOnModUpdateAvailable.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnAlertOnModUpdateAvailable.setSelected(true);
    tglbtnAlertOnModUpdateAvailable.setBounds(281, 86, 66, 28);
    panel.add(tglbtnAlertOnModUpdateAvailable);

    separator_4 = new JSeparator();
    separator_4.setBounds(0, 112, 676, 24);
    panel.add(separator_4);

    JLabel lblAlertModHas = new JLabel("Alert mod has update on launch?");
    lblAlertModHas.setBounds(6, 92, 231, 16);
    panel.add(lblAlertModHas);

    panelChangelog = new JPanel();
    tabbedPane.addTab("Changelog", null, panelChangelog, null);
    panelChangelog.setLayout(new BoxLayout(panelChangelog, BoxLayout.X_AXIS));

    scrollPane_6 = new JScrollPane();
    panelChangelog.add(scrollPane_6);

    textChangelog = new JTextArea();
    scrollPane_6.setViewportView(textChangelog);
    textChangelog.setEditable(false);
    textChangelog.setText(
            "v0.4.6\r\n\r\n+Fix problem where config file would not save in the correct location. (Thanks Arano-kai)\r\n+McLauncher will now save when you select a path, or profile. (Thanks Arano-kai)\r\n+Fixed an issue where McLauncher could not get the version from a .zip mod. (Thanks Arano-kai)\r\n+Added a Cancel button to stop downloading the current mod. (Suggested by  Arano-kai)\r\n\r\n\r\n\r\nv0.4.5\r\n\r\n+McLauncher should now correctly warn you on failed write/read access.\r\n+McLauncher should now work when a user has both zip and installer versions of factorio. (Thanks Jeroon)\r\n+Attempt to fix an error with dependency and .zip files, With versions. (Thanks Arano-kai)\r\n+Fix only allow single selection of mods. (Thanks Arano-kai)\r\n+Fix for the Launch+Ignore button problem on linux being cut off. (Thanks Arano-kai)\r\n+Display download progress.\r\n+Fixed an error that was thrown when clicking on some mods that had a single dependency mod.\r\n+Double clicking on a mod will now enable or disable the mod. (Thanks Arano-kai)");
    btnLaunchIgnore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (selProfile != null) {
                LaunchFactorioWithSelectedMods(true); //ignore errors, launch.
            }
        }
    });
    btnLaunchIgnore.setVisible(false);
    //This is my test button. I use this to test things then implement them into the swing.
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testButtonCode(e);
        }
    });
    //Disable mods button. (from profile)
    btnDisable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeMod();
        }
    });
    //Enable mods button. (to profile)
    btnEnable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addMod();
        }
    });
    //Game path button
    btnFind.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            findPath();
        }
    });
    //mouseClick event lister for when you click on a new profile
    profileList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            selectedProfile();
        }
    });

    readData(); //Load settings

    init(); //some extra init
    getMods(); //Get the mods the user has installed
}

From source file:org.monkeys.gui.matcher.MatcherPanel.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from   www  .j a v  a 2s  . c om
 */
@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    javax.swing.JSplitPane splitPane = new javax.swing.JSplitPane();
    textPanel = new javax.swing.JPanel();
    textHeader = new org.monkeys.gui.HeaderLabel();
    javax.swing.JScrollPane textScroll = new javax.swing.JScrollPane();
    textArea = new javax.swing.JTextArea();
    editPanel = new javax.swing.JPanel();
    clearButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator2 = new javax.swing.JSeparator();
    editButton = new javax.swing.JToggleButton();
    matchingPanel = new javax.swing.JPanel();
    org.monkeys.gui.HeaderLabel matchingHeader = new org.monkeys.gui.HeaderLabel();
    matchingScroll = new javax.swing.JScrollPane();
    matchingList = new org.monkeys.gui.matcher.MatcherTable();
    org.monkeys.gui.HeaderLabel categoryLabel = new org.monkeys.gui.HeaderLabel();
    categoryDropdown = new org.monkeys.gui.CategoryDropdown();
    clipboardButton = new javax.swing.JToggleButton();
    selectButton = new javax.swing.JToggleButton();
    removeDuplicateButton = new javax.swing.JButton();
    removeRowButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator3 = new javax.swing.JSeparator();
    javax.swing.JSeparator jSeparator4 = new javax.swing.JSeparator();
    javax.swing.JSeparator jSeparator5 = new javax.swing.JSeparator();
    modifyButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator6 = new javax.swing.JSeparator();
    undoButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator7 = new javax.swing.JSeparator();
    clipboardDropdown = new javax.swing.JComboBox();

    splitPane.setBorder(null);
    splitPane.setDividerSize(8);
    splitPane.setResizeWeight(0.6);

    textHeader.setText("Text");

    textScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));
    textScroll.setMinimumSize(new java.awt.Dimension(200, 50));
    textScroll.setPreferredSize(new java.awt.Dimension(300, 150));

    textArea.setTabSize(4);
    textArea.setAutoscrolls(false);
    textScroll.setViewportView(textArea);

    clearButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/clear-20.png"))); // NOI18N
    clearButton.setText("Clear");
    clearButton.setToolTipText("Clear All Fields");
    clearButton.setBorderPainted(false);
    clearButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clearButtonActionPerformed(evt);
        }
    });

    jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

    editButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/lock-18.png"))); // NOI18N
    editButton.setSelected(true);
    editButton.setText("Edit");
    editButton.setToolTipText("Edit Text");
    editButton.setBorderPainted(false);
    editButton.setDisabledIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/lock-18.png"))); // NOI18N
    editButton.setIconTextGap(3);
    editButton.setSelectedIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/unlock-18.png"))); // NOI18N
    editButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            editButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout editPanelLayout = new javax.swing.GroupLayout(editPanel);
    editPanel.setLayout(editPanelLayout);
    editPanelLayout.setHorizontalGroup(editPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editPanelLayout.createSequentialGroup().addComponent(editButton).addGap(0, 0, 0)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0).addComponent(clearButton).addGap(0, 89, Short.MAX_VALUE)));

    editPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { clearButton, editButton });

    editPanelLayout.setVerticalGroup(editPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editPanelLayout.createSequentialGroup().addGap(0, 0, 0)
                    .addGroup(editPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator2)
                            .addComponent(editButton, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(0, 0, 0)));

    editPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clearButton, editButton });

    javax.swing.GroupLayout textPanelLayout = new javax.swing.GroupLayout(textPanel);
    textPanel.setLayout(textPanelLayout);
    textPanelLayout.setHorizontalGroup(textPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(textPanelLayout.createSequentialGroup()
                    .addComponent(editPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(textPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(textPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textScroll, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(textHeader, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));
    textPanelLayout.setVerticalGroup(textPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(textPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(textHeader, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(editPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(textScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                    .addContainerGap()));

    splitPane.setLeftComponent(textPanel);

    matchingHeader.setText("Matches");

    matchingScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));
    matchingScroll.setMinimumSize(new java.awt.Dimension(200, 120));
    matchingScroll.setPreferredSize(new java.awt.Dimension(480, 300));
    matchingScroll.setViewportView(matchingList);

    categoryLabel.setText("Category");

    clipboardButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/clipboard-16.png"))); // NOI18N
    clipboardButton.setToolTipText("Copy Selected To Clipboard");
    clipboardButton.setBorderPainted(false);
    clipboardButton.setEnabled(false);
    clipboardButton.setIconTextGap(2);
    clipboardButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clipboardButtonActionPerformed(evt);
        }
    });

    selectButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/list-16.png"))); // NOI18N
    selectButton.setToolTipText("Select / Unselect All");
    selectButton.setBorderPainted(false);
    selectButton.setEnabled(false);
    selectButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            selectButtonActionPerformed(evt);
        }
    });

    removeDuplicateButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/monkeys/gui/icons/remove-duplicates-16.png"))); // NOI18N
    removeDuplicateButton.setToolTipText("Remove Duplicates");
    removeDuplicateButton.setBorderPainted(false);
    removeDuplicateButton.setEnabled(false);
    removeDuplicateButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeDuplicateButtonActionPerformed(evt);
        }
    });

    removeRowButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/remove-16.png"))); // NOI18N
    removeRowButton.setToolTipText("Remove Selected");
    removeRowButton.setBorderPainted(false);
    removeRowButton.setEnabled(false);
    removeRowButton.setIconTextGap(2);
    removeRowButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeRowButtonActionPerformed(evt);
        }
    });

    jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

    jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL);

    jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL);

    modifyButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/edit-16.png"))); // NOI18N
    modifyButton.setToolTipText("Edit Selected");
    modifyButton.setBorderPainted(false);
    modifyButton.setEnabled(false);
    modifyButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            modifyButtonActionPerformed(evt);
        }
    });

    jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL);

    undoButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/undo-16.png"))); // NOI18N
    undoButton.setBorderPainted(false);
    undoButton.setEnabled(false);
    undoButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            undoButtonActionPerformed(evt);
        }
    });

    jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL);

    clipboardDropdown.setEditable(true);
    clipboardDropdown.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
    clipboardDropdown.setEnabled(false);

    javax.swing.GroupLayout matchingPanelLayout = new javax.swing.GroupLayout(matchingPanel);
    matchingPanel.setLayout(matchingPanelLayout);
    matchingPanelLayout.setHorizontalGroup(matchingPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(matchingPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(matchingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(matchingPanelLayout.createSequentialGroup().addComponent(selectButton)
                                    .addGap(0, 0, 0)
                                    .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(removeDuplicateButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(removeRowButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(modifyButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(undoButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0)
                                    .addComponent(clipboardDropdown, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(clipboardButton)
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(matchingScroll, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(categoryLabel, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(categoryDropdown, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(matchingHeader, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));

    matchingPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { clipboardButton, modifyButton, removeRowButton });

    matchingPanelLayout.setVerticalGroup(matchingPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(matchingPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(categoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(categoryDropdown, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(matchingHeader, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(matchingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(matchingPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(removeDuplicateButton).addComponent(jSeparator4,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(selectButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                            .addComponent(jSeparator3,
                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(removeRowButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    28, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(modifyButton)
                            .addGroup(matchingPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(clipboardButton, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(undoButton).addComponent(jSeparator6,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clipboardDropdown, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(matchingScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
                    .addContainerGap()));

    matchingPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clipboardButton, clipboardDropdown });

    splitPane.setRightComponent(matchingPanel);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 664, Short.MAX_VALUE)
                    .addGap(0, 0, 0)));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(splitPane));
}

From source file:org.tinymediamanager.ui.settings.GeneralSettingsPanel.java

/**
 * Instantiates a new general settings panel.
 *///  w ww  . j  ava  2s  . c  om
public GeneralSettingsPanel() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(200px;min):grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default):grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    JPanel panelUI = new JPanel();
    panelUI.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.ui"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelUI, "2, 2, 3, 1, fill, fill");
    panelUI.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_COLSPEC,
                    FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));
    LocaleComboBox actualLocale = null;
    // cbLanguage = new JComboBox(Utils.getLanguages().toArray());
    Locale settingsLang = Utils.getLocaleFromLanguage(Globals.settings.getLanguage());
    for (Locale l : Utils.getLanguages()) {
        LocaleComboBox localeComboBox = new LocaleComboBox(l);
        locales.add(localeComboBox);
        if (l.equals(settingsLang)) {
            actualLocale = localeComboBox;
        }
    }

    JLabel lblUiLanguage = new JLabel(BUNDLE.getString("Settings.language"));
    panelUI.add(lblUiLanguage, "2, 2");
    cbLanguage = new JComboBox(locales.toArray());
    panelUI.add(cbLanguage, "4, 2");

    if (actualLocale != null) {
        cbLanguage.setSelectedItem(actualLocale);
    }

    JSeparator separator = new JSeparator();
    separator.setOrientation(SwingConstants.VERTICAL);
    panelUI.add(separator, "8, 2, 1, 7");

    JLabel lblFontFamily = new JLabel(BUNDLE.getString("Settings.fontfamily")); //$NON-NLS-1$
    panelUI.add(lblFontFamily, "10, 2, right, default");
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    cbFontFamily = new JComboBox(env.getAvailableFontFamilyNames());
    cbFontFamily.setSelectedItem(Globals.settings.getFontFamily());
    int index = cbFontFamily.getSelectedIndex();
    if (index < 0) {
        cbFontFamily.setSelectedItem("Dialog");
        index = cbFontFamily.getSelectedIndex();
    }
    if (index < 0) {
        cbFontFamily.setSelectedIndex(0);
    }
    panelUI.add(cbFontFamily, "12, 2, fill, default");

    JLabel lblFontSize = new JLabel(BUNDLE.getString("Settings.fontsize")); //$NON-NLS-1$
    panelUI.add(lblFontSize, "10, 4, right, default");

    cbFontSize = new JComboBox(DEFAULT_FONT_SIZES);
    cbFontSize.setSelectedItem(Globals.settings.getFontSize());
    index = cbFontSize.getSelectedIndex();
    if (index < 0) {
        cbFontSize.setSelectedIndex(0);
    }

    panelUI.add(cbFontSize, "12, 4, fill, default");

    JPanel panel = new JPanel();
    panelUI.add(panel, "2, 6, 5, 1, fill, fill");
    panel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("100dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, }));

    JLabel lblMissingTranslation = new JLabel(BUNDLE.getString("tmm.helptranslate"));
    panel.add(lblMissingTranslation, "1, 1, 5, 1");

    lblLinkTransifex = new LinkLabel("https://www.transifex.com/projects/p/tinymediamanager/");
    panel.add(lblLinkTransifex, "1, 3, 5, 1");
    lblLinkTransifex.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            try {
                TmmUIHelper.browseUrl(lblLinkTransifex.getNormalText());
            } catch (Exception e) {
                LOGGER.error(e.getMessage());
                MessageManager.instance
                        .pushMessage(new Message(MessageLevel.ERROR, lblLinkTransifex.getNormalText(),
                                "message.erroropenurl", new String[] { ":", e.getLocalizedMessage() }));//$NON-NLS-2$
            }
        }
    });

    tpFontHint = new JTextPane();
    tpFontHint.setOpaque(false);
    TmmFontHelper.changeFont(tpFontHint, 0.833);
    tpFontHint.setText(BUNDLE.getString("Settings.fonts.hint")); //$NON-NLS-1$
    panelUI.add(tpFontHint, "10, 6, 5, 1");

    lblLanguageHint = new JLabel("");
    TmmFontHelper.changeFont(lblLanguageHint, Font.BOLD);
    panelUI.add(lblLanguageHint, "2, 8, 5, 1");

    lblFontChangeHint = new JLabel("");
    TmmFontHelper.changeFont(lblFontChangeHint, Font.BOLD);
    panelUI.add(lblFontChangeHint, "10, 8, 5, 1");

    JPanel panelMemory = new JPanel();
    panelMemory.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.memoryborder"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelMemory, "2, 4, fill, fill");
    panelMemory.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow(4)"),
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(20dlu;default)"),
                    ColumnSpec.decode("left:default:grow(5)"), },
            new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, }));

    JLabel lblMemoryT = new JLabel(BUNDLE.getString("Settings.memory")); //$NON-NLS-1$
    panelMemory.add(lblMemoryT, "2, 1");

    sliderMemory = new JSlider();
    sliderMemory.setPaintLabels(true);
    sliderMemory.setPaintTicks(true);
    sliderMemory.setSnapToTicks(true);
    sliderMemory.setMajorTickSpacing(512);
    sliderMemory.setMinorTickSpacing(128);
    sliderMemory.setMinimum(256);
    sliderMemory.setMaximum(1536);
    sliderMemory.setValue(512);
    panelMemory.add(sliderMemory, "4, 1, fill, default");

    lblMemory = new JLabel("512"); //$NON-NLS-1$
    panelMemory.add(lblMemory, "6, 1, right, default");

    JLabel lblMb = new JLabel("MB");
    panelMemory.add(lblMb, "7, 1, left, default");

    tpMemoryHint = new JTextPane();
    tpMemoryHint.setOpaque(false);
    tpMemoryHint.setText(BUNDLE.getString("Settings.memory.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(tpMemoryHint, 0.833);
    panelMemory.add(tpMemoryHint, "2, 3, 6, 1, fill, fill");

    JPanel panelProxySettings = new JPanel();
    panelProxySettings.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.proxy"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelProxySettings, "4, 4, fill, fill");
    panelProxySettings.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, }));

    JLabel lblProxyHost = new JLabel(BUNDLE.getString("Settings.proxyhost")); //$NON-NLS-1$
    panelProxySettings.add(lblProxyHost, "2, 2, right, default");

    tfProxyHost = new JTextField();
    lblProxyHost.setLabelFor(tfProxyHost);
    panelProxySettings.add(tfProxyHost, "4, 2, fill, default");
    tfProxyHost.setColumns(10);

    JLabel lblProxyPort = new JLabel(BUNDLE.getString("Settings.proxyport")); //$NON-NLS-1$
    panelProxySettings.add(lblProxyPort, "2, 4, right, default");

    tfProxyPort = new JTextField();
    lblProxyPort.setLabelFor(tfProxyPort);
    panelProxySettings.add(tfProxyPort, "4, 4, fill, default");
    tfProxyPort.setColumns(10);

    JLabel lblProxyUser = new JLabel(BUNDLE.getString("Settings.proxyuser")); //$NON-NLS-1$
    panelProxySettings.add(lblProxyUser, "2, 6, right, default");

    tfProxyUsername = new JTextField();
    lblProxyUser.setLabelFor(tfProxyUsername);
    panelProxySettings.add(tfProxyUsername, "4, 6, fill, default");
    tfProxyUsername.setColumns(10);

    JLabel lblProxyPassword = new JLabel(BUNDLE.getString("Settings.proxypass")); //$NON-NLS-1$
    panelProxySettings.add(lblProxyPassword, "2, 8, right, default");

    tfProxyPassword = new JPasswordField();
    lblProxyPassword.setLabelFor(tfProxyPassword);
    panelProxySettings.add(tfProxyPassword, "4, 8, fill, default");

    JPanel panelMediaPlayer = new JPanel();
    panelMediaPlayer.setBorder(
            new TitledBorder(null, "MediaPlayer", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelMediaPlayer, "2, 6, fill, fill");
    panelMediaPlayer.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    tpMediaPlayer = new JTextPane();
    tpMediaPlayer.setOpaque(false);
    TmmFontHelper.changeFont(tpMediaPlayer, 0.833);
    tpMediaPlayer.setText(BUNDLE.getString("Settings.mediaplayer.hint")); //$NON-NLS-1$
    panelMediaPlayer.add(tpMediaPlayer, "2, 2, 3, 1, fill, fill");

    tfMediaPlayer = new JTextField();
    panelMediaPlayer.add(tfMediaPlayer, "2, 4, fill, default");
    tfMediaPlayer.setColumns(10);

    btnSearchMediaPlayer = new JButton(BUNDLE.getString("Button.chooseplayer")); //$NON-NLS-1$
    btnSearchMediaPlayer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            Path file = TmmUIHelper.selectFile(BUNDLE.getString("Button.chooseplayer")); //$NON-NLS-1$
            if (file != null && Utils.isRegularFile(file) || Platform.isMac()) {
                tfMediaPlayer.setText(file.toAbsolutePath().toString());
            }
        }
    });
    panelMediaPlayer.add(btnSearchMediaPlayer, "4, 4");

    JPanel panelCache = new JPanel();
    panelCache.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.cache"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelCache, "4, 6, fill, fill");
    panelCache.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    chckbxImageCache = new JCheckBox(BUNDLE.getString("Settings.imagecache"));//$NON-NLS-1$
    panelCache.add(chckbxImageCache, "2, 2, 3, 1");

    JLabel lblImageCacheQuality = new JLabel(BUNDLE.getString("Settings.imagecachetype"));//$NON-NLS-1$
    panelCache.add(lblImageCacheQuality, "2, 4, right, default");

    cbImageCacheQuality = new JComboBox(ImageCache.CacheType.values());
    panelCache.add(cbImageCacheQuality, "4, 4, fill, default");

    JPanel panelAnalytics = new JPanel();
    panelAnalytics.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.analytics.border"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelAnalytics, "2, 8, fill, fill");
    panelAnalytics.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, }));

    chckbxAnalytics = new JCheckBox(BUNDLE.getString("Settings.analytics"));//$NON-NLS-1$
    panelAnalytics.add(chckbxAnalytics, "2, 2");

    JTextPane tpAnalyticsDescription = new JTextPane();
    tpAnalyticsDescription.setText(BUNDLE.getString("Settings.analytics.desc"));//$NON-NLS-1$
    tpAnalyticsDescription.setOpaque(false);
    panelAnalytics.add(tpAnalyticsDescription, "2, 4, fill, fill");

    JPanel panelMisc = new JPanel();
    panelMisc.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.misc"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelMisc, "4, 8, fill, fill");
    panelMisc.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, }));

    chckbxDeleteTrash = new JCheckBox(BUNDLE.getString("Settings.deletetrash"));
    panelMisc.add(chckbxDeleteTrash, "2, 2, 3, 1");

    initDataBindings();

    initMemorySlider();

    // listen to changes of the combo box
    ItemListener listener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            checkChanges();
        }
    };

    cbLanguage.addItemListener(listener);
    cbFontSize.addItemListener(listener);
    cbFontFamily.addItemListener(listener);
}

From source file:org.zaproxy.zap.extension.cmss.CMSSFrame.java

/** Create the frame. */
public CMSSFrame() {
    setTitle("Fingerprinting tools");
    setResizable(false);/*  ww  w.j a v  a2s  .c o m*/
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    setBounds(100, 100, 756, 372);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JLayeredPane layeredPane = new JLayeredPane();
    contentPane.add(layeredPane, BorderLayout.CENTER);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 725, 323);
    layeredPane.add(tabbedPane);

    JLayeredPane layeredPane_1 = new JLayeredPane();
    tabbedPane.addTab("Fingerprint", null, layeredPane_1, null);

    JLabel label = new JLabel("App name:");
    label.setBounds(35, 188, 76, 14);
    layeredPane_1.add(label);

    JLabel label_1 = new JLabel("Version:");
    label_1.setBounds(35, 230, 76, 14);
    layeredPane_1.add(label_1);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(121, 188, 109, 29);
    layeredPane_1.add(textField);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setBounds(121, 223, 109, 29);
    layeredPane_1.add(textField_1);

    JSeparator separator = new JSeparator();
    separator.setBounds(35, 72, 665, 2);
    layeredPane_1.add(separator);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(196, 11, 1, 201);
    layeredPane_1.add(separator_1);

    JSeparator separator_2 = new JSeparator();
    separator_2.setOrientation(SwingConstants.VERTICAL);
    separator_2.setBounds(260, 81, 1, 201);
    layeredPane_1.add(separator_2);

    final JCheckBox chckbxGetVersion = new JCheckBox("Get version");
    chckbxGetVersion.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (textField_1.isEnabled() && !chckbxGetVersion.isSelected())
                textField_1.setEnabled(false);
            if (!textField_1.isEnabled() && chckbxGetVersion.isSelected())
                textField_1.setEnabled(true);
        }
    });
    chckbxGetVersion.setBounds(35, 81, 195, 23);
    layeredPane_1.add(chckbxGetVersion);

    final JCheckBox chckbxPassiveFingerprinting = new JCheckBox("Passive");
    chckbxPassiveFingerprinting.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    chckbxPassiveFingerprinting.setBounds(35, 107, 195, 23);
    chckbxPassiveFingerprinting.setSelected(true); //
    layeredPane_1.add(chckbxPassiveFingerprinting);

    final JCheckBox chckbxAgressive = new JCheckBox("Agressive");
    chckbxAgressive.setBounds(35, 133, 195, 23);
    layeredPane_1.add(chckbxAgressive);

    JLabel lblWhatToFingerprint = new JLabel("What to fingerprint ?");
    lblWhatToFingerprint.setBounds(287, 81, 109, 14);
    layeredPane_1.add(lblWhatToFingerprint);

    JCheckBox chckbxCms = new JCheckBox("cms");
    chckbxCms.setBounds(280, 102, 134, 23);
    layeredPane_1.add(chckbxCms);

    JCheckBox chckbxMessageboards = new JCheckBox("message-boards");
    chckbxMessageboards.setBounds(280, 128, 134, 23);
    layeredPane_1.add(chckbxMessageboards);

    JCheckBox chckbxJavascriptframeworks = new JCheckBox("javascript-frameworks");
    chckbxJavascriptframeworks.setBounds(281, 154, 133, 23);
    layeredPane_1.add(chckbxJavascriptframeworks);

    JCheckBox chckbxWebframeworks = new JCheckBox("web-frameworks");
    chckbxWebframeworks.setBounds(281, 178, 133, 23);
    layeredPane_1.add(chckbxWebframeworks);

    JCheckBox chckbxWebservers = new JCheckBox("web-servers");
    chckbxWebservers.setBounds(281, 204, 133, 23);
    layeredPane_1.add(chckbxWebservers);

    JSeparator separator_4 = new JSeparator();
    separator_4.setOrientation(SwingConstants.VERTICAL);
    separator_4.setBounds(435, 81, 1, 201);
    layeredPane_1.add(separator_4);

    JCheckBox chckbxDatabases = new JCheckBox("databases");
    chckbxDatabases.setBounds(281, 228, 133, 23);
    layeredPane_1.add(chckbxDatabases);

    JButton btnMore = new JButton("More");
    btnMore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            wtfpFrame = new WhatToFingerPrintFrame();
            wtfpFrame.setLocationRelativeTo(null);
            wtfpFrame.setVisible(true);
        }
    });
    btnMore.setBounds(291, 261, 123, 23);
    layeredPane_1.add(btnMore);

    JLabel lblFingerprintingTimeAnd = new JLabel("Fingerprinting time and occuracy settings:");
    lblFingerprintingTimeAnd.setBounds(490, 81, 210, 14);
    layeredPane_1.add(lblFingerprintingTimeAnd);

    JButton btnFingerprint = new JButton("Fingerprint");
    btnFingerprint.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (!chckbxPassiveFingerprinting.isSelected() && !chckbxAgressive.isSelected())
                chckbxPassiveFingerprinting.setSelected(true);
            if (chckbxPassiveFingerprinting.isSelected() && !chckbxAgressive.isSelected())
                POrAOption = 1;
            else if (!chckbxPassiveFingerprinting.isSelected() && chckbxAgressive.isSelected())
                POrAOption = 2;
            else if (chckbxPassiveFingerprinting.isSelected() && chckbxAgressive.isSelected())
                POrAOption = 3;

            try {
                targetUrl = new URL(txtHttp.getText());
            } catch (MalformedURLException e2) {
                // TODO Auto-generated catch block
                e2.printStackTrace();
            }

            System.out.println("POrAOption : " + POrAOption);

            // we concatenate the two ArrayLists
            ArrayList<String> wtfpList = getWhatToFingerprint();
            for (String wtfp : wtfpFrame.getWhatToFingerprint()) {
                wtfpList.add(wtfp);
            }
            // we call FastFingerprinter.filterResults on the global whatToFingerPrint
            // List

            fpThread = new FingerPrintingThread(targetUrl, wtfpList, POrAOption);
            fpThread.start();
            while (fpThread.isAlive()) {
                // waiting;

            }
            ArrayList<String> resultList = fpThread.getFingerPrintingResult();
            for (String app : resultList) {
                textField.setText(textField.getText() + app + " , ");
            }

            if (chckbxGetVersion.isSelected()) {
                System.out.println("wiw");
                ArrayList<String> versions = new ArrayList<String>();

                if (resultList.contains("wordpress")) {
                    textField_1.setText(textField_1.getText() + "wordpress :");
                    for (String version : FastFingerprinter.WordpressFastFingerprint(targetUrl)) {
                        textField_1.setText(textField_1.getText() + version + " ; ");
                    }
                }

                if (resultList.contains("joomla")) {
                    textField_1.setText(textField_1.getText() + "joomla :");
                    for (String version : FastFingerprinter.JoomlaFastFingerprint(targetUrl)) {
                        textField_1.setText(textField_1.getText() + version + " ; ");
                    }
                }

                // blindelephant
                for (String app : resultList) {
                    System.out.println("---->" + app);
                    try {
                        versions = WebAppGuesser.fingerPrintFile(app);
                        textField_1.setText(textField_1.getText() + app + " : ");
                        for (String version : versions) {
                            textField_1.setText(textField_1.getText() + version + " ; ");
                        }
                    } catch (NoSuchAlgorithmException | IOException | DecoderException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    });

    btnFingerprint.setBounds(35, 154, 195, 23);
    layeredPane_1.add(btnFingerprint);

    JButton btnDetailedView = new JButton("Detailed view ");
    btnDetailedView.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    btnDetailedView.setBounds(35, 259, 195, 23);
    layeredPane_1.add(btnDetailedView);
    this.checkBoxesList.add(chckbxCms);
    this.checkBoxesList.add(chckbxJavascriptframeworks);
    this.checkBoxesList.add(chckbxWebframeworks);
    this.checkBoxesList.add(chckbxWebservers);
    this.checkBoxesList.add(chckbxDatabases);
    this.checkBoxesList.add(chckbxMessageboards);

    txtHttp = new JTextField();
    txtHttp.setText("http://");
    txtHttp.setBounds(128, 22, 568, 29);
    layeredPane_1.add(txtHttp);
    txtHttp.setColumns(10);

    JLabel lblTarget = new JLabel("Target : ");
    lblTarget.setBounds(51, 29, 46, 14);
    layeredPane_1.add(lblTarget);

    JLayeredPane layeredPane_2 = new JLayeredPane();
    tabbedPane.addTab("Details", null, layeredPane_2, null);

    JTabbedPane tabbedPane_1 = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane_1.setBounds(0, 0, 720, 223);
    layeredPane_2.add(tabbedPane_1);

    JLayeredPane layeredPane_4 = new JLayeredPane();
    tabbedPane_1.addTab("Detailed result", null, layeredPane_4, null);

    JLayeredPane layeredPane_3 = new JLayeredPane();
    tabbedPane_1.addTab("Passive fingerprint", null, layeredPane_3, null);

    JTabbedPane tabbedPane_2 = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane_1.addTab("Agressive fingerprint", null, tabbedPane_2, null);
}

From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java

public OpenBSTGUI() {
    instance = this;
    UIManager.put("OptionPane.errorIcon", new ImageIcon(Icons.getImage("Cancel", 48)));
    UIManager.put("OptionPane.informationIcon", new ImageIcon(Icons.getImage("About", 48)));
    UIManager.put("OptionPane.questionIcon", new ImageIcon(Icons.getImage("Rename", 48)));
    UIManager.put("OptionPane.warningIcon", new ImageIcon(Icons.getImage("Error", 48)));

    BorderLayout borderLayout = new BorderLayout();
    borderLayout.setVgap(4);//from   w w  w  .java  2s  .c o  m
    getContentPane().setLayout(borderLayout);
    setIconImage(Icons.getImage("Logo", 48));
    setTitle("OpenBST " + OpenBST.VERSION);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            boolean cancelled = false;
            int i = 0;
            for (Component c : container.getComponents()) {
                if (c instanceof StoryPanel) {
                    i++;
                } else if (c instanceof StoryEditor) {
                    container.setSelectedComponent(c);
                    if (((StoryEditor) c).askClose()) {
                        continue;
                    } else {
                        cancelled = true;
                        break;
                    }
                }
            }
            if (!cancelled) {
                if (i > 0) {
                    int j = Messagers.showConfirm(OpenBSTGUI.this,
                            "You are about to close " + i + " file(s). Are you sure you wish to exit OpenBST?",
                            Messagers.OPTIONS_YES_NO, Messagers.TYPE_WARNING, "Closing OpenBST");
                    if (j != Messagers.OPTION_YES)
                        cancelled = true;
                }
                if (!cancelled)
                    System.exit(0);
            }
        }

    });

    JMenuBar jmb = new JMenuBar();
    jmb.setBackground(OPENBST_BLUE);
    jmb.add(Box.createHorizontalGlue());
    jmb.add(createShortMenu());
    jmb.add(Box.createHorizontalGlue());
    this.setJMenuBar(jmb);

    addDarkModeCallback(b -> {
        jmb.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE);
    });

    container = new JTabbedPane();
    container.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    container.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(final MouseEvent e) {
            if (SwingUtilities.isMiddleMouseButton(e)) {
                final int i = container.indexAtLocation(e.getX(), e.getY());
                System.out.println(i);
                if (i > -1) {
                    Component c = container.getComponentAt(i);
                    if (c instanceof StoryPanel) {
                        container.setSelectedComponent(c);
                        ((StoryPanel) c).askClose();
                    } else if (c instanceof StoryEditor) {
                        container.setSelectedComponent(c);
                        ((StoryEditor) c).askClose();
                    }
                }
            }
        }
    });
    getContentPane().add(container, BorderLayout.CENTER);

    final JBackgroundPanel welcomeContentPanel = new JBackgroundPanel(Icons.getRandomBackground(),
            Image.SCALE_FAST);
    background = welcomeContentPanel;

    welcomeContentPanel.setLayout(new MigLayout("hidemode 2", "[grow,center]", "[][grow][]"));
    container.add(welcomeContentPanel);
    container.setTitleAt(0, Lang.get("welcome"));

    bannersPanel = new JPanel(new MigLayout("hidemode 2, gap 0px, fill, wrap 1, ins 0"));
    bannersPanel.setBackground(new Color(0, 0, 0, 0));
    welcomeContentPanel.add(bannersPanel, "cell 0 0,grow");

    if (OpenBST.VERSION.endsWith("u")) {
        JButton btnReportBugs = new JButton(Lang.get("welcome.reportbugs"));
        btnReportBugs.addActionListener(e -> {
            VisualsUtils.browse("https://github.com/utybo/BST/issues");
        });
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Experiment", 32)), Color.YELLOW,
                Lang.get("welcome.ontheedge"), btnReportBugs, false), "grow");
    } else if (OpenBST.VERSION.contains("SNAPSHOT")) {
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Experiment", 32)), Color.ORANGE,
                Lang.get("welcome.snapshot"), null, false), "grow");
    }

    if (System.getProperty("java.specification.version").equals("9")) {
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Attention", 32)),
                new Color(255, 50, 50), Lang.get("welcome.java9warning"), null, false), "grow");
    }
    if (System.getProperty("java.specification.version").equals("10")) {
        bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Attention", 32)),
                new Color(255, 50, 50), Lang.get("welcome.java10warning"), null, false), "grow");
    }

    JButton btnJoinDiscord = new JButton(Lang.get("openbst.discordjoin"));
    btnJoinDiscord.addActionListener(e -> {
        VisualsUtils.browse("https://discord.gg/6SVDCMM");
    });
    bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Discord", 48)), DISCORD_COLOR,
            Lang.get("openbst.discord"), btnJoinDiscord, true), "grow");

    JPanel panel = new JPanel();
    panel.setBackground(new Color(0, 0, 0, 0));
    welcomeContentPanel.add(panel, "flowx,cell 0 1,growx,aligny center");
    panel.setLayout(new MigLayout("", "[40%][][][][60%,growprio 50]", "[][grow]"));

    final JLabel lblOpenbst = new JLabel(new ImageIcon(Icons.getImage("FullLogo", 48)));
    addDarkModeCallback(b -> lblOpenbst
            .setIcon(new ImageIcon(b ? Icons.getImage("FullLogoWhite", 48) : Icons.getImage("FullLogo", 48))));
    panel.add(lblOpenbst, "flowx,cell 0 0 1 2,alignx trailing,aligny center");

    JSeparator separator = new JSeparator();
    separator.setOrientation(SwingConstants.VERTICAL);
    panel.add(separator, "cell 2 0 1 2,growy");

    final JLabel lblWelcomeToOpenbst = new JLabel("<html>" + Lang.get("welcome.intro"));
    lblWelcomeToOpenbst.setMaximumSize(new Dimension(350, 999999));
    panel.add(lblWelcomeToOpenbst, "cell 4 0");

    Component horizontalStrut = Box.createHorizontalStrut(10);
    panel.add(horizontalStrut, "cell 1 1");

    Component horizontalStrut_1 = Box.createHorizontalStrut(10);
    panel.add(horizontalStrut_1, "cell 3 1");

    final JButton btnOpenAFile = new JButton(Lang.get("welcome.open"));
    panel.add(btnOpenAFile, "flowx,cell 4 1");
    btnOpenAFile.setIcon(new ImageIcon(Icons.getImage("Open", 40)));
    btnOpenAFile.addActionListener(e -> {
        openStory(VisualsUtils.askForFile(this, Lang.get("file.title")));
    });

    final JButton btnOpenEditor = new JButton(Lang.get("welcome.openeditor"));
    panel.add(btnOpenEditor, "cell 4 1");
    btnOpenEditor.setIcon(new ImageIcon(Icons.getImage("Edit Property", 40)));
    btnOpenEditor.addActionListener(e -> {
        openEditor(VisualsUtils.askForFile(this, Lang.get("file.title")));
    });

    JButton btnChangeBackground = new JButton(Lang.get("welcome.changebackground"),
            new ImageIcon(Icons.getImage("Change Theme", 16)));
    btnChangeBackground.addActionListener(e -> {
        BufferedImage prev = background.getImage();
        BufferedImage next;
        do {
            next = Icons.getRandomBackground();
        } while (prev == next);
        background.setImage(next);
    });
    welcomeContentPanel.add(btnChangeBackground, "flowx,cell 0 2,alignx left");

    JButton btnWelcomepixabay = new JButton(Lang.get("welcome.pixabay"),
            new ImageIcon(Icons.getImage("External Link", 16)));
    btnWelcomepixabay.addActionListener(e -> {
        VisualsUtils.browse("https://pixabay.com");

    });
    welcomeContentPanel.add(btnWelcomepixabay, "cell 0 2");

    JLabel creds = new JLabel(Lang.get("welcome.credits"));
    creds.setEnabled(false);
    welcomeContentPanel.add(creds, "cell 0 2, gapbefore 10px");

    setSize((int) (830 * Icons.getScale()), (int) (480 * Icons.getScale()));
    setLocationRelativeTo(null);
}