Example usage for javax.swing BoxLayout PAGE_AXIS

List of usage examples for javax.swing BoxLayout PAGE_AXIS

Introduction

In this page you can find the example usage for javax.swing BoxLayout PAGE_AXIS.

Prototype

int PAGE_AXIS

To view the source code for javax.swing BoxLayout PAGE_AXIS.

Click Source Link

Document

Specifies that components should be laid out in the direction that lines flow across a page as determined by the target container's ComponentOrientation property.

Usage

From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java

public StudyAccessionGUI(AppContainer appCont) {
    super(appCont);

    ResourceInjector.get("datamanager-package.style").inject(this);

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            doLoading();/*from w  w w  .j a va2 s.co  m*/
        }
    });
}

From source file:io.github.jeremgamer.editor.panels.components.ButtonPanel.java

public ButtonPanel(JFrame frame) {

    this.frame = frame;
    this.setSize(new Dimension(395, frame.getHeight() - 27 - 23));
    this.setLocation(300, 0);
    this.setBorder(BorderFactory.createTitledBorder("Edition du bouton"));
    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    JLabel nameLabel = new JLabel("Nom : ");
    name.setPreferredSize(new Dimension(this.getWidth() - 285, 30));
    name.setEditable(false);// w  w w  . ja v a 2  s  . c  o  m
    JPanel namePanel = new JPanel();
    namePanel.add(nameLabel);
    namePanel.add(name);
    JPanel textPanel = new JPanel();
    JPanel nameAndTextPanel = new JPanel();
    JLabel textLabel = new JLabel("Texte :");
    CaretListener caretUpdateText = new CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent e) {
            JTextField text = (JTextField) e.getSource();
            bs.set("text", text.getText());
            preview.setText(text.getText());
            preview2.setText(text.getText());
        }
    };
    text.addCaretListener(caretUpdateText);
    text.setPreferredSize(new Dimension(this.getWidth() - 283, 30));
    textPanel.add(textLabel);
    textPanel.add(text);
    nameAndTextPanel.setLayout(new BoxLayout(nameAndTextPanel, BoxLayout.PAGE_AXIS));
    nameAndTextPanel.add(namePanel);
    nameAndTextPanel.add(textPanel);

    JPanel policePanel = new JPanel();
    JLabel policeLabel = new JLabel("Police : ");
    police.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            @SuppressWarnings("unchecked")
            JComboBox<String> combo = (JComboBox<String>) e.getSource();
            fontStyle = (String) combo.getSelectedItem();
            preview.setFont(new Font(fontStyle, Font.PLAIN, fontSize));
            preview2.setFont(new Font(fontStyle, Font.PLAIN, fontSize));
            bs.set("police", fontStyle);
        }

    });
    police.setPreferredSize(new Dimension(105, 30));
    GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font[] fonts = e.getAllFonts();
    for (Font f : fonts) {
        police.addItem(f.getName());
    }
    police.setSelectedItem("Arial");
    policePanel.add(policeLabel);
    policePanel.add(police);

    JPanel sizePanel = new JPanel();
    size.setPreferredSize(new Dimension(60, 25));
    JLabel sizeLabel = new JLabel("Taille : ");
    sizePanel.add(sizeLabel);
    sizePanel.add(size);
    JButton colorButton = new JButton("Couleur");
    colorButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            colorFrame.setModal(false);
            JButton finish = new JButton("Terminer");
            finish.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent arg0) {
                    colorFrame.dispose();
                }

            });
            colorFrame.setLayout(new BorderLayout());
            colorFrame.add(color, BorderLayout.CENTER);
            colorFrame.add(finish, BorderLayout.SOUTH);
            colorFrame.pack();
            colorFrame.setLocation(SwingUtilities.windowForComponent(imagedButton).getX() + 325,
                    SwingUtilities.windowForComponent(imagedButton).getY() - colorFrame.getHeight() + 40);
            colorFrame.setVisible(true);
        }

    });
    sizePanel.add(colorButton);
    size.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            JSpinner spinner = (JSpinner) e.getSource();
            fontSize = (int) spinner.getValue();
            preview.setFont(new Font(fontStyle, Font.PLAIN, fontSize));
            preview2.setFont(new Font(fontStyle, Font.PLAIN, fontSize));
            bs.set("size", fontSize);
        }
    });

    JPanel policeAndSize = new JPanel();
    policeAndSize.setLayout(new BoxLayout(policeAndSize, BoxLayout.PAGE_AXIS));
    policeAndSize.add(policePanel);
    policeAndSize.add(sizePanel);

    JPanel top = new JPanel();
    top.add(nameAndTextPanel);
    top.add(policeAndSize);
    top.setPreferredSize(new Dimension(395, 20));

    this.add(top);

    JPanel images = new JPanel();
    images.setBorder(BorderFactory.createTitledBorder("Images"));
    images.setLayout(new GridLayout(2, 3));
    images.setPreferredSize(new Dimension(395, this.getHeight() - 320));

    JPanel imaged = new JPanel();
    imaged.setLayout(new BorderLayout());
    imaged.setBorder(BorderFactory.createTitledBorder("Icne interne"));
    imagedButton.setSelected(true);
    imagedButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            if (ev.getStateChange() == ItemEvent.SELECTED) {
                bs.set("strings", true);
                preview.setBorderPainted(true);
            } else if (ev.getStateChange() == ItemEvent.DESELECTED) {
                bs.set("strings", false);
                preview.setBorderPainted(false);
            }
        }
    });
    JButton browseInternal = new JButton("Parcourir");
    browseInternal.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String path = null;
            JFileChooser chooser = new JFileChooser(Editor.lastPath);
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg",
                    "bmp");
            chooser.setFileFilter(filter);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int option = chooser.showOpenDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                path = chooser.getSelectedFile().getAbsolutePath();
                Editor.lastPath = chooser.getSelectedFile().getParent();
                copyImage(new File(path), "internal.png");
                nameInternal.setText(new File(path).getName());
                nameInternal.setPreferredSize(new Dimension(imgBasic.getWidth() - 10, 30));
                preview.setIcon(new ImageIcon(path));
                preview.repaint();
                bs.set("imageInternal", new File(path).getName());
            }
        }

    });
    JPanel northImaged = new JPanel();
    northImaged.setLayout(new BorderLayout());
    northImaged.add(imagedButton, BorderLayout.NORTH);
    northImaged.add(browseInternal, BorderLayout.SOUTH);
    imaged.add(northImaged, BorderLayout.NORTH);
    imaged.add(nameInternal, BorderLayout.CENTER);
    JButton removeInternal = null;
    try {
        removeInternal = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    removeInternal.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            File file = new File(
                    "projects/" + Editor.getProjectName() + "/buttons/" + name.getText() + "/internal.png");
            file.delete();
            nameInternal.setText("");
            bs.set("imageInternal", "");
            preview.setIcon(null);
        }

    });
    imaged.add(removeInternal, BorderLayout.SOUTH);
    images.add(imaged);

    imgBasic.setBorder(BorderFactory.createTitledBorder("Base"));
    JButton browseBasic = new JButton("Parcourir");
    browseBasic.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String path = null;
            JFileChooser chooser = new JFileChooser(Editor.lastPath);
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg",
                    "bmp");
            chooser.setFileFilter(filter);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int option = chooser.showOpenDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                path = chooser.getSelectedFile().getAbsolutePath();
                Editor.lastPath = chooser.getSelectedFile().getParent();
                copyImage(new File(path), "basic.png");
                nameBasic.setText(new File(path).getName());
                nameBasic.setPreferredSize(new Dimension(imgBasic.getWidth() - 10, 30));
                previewPanel.remove(preview);
                previewPanel.remove(preview2);
                previewPanel.add(preview2);
                color.changePreview(preview2);
                bs.set("imageBasic", new File(path).getName());
                preview2.update();
                previewPanel.repaint();
            }
        }

    });
    imgBasic.setLayout(new BorderLayout());
    imgBasic.add(browseBasic, BorderLayout.NORTH);
    imgBasic.add(nameBasic, BorderLayout.CENTER);
    JButton removeBasic = null;
    try {
        removeBasic = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    removeBasic.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            File file = new File(
                    "projects/" + Editor.getProjectName() + "/buttons/" + name.getText() + "/basic.png");
            file.delete();
            nameBasic.setText("");
            bs.set("imageBasic", "");
            preview2.update();
            previewPanel.repaint();
            if (bs.getString("imageBasic").equals("") && bs.getString("imageEntered").equals("")
                    && bs.getString("imageExited").equals("") && bs.getString("imagePressed").equals("")
                    && bs.getString("imageReleased").equals("")) {
                previewPanel.remove(preview2);
                previewPanel.add(preview);
            }
        }

    });
    imgBasic.add(removeBasic, BorderLayout.SOUTH);
    images.add(imgBasic);

    imgEntered.setBorder(BorderFactory.createTitledBorder("Survol"));
    JButton browseEntered = new JButton("Parcourir");
    browseEntered.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String path = null;
            JFileChooser chooser = new JFileChooser(Editor.lastPath);
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg",
                    "bmp");
            chooser.setFileFilter(filter);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int option = chooser.showOpenDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                path = chooser.getSelectedFile().getAbsolutePath();
                Editor.lastPath = chooser.getSelectedFile().getParent();
                copyImage(new File(path), "entered.png");
                nameEntered.setText(new File(path).getName());
                nameEntered.setPreferredSize(new Dimension(imgEntered.getWidth() - 10, 30));
                bs.set("imageEntered", new File(path).getName());
                preview2.update();
                previewPanel.repaint();
            }
        }

    });
    imgEntered.setLayout(new BorderLayout());
    imgEntered.add(browseEntered, BorderLayout.NORTH);
    imgEntered.add(nameEntered, BorderLayout.CENTER);
    JButton removeEntered = null;
    try {
        removeEntered = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    removeEntered.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            File file = new File(
                    "projects/" + Editor.getProjectName() + "/buttons/" + name.getText() + "/entered.png");
            file.delete();
            nameEntered.setText("");
            bs.set("imageEntered", "");
            preview2.update();
            previewPanel.repaint();
            if (bs.getString("imageBasic").equals("") && bs.getString("imageEntered").equals("")
                    && bs.getString("imageExited").equals("") && bs.getString("imagePressed").equals("")
                    && bs.getString("imageReleased").equals("")) {
                previewPanel.remove(preview2);
                previewPanel.add(preview);
            }
        }

    });
    imgEntered.add(removeEntered, BorderLayout.SOUTH);
    images.add(imgEntered);

    imgExited.setBorder(BorderFactory.createTitledBorder("Sortie"));
    JButton browseExited = new JButton("Parcourir");
    browseExited.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String path = null;
            JFileChooser chooser = new JFileChooser(Editor.lastPath);
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg",
                    "bmp");
            chooser.setFileFilter(filter);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int option = chooser.showOpenDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                path = chooser.getSelectedFile().getAbsolutePath();
                Editor.lastPath = chooser.getSelectedFile().getParent();
                copyImage(new File(path), "exited.png");
                nameExited.setText(new File(path).getName());
                nameExited.setPreferredSize(new Dimension(imgExited.getWidth() - 10, 30));
                bs.set("imageExited", new File(path).getName());
                preview2.update();
                previewPanel.repaint();
            }
        }

    });
    imgExited.setLayout(new BorderLayout());
    imgExited.add(browseExited, BorderLayout.NORTH);
    imgExited.add(nameExited, BorderLayout.CENTER);
    JButton removeExited = null;
    try {
        removeExited = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    removeExited.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            File file = new File(
                    "projects/" + Editor.getProjectName() + "/buttons/" + name.getText() + "/exited.png");
            file.delete();
            nameExited.setText("");
            bs.set("imageExited", "");
            preview2.update();
            previewPanel.repaint();
            if (bs.getString("imageBasic").equals("") && bs.getString("imageEntered").equals("")
                    && bs.getString("imageExited").equals("") && bs.getString("imagePressed").equals("")
                    && bs.getString("imageReleased").equals("")) {
                previewPanel.remove(preview2);
                previewPanel.add(preview);
            }
        }

    });
    imgExited.add(removeExited, BorderLayout.SOUTH);
    images.add(imgExited);

    imgPressed.setBorder(BorderFactory.createTitledBorder("Clic"));
    JButton browsePressed = new JButton("Parcourir");
    browsePressed.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String path = null;
            JFileChooser chooser = new JFileChooser(Editor.lastPath);
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg",
                    "bmp");
            chooser.setFileFilter(filter);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int option = chooser.showOpenDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                path = chooser.getSelectedFile().getAbsolutePath();
                Editor.lastPath = chooser.getSelectedFile().getParent();
                copyImage(new File(path), "pressed.png");
                namePressed.setText(new File(path).getName());
                namePressed.setPreferredSize(new Dimension(imgPressed.getWidth() - 10, 30));
                bs.set("imagePressed", new File(path).getName());
                preview2.update();
                previewPanel.repaint();
            }
        }

    });
    imgPressed.setLayout(new BorderLayout());
    imgPressed.add(browsePressed, BorderLayout.NORTH);
    imgPressed.add(namePressed, BorderLayout.CENTER);
    JButton removePressed = null;
    try {
        removePressed = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    removePressed.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            File file = new File(
                    "projects/" + Editor.getProjectName() + "/buttons/" + name.getText() + "/pressed.png");
            file.delete();
            namePressed.setText("");
            bs.set("imagePressed", "");
            preview2.update();
            previewPanel.repaint();
            if (bs.getString("imageBasic").equals("") && bs.getString("imageEntered").equals("")
                    && bs.getString("imageExited").equals("") && bs.getString("imagePressed").equals("")
                    && bs.getString("imageReleased").equals("")) {
                previewPanel.remove(preview2);
                previewPanel.add(preview);
            }
        }

    });
    imgPressed.add(removePressed, BorderLayout.SOUTH);
    images.add(imgPressed);

    imgReleased.setBorder(BorderFactory.createTitledBorder("Relachement"));
    JButton browseReleased = new JButton("Parcourir");
    browseReleased.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String path = null;
            JFileChooser chooser = new JFileChooser(Editor.lastPath);
            FileNameExtensionFilter filter = new FileNameExtensionFilter("Images", "jpg", "png", "gif", "jpeg",
                    "bmp");
            chooser.setFileFilter(filter);
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int option = chooser.showOpenDialog(null);
            if (option == JFileChooser.APPROVE_OPTION) {
                path = chooser.getSelectedFile().getAbsolutePath();
                Editor.lastPath = chooser.getSelectedFile().getParent();
                copyImage(new File(path), "released.png");
                nameReleased.setText(new File(path).getName());
                nameReleased.setPreferredSize(new Dimension(imgReleased.getWidth() - 10, 30));
                bs.set("imageReleased", new File(path).getName());
                preview2.update();
                previewPanel.repaint();
            }
        }

    });
    imgReleased.setLayout(new BorderLayout());
    imgReleased.add(browseReleased, BorderLayout.NORTH);
    imgReleased.add(nameReleased, BorderLayout.CENTER);
    JButton removeReleased = null;
    try {
        removeReleased = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    removeReleased.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            File file = new File(
                    "projects/" + Editor.getProjectName() + "/buttons/" + name.getText() + "/released.png");
            file.delete();
            nameReleased.setText("");
            bs.set("imageReleased", "");
            preview2.update();
            previewPanel.repaint();
            if (bs.getString("imageBasic").equals("") && bs.getString("imageEntered").equals("")
                    && bs.getString("imageExited").equals("") && bs.getString("imagePressed").equals("")
                    && bs.getString("imageReleased").equals("")) {
                previewPanel.remove(preview2);
                previewPanel.add(preview);
            }
        }

    });
    imgReleased.add(removeReleased, BorderLayout.SOUTH);
    images.add(imgReleased);

    this.add(images);

    JPanel action = new JPanel();
    action.setPreferredSize(new Dimension(395, -20));
    JLabel labelAction = new JLabel("Action : ");
    action.add(labelAction);
    actionList.removeAllItems();
    actionList.addItem("Aucune");
    for (String s : Actions.getActions()) {
        actionList.addItem(s);
    }
    actionList.setPreferredSize(new Dimension(this.getWidth() - 100, 30));
    actionList.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            @SuppressWarnings("unchecked")
            JComboBox<String> combo = (JComboBox<String>) event.getSource();
            bs.set("action", combo.getSelectedItem());
        }

    });
    action.add(actionList);
    this.add(action);

    JScrollPane previewScroll = new JScrollPane(previewPanel);
    previewScroll.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED);
    previewPanel.setBorder(BorderFactory.createTitledBorder("Aperu"));
    previewPanel.add(preview);
    previewScroll.setPreferredSize(new Dimension(395, 40));
    previewScroll.setBorder(null);

    this.add(previewScroll);
}

