Example usage for javax.swing JButton setToolTipText

List of usage examples for javax.swing JButton setToolTipText

Introduction

In this page you can find the example usage for javax.swing JButton setToolTipText.

Prototype

@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.")
public void setToolTipText(String text) 

Source Link

Document

Registers the text to display in a tool tip.

Usage

From source file:net.itransformers.topologyviewer.gui.GraphViewerPanel.java

private JButton createZoomOutButton(final ScalingControl scaler) {
    JButton minus = new JButton("-");
    minus.setToolTipText("Zoom Out");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }/*from  w w  w  .j av  a  2  s. co m*/
    });
    return minus;
}

From source file:net.itransformers.topologyviewer.gui.GraphViewerPanel.java

private JButton createUpdateButton() {
    JButton update = new JButton("Refresh");
    update.setToolTipText("Refresh");
    update.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Set<String> vertexes = new HashSet<String>(currentGraph.getVertices());
            applyFilter(currentFilter, currentHops, vertexes);
            //                refreshComboFilters();
            //                vv.repaint();
        }//from w ww .  j  a v a2 s.  c  o  m
    });
    return update;
}

From source file:net.itransformers.topologyviewer.gui.GraphViewerPanel.java

private JButton createReloadButton() {
    JButton reload = new JButton("Reload");
    reload.setToolTipText("Reload ");
    reload.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                graphmlLoader.loadGraphml();
            } catch (Exception e1) {
                e1.printStackTrace();// w  ww  .  ja  v  a2  s .c  o  m
            }
            Set<String> vertexes = new HashSet<String>(currentGraph.getVertices());
            applyFilter(currentFilter, currentHops, vertexes);
            //refreshComboFilters();
            vv.repaint();
        }
    });
    return reload;
}

From source file:at.tuwien.ifs.somtoolbox.apps.viewer.controls.ClusteringControl.java

