Example usage for javax.swing BorderFactory createEmptyBorder

List of usage examples for javax.swing BorderFactory createEmptyBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createEmptyBorder.

Prototype

public static Border createEmptyBorder(int top, int left, int bottom, int right) 

Source Link

Document

Creates an empty border that takes up space but which does no drawing, specifying the width of the top, left, bottom, and right sides.

Usage

From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java

/**
 * Build the UI.//from   w ww. j  a va 2  s .  com
 */
private void buildUi() {
    // Set the layout
    setLayout(new BorderLayout());

    // Create a grid bag constraints configuration
    GridBagConstraints c = new GridBagConstraints();

    // Create the container and body state panel
    final JPanel container = new JPanel(new GridBagLayout());
    container.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16));

    // Add the close button
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 0, 0, 0);
    container.add(new JLabel("Select a student to see their details."), c);

    // Add the body state panel to the container
    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(16, 0, 0, 0);
    container.add(buildUiBodyStatePanel(), c);

    // Create the close button
    final JButton closeButton = new JButton("Close");
    closeButton.addActionListener(e -> dispose());

    // Add the close button
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.EAST;
    c.insets = new Insets(8, 0, 0, 0);
    container.add(closeButton, c);

    // Add the container
    add(container, BorderLayout.CENTER);
}

From source file:com.joey.software.memoryToolkit.MemoryUsagePanel.java

/**
 * Creates a new application./*  w w  w. j  a va 2 s  .  c  om*/
 * 
 * @param historyCount
 *            the history count (in milliseconds).
 */
public MemoryUsagePanel(int historyCount, int interval) {
    super(new BorderLayout());
    // create two series that automatically discard data more than 30
    // seconds old...
    this.total = new TimeSeries("Total Memory", Millisecond.class);
    this.total.setMaximumItemCount(historyCount);
    this.free = new TimeSeries("Free Memory", Millisecond.class);
    this.free.setMaximumItemCount(historyCount);
    this.used = new TimeSeries("Used Memory", Millisecond.class);
    this.used.setMaximumItemCount(historyCount);
    this.max = new TimeSeries("Used Memory", Millisecond.class);
    this.max.setMaximumItemCount(historyCount);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(this.total);
    dataset.addSeries(this.free);
    dataset.addSeries(this.used);
    dataset.addSeries(this.max);

    DateAxis domain = new DateAxis("Time");
    NumberAxis range = new NumberAxis("Memory");

    domain.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    range.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    domain.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));

    range.setLabelFont(new Font("SansSerif", Font.PLAIN, 14));
    XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false);
    renderer.setSeriesPaint(0, Color.red);
    renderer.setSeriesPaint(1, Color.green);
    renderer.setSeriesPaint(2, Color.black);

    renderer.setStroke(new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);
    range.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    JFreeChart chart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", Font.BOLD, 24), plot, true);
    chart.setBackgroundPaint(Color.white);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    add(chartPanel);

    gen = new DataGenerator(interval);

}

From source file:net.aepik.alasca.gui.util.LoadFileFrame.java

/**
 * Initialize frame content./*from   www . j  a  v  a 2 s.  c  o m*/
 */