From source file:org.openmrs.module.muzimabiometrics.panels.ScanFingerprint.java

@Override
protected void initGUI() throws IOException, JSONException {
    panelMain = new JPanel();
    panelMain.setBackground(Color.white);
    panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.PAGE_AXIS));

    panelMessage = new JPanel();
    panelMessage.setBackground(Color.white);
    panelMessage.add(lblProgressMessage);
    panelMessage.setLayout(new FlowLayout(FlowLayout.TRAILING));

    panelButtons = new JPanel();
    panelButtons.setBackground(Color.white);
    panelButtons.setLayout(new FlowLayout(FlowLayout.LEADING));

    btnTryAgain.setVisible(false);//  ww w. j a  v  a 2 s . c  om
    btnTryAgain.addActionListener(this);

    btnLaunchApplet.setVisible(true);
    btnLaunchApplet.addActionListener(this);

    panelButtons.add(btnTryAgain);
    panelButtons.add(btnLaunchApplet);

    panelMain.add(panelMessage);
    panelMain.add(panelButtons);

    add(panelMain);

    scannerList = new JList();
    scannerList.setModel(new DefaultListModel());
    scannerList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scannerList.addListSelectionListener(new ScannerSelectionListener());
}

From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java

private JPanel getJPanel12() {
    if (jPanel12 != null)
        return jPanel12;
    jPanel12 = new JPanel();
    jPanel12.setMaximumSize(new Dimension(60, Short.MAX_VALUE));
    jPanel12.setPreferredSize(new Dimension(60, 150));
    jPanel12.setLayout(new BoxLayout(jPanel12, BoxLayout.PAGE_AXIS));
    jPanel12.add(Box.createVerticalGlue());
    jPanel12.add(getJButton());//from  w ww  . j a  v a 2 s  .com
    jPanel12.add(Box.createVerticalGlue());
    jPanel12.add(getJButton1());
    jPanel12.add(Box.createVerticalGlue());

    return jPanel12;
}

