Example usage for javax.swing SpringLayout NORTH

List of usage examples for javax.swing SpringLayout NORTH

Introduction

In this page you can find the example usage for javax.swing SpringLayout NORTH.

Prototype

String NORTH

To view the source code for javax.swing SpringLayout NORTH.

Click Source Link

Document

Specifies the top edge of a component's bounding rectangle.

Usage

From source file:layout.SpringDemo2.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//from   w  ww. j  ava2  s .  c  om
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("SpringDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Set up the content pane.
    Container contentPane = frame.getContentPane();
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);

    //Create and add the components.
    JLabel label = new JLabel("Label: ");
    JTextField textField = new JTextField("Text field", 15);
    contentPane.add(label);
    contentPane.add(textField);

    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, contentPane);

    //Adjust constraints for the text field so it's at
    //(<label's right edge> + 5, 5).
    layout.putConstraint(SpringLayout.WEST, textField, 5, SpringLayout.EAST, label);
    layout.putConstraint(SpringLayout.NORTH, textField, 5, SpringLayout.NORTH, contentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:layout.SpringDemo3.java

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.//  w ww  .  ja va2  s .c om
 */
private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("SpringDemo3");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Set up the content pane.
    Container contentPane = frame.getContentPane();
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);

    //Create and add the components.
    JLabel label = new JLabel("Label: ");
    JTextField textField = new JTextField("Text field", 15);
    contentPane.add(label);
    contentPane.add(textField);

    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, contentPane);

    //Adjust constraints for the text field so it's at
    //(<label's right edge> + 5, 5).
    layout.putConstraint(SpringLayout.WEST, textField, 5, SpringLayout.EAST, label);
    layout.putConstraint(SpringLayout.NORTH, textField, 5, SpringLayout.NORTH, contentPane);

    //Adjust constraints for the content pane: Its right
    //edge should be 5 pixels beyond the text field's right
    //edge, and its bottom edge should be 5 pixels beyond
    //the bottom edge of the tallest component (which we'll
    //assume is textField).
    layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, textField);
    layout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, textField);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:CompassButtons.java

public CompassButtons(String terrain) {
    super("SpringLayout Compass Demo");
    setSize(500, 300);//ww  w.  j a v a  2s .  com
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    SpringLayout sl = new SpringLayout();
    Container c = getContentPane();
    c.setLayout(sl);

    int offset = 50; // gap between buttons and outside edge
    int w = 80; // width of buttons
    int h = 26; // height of buttons
    int border = 3; // border around viewport

    Spring offsetS = Spring.constant(offset);
    Spring borderS = Spring.constant(border);
    Spring widthS = Spring.constant(w);
    Spring halfWidthS = FractionSpring.half(widthS);
    Spring heightS = Spring.constant(h);
    Spring halfHeightS = FractionSpring.half(heightS);
    Spring leftEdgeS = sl.getConstraint(SpringLayout.WEST, c);
    Spring topEdgeS = sl.getConstraint(SpringLayout.NORTH, c);
    Spring rightEdgeS = sl.getConstraint(SpringLayout.EAST, c);
    Spring bottomEdgeS = sl.getConstraint(SpringLayout.SOUTH, c);
    Spring xCenterS = FractionSpring.half(rightEdgeS);
    Spring yCenterS = FractionSpring.half(bottomEdgeS);
    Spring leftBorder = Spring.sum(leftEdgeS, borderS);
    Spring topBorder = Spring.sum(topEdgeS, borderS);

    Spring northX = Spring.sum(xCenterS, Spring.minus(halfWidthS));
    Spring southY = Spring.sum(bottomEdgeS, Spring.minus(Spring.sum(heightS, offsetS)));
    Spring eastX = Spring.sum(rightEdgeS, Spring.minus(Spring.sum(widthS, offsetS)));
    Spring eastY = Spring.sum(yCenterS, Spring.minus(halfHeightS));

    c.add(nb, new SpringLayout.Constraints(northX, offsetS, widthS, heightS));
    c.add(sb, new SpringLayout.Constraints(northX, southY, widthS, heightS));

    c.add(wb);
    sl.getConstraints(wb).setX(offsetS);
    sl.getConstraints(wb).setY(eastY);
    sl.getConstraints(wb).setWidth(widthS);
    sl.getConstraints(wb).setHeight(heightS);

    c.add(eb);
    sl.getConstraints(eb).setX(eastX);
    sl.getConstraints(eb).setY(eastY);
    sl.getConstraints(eb).setWidth(widthS);
    sl.getConstraints(eb).setHeight(heightS);

    c.add(viewport); // this sets a bounds of (0,0,pref_width,pref_height)
    // The order here is important...need to have a valid width and height
    // in place before binding the (x,y) location
    sl.putConstraint(SpringLayout.SOUTH, viewport, Spring.minus(borderS), SpringLayout.SOUTH, c);
    sl.putConstraint(SpringLayout.EAST, viewport, Spring.minus(borderS), SpringLayout.EAST, c);
    sl.putConstraint(SpringLayout.NORTH, viewport, topBorder, SpringLayout.NORTH, c);
    sl.putConstraint(SpringLayout.WEST, viewport, leftBorder, SpringLayout.WEST, c);

    ImageIcon icon = new ImageIcon(getClass().getResource(terrain));
    viewport.setView(new JLabel(icon));

    // Hook up the buttons. See the CompassScroller class (on-line) for
    // details
    // on controlling the viewport.
    nb.setActionCommand(CompassScroller.NORTH);
    sb.setActionCommand(CompassScroller.SOUTH);
    wb.setActionCommand(CompassScroller.WEST);
    eb.setActionCommand(CompassScroller.EAST);
    CompassScroller scroller = new CompassScroller(viewport);
    nb.addActionListener(scroller);
    sb.addActionListener(scroller);
    eb.addActionListener(scroller);
    wb.addActionListener(scroller);

    setVisible(true);
}