public void init() {

    maxCluster = state.growingLayer.getXSize() * state.growingLayer.getYSize();

    spinnerNoCluster = new JSpinner(new SpinnerNumberModel(1, 1, maxCluster, 1));
    spinnerNoCluster.addChangeListener(new ChangeListener() {
        @Override//from  ww  w  .  j  ava  2s .  c o m
        public void stateChanged(ChangeEvent e) {
            numClusters = (Integer) ((JSpinner) e.getSource()).getValue();
            SortedMap<Integer, ClusterElementsStorage> m = mapPane.getMap().getCurrentClusteringTree()
                    .getAllClusteringElements();
            if (m.containsKey(numClusters)) {
                st = m.get(numClusters).sticky;
            } else {
                st = false;
            }
            sticky.setSelected(st);
            redrawClustering();
        }
    });

    JPanel clusterPanel = UiUtils.makeBorderedPanel(new FlowLayout(FlowLayout.LEFT, 10, 0), "Clusters");

    sticky.setToolTipText(
            "Marks this number of clusters as sticky for a certain leve; the next set of clusters will have a smaller boundary");
    sticky.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            st = sticky.isSelected();
            SortedMap<Integer, ClusterElementsStorage> m = mapPane.getMap().getCurrentClusteringTree()
                    .getAllClusteringElements();
            if (m.containsKey(numClusters)) {
                ClusterElementsStorage c = m.get(numClusters);
                c.sticky = st;
                // System.out.println("test");
                // ((ClusterElementsStorageNode)m.get(numClusters)).sticky = st;
                redrawClustering();
            }
        }
    });

    colorCluster = new JCheckBox("colour", state.colorClusters);
    colorCluster.setToolTipText("Fill the clusters in colours");
    colorCluster.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            state.colorClusters = colorCluster.isSelected();
            // TODO: Palette anzeigen (?)
            redrawClustering();
        }
    });

    UiUtils.fillPanel(clusterPanel, new JLabel("#"), spinnerNoCluster, sticky, colorCluster);
    getContentPane().add(clusterPanel, c.nextRow());

    dendogramPanel = UiUtils.makeBorderedPanel(new GridLayout(0, 1), "Dendogram");
    getContentPane().add(dendogramPanel, c.nextRow());

    JPanel numLabelPanel = UiUtils.makeBorderedPanel(new GridBagLayout(), "Labels");
    GridBagConstraintsIFS gcLabels = new GridBagConstraintsIFS();

    labelSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 99, 1));
    labelSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            numLabels = (Integer) ((JSpinner) e.getSource()).getValue();
            state.clusterWithLabels = numLabels;
            redrawClustering();
        }
    });

    this.showValues = new JCheckBox("values", state.labelsWithValues);
    this.showValues.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            state.labelsWithValues = showValues.isSelected();
            redrawClustering();
        }
    });

    int start = new Double((1 - state.clusterByValue) * 100).intValue();
    valueQe = new JSlider(0, 100, start);
    valueQe.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            int byValue = ((JSlider) e.getSource()).getValue();
            state.clusterByValue = 1 - byValue / 100;
            redrawClustering();
        }
    });

    numLabelPanel.add(new JLabel("# Labels"), gcLabels);
    numLabelPanel.add(labelSpinner, gcLabels.nextCol());
    numLabelPanel.add(showValues, gcLabels.nextCol());
    numLabelPanel.add(valueQe, gcLabels.nextRow().setGridWidth(3).setFill(GridBagConstraints.HORIZONTAL));
    getContentPane().add(numLabelPanel, c.nextRow());

    Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
    labelTable.put(0, new JLabel("by Value"));
    labelTable.put(100, new JLabel("by Qe"));
    valueQe.setToolTipText("Method how to select representative labels - by QE, or the attribute values");
    valueQe.setLabelTable(labelTable);
    valueQe.setPaintLabels(true);

    final JComboBox initialisationBox = new JComboBox(KMeans.InitType.values());
    initialisationBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Object o = mapPane.getMap().getClusteringTreeBuilder();
            if (o instanceof KMeansTreeBuilder) {
                ((KMeansTreeBuilder) o).reInit((KMeans.InitType) initialisationBox.getSelectedItem());
                // FIXME: is this call needed?
                mapPane.getMap().getCurrentClusteringTree().getAllClusteringElements();
                redrawClustering();
            }
        }
    });

    getContentPane().add(UiUtils.fillPanel(kmeansInitialisationPanel, new JLabel("k-Means initialisation"),
            initialisationBox), c.nextRow());

    JPanel borderPanel = new TitledCollapsiblePanel("Border", new GridLayout(1, 4), true);

    JSpinner borderSpinner = new JSpinner(
            new SpinnerNumberModel(ClusteringTree.INITIAL_BORDER_WIDTH_MAGNIFICATION_FACTOR, 0.1, 5, 0.1));
    borderSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            state.clusterBorderWidthMagnificationFactor = ((Double) ((JSpinner) e.getSource()).getValue())
                    .floatValue();
            redrawClustering();
        }
    });

    borderPanel.add(new JLabel("width"));
    borderPanel.add(borderSpinner);

    borderPanel.add(new JLabel("colour"));
    buttonColour = new JButton("");
    buttonColour.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            new ClusterBoderColorChooser(state.parentFrame, state.clusterBorderColour, ClusteringControl.this);
        }
    });
    buttonColour.setBackground(state.clusterBorderColour);
    borderPanel.add(buttonColour);

    getContentPane().add(borderPanel, c.nextRow());

    JPanel evaluationPanel = new TitledCollapsiblePanel("Cluster Evaluation", new GridLayout(3, 2), true);

    evaluationPanel.add(new JLabel("quality measure"));
    qualityMeasureButton = new JButton();
    qualityMeasureButton.setText("ent/pur calc");
    qualityMeasureButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("doing entropy here");
            ClusteringTree clusteringTree = state.mapPNode.getClusteringTree();
            if (clusteringTree == null) {
                // we have not clustered yet
                return;
            }
            // System.out.println(clusteringTree.getChildrenCount());

            // FIXME put this in a method and call it on numcluster.change()
            SOMLibClassInformation classInfo = state.inputDataObjects.getClassInfo();
            ArrayList<ClusterNode> clusters = clusteringTree.getNodesAtLevel(numClusters);
            System.out.println(clusters.size());
            // EntropyMeasure.computeEntropy(clusters, classInfo);
            EntropyAndPurityCalculator eapc = new EntropyAndPurityCalculator(clusters, classInfo);
            // FIXME round first
            entropyLabel.setText(String.valueOf(eapc.getEntropy()));
            purityLabel.setText(String.valueOf(eapc.getPurity()));

        }
    });
    evaluationPanel.add(qualityMeasureButton);
    GridBagConstraintsIFS gcEval = new GridBagConstraintsIFS();

    evaluationPanel.add(new JLabel("entropy"), gcEval);
    evaluationPanel.add(new JLabel("purity"), gcEval.nextCol());

    entropyLabel = new JLabel("n/a");
    purityLabel = new JLabel("n/a");

    evaluationPanel.add(entropyLabel, gcEval.nextRow());
    evaluationPanel.add(purityLabel, gcEval.nextCol());

    getContentPane().add(evaluationPanel, c.nextRow());

    JPanel panelButtons = new JPanel(new GridLayout(1, 4));

    JButton saveButton = new JButton("Save");
    saveButton.setFont(smallFont);
    saveButton.setMargin(SMALL_INSETS);
    saveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser;
            if (state.fileChooser.getSelectedFile() != null) {
                fileChooser = new JFileChooser(state.fileChooser.getSelectedFile().getPath());
            } else {
                fileChooser = new JFileChooser();
            }
            fileChooser.addChoosableFileFilter(clusteringFilter);
            fileChooser.addChoosableFileFilter(xmlFilter);

            File filePath = ExportUtils.getFilePath(ClusteringControl.this, fileChooser,
                    "Save Clustering and Labels");

            if (filePath != null) {
                if (xmlFilter.accept(filePath)) {
                    LabelXmlUtils.saveLabelsToFile(state.mapPNode, filePath);
                } else {
                    try {
                        FileOutputStream fos = new FileOutputStream(filePath);
                        GZIPOutputStream gzipOs = new GZIPOutputStream(fos);
                        PObjectOutputStream oos = new PObjectOutputStream(gzipOs);

                        oos.writeObjectTree(mapPane.getMap().getCurrentClusteringTree());
                        oos.writeObjectTree(mapPane.getMap().getManualLabels());
                        oos.writeInt(state.clusterWithLabels);
                        oos.writeBoolean(state.labelsWithValues);
                        oos.writeDouble(state.clusterByValue);
                        oos.writeObject(spinnerNoCluster.getValue());

                        oos.close();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
                // keep the selected path for future references
                state.fileChooser.setSelectedFile(filePath.getParentFile());
            }
        }
    });
    panelButtons.add(saveButton);

    JButton loadButton = new JButton("Load");
    loadButton.setFont(smallFont);
    loadButton.setMargin(SMALL_INSETS);
    loadButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = getFileChooser();
            fileChooser.setName("Open Clustering");
            fileChooser.addChoosableFileFilter(xmlFilter);
            fileChooser.addChoosableFileFilter(clusteringFilter);

            int returnVal = fileChooser.showDialog(ClusteringControl.this, "Open");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File filePath = fileChooser.getSelectedFile();
                if (xmlFilter.accept(filePath)) {
                    PNode restoredLabels = null;
                    try {
                        restoredLabels = LabelXmlUtils.restoreLabelsFromFile(fileChooser.getSelectedFile());
                        PNode manual = state.mapPNode.getManualLabels();

                        ArrayList<PNode> tmp = new ArrayList<PNode>();
                        for (ListIterator<?> iter = restoredLabels.getChildrenIterator(); iter.hasNext();) {
                            PNode element = (PNode) iter.next();
                            tmp.add(element);
                        }
                        manual.addChildren(tmp);
                        Logger.getLogger("at.tuwien.ifs.somtoolbox")
                                .info("Successfully loaded cluster labels.");
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        Logger.getLogger("at.tuwien.ifs.somtoolbox")
                                .info("Error loading cluster labels: " + e1.getMessage());
                    }

                } else {

                    try {
                        FileInputStream fis = new FileInputStream(filePath);
                        GZIPInputStream gzipIs = new GZIPInputStream(fis);
                        ObjectInputStream ois = new ObjectInputStream(gzipIs);
                        ClusteringTree tree = (ClusteringTree) ois.readObject();

                        PNode manual = (PNode) ois.readObject();
                        PNode all = mapPane.getMap().getManualLabels();
                        ArrayList<PNode> tmp = new ArrayList<PNode>();
                        for (ListIterator<?> iter = manual.getChildrenIterator(); iter.hasNext();) {
                            PNode element = (PNode) iter.next();
                            tmp.add(element);
                        }
                        all.addChildren(tmp);

                        state.clusterWithLabels = ois.readInt();
                        labelSpinner.setValue(state.clusterWithLabels);
                        state.labelsWithValues = ois.readBoolean();
                        showValues.setSelected(state.labelsWithValues);
                        state.clusterByValue = ois.readDouble();
                        valueQe.setValue(new Double((1 - state.clusterByValue) * 100).intValue());

                        mapPane.getMap().buildTree(tree);
                        spinnerNoCluster.setValue(ois.readObject());

                        ois.close();
                        Logger.getLogger("at.tuwien.ifs.somtoolbox").info("Successfully loaded clustering.");
                    } catch (Exception ex) {
                        ex.printStackTrace();
                        Logger.getLogger("at.tuwien.ifs.somtoolbox")
                                .info("Error loading clustering: " + ex.getMessage());
                    }

                }
                // keep the selected path for future references
                state.fileChooser.setSelectedFile(filePath.getParentFile());
            }
        }

    });
    panelButtons.add(loadButton);

    JButton exportImages = new JButton("Export");
    exportImages.setFont(smallFont);
    exportImages.setMargin(SMALL_INSETS);
    exportImages.setToolTipText("Export labels as images (not yet working)");
    exportImages.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            if (CommonSOMViewerStateData.fileNamePrefix != null
                    && !CommonSOMViewerStateData.fileNamePrefix.equals("")) {
                fileChooser.setCurrentDirectory(new File(CommonSOMViewerStateData.fileNamePrefix));
            } else {
                fileChooser.setCurrentDirectory(state.getFileChooser().getCurrentDirectory());
            }
            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            if (fileChooser.getSelectedFile() != null) { // reusing the dialog
                fileChooser.setSelectedFile(null);
            }
            fileChooser.setName("Choose path");
            int returnVal = fileChooser.showDialog(ClusteringControl.this, "Choose path");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                // save images
                String path = fileChooser.getSelectedFile().getAbsolutePath();
                Logger.getLogger("at.tuwien.ifs.somtoolbox").info("Writing label images to " + path);
            }
        }
    });
    panelButtons.add(exportImages);

    JButton deleteManual = new JButton("Delete");
    deleteManual.setFont(smallFont);
    deleteManual.setMargin(SMALL_INSETS);
    deleteManual.setToolTipText("Delete manually added labels.");
    deleteManual.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            state.mapPNode.getManualLabels().removeAllChildren();
            Logger.getLogger("at.tuwien.ifs.somtoolbox").info("Manual Labels deleted.");
        }
    });
    panelButtons.add(deleteManual);
    c.anchor = GridBagConstraints.NORTH;
    this.getContentPane().add(panelButtons, c.nextRow());

    this.setVisible(true);
}