From source file:fungus.PeerRatioChartFrame.java

public PeerRatioChartFrame(String prefix) {
    simulationCycles = Configuration.getDouble(PAR_SIMULATION_CYCLES);
    this.setTitle("MycoNet Statistics Chart");
    graph = JungGraphObserver.getGraph();

    //data.add(-1,0);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.setAutoWidth(false);//  w w  w  .j  a v  a2s  .  c  om
    dataset.setIntervalWidth(simulationCycles);

    //averageUtilizationData = new XYSeries("Average Utilization");
    //dataset.addSeries(averageUtilizationData);
    //averageStableUtilizationData = new XYSeries("Avg Stable Util");
    //dataset.addSeries(averageStableUtilizationData);
    bulwarkRatioData = new XYSeries("Bulwark Ratio");
    dataset.addSeries(bulwarkRatioData);
    biomassRatioData = new XYSeries("Biomass Ratio");
    dataset.addSeries(biomassRatioData);
    hyphaRatioData = new XYSeries("Hypha Ratio");
    dataset.addSeries(hyphaRatioData);
    // stableHyphaRatioData = new XYSeries("Stable Hypha Ratio");
    // dataset.addSeries(stableHyphaRatioData);

    //XYSeriesCollection dataset;

    JFreeChart peerRatioChart = ChartFactory.createXYLineChart("Bulwark Metrics", "Cycle", "Peer State Ratio",
            dataset, PlotOrientation.VERTICAL, true, false, false);
    ChartPanel peerRatioChartPanel = new ChartPanel(peerRatioChart);

    XYPlot xyplot = peerRatioChart.getXYPlot();

    NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis();
    NumberAxis rangeAxis = (NumberAxis) xyplot.getRangeAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(0, 1);

    //chart.setBackgroundPaint(Color.white);
    //XYPlot plot = chart.getXYPlot();

    //        BufferedImage chartImage = chart.createBufferedImage(500,300);
    //        chartLabel = new JLabel();
    //chartLabel.setIcon(new ImageIcon(chartImage));

    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
    JPanel labelPane = new JPanel();
    labelPane.setLayout(new GridLayout(1, 1));
    //chartPane.setPreferredSize(new java.awt.Dimension(500, 300));
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));

    ////contentPane.add(labelPane,BorderLayout.PAGE_START);
    //contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    contentPane.add(peerRatioChartPanel, BorderLayout.CENTER);
    //contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    ////contentPane.add(buttonPane, BorderLayout.PAGE_END);

    //data = node.getHyphaData();
    //link = node.getHyphaLink();
    //mycocast = node.getMycoCast();

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    //chartPanel.add(chartLabel);

    /*JButton updateButton = new JButton("Refresh");
      ActionListener updater = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      refreshData();
      }
      };
      updateButton.addActionListener(updater);
            
      JButton closeButton = new JButton("Close");
      ActionListener closer = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      closeFrame();
      }
      };
      closeButton.addActionListener(closer);
            
      buttonPane.add(Box.createHorizontalGlue());
      buttonPane.add(updateButton);
      buttonPane.add(Box.createRigidArea(new Dimension(5,0)));
      buttonPane.add(closeButton);
      refreshData();
    */

    //JungGraphObserver.addChangeListener(this);

    this.pack();
    this.setVisible(true);
}