From source file:SpringDemo2.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///from   www.ja  v a  2s .  c o m
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SpringDemo2");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Set up the content pane.
    Container contentPane = frame.getContentPane();
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);

    //Create and add the components.
    JLabel label = new JLabel("Label: ");
    JTextField textField = new JTextField("Text field", 15);
    contentPane.add(label);
    contentPane.add(textField);

    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, contentPane);

    //Adjust constraints for the text field so it's at
    //(<label's right edge> + 5, 5).
    layout.putConstraint(SpringLayout.WEST, textField, 5, SpringLayout.EAST, label);
    layout.putConstraint(SpringLayout.NORTH, textField, 5, SpringLayout.NORTH, contentPane);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:SpringDemo3.java

/**
 * Create the GUI and show it. For thread safety, this method should be
 * invoked from the event-dispatching thread.
 *///from  w w  w  .  ja  va 2  s  .c  om
private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    //Create and set up the window.
    JFrame frame = new JFrame("SpringDemo3");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    //Set up the content pane.
    Container contentPane = frame.getContentPane();
    SpringLayout layout = new SpringLayout();
    contentPane.setLayout(layout);

    //Create and add the components.
    JLabel label = new JLabel("Label: ");
    JTextField textField = new JTextField("Text field", 15);
    contentPane.add(label);
    contentPane.add(textField);

    //Adjust constraints for the label so it's at (5,5).
    layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, contentPane);
    layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, contentPane);

    //Adjust constraints for the text field so it's at
    //(<label's right edge> + 5, 5).
    layout.putConstraint(SpringLayout.WEST, textField, 5, SpringLayout.EAST, label);
    layout.putConstraint(SpringLayout.NORTH, textField, 5, SpringLayout.NORTH, contentPane);

    //Adjust constraints for the content pane: Its right
    //edge should be 5 pixels beyond the text field's right
    //edge, and its bottom edge should be 5 pixels beyond
    //the bottom edge of the tallest component (which we'll
    //assume is textField).
    layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, textField);
    layout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, textField);

    //Display the window.
    frame.pack();
    frame.setVisible(true);
}

From source file:com.awesomecoding.minetestlauncher.Main.java