private void initFrame() {
    // - Panel bouton du bas -

    JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    boutonsPanel.add(boutonOk);
    boutonsPanel.add(boutonAnnuler);

    // - Panel nom du fichier -

    JTextArea textAreaFilename = new JTextArea(
            "Indiquez le nom du fichier contenant les dfinitions du schma LDAP que vous souhaitez charger.");
    textAreaFilename.setEditable(false);
    textAreaFilename.setLineWrap(true);
    textAreaFilename.setWrapStyleWord(true);
    textAreaFilename.setFont((new JLabel()).getFont());
    textAreaFilename.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6));
    textAreaFilename.setBackground(new Color(240, 235, 226));

    boutonOpenFile.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 5, 0, 0, boutonsPanel.getBackground()),
            boutonOpenFile.getBorder()));

    JPanel filenamePanel = new JPanel(new BorderLayout());
    filenamePanel.add(textAreaFilename, BorderLayout.NORTH);
    filenamePanel.add(filename, BorderLayout.CENTER);
    filenamePanel.add(boutonOpenFile, BorderLayout.EAST);
    filenamePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Schma LDAP "),
                    BorderFactory.createEmptyBorder(0, 5, 5, 5))));

    // - Panel du selecteur de syntaxes -

    JTextArea textAreaSyntaxes = new JTextArea(
            "Il vous faut appliquer un filtre sur le schma que vous voulez charger. Voici la liste des filtres disponibles :");
    textAreaSyntaxes.setEditable(false);
    textAreaSyntaxes.setLineWrap(true);
    textAreaSyntaxes.setWrapStyleWord(true);
    textAreaSyntaxes.setFont((new JLabel()).getFont());
    textAreaSyntaxes.setBorder(BorderFactory.createEmptyBorder(7, 6, 12, 6));
    textAreaSyntaxes.setBackground(new Color(240, 235, 226));

    JPanel syntaxesPanel = new JPanel(new BorderLayout());
    syntaxesPanel.add(textAreaSyntaxes, BorderLayout.NORTH);
    syntaxesPanel.add(syntaxes);
    syntaxesPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 4, 1, 4),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Syntaxe LDAP "),
                    BorderFactory.createEmptyBorder(0, 5, 5, 5))));

    // On injecte le nom des classes de syntaxes possibles
    // dynamiquement.
    String[] syntaxesName = Schema.getSyntaxeNames();
    for (int i = 0; syntaxesName != null && i < syntaxesName.length; i++) {
        syntaxes.addItem(syntaxesName[i]);
    }

    // - Organisation gnrale -

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(filenamePanel, BorderLayout.NORTH);
    mainPanel.add(syntaxesPanel, BorderLayout.CENTER);

    JPanel mainPanelContainer = new JPanel(new BorderLayout());
    mainPanelContainer.add(mainPanel, BorderLayout.NORTH);
    mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH);
    mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1));

    getContentPane().add(new DescriptiveInternalFrame(mainFrame.getIconImage(),
            "Slectionner un fichier et sa syntaxe.", mainPanelContainer));

    // - Listeners -

    addWindowListener(this);
    boutonOpenFile.addActionListener(this);
    boutonOk.addActionListener(this);
    boutonAnnuler.addActionListener(this);
}

From source file:eu.europeana.sip.gui.SipCreatorGUI.java

public SipCreatorGUI() throws FileStoreException {
    super("Delving SIP Creator");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    MetadataModel metadataModel = loadMetadataModel();
    File fileStoreDirectory = getFileStoreDirectory();
    FileStore fileStore = new FileStoreImpl(fileStoreDirectory, metadataModel);
    GroovyCodeResource groovyCodeResource = new GroovyCodeResource();
    this.dataSetListModel = new DataSetListModel(new DataSetListModel.ConnectedStatus() {
        @Override//www  . j  a  v  a  2s.co  m
        public boolean isConnected() {
            return connectedBox.isSelected();
        }
    });
    this.dataSetList = new JList(dataSetListModel);
    this.sipModel = new SipModel(fileStore, metadataModel, groovyCodeResource, new PopupExceptionHandler());
    this.dataSetClient = new DataSetClient(new DataSetClient.Context() {

        @Override
        public String getServerUrl() {
            return sipModel.getAppConfigModel().getServerUrl();
        }

        @Override
        public String getAccessKey() {
            return sipModel.getAppConfigModel().getAccessKey();
        }

        @Override
        public void setInfo(DataSetInfo dataSetInfo) {
            dataSetListModel.setDataSetInfo(dataSetInfo);
            dataSetActions.setDataSetInfo(dataSetInfo);
        }

        @Override
        public void setList(List<DataSetInfo> list) {
            if (list != null) {
                Set<String> untouched = dataSetListModel.setDataSetInfoList(list);
                if (!untouched.isEmpty()) {
                    dataSetActions.setUntouched(untouched);
                }
                for (DataSetInfo dataSetInfo : list) {
                    dataSetActions.setDataSetInfo(dataSetInfo);
                }
            } else {
                log.warn("received empty list from the server");
            }
        }

        @Override
        public void tellUser(String message) {
            sipModel.getUserNotifier().tellUser(message);
        }

        @Override
        public void disconnected() {
            connectedBox.setSelected(false);
            sipModel.getUserNotifier().tellUser(String.format("Disconnected from Repository at %s",
                    sipModel.getAppConfigModel().getServerHostPort()));
        }
    });
    dataSetActions = new DataSetActions(this, sipModel, dataSetClient, new Runnable() {
        @Override
        public void run() {
            dataSetListModel.clear();
            for (FileStore.DataSetStore dataSetStore : sipModel.getFileStore().getDataSetStores().values()) {
                dataSetListModel.setDataSetStore(dataSetStore);
            }
            dataSetListModel.setPattern(filter.getText());
        }
    });
    setJMenuBar(createMenuBar());
    JPanel main = new JPanel(new BorderLayout(MARGIN, MARGIN));
    main.setBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, MARGIN, MARGIN));
    JPanel north = new JPanel(new BorderLayout());
    north.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(MARGIN, MARGIN, 0, MARGIN),
                    BorderFactory.createRaisedBevelBorder()));
    titleLabel.setOpaque(true);
    titleLabel.setFont(new Font("Sans", Font.BOLD, 24));
    JLabel northRight = new JLabel(new ImageIcon(getClass().getResource("/delving-logo.png")));
    north.add(createFilterPanel(), BorderLayout.WEST);
    north.add(titleLabel, BorderLayout.CENTER);
    north.add(northRight, BorderLayout.EAST);
    getContentPane().add(north, BorderLayout.NORTH);
    getContentPane().add(main, BorderLayout.CENTER);
    JPanel south = new JPanel(new GridLayout(1, 0));
    south.add(createConnectPanel());
    south.add(createFinishedPanel());
    getContentPane().add(south, BorderLayout.SOUTH);
    main.add(createList(), BorderLayout.CENTER);
    main.add(dataSetActions.getPanel(), BorderLayout.EAST);
    setSize(SIZE);
    setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - SIZE.width) / 2,
            (Toolkit.getDefaultToolkit().getScreenSize().height - SIZE.height) / 2);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            for (FileStore.DataSetStore dataSetStore : sipModel.getFileStore().getDataSetStores().values()) {
                dataSetListModel.setDataSetStore(dataSetStore);
            }
        }
    });
}

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);/*from w w w. j  a  v a  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;

}

From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java

/**
 * Create a UI panel to show export progress
 *//*from  w  w w. j ava2s .co  m*/