From source file:ome.formats.importer.gui.FileQueueTable.java

/**
 * Set up and display the file queue table
 *///  w  ww.  ja v a2 s .c om
FileQueueTable() {

    // ----- Variables -----
    // Debug Borders
    Boolean debugBorders = false;

    // Size of the add/remove/refresh buttons (which are square).
    int buttonSize = 40;
    // Add graphic for the refresh button
    //String refreshIcon = "gfx/recycled.png";
    // Add graphic for add button
    String addIcon = "gfx/add.png";
    // Remove graphics for remove button
    String removeIcon = "gfx/remove.png";

    // Width of the status columns
    int statusWidth = 100;

    // ----- GUI Layout Elements -----

    // Start layout here
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    setBorder(BorderFactory.createEmptyBorder(6, 5, 9, 8));

    JPanel buttonPanel = new JPanel();
    if (debugBorders == true)
        buttonPanel.setBorder(BorderFactory.createLineBorder(Color.red, 1));
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS));

    //        refreshBtn = addButton("+", refreshIcon, null);
    //        refreshBtn.setMaximumSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setPreferredSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setMinimumSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setActionCommand(Actions.REFRESH);
    //        refreshBtn.addActionListener(this);

    addBtn = GuiCommonElements.addBasicButton(null, addIcon, null);
    addBtn.setMaximumSize(new Dimension(buttonSize, buttonSize));
    addBtn.setPreferredSize(new Dimension(buttonSize, buttonSize));
    addBtn.setMinimumSize(new Dimension(buttonSize, buttonSize));
    addBtn.setSize(new Dimension(buttonSize, buttonSize));
    addBtn.setActionCommand(FileQueueHandler.ADD);
    addBtn.addActionListener(this);
    addBtn.setToolTipText("Add files to the import queue.");

    removeBtn = GuiCommonElements.addBasicButton(null, removeIcon, null);
    removeBtn.setMaximumSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setPreferredSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setMinimumSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setActionCommand(FileQueueHandler.REMOVE);
    removeBtn.addActionListener(this);
    removeBtn.setToolTipText("Remove files from the import queue.");

    buttonPanel.add(Box.createRigidArea(new Dimension(0, 60)));
    //buttonPanel.add(refreshBtn);
    buttonPanel.add(Box.createVerticalGlue());
    buttonPanel.add(addBtn);
    buttonPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    buttonPanel.add(removeBtn);
    buttonPanel.add(Box.createVerticalGlue());
    buttonPanel.add(Box.createRigidArea(new Dimension(0, 60)));
    add(buttonPanel);
    add(Box.createRigidArea(new Dimension(5, 0)));

    JPanel queuePanel = new JPanel();
    if (debugBorders == true)
        queuePanel.setBorder(BorderFactory.createLineBorder(Color.red, 1));
    queuePanel.setLayout(new BoxLayout(queuePanel, BoxLayout.PAGE_AXIS));
    //queuePanel.add(Box.createRigidArea(new Dimension(0,10)));
    JPanel labelPanel = new JPanel();
    labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.LINE_AXIS));
    JLabel label = new JLabel("Import Queue:");
    labelPanel.add(label);
    labelPanel.add(Box.createHorizontalGlue());
    groupBtn = GuiCommonElements.addBasicButton("Group: ", null, "Current Group");
    groupBtn.setToolTipText("The user group you are logged into.");
    //groupBtn.setEnabled(false);
    labelPanel.add(groupBtn);
    queuePanel.add(labelPanel);
    queuePanel.add(Box.createRigidArea(new Dimension(0, 5)));

    TableColumnModel cModel = getQueue().getColumnModel();

    headerCellRenderer = new MyTableHeaderRenderer();
    fileCellRenderer = new LeftDotRenderer();
    dpCellRenderer = new CenterTextRenderer();
    statusCellRenderer = new CenterTextRenderer();

    // Create a custom header for the table
    cModel.getColumn(0).setHeaderRenderer(headerCellRenderer);
    cModel.getColumn(1).setHeaderRenderer(headerCellRenderer);
    cModel.getColumn(2).setHeaderRenderer(headerCellRenderer);
    cModel.getColumn(0).setCellRenderer(fileCellRenderer);
    cModel.getColumn(1).setCellRenderer(dpCellRenderer);
    cModel.getColumn(2).setCellRenderer(statusCellRenderer);

    // Set the width of the status column
    TableColumn statusColumn = getQueue().getColumnModel().getColumn(2);
    statusColumn.setPreferredWidth(statusWidth);
    statusColumn.setMaxWidth(statusWidth);
    statusColumn.setMinWidth(statusWidth);

    SelectionListener listener = new SelectionListener(getQueue());
    getQueue().getSelectionModel().addListSelectionListener(listener);
    //queue.getColumnModel().getSelectionModel()
    //    .addListSelectionListener(listener);

    // Hide 3rd to 6th columns
    TableColumnModel tcm = getQueue().getColumnModel();
    TableColumn projectColumn = tcm.getColumn(6);
    tcm.removeColumn(projectColumn);
    TableColumn userPixelColumn = tcm.getColumn(6);
    tcm.removeColumn(userPixelColumn);
    TableColumn userSpecifiedNameColumn = tcm.getColumn(6);
    tcm.removeColumn(userSpecifiedNameColumn);
    TableColumn datasetColumn = tcm.getColumn(3);
    tcm.removeColumn(datasetColumn);
    TableColumn pathColumn = tcm.getColumn(3);
    tcm.removeColumn(pathColumn);
    TableColumn archiveColumn = tcm.getColumn(3);
    tcm.removeColumn(archiveColumn);

    // Add the table to the scollpane
    JScrollPane scrollPane = new JScrollPane(getQueue());

    queuePanel.add(scrollPane);

    JPanel importPanel = new JPanel();
    importPanel.setLayout(new BoxLayout(importPanel, BoxLayout.LINE_AXIS));
    clearDoneBtn = GuiCommonElements.addBasicButton("Clear Done", null, null);
    clearFailedBtn = GuiCommonElements.addBasicButton("Clear Failed", null, null);
    importBtn = GuiCommonElements.addBasicButton("Import", null, null);
    importPanel.add(Box.createHorizontalGlue());
    importPanel.add(clearDoneBtn);
    clearDoneBtn.setEnabled(false);
    clearDoneBtn.setActionCommand(FileQueueHandler.CLEARDONE);
    clearDoneBtn.addActionListener(this);
    clearDoneBtn.setToolTipText("Clear all 'done' entries from the import queue.");
    importPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    importPanel.add(clearFailedBtn);
    clearFailedBtn.setEnabled(false);
    clearFailedBtn.setActionCommand(FileQueueHandler.CLEARFAILED);
    clearFailedBtn.addActionListener(this);
    clearFailedBtn.setToolTipText("Clear all 'failed' entries from the import queue.");
    importPanel.add(Box.createRigidArea(new Dimension(0, 10)));
    importPanel.add(importBtn);
    importBtn.setEnabled(false);
    importBtn.setActionCommand(FileQueueHandler.IMPORT);
    importBtn.addActionListener(this);
    importBtn.setToolTipText("Begin importing files.");
    GuiCommonElements.enterPressesWhenFocused(importBtn);
    queuePanel.add(Box.createRigidArea(new Dimension(0, 5)));
    queuePanel.add(importPanel);
    add(queuePanel);
}