From source file:com.net2plan.gui.tools.GUINetworkDesign.java

private JPanel configureLeftBottomPanel() {
    this.focusPanel = new FocusPane(this);
    final JPanel focusPanelContainer = new JPanel(new BorderLayout());
    final JToolBar navigationToolbar = new JToolBar(JToolBar.VERTICAL);
    navigationToolbar.setRollover(true);
    navigationToolbar.setFloatable(false);
    navigationToolbar.setOpaque(false);/*from   ww w .  j  a v a2 s. c  o  m*/

    final JButton btn_pickNavigationUndo, btn_pickNavigationRedo;

    btn_pickNavigationUndo = new JButton("");
    btn_pickNavigationUndo
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/undoPick.png")));
    btn_pickNavigationUndo.setToolTipText("Navigate back to the previous element picked");
    btn_pickNavigationRedo = new JButton("");
    btn_pickNavigationRedo
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/redoPick.png")));
    btn_pickNavigationRedo.setToolTipText("Navigate forward to the next element picked");

    final ActionListener action = e -> {
        Pair<NetworkElement, Pair<Demand, Link>> backOrForward;
        do {
            backOrForward = (e.getSource() == btn_pickNavigationUndo)
                    ? GUINetworkDesign.this.getVisualizationState().getPickNavigationBackElement()
                    : GUINetworkDesign.this.getVisualizationState().getPickNavigationForwardElement();
            if (backOrForward == null)
                break;
            final NetworkElement ne = backOrForward.getFirst(); // For network elements
            final Pair<Demand, Link> fr = backOrForward.getSecond(); // For forwarding rules
            if (ne != null) {
                if (ne.getNetPlan() != GUINetworkDesign.this.getDesign())
                    continue;
                if (ne.getNetPlan() == null)
                    continue;
                break;
            } else if (fr != null) {
                if (fr.getFirst().getNetPlan() != GUINetworkDesign.this.getDesign())
                    continue;
                if (fr.getFirst().getNetPlan() == null)
                    continue;
                if (fr.getSecond().getNetPlan() != GUINetworkDesign.this.getDesign())
                    continue;
                if (fr.getSecond().getNetPlan() == null)
                    continue;
                break;
            } else
                break; // null,null => reset picked state
        } while (true);
        if (backOrForward != null) {
            if (backOrForward.getFirst() != null)
                GUINetworkDesign.this.getVisualizationState().pickElement(backOrForward.getFirst());
            else if (backOrForward.getSecond() != null)
                GUINetworkDesign.this.getVisualizationState().pickForwardingRule(backOrForward.getSecond());
            else
                GUINetworkDesign.this.getVisualizationState().resetPickedState();

            GUINetworkDesign.this.updateVisualizationAfterPick();
        }
    };

    btn_pickNavigationUndo.addActionListener(action);
    btn_pickNavigationRedo.addActionListener(action);

    btn_pickNavigationRedo.setFocusable(false);
    btn_pickNavigationUndo.setFocusable(false);

    navigationToolbar.add(btn_pickNavigationUndo);
    navigationToolbar.add(btn_pickNavigationRedo);

    final JScrollPane scPane = new JScrollPane(focusPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scPane.getVerticalScrollBar().setUnitIncrement(20);
    scPane.getHorizontalScrollBar().setUnitIncrement(20);
    scPane.setBorder(BorderFactory.createEmptyBorder());

    // Control the scroll
    scPane.getHorizontalScrollBar().addAdjustmentListener(e -> {
        // Repaints the panel each time the horizontal scroll bar is moves, in order to avoid ghosting.
        focusPanelContainer.revalidate();
        focusPanelContainer.repaint();
    });

    focusPanelContainer.add(navigationToolbar, BorderLayout.WEST);
    focusPanelContainer.add(scPane, BorderLayout.CENTER);

    JPanel pane = new JPanel(new MigLayout("fill, insets 0 0 0 0"));
    pane.setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Focus panel"));

    pane.add(focusPanelContainer, "grow");
    return pane;
}

From source file:com.hammurapi.jcapture.CaptureFrame.java

public CaptureFrame(final AbstractCaptureApplet applet) throws Exception {
    super("Screen capture");
    setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("camera.png")));

    setUndecorated(true);/* w ww .  j  a va 2 s  .c om*/

    Translucener.makeFrameTranslucent(this);

    setAlwaysOnTop(true);
    this.applet = applet;
    captureConfig = new CaptureConfig();
    captureConfig.load(applet.loadConfig());
    captureConfig.setBackgroundProcessor(applet.getBackgroundProcessor());

    //--- GUI construction ---

    capturePanel = new JPanel();

    final JLabel dimensionsLabel = new JLabel("");
    capturePanel.add(dimensionsLabel, BorderLayout.CENTER);

    capturePanel.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            super.componentResized(e);
            dimensionsLabel.setText(e.getComponent().getWidth() + " x " + e.getComponent().getHeight());
        }
    });

    JButton captureButton = new JButton(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Rectangle bounds = capturePanel.getBounds();
            Point loc = bounds.getLocation();
            SwingUtilities.convertPointToScreen(loc, capturePanel);
            bounds.setLocation(loc);
            Properties props = captureConfig.setRecordingRectangle(bounds);
            if (props != null) {
                getApplet().storeConfig(props);
            }
            capturing.set(true);
            setVisible(false);
        }

    });
    captureButton.setText("Capture");
    captureButton.setToolTipText("Create a snapshot of the screen");
    capturePanel.add(captureButton, BorderLayout.CENTER);

    recordButton = new JButton(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Rectangle bounds = capturePanel.getBounds();
            Point loc = bounds.getLocation();
            SwingUtilities.convertPointToScreen(loc, capturePanel);
            bounds.setLocation(loc);
            Properties props = captureConfig.setRecordingRectangle(bounds);
            if (props != null) {
                getApplet().storeConfig(props);
            }
            recording.set(true);
            setVisible(false);
        }

    });
    recordButton.setText("Record");
    setRecordButtonState();
    capturePanel.add(recordButton, BorderLayout.CENTER);

    JButton optionsButton = new JButton(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            new CaptureOptionsDialog(CaptureFrame.this).setVisible(true);
        }

    });
    optionsButton.setText("Options");
    capturePanel.add(optionsButton, BorderLayout.CENTER);

    JButton cancelButton = new JButton(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            CaptureFrame.this.setVisible(false);
        }

    });
    cancelButton.setText("Cancel");
    capturePanel.add(cancelButton, BorderLayout.CENTER);

    getContentPane().add(capturePanel, BorderLayout.CENTER);

    capturePanel.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));

    if (captureConfig.getRecordingRectangle() == null) {
        setSize(400, 300);
        setLocationRelativeTo(null);
    } else {
        setBounds(captureConfig.getRecordingRectangle());
    }

    Insets dragInsets = new Insets(5, 5, 5, 5);
    new ComponentResizer(dragInsets, this);

    ComponentMover cm = new ComponentMover();
    cm.registerComponent(this);
    cm.setDragInsets(dragInsets);

    addComponentListener(new ComponentListener() {

        @Override
        public void componentShown(ComponentEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void componentResized(ComponentEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void componentMoved(ComponentEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void componentHidden(ComponentEvent e) {
            if (capturing.get()) {
                capturing.set(false);
                try {
                    capture();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            } else if (recording.get()) {
                recording.set(false);
                record();
            }
        }
    });

}

From source file:com.entertailion.java.fling.FlingFrame.java

public FlingFrame(String appId) {
    super();// ww w .j a v  a2s. c o  m
    this.appId = appId;
    rampClient = new RampClient(this);

    addWindowListener(this);

    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

    Locale locale = Locale.getDefault();
    resourceBundle = ResourceBundle.getBundle("com/entertailion/java/fling/resources/resources", locale);
    setTitle(MessageFormat.format(resourceBundle.getString("fling.title"), Fling.VERSION));

    JPanel listPane = new JPanel();
    // show list of ChromeCast devices detected on the local network
    listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
    JPanel devicePane = new JPanel();
    devicePane.setLayout(new BoxLayout(devicePane, BoxLayout.LINE_AXIS));
    deviceList = new JComboBox();
    deviceList.addActionListener(this);
    devicePane.add(deviceList);
    URL url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/refresh.png");
    ImageIcon icon = new ImageIcon(url, resourceBundle.getString("button.refresh"));
    refreshButton = new JButton(icon);
    refreshButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            // refresh the list of devices
            if (deviceList.getItemCount() > 0) {
                deviceList.setSelectedIndex(0);
            }
            discoverDevices();
        }
    });
    refreshButton.setToolTipText(resourceBundle.getString("button.refresh"));
    devicePane.add(refreshButton);
    url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/settings.png");
    icon = new ImageIcon(url, resourceBundle.getString("settings.title"));
    settingsButton = new JButton(icon);
    settingsButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JTextField transcodingExtensions = new JTextField(50);
            transcodingExtensions.setText(transcodingExtensionValues);
            JTextField transcodingParameters = new JTextField(50);
            transcodingParameters.setText(transcodingParameterValues);

            JPanel myPanel = new JPanel(new BorderLayout());
            JPanel labelPanel = new JPanel(new GridLayout(3, 1));
            JPanel fieldPanel = new JPanel(new GridLayout(3, 1));
            myPanel.add(labelPanel, BorderLayout.WEST);
            myPanel.add(fieldPanel, BorderLayout.CENTER);
            labelPanel.add(new JLabel(resourceBundle.getString("transcoding.extensions"), JLabel.RIGHT));
            fieldPanel.add(transcodingExtensions);
            labelPanel.add(new JLabel(resourceBundle.getString("transcoding.parameters"), JLabel.RIGHT));
            fieldPanel.add(transcodingParameters);
            labelPanel.add(new JLabel(resourceBundle.getString("device.manual"), JLabel.RIGHT));
            JPanel devicePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
            final JComboBox manualDeviceList = new JComboBox();
            if (manualServers.size() == 0) {
                manualDeviceList.setVisible(false);
            } else {
                for (DialServer dialServer : manualServers) {
                    manualDeviceList.addItem(dialServer);
                }
            }
            devicePanel.add(manualDeviceList);
            JButton addButton = new JButton(resourceBundle.getString("device.manual.add"));
            addButton.setToolTipText(resourceBundle.getString("device.manual.add.tooltip"));
            addButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    JTextField name = new JTextField();
                    JTextField ipAddress = new JTextField();
                    Object[] message = { resourceBundle.getString("device.manual.name") + ":", name,
                            resourceBundle.getString("device.manual.ipaddress") + ":", ipAddress };

                    int option = JOptionPane.showConfirmDialog(null, message,
                            resourceBundle.getString("device.manual"), JOptionPane.OK_CANCEL_OPTION);
                    if (option == JOptionPane.OK_OPTION) {
                        try {
                            manualServers.add(
                                    new DialServer(name.getText(), InetAddress.getByName(ipAddress.getText())));

                            Object selected = deviceList.getSelectedItem();
                            int selectedIndex = deviceList.getSelectedIndex();
                            deviceList.removeAllItems();
                            deviceList.addItem(resourceBundle.getString("devices.select"));
                            for (DialServer dialServer : servers) {
                                deviceList.addItem(dialServer);
                            }
                            for (DialServer dialServer : manualServers) {
                                deviceList.addItem(dialServer);
                            }
                            deviceList.invalidate();
                            if (selectedIndex > 0) {
                                deviceList.setSelectedItem(selected);
                            } else {
                                if (deviceList.getItemCount() == 2) {
                                    // Automatically select single device
                                    deviceList.setSelectedIndex(1);
                                }
                            }

                            manualDeviceList.removeAllItems();
                            for (DialServer dialServer : manualServers) {
                                manualDeviceList.addItem(dialServer);
                            }
                            manualDeviceList.setVisible(true);
                            storeProperties();
                        } catch (UnknownHostException e1) {
                            Log.e(LOG_TAG, "manual IP address", e1);

                            JOptionPane.showMessageDialog(FlingFrame.this,
                                    resourceBundle.getString("device.manual.invalidip"));
                        }
                    }
                }
            });
            devicePanel.add(addButton);
            JButton removeButton = new JButton(resourceBundle.getString("device.manual.remove"));
            removeButton.setToolTipText(resourceBundle.getString("device.manual.remove.tooltip"));
            removeButton.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    Object selected = manualDeviceList.getSelectedItem();
                    manualDeviceList.removeItem(selected);
                    if (manualDeviceList.getItemCount() == 0) {
                        manualDeviceList.setVisible(false);
                    }
                    deviceList.removeItem(selected);
                    deviceList.invalidate();
                    manualServers.remove(selected);
                    storeProperties();
                }
            });
            devicePanel.add(removeButton);
            fieldPanel.add(devicePanel);
            int result = JOptionPane.showConfirmDialog(FlingFrame.this, myPanel,
                    resourceBundle.getString("settings.title"), JOptionPane.OK_CANCEL_OPTION);
            if (result == JOptionPane.OK_OPTION) {
                transcodingParameterValues = transcodingParameters.getText();
                transcodingExtensionValues = transcodingExtensions.getText();
                storeProperties();
            }
        }
    });
    settingsButton.setToolTipText(resourceBundle.getString("settings.title"));
    devicePane.add(settingsButton);
    listPane.add(devicePane);

    // TODO
    volume = new JSlider(JSlider.VERTICAL, 0, 100, 0);
    volume.setUI(new MySliderUI(volume));
    volume.setMajorTickSpacing(25);
    // volume.setMinorTickSpacing(5);
    volume.setPaintTicks(true);
    volume.setEnabled(true);
    volume.setValue(100);
    volume.setToolTipText(resourceBundle.getString("volume.title"));
    volume.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int position = (int) source.getValue();
                rampClient.volume(position / 100.0f);
            }
        }

    });
    JPanel centerPanel = new JPanel(new BorderLayout());
    // centerPanel.add(volume, BorderLayout.WEST);

    centerPanel.add(DragHereIcon.makeUI(this), BorderLayout.CENTER);
    listPane.add(centerPanel);

    scrubber = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
    scrubber.addChangeListener(this);
    scrubber.setMajorTickSpacing(25);
    scrubber.setMinorTickSpacing(5);
    scrubber.setPaintTicks(true);
    scrubber.setEnabled(false);
    listPane.add(scrubber);

    // panel of playback buttons
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    label = new JLabel("00:00:00");
    buttonPane.add(label);
    url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/play.png");
    icon = new ImageIcon(url, resourceBundle.getString("button.play"));
    playButton = new JButton(icon);
    playButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            rampClient.play();
        }
    });
    buttonPane.add(playButton);
    url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/pause.png");
    icon = new ImageIcon(url, resourceBundle.getString("button.pause"));
    pauseButton = new JButton(icon);
    pauseButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            rampClient.pause();
        }
    });
    buttonPane.add(pauseButton);
    url = ClassLoader.getSystemResource("com/entertailion/java/fling/resources/stop.png");
    icon = new ImageIcon(url, resourceBundle.getString("button.stop"));
    stopButton = new JButton(icon);
    stopButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            rampClient.stop();
            setDuration(0);
            scrubber.setValue(0);
            scrubber.setEnabled(false);
        }
    });
    buttonPane.add(stopButton);
    listPane.add(buttonPane);
    getContentPane().add(listPane);

    createProgressDialog();
    startWebserver();
    discoverDevices();
}