private void createStatusPane() {
    this.statusPanel = new JPanel();
    this.statusPanel.setBackground(Color.white);
    this.statusPanel.setLayout(new BorderLayout(5, 5));
    this.statusPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0));

    JPanel content = new JPanel();
    content.setBackground(Color.white);
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    content.add(Box.createVerticalStrut(30));
    JLabel l = new JLabel("Status", SwingConstants.CENTER);
    l.setAlignmentX(CENTER_ALIGNMENT);
    l.setFont(JuxtaUserInterfaceStyle.LARGE_FONT);
    content.add(l);
    content.add(Box.createVerticalStrut(10));
    this.statusLabel = new JLabel("", SwingConstants.CENTER);
    this.statusLabel.setAlignmentX(CENTER_ALIGNMENT);
    this.setFont(JuxtaUserInterfaceStyle.NORMAL_FONT);
    content.add(this.statusLabel);
    this.statusPanel.add(content, BorderLayout.CENTER);

    JPanel p = new JPanel();
    p.setBackground(Color.white);
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(Box.createHorizontalGlue());
    this.workAnimation = new JLabel();
    this.workAnimation.setIcon(JuxtaUserInterfaceStyle.WORKING_ANIMATION);
    p.add(this.workAnimation);
    p.add(Box.createHorizontalGlue());
    this.statusPanel.add(p, BorderLayout.NORTH);
}

From source file:ja.lingo.application.gui.main.describer.DescriberGui.java

public DescriberGui(Model model, Actions actions, IEngine engine, DropHandler dropHandler) {
    this.model = model;
    this.engine = engine;

    this.model.addApplicationModelListener(new ModelAdapter() {
        public void initialize(Preferences preferences) {
            cardPanel.show(welcomePanel);
        }/*from w  w w . j a  v a2s .  c o  m*/

        public void translate(IArticle article, String highlight) {
            LOG.info("translating \"" + article.getTitle() + "\"...");
            articlePanel.setArticle(article, highlight);
            cardPanel.show(describerPanel);
        }

        public void translateNotFound(String articleTitle) {
            articleNotFoundPanel.update(articleTitle, getClosestArticleTitleFor(articleTitle),
                    !DescriberGui.this.engine.getFinder().isEmpty());
            cardPanel.show(articleNotFoundPanel);
        }

        public void find(String text, boolean fromStart, boolean forwardDirection, boolean caseSensetive,
                boolean wholeWordsOnly) {
            DescriberGui.this.find(text, fromStart, forwardDirection, caseSensetive, wholeWordsOnly);
        }

        public void find_show() {
            showFindGui();
        };
    });

    articlePanel = new ArticlePanel(engine, false);

    findGui = new FindGui(model);

    menu = new DescriberMenu(actions);
    menuOnSelect = new DescriberMenuOnSelect(engine);

    describerPanel = new JPanel(new BorderLayout());
    describerPanel.add(articlePanel.getGui(), BorderLayout.CENTER);
    describerPanel.add(findGui.getGui(), BorderLayout.SOUTH);

    articleNotFoundPanel = new ArticleNotFoundPanel(model);
    welcomePanel = new WelcomePanel(actions);

    cardPanel = new CardPanel();
    cardPanel.add(describerPanel);
    cardPanel.add(articleNotFoundPanel);
    cardPanel.add(welcomePanel);

    cardPanel.getGui().setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 1)));

    articlePanel.getEditorPane().setTransferHandler(dropHandler);
    articleNotFoundPanel.getGui().setTransferHandler(dropHandler);
    welcomePanel.getGui().setTransferHandler(dropHandler);

    ActionBinder.bind(this);
}