From source file:io.github.jeremgamer.editor.panels.MusicFrame.java

public MusicFrame(JFrame frame, final GeneralSave gs) {

    ArrayList<BufferedImage> icons = new ArrayList<BufferedImage>();
    try {//  www  .j ava 2 s.  co  m
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon16.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon32.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon64.png")));
        icons.add(ImageIO.read(ImageGetter.class.getResource("icon128.png")));
    } catch (IOException e1) {
        e1.printStackTrace();
    }

    this.setIconImages((List<? extends Image>) icons);

    this.setTitle("Musique");
    this.setSize(new Dimension(300, 225));

    this.addWindowListener(new WindowListener() {
        @Override
        public void windowActivated(WindowEvent event) {
        }

        @Override
        public void windowClosed(WindowEvent event) {
        }

        @Override
        public void windowClosing(WindowEvent event) {
            try {
                gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd"));
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (clip != null) {
                clip.stop();
                clip.close();
                try {
                    audioStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        @Override
        public void windowDeactivated(WindowEvent event) {
        }

        @Override
        public void windowDeiconified(WindowEvent event) {
        }

        @Override
        public void windowIconified(WindowEvent event) {
        }

        @Override
        public void windowOpened(WindowEvent event) {
        }
    });

    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));

    this.setModal(true);
    this.setLocationRelativeTo(frame);

    JPanel properties = new JPanel();
    properties.setBorder(BorderFactory.createTitledBorder("Lecture"));
    ButtonGroup bg = new ButtonGroup();
    bg.add(one);
    bg.add(loop);
    one.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent event) {
            JRadioButton rb = (JRadioButton) event.getSource();
            if (rb.isSelected()) {
                gs.set("music.reading", 0);
                try {
                    gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd"));
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (clip != null) {
                    if (clip.isRunning())
                        clip.loop(0);
                }
            }
        }
    });
    loop.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent event) {
            JRadioButton rb = (JRadioButton) event.getSource();
            if (rb.isSelected()) {
                gs.set("music.reading", 1);
                try {
                    gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd"));
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (clip != null) {
                    if (clip.isRunning())
                        clip.loop(Clip.LOOP_CONTINUOUSLY);
                }
            }
        }
    });
    properties.add(one);
    properties.add(loop);
    if (gs.getInt("music.reading") == 0) {
        one.setSelected(true);
    } else {
        loop.setSelected(true);
    }

    volume.setMaximum(100);
    volume.setMinimum(0);
    volume.setValue(30);
    volume.setPaintTicks(true);
    volume.setPaintLabels(true);
    volume.setMinorTickSpacing(10);
    volume.setMajorTickSpacing(20);
    volume.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            JSlider slider = (JSlider) event.getSource();
            double value = slider.getValue();
            gain = value / 100;
            dB = (float) (Math.log(gain) / Math.log(10.0) * 20.0);
            if (clip != null)
                gainControl.setValue(dB);
            gs.set("music.volume", (int) value);
        }
    });
    volume.setValue(gs.getInt("music.volume"));
    properties.add(volume);
    properties.setPreferredSize(new Dimension(300, 125));

    content.add(properties);

    JPanel browsePanel = new JPanel();
    browsePanel.setBorder(BorderFactory.createTitledBorder(""));
    JButton browse = new JButton("Parcourir...");
    if (new File("projects/" + Editor.getProjectName() + "/music.wav").exists()) {
        preview.setEnabled(false);
        browse.setText("");
        try {
            browse.setIcon(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    browse.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            JButton button = (JButton) event.getSource();
            if (new File("projects/" + Editor.getProjectName() + "/music.wav").exists()) {
                if (clip != null) {
                    clip.stop();
                    clip.close();
                    try {
                        audioStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                name.setText("");
                preview.setEnabled(false);
                button.setText("Parcourir...");
                button.setIcon(null);
                new File("projects/" + Editor.getProjectName() + "/music.wav").delete();
                gs.set("music.name", "");
            } else {
                String path = null;
                JFileChooser chooser = new JFileChooser(Editor.lastPath);
                FileNameExtensionFilter filter = new FileNameExtensionFilter("Audio (WAV)", "wav");
                chooser.setFileFilter(filter);
                chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                int option = chooser.showOpenDialog(null);
                if (option == JFileChooser.APPROVE_OPTION) {
                    path = chooser.getSelectedFile().getAbsolutePath();
                    Editor.lastPath = chooser.getSelectedFile().getParent();
                    copyMusic(new File(path));
                    button.setText("");
                    try {
                        button.setIcon(
                                new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    gs.set("music.name", new File(path).getName());
                    try {
                        gs.save(new File("projects/" + Editor.getProjectName() + "/general.rbd"));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    name.setText(new File(path).getName());
                    preview.setEnabled(true);
                }
            }
        }

    });
    if (new File("projects/" + Editor.getProjectName() + "/music.wav").exists()) {
        preview.setEnabled(true);
    } else {
        preview.setEnabled(false);
    }
    preview.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            JToggleButton tb = (JToggleButton) event.getSource();
            if (tb.isSelected()) {
                try {
                    audioStream = AudioSystem.getAudioInputStream(
                            new File("projects/" + Editor.getProjectName() + "/music.wav"));
                    format = audioStream.getFormat();
                    info = new DataLine.Info(Clip.class, format);
                    clip = (Clip) AudioSystem.getLine(info);
                    clip.open(audioStream);
                    clip.start();
                    gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
                    gainControl.setValue(dB);
                    if (loop.isSelected()) {
                        clip.loop(Clip.LOOP_CONTINUOUSLY);
                    } else {
                        clip.loop(0);
                    }
                    clip.addLineListener(new LineListener() {
                        @Override
                        public void update(LineEvent event) {
                            Clip clip = (Clip) event.getSource();
                            if (!clip.isRunning()) {
                                preview.setSelected(false);
                                clip.stop();
                                clip.close();
                                try {
                                    audioStream.close();
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                            }
                        }

                    });
                } catch (Exception exc) {
                    exc.printStackTrace();
                }
            } else {
                clip.stop();
                clip.close();
                try {
                    audioStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    });
    JPanel buttons = new JPanel();
    buttons.setLayout(new BorderLayout());
    buttons.add(browse, BorderLayout.WEST);
    buttons.add(preview, BorderLayout.EAST);
    browsePanel.setLayout(new BorderLayout());
    browsePanel.add(buttons, BorderLayout.NORTH);
    browsePanel.add(name, BorderLayout.SOUTH);

    name.setPreferredSize(new Dimension(280, 25));
    name.setText(gs.getString("music.name"));
    content.add(browsePanel);

    this.setContentPane(content);
    this.setVisible(true);
}

From source file:QandE.LunarPhasesRB.java

private void addWidgets() {
    /*/* w  w  w .j  a  va 2s  . co m*/
     * Create a label for displaying the moon phase images and
     * put a border around it.
     */
    phaseIconLabel = new JLabel();
    phaseIconLabel.setHorizontalAlignment(JLabel.CENTER);
    phaseIconLabel.setVerticalAlignment(JLabel.CENTER);
    phaseIconLabel.setVerticalTextPosition(JLabel.CENTER);
    phaseIconLabel.setHorizontalTextPosition(JLabel.CENTER);
    phaseIconLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    phaseIconLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0),
            phaseIconLabel.getBorder()));

    //Create radio buttons with lunar phase choices.
    JRadioButton newButton = new JRadioButton("New");
    newButton.setActionCommand("0");
    newButton.setSelected(true);

    JRadioButton waxingCrescentButton = new JRadioButton("Waxing Crescent");
    waxingCrescentButton.setActionCommand("1");

    JRadioButton firstQuarterButton = new JRadioButton("First Quarter");
    firstQuarterButton.setActionCommand("2");

    JRadioButton waxingGibbousButton = new JRadioButton("Waxing Gibbous");
    waxingGibbousButton.setActionCommand("3");

    JRadioButton fullButton = new JRadioButton("Full");
    fullButton.setActionCommand("4");

    JRadioButton waningGibbousButton = new JRadioButton("Waning Gibbous");
    waningGibbousButton.setActionCommand("5");

    JRadioButton thirdQuarterButton = new JRadioButton("Third Quarter");
    thirdQuarterButton.setActionCommand("6");

    JRadioButton waningCrescentButton = new JRadioButton("Waning Crescent");
    waningCrescentButton.setActionCommand("7");

    // Create a button group and add the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(newButton);
    group.add(waxingCrescentButton);
    group.add(firstQuarterButton);
    group.add(waxingGibbousButton);
    group.add(fullButton);
    group.add(waningGibbousButton);
    group.add(thirdQuarterButton);
    group.add(waningCrescentButton);

    // Display the first image.
    phaseIconLabel.setIcon(new ImageIcon("images/image0.jpg"));
    phaseIconLabel.setText("");

    //Make the radio buttons appear in a center-aligned column.
    selectPanel.setLayout(new BoxLayout(selectPanel, BoxLayout.PAGE_AXIS));
    selectPanel.setAlignmentX(Component.CENTER_ALIGNMENT);

    //Add a border around the select panel.
    selectPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Select Phase"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Add a border around the display panel.
    displayPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Display Phase"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Add image and moon phases radio buttons to select panel.
    displayPanel.add(phaseIconLabel);
    selectPanel.add(newButton);
    selectPanel.add(waxingCrescentButton);
    selectPanel.add(firstQuarterButton);
    selectPanel.add(waxingGibbousButton);
    selectPanel.add(fullButton);
    selectPanel.add(waningGibbousButton);
    selectPanel.add(thirdQuarterButton);
    selectPanel.add(waningCrescentButton);

    //Listen to events from the radio buttons.
    newButton.addActionListener(this);
    waxingCrescentButton.addActionListener(this);
    firstQuarterButton.addActionListener(this);
    waxingGibbousButton.addActionListener(this);
    fullButton.addActionListener(this);
    waningGibbousButton.addActionListener(this);
    thirdQuarterButton.addActionListener(this);
    waningCrescentButton.addActionListener(this);

}

From source file:org.isatools.gui.datamanager.exportisa.ExportISAGUI.java

public void createGUI() {
    // header image
    add(UIHelper.wrapComponentInPanel(new JLabel(panelHeader, SwingConstants.RIGHT)), BorderLayout.NORTH);

    // add a checkable jtree with investigations & studies...
    JPanel availableSubmissionsContainer = new JPanel(new BorderLayout());
    availableSubmissionsContainer.setOpaque(false);

    JPanel optionsContainer = new JPanel();
    optionsContainer.setLayout(new BoxLayout(optionsContainer, BoxLayout.LINE_AXIS));
    optionsContainer.setOpaque(false);// www. j a  v a2  s.c  o m

    JPanel optionsAndInformationPanel = new JPanel();
    optionsAndInformationPanel.setLayout(new BoxLayout(optionsAndInformationPanel, BoxLayout.PAGE_AXIS));
    optionsAndInformationPanel.setOpaque(false);

    JLabel fileInformation = UIHelper.createLabel("<html><i>where</i> to save the isatab files?</html>",
            UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR);
    fileInformation.setVerticalAlignment(JLabel.TOP);

    JPanel fileLocationOptionContainer = new JPanel();
    fileLocationOptionContainer.setLayout(new BoxLayout(fileLocationOptionContainer, BoxLayout.PAGE_AXIS));
    fileLocationOptionContainer.setOpaque(false);

    // add component for selection of output to repository or output to folder...
    fileLocationOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true);
    fileLocationOptionGroup.addOptionItem("BII repository", true);
    fileLocationOptionGroup.addOptionItem("Local file system");

    localDirectoryLocation = new FileSelectionUtil("select output directory", createFileChooser(),
            UIHelper.VER_11_BOLD, UIHelper.GREY_COLOR);
    localDirectoryLocation.setVisible(false);
    localDirectoryLocation.setPreferredSize(new Dimension(150, 20));

    fileLocationOptionGroup.addPropertyChangeListener("optionSelectionChange", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            localDirectoryLocation
                    .setVisible(fileLocationOptionGroup.getSelectedItem().equals("Local file system"));
            revalidate();
        }
    });

    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileInformation));
    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileLocationOptionGroup));
    fileLocationOptionContainer.add(Box.createVerticalStrut(5));
    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(localDirectoryLocation));

    optionsContainer.add(fileLocationOptionContainer);

    JPanel dataFileExportOptionContainer = new JPanel();
    dataFileExportOptionContainer.setLayout(new BoxLayout(dataFileExportOptionContainer, BoxLayout.PAGE_AXIS));
    dataFileExportOptionContainer.setOpaque(false);

    JLabel dataFileExportInformation = UIHelper.createLabel("<html>export data files?</html>",
            UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR);
    dataFileExportInformation.setVerticalAlignment(JLabel.TOP);

    dataFileExportOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true);
    dataFileExportOptionGroup.addOptionItem("yes", true);
    dataFileExportOptionGroup.addOptionItem("no");

    dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportInformation));
    dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportOptionGroup));
    dataFileExportOptionContainer.add(Box.createVerticalStrut(25));

    optionsContainer.add(dataFileExportOptionContainer);

    optionsAndInformationPanel.add(Box.createVerticalStrut(5));
    optionsAndInformationPanel.add(optionsContainer);
    optionsAndInformationPanel.add(Box.createVerticalStrut(10));

    JLabel information = UIHelper.createLabel(
            "<html>please <i>select</i> the submissions to be exported...</html>", UIHelper.VER_12_BOLD,
            UIHelper.LIGHT_GREY_COLOR);
    information.setVerticalAlignment(JLabel.TOP);

    optionsAndInformationPanel.add(UIHelper.wrapComponentInPanel(information));
    optionsAndInformationPanel.add(Box.createVerticalStrut(5));

    availableSubmissionsContainer.add(optionsAndInformationPanel, BorderLayout.NORTH);

    retrieveAndProcessStudyInformation();

    JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    treeScroller.getViewport().setOpaque(false);
    treeScroller.setOpaque(false);
    treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1));

    treeScroller.setPreferredSize(new Dimension(380, 250));

    availableSubmissionsContainer.add(treeScroller, BorderLayout.CENTER);
    add(availableSubmissionsContainer, BorderLayout.CENTER);
    add(createSouthPanel(), BorderLayout.SOUTH);
}