From source file:edu.ucla.stat.SOCR.chart.demo.PowerTransformHistogramChart.java

protected void createActionComponents(JToolBar toolBar) {
    super.createActionComponents(toolBar);
    JButton button;

    /**************** wiki Tab ****************/
    Action linkAction = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

            try {
                parentApplet.getAppletContext().showDocument(new java.net.URL(
                        "http://wiki.stat.ucla.edu/socr/index.php/SOCR_EduMaterials_Activities_PowerTransformFamily_Graphs"),
                        "SOCR: Power Transform Graphing Activity");
            } catch (MalformedURLException Exc) {
                JOptionPane.showMessageDialog(null, Exc, "MalformedURL Error", JOptionPane.ERROR_MESSAGE);
                Exc.printStackTrace();/*w w w  . j  a va  2 s.c  o  m*/
            }

        }
    };

    button = toolBar.add(linkAction);
    button.setText(" WIKI_Activity ");
    button.setToolTipText("Press this Button to go to SOCR_POWER_Activity wiki page");
}

From source file:com.isencia.passerelle.hmi.HMIBase.java

/**
 * DBA : add tooltip for each button/*  www  .jav a  2  s  . c  o m*/
 * 
 * @return
 */
private JButton createToolbarButton(final Action action, final JToolBar toolbar, final String tooltip) {
    final JButton b = new JButton(action);
    b.setBorderPainted(false);
    b.setToolTipText(tooltip);
    b.setText(null);
    toolbar.add(b);
    return b;
}