From source file:net.mitnet.tools.pdf.book.publisher.ui.gui.BookPublisherGUI2.java

/**
 * Initialise widgets.//  www.  ja  va2  s.  c  om
 */
protected void initComponents() {

    // frame
    this.frame = new JFrame();
    this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    this.frame.setTitle(FRAME_TITLE);

    // input dir panel

    inputDirLabel = new JLabel();
    inputDirLabel.setText("Input Folder:");

    inputDirField = new JTextField();
    inputDirField.setColumns(FILE_TEXTFIELD_WIDTH);

    inputDirButton = new JButton();
    inputDirButton.setText("Browse ...");
    inputDirButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            inputDirButtonActionHandler(event);
        }
    });

    JPanel inputDirPanel = new JPanel();
    // inputDirPanel.setLayout( new BoxLayout( inputDirPanel, BoxLayout.X_AXIS ) );
    inputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    inputDirPanel.add(inputDirLabel);
    inputDirPanel.add(inputDirField);
    inputDirPanel.add(inputDirButton);

    // output dir panel

    outputDirLabel = new JLabel();
    outputDirLabel.setText("Output Folder:");

    outputDirField = new JTextField();
    outputDirField.setColumns(FILE_TEXTFIELD_WIDTH);

    outputDirButton = new JButton();
    outputDirButton.setText("Browse ...");
    outputDirButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            outputDirButtonActionHandler(event);
        }
    });

    JPanel outputDirPanel = new JPanel();
    // outputDirPanel.setLayout( new BoxLayout( outputDirPanel, BoxLayout.X_AXIS ) );
    outputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    outputDirPanel.add(outputDirLabel);
    outputDirPanel.add(outputDirField);
    outputDirPanel.add(outputDirButton);

    // document control panel
    docControlPanel = new JPanel();
    docControlPanel.setLayout(new BoxLayout(docControlPanel, BoxLayout.Y_AXIS));
    docControlPanel.add(inputDirPanel);
    docControlPanel.add(outputDirPanel);
    // Border docControlPanelBorder = BorderFactory.createTitledBorder("Documents");
    Border docControlPanelBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Documents"), BorderFactory.createEmptyBorder(5, 5, 5, 5));
    docControlPanel.setBorder(docControlPanelBorder);

    // publish button
    publishButton = new JButton();
    publishButton.setText("Publish");
    publishButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            publishButtonActionHandler(event);
        }
    });

    // status message label
    statusMessageLabel = new JLabel();
    // String statusMessageText = "Press " + publishButton.getText() + " to start.";
    String statusMessageText = "";
    statusMessageLabel.setText(statusMessageText);
    // statusMessageLabel.setVisible(false);

    // progress bar
    progressBar = new JProgressBar();

    // exit button
    exitButton = new JButton();
    exitButton.setText("Exit");
    exitButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            exitButtonActionHandler(event);
        }
    });

    // build main panel
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(docControlPanel);
    // mainPanel.add(new Spacer());
    mainPanel.add(publishButton);
    // mainPanel.add(new Spacer());
    mainPanel.add(progressBar);
    // mainPanel.add(new Spacer());
    mainPanel.add(statusMessageLabel);
    // mainPanel.add(new Spacer());
    mainPanel.add(exitButton);

    // add main panel to frame
    this.frame.getContentPane().setLayout(new BoxLayout(this.frame.getContentPane(), BoxLayout.Y_AXIS));
    this.frame.getContentPane().add(mainPanel);
    // this.frame.setSize(800,600);
    this.frame.pack();

}