private void initialize() {
    fileGetter = new FileGetter(userhome + "\\minetest\\temp\\");
    latest = fileGetter.getContents("http://socialmelder.com/minetest/latest.txt", true);
    currentVersion = latest.split("\n")[0];
    changelog = fileGetter.getContents("http://socialmelder.com/minetest/changelog.html", false);

    try {//from   www.j  a  v  a  2  s . c  o  m
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        e.printStackTrace();
    }

    frmMinetestLauncherV = new JFrame();
    frmMinetestLauncherV.setResizable(false);
    frmMinetestLauncherV.setIconImage(Toolkit.getDefaultToolkit()
            .getImage(Main.class.getResource("/com/awesomecoding/minetestlauncher/icon.png")));
    frmMinetestLauncherV.setTitle("Minetest Launcher (Version 0.1)");
    frmMinetestLauncherV.setBounds(100, 100, 720, 480);
    frmMinetestLauncherV.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SpringLayout springLayout = new SpringLayout();
    frmMinetestLauncherV.getContentPane().setLayout(springLayout);

    final JProgressBar progressBar = new JProgressBar();
    springLayout.putConstraint(SpringLayout.WEST, progressBar, 10, SpringLayout.WEST,
            frmMinetestLauncherV.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, progressBar, -10, SpringLayout.SOUTH,
            frmMinetestLauncherV.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, progressBar, -130, SpringLayout.EAST,
            frmMinetestLauncherV.getContentPane());
    frmMinetestLauncherV.getContentPane().add(progressBar);

    final JButton btnDownloadPlay = new JButton("Play!");
    springLayout.putConstraint(SpringLayout.WEST, btnDownloadPlay, 6, SpringLayout.EAST, progressBar);
    springLayout.putConstraint(SpringLayout.SOUTH, btnDownloadPlay, 0, SpringLayout.SOUTH, progressBar);
    springLayout.putConstraint(SpringLayout.EAST, btnDownloadPlay, -10, SpringLayout.EAST,
            frmMinetestLauncherV.getContentPane());
    frmMinetestLauncherV.getContentPane().add(btnDownloadPlay);

    final JLabel label = new JLabel("Ready to play!");
    springLayout.putConstraint(SpringLayout.WEST, label, 10, SpringLayout.WEST,
            frmMinetestLauncherV.getContentPane());
    springLayout.putConstraint(SpringLayout.NORTH, btnDownloadPlay, 0, SpringLayout.NORTH, label);
    springLayout.putConstraint(SpringLayout.SOUTH, label, -37, SpringLayout.SOUTH,
            frmMinetestLauncherV.getContentPane());
    springLayout.putConstraint(SpringLayout.NORTH, progressBar, 6, SpringLayout.SOUTH, label);
    frmMinetestLauncherV.getContentPane().add(label);

    JTextPane txtpnNewFeatures = new JTextPane();
    txtpnNewFeatures.setBackground(SystemColor.window);
    springLayout.putConstraint(SpringLayout.NORTH, txtpnNewFeatures, 10, SpringLayout.NORTH,
            frmMinetestLauncherV.getContentPane());
    springLayout.putConstraint(SpringLayout.WEST, txtpnNewFeatures, 10, SpringLayout.WEST,
            frmMinetestLauncherV.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, txtpnNewFeatures, -10, SpringLayout.NORTH, btnDownloadPlay);
    springLayout.putConstraint(SpringLayout.EAST, txtpnNewFeatures, 0, SpringLayout.EAST, btnDownloadPlay);
    txtpnNewFeatures.setEditable(false);
    txtpnNewFeatures.setContentType("text/html");
    txtpnNewFeatures.setText(changelog);
    txtpnNewFeatures.setFont(new Font("Tahoma", Font.PLAIN, 12));
    frmMinetestLauncherV.getContentPane().add(txtpnNewFeatures);

    File file = new File(userhome + "\\minetest\\version.txt");

    if (!file.exists())
        newVersion = true;
    else {
        String version = fileGetter.getLocalContents(file, false);
        if (!version.equals(currentVersion))
            newVersion = true;
    }

    if (newVersion) {
        label.setText("New Version Available! (" + currentVersion + ")");
        btnDownloadPlay.setText("Download & Play");

        btnDownloadPlay.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                Thread t = new Thread() {
                    public void run() {
                        File file = new File(userhome + "\\minetest\\version.txt");
                        String version = fileGetter.getLocalContents(file, false);
                        try {
                            FileUtils.deleteDirectory(new File(userhome + "\\minetest\\minetest-" + version));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        fileGetter.download(latest.split("\n")[1], userhome + "\\minetest\\temp\\",
                                "minetest.zip", label, progressBar, btnDownloadPlay, currentVersion);
                        try {
                            label.setText("Cleaning up...");
                            btnDownloadPlay.setText("Cleaning up...");
                            FileUtils.deleteDirectory(new File(userhome + "\\minetest\\temp"));
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        System.exit(0);
                    }
                };
                t.start();
            }
        });
    } else {
        btnDownloadPlay.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                try {
                    label.setText("Launching...");
                    btnDownloadPlay.setEnabled(false);
                    btnDownloadPlay.setText("Launching...");
                    File file = new File(userhome + "\\minetest\\version.txt");
                    String version = fileGetter.getLocalContents(file, false);
                    Runtime.getRuntime()
                            .exec(userhome + "\\minetest\\minetest-" + version + "\\bin\\minetest.exe");
                    System.exit(0);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
        progressBar.setValue(100);
    }
}