From source file:com.fratello.longevity.smooth.AppGUI.java

private void initialize() {
    LabelMaxSize = 0;//w  w w .j a v a  2 s  . c  om

    ActiveGUI = true;
    GUI_Start = false;
    GUI_Pause = true;
    GUI_Stop = false;
    ran_at_least_once = false;

    execute();

    initializeFields();

    frmFileSystemSearch = new JFrame();
    frmFileSystemSearch.setTitle("Smooth Longevity Fratello");
    frmFileSystemSearch.setBounds(100, 100, 450, 300);
    frmFileSystemSearch.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmFileSystemSearch.setResizable(false);

    UIManager.put("PopupMenu.border", BorderFactory.createLineBorder(Color.black, 1));

    JMenuBar menuBar = new JMenuBar();
    frmFileSystemSearch.setJMenuBar(menuBar);

    JMenu mnNewMenu = new JMenu("File");
    menuBar.add(mnNewMenu);

    JMenuItem mntmFirst = new JMenuItem("Open Directory");
    mntmFirst.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openFileChooserDir(mntmFirst);
        }
    });
    mnNewMenu.add(mntmFirst);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            frmFileSystemSearch.dispose();
        }
    });
    mnNewMenu.add(mntmExit);

    JMenu mnHelp = new JMenu("Help");
    menuBar.add(mnHelp);

    JMenuItem mntmAbout = new JMenuItem("About");
    mnHelp.add(mntmAbout);

    JMenuItem mntmTutorials = new JMenuItem("Tutorials");
    mnHelp.add(mntmTutorials);

    JMenuItem mntmCheckForUpdates = new JMenuItem("Check for Updates");
    mnHelp.add(mntmCheckForUpdates);

    String ppallink = "https://www.paypal.com/cgi-bin/webscr" + "?cmd=" + "_donations" + "&business="
            + "8YUJNSN6KFV54" + "&lc=" + "US" + "&item_name="
            + "Personal%20funds%20for%20programming%20at%20university" + "&currency_code=" + "USD" + "&bn="
            + "PP%2dDonationsBF" + "%3abtn_donateCC_LG%2egif%3aNonHosted";

    JButton btnDonate = new JButton("Donate");
    btnDonate.setToolTipText("<html>Open default Internet browser <br>(Chrome, FireFox, etc.)</html>");
    btnDonate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    btnDonate.setBounds(159, 176, 90, 25);
    menuBar.add(btnDonate);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    frmFileSystemSearch.getContentPane().add(tabbedPane, BorderLayout.CENTER);

    // ---------------------------- JPanels ------------------------------
    JPanel panel = new JPanel();
    tabbedPane.addTab("Start Directory", null, panel, null);

    JPanel panel_1 = new JPanel();
    tabbedPane.addTab("Search Setup", null, panel_1, null);
    panel_1.setLayout(null);

    JPanel panel_2 = new JPanel();
    tabbedPane.addTab("Run Program", null, panel_2, null);
    panel_2.setLayout(null);

    JPanel panel_3 = new JPanel();
    tabbedPane.addTab("Information", null, panel_3, null);
    panel_3.setBounds(10, 11, 409, 154);
    GridBagLayout gbl_panel_3 = new GridBagLayout();
    gbl_panel_3.columnWidths = new int[] { 0, 0, 0 };
    gbl_panel_3.rowHeights = new int[] { 0, 0, 0 };
    gbl_panel_3.columnWeights = new double[] { 1.0, 1.0, 1.0 };
    gbl_panel_3.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    panel_3.setLayout(gbl_panel_3);

    // ------------- Dynamic Update - Swingworker Components -------------
    SentinelProgressBar = new JProgressBar();
    SentinelProgressBar.setMaximumSize(new Dimension(146, 14));
    SentinelProgressBar.setMaximum(1000);
    SentinelProgressBar.setBounds(74, 187, 146, 14);
    panel_2.add(SentinelProgressBar);

    SentinelProgressLabel = new JLabel();
    SentinelProgressLabel.setToolTipText("Time needed to finish the program in progress");
    SentinelProgressLabel.setBounds(333, 181, 86, 20);
    panel_2.add(SentinelProgressLabel);

    // -------------------------------------------------------------------
    // ------------------------ JPanel Components ------------------------
    JLabel lblCurrentDirectory = new JLabel("Current Directory");
    panel.add(lblCurrentDirectory);

    userSelectedDirectories = new JTextField();
    panel.add(userSelectedDirectories);
    userSelectedDirectories.setColumns(35);

    JButton btnBrowse = new JButton("Browse");
    btnBrowse.setToolTipText("Locate directory in system");
    btnBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openFileChooserDir(btnBrowse);
        }
    });
    panel.add(btnBrowse);

    JButton btnClear = new JButton("Clear");
    btnClear.setToolTipText("Deletes the current directory shown");
    btnClear.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            userSelectedDirectories.setText("");
            clearSourceDirectory();
        }
    });
    panel.add(btnClear);

    // -------------------------------------------------------------------
    // ----------------------- JPanel_1 Components -----------------------

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Extension :: [Check Box]
    chckbxExt = new JCheckBox("Extension");
    chckbxExt.setToolTipText("Check to ignore file extensions");
    chckbxExt.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Ext", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Ext", false);
        }
    });
    chckbxExt.setBounds(8, 15, 97, 23);
    panel_1.add(chckbxExt);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Hash :: [Check Box]
    chckbxHash = new JCheckBox("Hash");
    chckbxHash.setToolTipText("Check to compare by hashing files (FAST)");
    chckbxHash.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Hash", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Hash", false);
        }
    });
    chckbxHash.setBounds(8, 45, 97, 23);
    panel_1.add(chckbxHash);

    // Hash :: [Combo Box]
    comboBoxHash = new JComboBox<String>();
    comboBoxHash.setToolTipText(
            "<html>Hash algorithm to use in file hashing <br>(note - SHA-512 may not be <br>supported by your computer)</html>");
    comboBoxHash.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            String UIselect = (String) cb.getSelectedItem();
            cf.setHashString(UIselect);
        }
    });
    comboBoxHash
            .setModel(new DefaultComboBoxModel<String>(new String[] { "MD5", "SHA-1", "SHA-256", "SHA-512" }));
    comboBoxHash.setBounds(150, 44, 75, 25);
    panel_1.add(comboBoxHash);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Name :: [Check Box]
    chckbxName = new JCheckBox("Name");
    chckbxName.setToolTipText("Name tool-tip goes here");
    chckbxName.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Name", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Name", false);
        }
    });
    chckbxName.setBounds(8, 75, 97, 23);
    panel_1.add(chckbxName);

    // Name :: [Text Field]
    namePercentMatchTextField = new JFormattedTextField(new Double(0.0d));
    namePercentMatchTextField.setFormatterFactory(new DoubleDocListener(namePercentMatchTextField));
    namePercentMatchTextField.getDocument()
            .addDocumentListener(new DoubleDocListener(namePercentMatchTextField));
    namePercentMatchTextField.setToolTipText("Match file names by percentage [00.00-100.00]");
    namePercentMatchTextField.setBounds(150, 74, 110, 25);
    panel_1.add(namePercentMatchTextField);
    namePercentMatchTextField.setColumns(10);

    // Name :: [Combo Box]
    comboBoxNames = new JComboBox<String>();
    comboBoxNames.setToolTipText("Algorithm to compare names");
    comboBoxNames.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            String UIselect = (String) cb.getSelectedItem();
            cf.setMatchingAlgorithm(UIselect);
        }
    });
    comboBoxNames.setModel(new DefaultComboBoxModel<String>(new String[] { "Bitap", "Cosine",
            "DamerauLevenshtein", "DynamicTimeWarpingStandard1", "DynamicTimeWarpingStandard2", "Hamming",
            "Hirschberg", "JaccardIndex", "JaroWinkler", "Levenshtein", "NeedlemanWunsch", "SmithWaterman",
            "SorensenSimilarityIndex", "WagnerFischer" }));
    comboBoxNames.setBounds(265, 74, 150, 25);
    panel_1.add(comboBoxNames);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Size :: [Check Box]
    chckbxSize = new JCheckBox("Size");
    chckbxSize.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Size", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Size", false);
        }
    });
    chckbxSize.setBounds(8, 105, 97, 23);
    panel_1.add(chckbxSize);

    // Size :: [Text Field]
    sizePercentMatchTextField = new JFormattedTextField(new Double(0.0d));
    sizePercentMatchTextField.setFormatterFactory(new DoubleDocListener(sizePercentMatchTextField));
    sizePercentMatchTextField.getDocument()
            .addDocumentListener(new DoubleDocListener(sizePercentMatchTextField));
    sizePercentMatchTextField.setToolTipText("Match file sizes by percentage [00.00-100.00]");
    sizePercentMatchTextField.setBounds(150, 104, 110, 25);
    panel_1.add(sizePercentMatchTextField);
    sizePercentMatchTextField.setColumns(10);

    // Size :: [Combo Box]
    comboBoxSize = new JComboBox<String>();
    comboBoxSize.setToolTipText("Specify byte grouping");
    comboBoxSize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> cb = (JComboBox<String>) e.getSource();
            String UIselect = (String) cb.getSelectedItem();
            cf.setMetricSize(UIselect);
        }
    });
    comboBoxSize.setModel(
            new DefaultComboBoxModel<String>(new String[] { "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE" }));
    comboBoxSize.setBounds(265, 104, 150, 25);
    panel_1.add(comboBoxSize);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // Thorough :: [Check Box]
    chckbxThorough = new JCheckBox("Thorough");
    chckbxThorough.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setUse("Thorough", true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setUse("Thorough", false);
        }
    });
    chckbxThorough.setToolTipText("Check byte by byte");
    chckbxThorough.setBounds(8, 135, 97, 23);
    panel_1.add(chckbxThorough);

    // Thorough :: [Text Field]
    thoroughPercentMatchTextField = new JFormattedTextField(new Double(0.0d));
    thoroughPercentMatchTextField.setFormatterFactory(new DoubleDocListener(thoroughPercentMatchTextField));
    thoroughPercentMatchTextField.getDocument()
            .addDocumentListener(new DoubleDocListener(thoroughPercentMatchTextField));
    thoroughPercentMatchTextField.setToolTipText("Match file sizes by percentage [00.00-100.00]");
    thoroughPercentMatchTextField.setBounds(150, 134, 110, 25);
    panel_1.add(thoroughPercentMatchTextField);
    thoroughPercentMatchTextField.setColumns(10);

    // Thorough :: [Check Box]
    chckbxExitFast = new JCheckBox("Exit Fast");
    chckbxExitFast.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED)
                cf.setThoroughExitFirstByteMisMatch(true);
            else if (e.getStateChange() == ItemEvent.DESELECTED)
                cf.setThoroughExitFirstByteMisMatch(false);
        }
    });
    chckbxExitFast.setToolTipText("<html>When the first byte comparison <br>is a mis-match then stop</html>");
    chckbxExitFast.setBounds(265, 138, 105, 16);
    panel_1.add(chckbxExitFast);

    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    JButton btnSaveSearchSettings = new JButton("Save Search Settings");
    btnSaveSearchSettings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            pollSearchSettings();
            cf.saveObject();
            // System.out.println(cf.toString()); // debug
        }
    });
    btnSaveSearchSettings.setBounds(292, 181, 140, 25);
    panel_1.add(btnSaveSearchSettings);

    JButton btnLoadSettings = new JButton("Load Settings");
    btnLoadSettings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (!cf.loadObject())
                cf.setDefaultSettings();
            cacheUpdateGUISettings();
        }
    });
    btnLoadSettings.setBounds(148, 181, 140, 25);
    panel_1.add(btnLoadSettings);

    JButton btnDefaultSettings = new JButton("Use Default Settings");
    btnDefaultSettings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            cf.setDefaultSettings();
            cacheUpdateGUISettings();
        }
    });
    btnDefaultSettings.setBounds(4, 181, 140, 25);
    panel_1.add(btnDefaultSettings);

    // -------------------------------------------------------------------
    // ----------------------- JPanel_2 Components -----------------------
    JLabel labelStatus = new JLabel("Progress");
    labelStatus.setBounds(10, 187, 54, 14);
    panel_2.add(labelStatus);

    JButton btnStart = new JButton("Start");
    btnStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            pollSearchSettings();
            if (!ran_at_least_once)
                ran_at_least_once = true;
            else {
                SentinelProgressBar.setValue(0);
                SentinelProgressLabel.setText("Waiting...");
            }
            try {
                if (multiSelection == null) {
                    JOptionPane.showMessageDialog(btnStart, "Please enter at least one directory.",
                            "Press OK to continue", JOptionPane.PLAIN_MESSAGE);
                    return;
                }
                setSourceDirectory(multiSelection);
                GUI_Start = true;
            } catch (Exception err) {
                err.printStackTrace();
            }
        }
    });
    btnStart.setBounds(40, 153, 89, 23);
    panel_2.add(btnStart);

    JButton btnStop = new JButton("Stop");
    btnStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            GUI_Stop = true;
        }
    });
    btnStop.setBounds(169, 153, 89, 23);
    panel_2.add(btnStop);

    JButton btnNewButton = new JButton("Pause");
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            GUI_Pause = true;
        }
    });
    btnNewButton.setBounds(298, 153, 89, 23);
    panel_2.add(btnNewButton);

    JCheckBox chckbxDeleteDuplicateFiles = new JCheckBox("Delete duplicate files");
    chckbxDeleteDuplicateFiles.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            deleteCopyResults = true;
        }
    });
    chckbxDeleteDuplicateFiles.setBounds(230, 10, 150, 16);
    panel_2.add(chckbxDeleteDuplicateFiles);

    JCheckBox chckbxLogDuplicateFiles = new JCheckBox("Save duplicates to file");
    chckbxLogDuplicateFiles.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            saveCopyResults = true;
        }
    });
    chckbxLogDuplicateFiles.setBounds(230, 36, 150, 16);
    panel_2.add(chckbxLogDuplicateFiles);

    // -------------------------------------------------------------------
    // ----------------------- JPanel_3 Components -----------------------

    JLabel lblAbout = new JLabel("About");
    GridBagConstraints gbc_lblAbout = new GridBagConstraints();
    gbc_lblAbout.insets = new Insets(0, 0, 5, 5);
    gbc_lblAbout.gridx = 0;
    gbc_lblAbout.gridy = 0;
    panel_3.add(lblAbout, gbc_lblAbout);

    JLabel lblTutorials = new JLabel("Tutorials");
    GridBagConstraints gbc_lblTutorials = new GridBagConstraints();
    gbc_lblTutorials.insets = new Insets(0, 0, 5, 5);
    gbc_lblTutorials.gridx = 1;
    gbc_lblTutorials.gridy = 0;
    panel_3.add(lblTutorials, gbc_lblTutorials);

    JLabel lblUpdates = new JLabel("Updates");
    GridBagConstraints gbc_lblUpdates = new GridBagConstraints();
    gbc_lblUpdates.insets = new Insets(0, 0, 5, 0);
    gbc_lblUpdates.gridx = 2;
    gbc_lblUpdates.gridy = 0;
    panel_3.add(lblUpdates, gbc_lblUpdates);

    JButton btnInformation = new JButton("Information");
    btnInformation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    GridBagConstraints gbc_btnInformation = new GridBagConstraints();
    gbc_btnInformation.insets = new Insets(0, 0, 0, 5);
    gbc_btnInformation.gridx = 0;
    gbc_btnInformation.gridy = 1;
    panel_3.add(btnInformation, gbc_btnInformation);

    JButton btnExamples = new JButton("Examples");
    btnExamples.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    GridBagConstraints gbc_btnExamples = new GridBagConstraints();
    gbc_btnExamples.insets = new Insets(0, 0, 0, 5);
    gbc_btnExamples.gridx = 1;
    gbc_btnExamples.gridy = 1;
    panel_3.add(btnExamples, gbc_btnExamples);

    JButton btnCheckNow = new JButton("Check Now");
    btnCheckNow.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            openWebPage(ppallink);
        }
    });
    GridBagConstraints gbc_btnCheckNow = new GridBagConstraints();
    gbc_btnCheckNow.gridx = 2;
    gbc_btnCheckNow.gridy = 1;
    panel_3.add(btnCheckNow, gbc_btnCheckNow);
}