From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java

/**
 * Build frame.//  ww w.j  a v  a  2 s.  c o m
 */
private void build() {
    setTitle("Proprits de l'objet " + objetSchema.getId());
    setSize(700, 400);
    setResizable(false);
    setLocationRelativeTo(mainFrame);

    if (mainFrame != null)
        setIconImage(mainFrame.getIconImage());

    // - Panel bouton du bas -

    JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    boutonsPanel.add(boutonOk);
    boutonsPanel.add(boutonAnnuler);

    // - Description -

    JTextArea textAreaValues = new JTextArea("Vous pouvez apporter des modifications sur les paramtres"
            + " de cet objet d'identifiant " + objetSchema.getId() + ". Les"
            + " modifications apportes  des paramtres non-cochs ne" + " seront pas prises en compte.");
    textAreaValues.setEditable(false);
    textAreaValues.setLineWrap(true);
    textAreaValues.setWrapStyleWord(true);
    textAreaValues.setFont((new JLabel()).getFont());
    textAreaValues.setBorder(BorderFactory.createEmptyBorder(7, 8, 7, 8));
    textAreaValues.setBackground((new JLabel()).getBackground());

    // - La table des valeurs -
    // Correction : Tri alphabtique des valeurs

    Enumeration<String> k = values.keys();
    String[] keys = new String[values.size()];

    for (int i = 0; i < keys.length; i++)
        keys[i] = k.nextElement();
    Arrays.sort(keys);

    JPanel colonne1 = new JPanel(new GridLayout(keys.length, 1));
    JPanel colonne2 = new JPanel(new GridLayout(keys.length, 1));

    // Enumeration<JComponent> l = labels.elements();
    // Enumeration<JComponent> v = values.elements();
    // Enumeration<String> k = values.keys();
    // JPanel colonne1 = new JPanel( new GridLayout( values.size(), 1 ) );
    // JPanel colonne2 = new JPanel( new GridLayout( values.size(), 1 ) );

    for (int i = 0; keys != null && i < keys.length; i++) {

        // while( l.hasMoreElements() && v.hasMoreElements() && k.hasMoreElements() ) {

        String key = keys[i];
        JComponent label = labels.get(key);
        JComponent value = values.get(key);
        JCheckBox checkbox = valuesPresent.get(key);

        // String key = k.nextElement();
        // JComponent label = l.nextElement();
        // JComponent value = v.nextElement();
        // JCheckBox checkbox = valuesPresent.get( key );

        if (!value.isEnabled() && value instanceof JTextField) {

            //value.setEnabled( true );

            JButton b = new JButton("...");
            b.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createMatteBorder(0, 5, 0, 0, Color.white), b.getBorder()));
            b.addActionListener(new SchemaValueEditorLauncher(b, (JTextField) value, objetSchema, key));

            JPanel tmp = new JPanel(new BorderLayout());
            tmp.add(value, BorderLayout.CENTER);
            tmp.add(b, BorderLayout.EAST);
            tmp.setOpaque(false);
            value = tmp;
        }

        JPanel panelTmp1 = new JPanel(new BorderLayout());
        panelTmp1.add(checkbox, BorderLayout.WEST);
        panelTmp1.add(label, BorderLayout.CENTER);
        panelTmp1.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 3));
        colonne1.add(panelTmp1);

        JPanel panelTmp2 = new JPanel(new BorderLayout());
        panelTmp2.add(value, BorderLayout.CENTER);
        panelTmp2.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
        colonne2.add(panelTmp2);

        checkbox.setOpaque(false);
        label.setOpaque(false);
        value.setOpaque(false);
        panelTmp1.setOpaque(false);
        panelTmp2.setOpaque(false);
    }

    JPanel tablePanel = new JPanel(new BorderLayout());
    tablePanel.add(colonne1, BorderLayout.WEST);
    tablePanel.add(colonne2, BorderLayout.EAST);
    tablePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    colonne1.setOpaque(false);
    colonne2.setOpaque(false);
    tablePanel.setOpaque(false);

    JPanel tablePanelContainer = new JPanel(new BorderLayout());
    tablePanelContainer.add(tablePanel, BorderLayout.NORTH);
    tablePanelContainer.setBackground(Color.white);

    JList tmpForBorderList = new JList();
    JScrollPane tmpForBorderScroller = new JScrollPane(tmpForBorderList);

    JScrollPane tableScroller = new JScrollPane(tablePanelContainer);
    //tableScroller.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
    tableScroller.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 6, 1, 6),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Listes des paramtres "),
                    BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5),
                            tmpForBorderScroller.getBorder()))));

    // - Organisation gnrale -

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(textAreaValues, BorderLayout.NORTH);
    mainPanel.add(tableScroller, BorderLayout.CENTER);

    JPanel mainPanelContainer = new JPanel(new BorderLayout());
    mainPanelContainer.add(mainPanel, BorderLayout.CENTER);
    mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH);
    mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1));

    getContentPane().add(mainPanelContainer);

    // - Listeners -

    addWindowListener(this);
    boutonOk.addActionListener(this);
    boutonAnnuler.addActionListener(this);
}