From source file:org.gumtree.vis.awt.AbstractPlotEditor.java

private JPanel createHelpPanel() {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = plot.getHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);// w w w  .j a  va2  s  .c om
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;
}

From source file:AppSpringLayout.java

/**
 * Initialize the contents of the frame.
 *//*ww  w .  ja  va2 s  .  co m*/
private void initialize() {

    frame = new JFrame();
    frame.setBounds(0, 0, 850, 750);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    springLayout = new SpringLayout();
    frame.getContentPane().setLayout(springLayout);
    frame.setLocationRelativeTo(null);

    FileNameExtensionFilter filter = new FileNameExtensionFilter("Image files", "jpg", "jpeg", "png");
    fc = new JFileChooser();
    fc.setFileFilter(filter);
    // frame.getContentPane().add(fc);

    btnTurnCameraOn = new JButton("Turn camera on");
    springLayout.putConstraint(SpringLayout.WEST, btnTurnCameraOn, 51, SpringLayout.WEST,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, btnTurnCameraOn, -581, SpringLayout.EAST,
            frame.getContentPane());
    frame.getContentPane().add(btnTurnCameraOn);

    urlTextField = new JTextField();
    springLayout.putConstraint(SpringLayout.SOUTH, btnTurnCameraOn, -6, SpringLayout.NORTH, urlTextField);
    springLayout.putConstraint(SpringLayout.WEST, urlTextField, 0, SpringLayout.WEST, btnTurnCameraOn);
    springLayout.putConstraint(SpringLayout.EAST, urlTextField, 274, SpringLayout.WEST, frame.getContentPane());
    frame.getContentPane().add(urlTextField);
    urlTextField.setColumns(10);

    originalImageLabel = new JLabel("");
    springLayout.putConstraint(SpringLayout.NORTH, originalImageLabel, 102, SpringLayout.NORTH,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.WEST, originalImageLabel, 34, SpringLayout.WEST,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, originalImageLabel, -326, SpringLayout.SOUTH,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, originalImageLabel, -566, SpringLayout.EAST,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, urlTextField, -6, SpringLayout.NORTH, originalImageLabel);
    frame.getContentPane().add(originalImageLabel);

    btnAnalyseImage = new JButton("Analyse image");
    springLayout.putConstraint(SpringLayout.NORTH, btnAnalyseImage, 6, SpringLayout.SOUTH, originalImageLabel);
    springLayout.putConstraint(SpringLayout.WEST, btnAnalyseImage, 58, SpringLayout.WEST,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, btnAnalyseImage, 252, SpringLayout.WEST,
            frame.getContentPane());
    frame.getContentPane().add(btnAnalyseImage);

    lblTags = new JLabel("Tags:");
    frame.getContentPane().add(lblTags);

    lblDescription = new JLabel("Description:");
    springLayout.putConstraint(SpringLayout.WEST, lblDescription, 84, SpringLayout.EAST, lblTags);
    springLayout.putConstraint(SpringLayout.NORTH, lblTags, 0, SpringLayout.NORTH, lblDescription);
    springLayout.putConstraint(SpringLayout.NORTH, lblDescription, 6, SpringLayout.SOUTH, btnAnalyseImage);
    springLayout.putConstraint(SpringLayout.SOUTH, lblDescription, -269, SpringLayout.SOUTH,
            frame.getContentPane());
    frame.getContentPane().add(lblDescription);

    tagsTextArea = new JTextArea();
    springLayout.putConstraint(SpringLayout.NORTH, tagsTextArea, 459, SpringLayout.NORTH,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.WEST, tagsTextArea, 10, SpringLayout.WEST, frame.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, tagsTextArea, -727, SpringLayout.EAST,
            frame.getContentPane());
    frame.getContentPane().add(tagsTextArea);

    descriptionTextArea = new JTextArea();
    springLayout.putConstraint(SpringLayout.NORTH, descriptionTextArea, 0, SpringLayout.SOUTH, lblDescription);
    springLayout.putConstraint(SpringLayout.WEST, descriptionTextArea, 18, SpringLayout.EAST, tagsTextArea);
    descriptionTextArea.setLineWrap(true);
    descriptionTextArea.setWrapStyleWord(true);
    frame.getContentPane().add(descriptionTextArea);

    lblImageType = new JLabel("Image type");
    springLayout.putConstraint(SpringLayout.WEST, lblTags, 0, SpringLayout.WEST, lblImageType);
    springLayout.putConstraint(SpringLayout.NORTH, lblImageType, 10, SpringLayout.SOUTH, tagsTextArea);
    springLayout.putConstraint(SpringLayout.WEST, lblImageType, 20, SpringLayout.WEST, frame.getContentPane());
    frame.getContentPane().add(lblImageType);

    lblSize = new JLabel("Size");
    springLayout.putConstraint(SpringLayout.NORTH, lblSize, 21, SpringLayout.SOUTH, lblImageType);
    springLayout.putConstraint(SpringLayout.WEST, lblSize, 20, SpringLayout.WEST, frame.getContentPane());
    frame.getContentPane().add(lblSize);

    lblLicense = new JLabel("License");
    springLayout.putConstraint(SpringLayout.WEST, lblLicense, 20, SpringLayout.WEST, frame.getContentPane());
    frame.getContentPane().add(lblLicense);

    lblSafeSearch = new JLabel("Safe search");
    springLayout.putConstraint(SpringLayout.WEST, lblSafeSearch, 10, SpringLayout.WEST, frame.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, lblSafeSearch, 139, SpringLayout.SOUTH,
            frame.getContentPane());
    frame.getContentPane().add(lblSafeSearch);

    String[] licenseTypes = { "unspecified", "Public", "Share", "ShareCommercially", "Modify" };
    licenseBox = new JComboBox(licenseTypes);
    springLayout.putConstraint(SpringLayout.WEST, licenseBox, 28, SpringLayout.EAST, lblLicense);
    frame.getContentPane().add(licenseBox);

    String[] sizeTypes = { "unspecified", "Small", "Medium", "Large", "Wallpaper" };
    sizeBox = new JComboBox(sizeTypes);
    springLayout.putConstraint(SpringLayout.WEST, sizeBox, 50, SpringLayout.EAST, lblSize);
    springLayout.putConstraint(SpringLayout.EAST, sizeBox, -556, SpringLayout.EAST, frame.getContentPane());
    springLayout.putConstraint(SpringLayout.EAST, licenseBox, 0, SpringLayout.EAST, sizeBox);
    frame.getContentPane().add(sizeBox);

    String[] imageTypes = { "unspecified", "AnimategGif", "Clipart", "Line", "Photo" };
    imageTypeBox = new JComboBox(imageTypes);
    springLayout.putConstraint(SpringLayout.SOUTH, descriptionTextArea, -6, SpringLayout.NORTH, imageTypeBox);
    springLayout.putConstraint(SpringLayout.NORTH, imageTypeBox, 547, SpringLayout.NORTH,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, tagsTextArea, -6, SpringLayout.NORTH, imageTypeBox);
    springLayout.putConstraint(SpringLayout.WEST, imageTypeBox, 6, SpringLayout.EAST, lblImageType);
    springLayout.putConstraint(SpringLayout.EAST, imageTypeBox, -556, SpringLayout.EAST,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.NORTH, sizeBox, 10, SpringLayout.SOUTH, imageTypeBox);
    frame.getContentPane().add(imageTypeBox);

    btnBrowse = new JButton("Browse");
    springLayout.putConstraint(SpringLayout.WEST, btnBrowse, 0, SpringLayout.WEST, btnTurnCameraOn);
    springLayout.putConstraint(SpringLayout.EAST, btnBrowse, -583, SpringLayout.EAST, frame.getContentPane());
    frame.getContentPane().add(btnBrowse);

    lblSafeSearch_1 = new JLabel("Safe search");
    springLayout.putConstraint(SpringLayout.WEST, lblSafeSearch_1, 20, SpringLayout.WEST,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.SOUTH, lblLicense, -17, SpringLayout.NORTH, lblSafeSearch_1);
    frame.getContentPane().add(lblSafeSearch_1);

    String[] safeSearchTypes = { "Strict", "Moderate", "Off" };
    safeSearchBox = new JComboBox(safeSearchTypes);
    springLayout.putConstraint(SpringLayout.SOUTH, licenseBox, -6, SpringLayout.NORTH, safeSearchBox);
    springLayout.putConstraint(SpringLayout.WEST, safeSearchBox, 4, SpringLayout.EAST, lblSafeSearch_1);
    springLayout.putConstraint(SpringLayout.EAST, safeSearchBox, 0, SpringLayout.EAST, licenseBox);
    frame.getContentPane().add(safeSearchBox);

    btnSearchForSimilar = new JButton("Search for similar images");
    springLayout.putConstraint(SpringLayout.SOUTH, lblSafeSearch_1, -13, SpringLayout.NORTH,
            btnSearchForSimilar);
    springLayout.putConstraint(SpringLayout.SOUTH, safeSearchBox, -6, SpringLayout.NORTH, btnSearchForSimilar);
    springLayout.putConstraint(SpringLayout.NORTH, btnSearchForSimilar, 689, SpringLayout.NORTH,
            frame.getContentPane());
    springLayout.putConstraint(SpringLayout.WEST, btnSearchForSimilar, 36, SpringLayout.WEST,
            frame.getContentPane());
    frame.getContentPane().add(btnSearchForSimilar);

    btnCancel = new JButton("Cancel");
    springLayout.putConstraint(SpringLayout.NORTH, btnCancel, 0, SpringLayout.NORTH, btnBrowse);
    btnCancel.setVisible(false);
    frame.getContentPane().add(btnCancel);

    btnSave = new JButton("Save");
    springLayout.putConstraint(SpringLayout.WEST, btnCancel, 6, SpringLayout.EAST, btnSave);
    springLayout.putConstraint(SpringLayout.NORTH, btnSave, 0, SpringLayout.NORTH, btnBrowse);
    btnSave.setVisible(false);
    frame.getContentPane().add(btnSave);

    btnTakeAPicture = new JButton("Take a picture");
    springLayout.putConstraint(SpringLayout.WEST, btnTakeAPicture, 114, SpringLayout.EAST, btnBrowse);
    springLayout.putConstraint(SpringLayout.WEST, btnSave, 6, SpringLayout.EAST, btnTakeAPicture);
    springLayout.putConstraint(SpringLayout.NORTH, btnTakeAPicture, 0, SpringLayout.NORTH, btnBrowse);
    btnTakeAPicture.setVisible(false);
    frame.getContentPane().add(btnTakeAPicture);

    //// JScrollPane scroll = new JScrollPane(list);
    // Constraints c = springLayout.getConstraints(list);
    // frame.getContentPane().add(scroll, c);

    list = new JList();
    JScrollPane scroll = new JScrollPane(list);
    springLayout.putConstraint(SpringLayout.EAST, descriptionTextArea, -89, SpringLayout.WEST, list);
    springLayout.putConstraint(SpringLayout.EAST, list, -128, SpringLayout.EAST, frame.getContentPane());
    springLayout.putConstraint(SpringLayout.WEST, list, 64, SpringLayout.EAST, licenseBox);
    springLayout.putConstraint(SpringLayout.NORTH, list, 0, SpringLayout.NORTH, btnTurnCameraOn);
    springLayout.putConstraint(SpringLayout.SOUTH, list, -35, SpringLayout.SOUTH, lblSafeSearch_1);

    Constraints c = springLayout.getConstraints(list);
    frame.getContentPane().add(scroll, c);

    // frame.getContentPane().add(list);

    progressBar = new JProgressBar();
    springLayout.putConstraint(SpringLayout.NORTH, progressBar, 15, SpringLayout.SOUTH, list);
    springLayout.putConstraint(SpringLayout.WEST, progressBar, 24, SpringLayout.EAST, safeSearchBox);
    springLayout.putConstraint(SpringLayout.EAST, progressBar, 389, SpringLayout.WEST, btnTakeAPicture);
    progressBar.setIndeterminate(true);
    progressBar.setStringPainted(true);
    progressBar.setVisible(false);
    Border border = BorderFactory
            .createTitledBorder("We are checking every image, pixel by pixel, it may take a while...");
    progressBar.setBorder(border);
    frame.getContentPane().add(progressBar);

    labelTryLinks = new JLabel();
    labelTryLinks.setVisible(false);
    springLayout.putConstraint(SpringLayout.NORTH, labelTryLinks, -16, SpringLayout.SOUTH, btnSearchForSimilar);
    springLayout.putConstraint(SpringLayout.WEST, labelTryLinks, -61, SpringLayout.EAST, licenseBox);
    springLayout.putConstraint(SpringLayout.SOUTH, labelTryLinks, 0, SpringLayout.SOUTH, btnSearchForSimilar);
    springLayout.putConstraint(SpringLayout.EAST, labelTryLinks, 0, SpringLayout.EAST, licenseBox);
    frame.getContentPane().add(labelTryLinks);

    lblFoundLinks = new JLabel("");
    springLayout.putConstraint(SpringLayout.NORTH, lblFoundLinks, -29, SpringLayout.NORTH, progressBar);
    springLayout.putConstraint(SpringLayout.WEST, lblFoundLinks, 6, SpringLayout.EAST, scroll);
    springLayout.putConstraint(SpringLayout.SOUTH, lblFoundLinks, -13, SpringLayout.NORTH, progressBar);
    springLayout.putConstraint(SpringLayout.EAST, lblFoundLinks, -10, SpringLayout.EAST,
            frame.getContentPane());
    frame.getContentPane().add(lblFoundLinks);

    numberOfImagesToSearchFor = new JTextField();
    springLayout.putConstraint(SpringLayout.NORTH, numberOfImagesToSearchFor, 0, SpringLayout.NORTH,
            tagsTextArea);
    springLayout.putConstraint(SpringLayout.WEST, numberOfImagesToSearchFor, 6, SpringLayout.EAST,
            descriptionTextArea);
    springLayout.putConstraint(SpringLayout.EAST, numberOfImagesToSearchFor, -36, SpringLayout.WEST, scroll);
    frame.getContentPane().add(numberOfImagesToSearchFor);
    numberOfImagesToSearchFor.setColumns(10);

    JLabel lblNumberOfImages = new JLabel("Number");
    springLayout.putConstraint(SpringLayout.NORTH, lblNumberOfImages, 0, SpringLayout.NORTH, lblTags);
    springLayout.putConstraint(SpringLayout.WEST, lblNumberOfImages, 31, SpringLayout.EAST, btnAnalyseImage);
    springLayout.putConstraint(SpringLayout.EAST, lblNumberOfImages, -6, SpringLayout.WEST, scroll);
    frame.getContentPane().add(lblNumberOfImages);

    // label to get coordinates for web camera panel
    // lblNewLabel_1 = new JLabel("New label");
    // springLayout.putConstraint(SpringLayout.NORTH, lblNewLabel_1, 0,
    // SpringLayout.NORTH, btnTurnCameraOn);
    // springLayout.putConstraint(SpringLayout.WEST, lblNewLabel_1, 98,
    // SpringLayout.EAST, originalImagesLabel);
    // springLayout.putConstraint(SpringLayout.SOUTH, lblNewLabel_1, -430,
    // SpringLayout.SOUTH, lblSafeSearch_1);
    // springLayout.putConstraint(SpringLayout.EAST, lblNewLabel_1, 0,
    // SpringLayout.EAST, btnCancel);
    // frame.getContentPane().add(lblNewLabel_1);

    btnBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (fc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
                openFilechooser();
            }
        }
    });

    btnTurnCameraOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.out.println("turn camera on");
            turnCameraOn();
            btnCancel.setVisible(true);
            btnTakeAPicture.setVisible(true);
        }
    });

    btnTakeAPicture.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnSave.setVisible(true);
            imageWebcam = webcam.getImage();
            originalImage = imageWebcam;

            // to mirror the image we create a temporary file, flip it
            // horizontally and then delete

            // get user's name to store file in the user directory
            String user = System.getProperty("user.home");
            String fileName = user + "/webCamPhoto.jpg";
            File newFile = new File(fileName);

            try {
                ImageIO.write(originalImage, "jpg", newFile);
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            try {
                originalImage = (BufferedImage) ImageIO.read(newFile);
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            newFile.delete();
            originalImage = mirrorImage(originalImage);
            icon = scaleBufferedImage(originalImage, originalImageLabel);
            originalImageLabel.setIcon(icon);
        }
    });

    btnSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
                try {

                    file = fc.getSelectedFile();
                    File output = new File(file.toString());
                    // check if image already exists
                    if (output.exists()) {
                        int response = JOptionPane.showConfirmDialog(null, //
                                "Do you want to replace the existing file?", //
                                "Confirm", JOptionPane.YES_NO_OPTION, //
                                JOptionPane.QUESTION_MESSAGE);
                        if (response != JOptionPane.YES_OPTION) {
                            return;
                        }
                    }
                    ImageIO.write(toBufferedImage(originalImage), "jpg", output);
                    System.out.println("Your image has been saved in the folder " + file.getPath());
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
    });

    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnTakeAPicture.setVisible(false);
            btnCancel.setVisible(false);
            btnSave.setVisible(false);
            webcam.close();
            panel.setVisible(false);
        }
    });

    urlTextField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (urlTextField.getText().length() > 0) {
                String linkNew = urlTextField.getText();
                displayImage(linkNew, originalImageLabel);
                originalImage = imageResponses;
            }
        }
    });

    btnAnalyseImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Token computerVisionToken = new Token();
            String computerVisionTokenFileName = "APIToken.txt";

            try {
                computerVisionImageToken = computerVisionToken.getApiToken(computerVisionTokenFileName);
                try {
                    analyse();
                } catch (NullPointerException e1) {
                    // if user clicks on "analyze" button without uploading
                    // image or posts a broken link
                    JOptionPane.showMessageDialog(null, "Please choose an image");
                    e1.printStackTrace();
                }
            } catch (NullPointerException e1) {
                e1.printStackTrace();
            }
        }
    });

    btnSearchForSimilar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            listModel.clear();

            Token bingImageToken = new Token();
            String bingImageTokenFileName = "SearchApiToken.txt";
            bingToken = bingImageToken.getApiToken(bingImageTokenFileName);

            // in case user edited description or tags, update it and
            // replace new line character, spaces and breaks with %20
            text = descriptionTextArea.getText().replace(" ", "%20").replace("\r", "%20").replace("\n", "%20");
            String tagsString = tagsTextArea.getText().replace(" ", "%20").replace("\r", "%20").replace("\n",
                    "%20");

            String numberOfImages = numberOfImagesToSearchFor.getText();

            try {
                int numberOfImagesTry = Integer.parseInt(numberOfImages);
                System.out.println(numberOfImagesTry);

                imageTypeString = imageTypeBox.getSelectedItem().toString();
                sizeTypeString = sizeBox.getSelectedItem().toString();
                licenseTypeString = licenseBox.getSelectedItem().toString();
                safeSearchTypeString = safeSearchBox.getSelectedItem().toString();

                searchParameters = tagsString + text;
                System.out.println("search parameters: " + searchParameters);

                if (searchParameters.length() != 0) {

                    // add new thread for searching, so that progress bar
                    // and searching could run simultaneously
                    Thread t1 = new Thread(new Runnable() {
                        @Override
                        public void run() {
                            progressBar.setVisible(true);
                            workingUrls = searchToDisplayOnJList(searchParameters, imageTypeString,
                                    sizeTypeString, licenseTypeString, safeSearchTypeString, numberOfImages);
                        }
                    });
                    // start searching in a separate thread
                    t1.start();
                } else {
                    JOptionPane.showMessageDialog(null,
                            "Please choose first an image to analyse or insert search parameters");
                }
            } catch (NumberFormatException e1) {
                JOptionPane.showMessageDialog(null, "Please insert a valid number of images to search for");
                e1.printStackTrace();

            }
        }
    });

    list.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            int i = list.getSelectedIndex();

            if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
                try {
                    file = fc.getSelectedFile();
                    File output = new File(file.toString());
                    // check if file already exists, ask user if they
                    // wish to overwrite it
                    if (output.exists()) {
                        int response = JOptionPane.showConfirmDialog(null, //
                                "Do you want to replace the existing file?", //
                                "Confirm", JOptionPane.YES_NO_OPTION, //
                                JOptionPane.QUESTION_MESSAGE);
                        if (response != JOptionPane.YES_OPTION) {
                            return;
                        }
                    }
                    try {

                        URL fileNameAsUrl = new URL(linksResponse[i]);
                        originalImage = ImageIO.read(fileNameAsUrl);
                        ImageIO.write(toBufferedImage(originalImage), "jpeg", output);
                        System.out.println("image saved, in the folder: " + output.getAbsolutePath());

                    } catch (MalformedURLException e1) {
                        e1.printStackTrace();
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                } catch (NullPointerException e2) {
                    e2.getMessage();
                }
            }
        }
    });
}

From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java

private JPanel createHelpPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = new Hist2DHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);// w ww  .  j  a  v a 2  s. co  m
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;

}

From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java

private JPanel createHelpPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = new Plot1DHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);/*from   w w  w . j a  va  2  s  .  c  o  m*/
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;

}