From source file:org.isatools.isacreator.wizard.AddAssayPane.java

public JComponent createCenterPanel() {
    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS));
    centerPanel.setOpaque(false);/*  ww  w .  j  ava 2 s. c om*/
    centerPanel.add(Box.createVerticalStrut(15));

    String sourceNameFormat = ConfigurationManager.selectTROForUserSelection(MappingObject.STUDY_SAMPLE)
            .getColumnFormatByName("source name");

    String[] arrayDesigns = retrieveArrayDesigns();

    for (Assay a : assaysToDefine) {
        if (a.getTechnologyType().equalsIgnoreCase("dna microarray")) {
            MicroarrayCreationAlgorithm maAlg = new MicroarrayCreationAlgorithm(study, a, factorsToAdd,
                    treatmentGroups,
                    new TableReferenceObject(ConfigurationManager
                            .selectTROForUserSelection(a.getMeasurementEndpoint(), a.getTechnologyType())
                            .getTableFields()),
                    up.getInstitution(), sourceNameFormat, arrayDesigns);
            algorithmsToRun.add(maAlg);
            centerPanel.add(maAlg);
        } else {
            GeneralCreationAlgorithm gca = new GeneralCreationAlgorithm(study, a, factorsToAdd, treatmentGroups,
                    new TableReferenceObject(ConfigurationManager
                            .selectTROForUserSelection(a.getMeasurementEndpoint(), a.getTechnologyType())
                            .getTableFields()),
                    up.getInstitution(), sourceNameFormat);
            algorithmsToRun.add(gca);
            centerPanel.add(gca);
        }
    }

    JScrollPane assayScroller = new JScrollPane(centerPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    assayScroller.setBackground(UIHelper.BG_COLOR);
    assayScroller.setBorder(null);
    assayScroller.getViewport().setOpaque(false);
    assayScroller.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE);

    IAppWidgetFactory.makeIAppScrollPane(assayScroller);

    return abstractDataEntryEnvironment.getGeneralLayout(
            new ImageIcon(getClass().getResource("/images/wizard/defineassay.png")),
            new ImageIcon(getClass().getResource("/images/wizard/BC_4.png")),
            "Please provide some information about these assays...", assayScroller, getHeight());
}