From source file:gui.TwopointPWDPanelnonsnp.java

private JPanel createControls() {
    // Marker model (for ordered list of markers)
    markerModel = new PWDTableModel();

    // Populate the marker table
    markerTable = new JTable(markerModel);
    markerTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    markerTable.getColumnModel().getColumn(0).setPreferredWidth(60);
    markerTable.getColumnModel().getColumn(1).setPreferredWidth(130);
    markerTable.getColumnModel().getColumn(2).setPreferredWidth(50);// ratio
    markerTable.getColumnModel().getColumn(3).setPreferredWidth(70);// geno
    markerTable.getColumnModel().getColumn(4).setPreferredWidth(50);// p1
    markerTable.getColumnModel().getColumn(5).setPreferredWidth(50);// p2
    for (CMarker cm : order.getLinkageGroup().getMarkers()) {
        markerModel.addRow(new Object[] { cm.marker.getPrefix(), cm, cm.marker.getRatio(),
                cm.marker.getRatioGenotypes(), "0000", "0000" });
    }//from w w  w  .  j  ava 2  s. c  o m
    markerTable.getSelectionModel().addListSelectionListener(this);

    if (order.rows != null) {
        int row = 0;
        for (String[] data : order.rows) {
            for (int i = 0; i < 2; i++) {
                markerModel.setValueAt(data[i], row, i + 4);
            }
            row++;
        }
    } else {
        order.rows = getSelection();
    }

    // Phase model (for scores of each ordered marker against the others)
    phaseModel = new PWDTableModel2();
    phaseModel.setColumnIdentifiers(new Object[] { "Graph Code", "Marker Name", "Recom Freq", "LOD Score" });

    phaseTable = new JTable(phaseModel);
    phaseTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    phaseTable.getSelectionModel().addListSelectionListener(this);

    rfqChart = new PWDChartPanel("Recombination Freq");
    lodChart = new PWDChartPanel("LOD Score");

    m1Label = new JLabel("");
    m1Label.setFont(new Font("Monospaced", Font.PLAIN, 11));
    m2Label = new JLabel("");
    m2Label.setFont(new Font("Monospaced", Font.PLAIN, 11));

    JScrollPane mSP = new JScrollPane(markerTable);
    mSP.setPreferredSize(new Dimension(300, 10));

    JPanel p1 = new JPanel(new BorderLayout(5, 0));
    p1.add(new JLabel("Ordered Markers:"), BorderLayout.NORTH);
    p1.add(mSP);

    JPanel p2 = new JPanel(new BorderLayout(5, 0));
    p2.add(new JLabel("Scores:"), BorderLayout.NORTH);
    p2.add(new JScrollPane(phaseTable));

    JPanel p3 = new JPanel(new GridLayout(2, 1, 2, 2));
    p3.setBorder(BorderFactory.createLoweredBevelBorder());
    p3.add(m1Label);
    p3.add(m2Label);

    JPanel p4 = new JPanel(new GridLayout(1, 2, 5, 5));
    p4.add(rfqChart);
    p4.add(lodChart);

    JPanel p5 = new JPanel(new BorderLayout(5, 5));
    p5.add(p3, BorderLayout.NORTH);
    p5.add(p4, BorderLayout.CENTER);

    JSplitPane splits = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splits.setResizeWeight(0.5);
    splits.setLeftComponent(p1);
    splits.setRightComponent(p2);

    JPanel p6 = new JPanel(new BorderLayout(5, 5));
    p6.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    p6.add(splits);
    p6.add(p5, BorderLayout.SOUTH);

    return p6;
}