Example usage for javax.swing.border EmptyBorder EmptyBorder

List of usage examples for javax.swing.border EmptyBorder EmptyBorder

Introduction

In this page you can find the example usage for javax.swing.border EmptyBorder EmptyBorder.

Prototype

public EmptyBorder(int top, int left, int bottom, int right) 

Source Link

Document

Creates an empty border with the specified insets.

Usage

From source file:LayeredPaneDemo2.java

protected void createTitleBar() {
    m_titlePanel = new JPanel() {
        public Dimension getPreferredSize() {
            return new Dimension(InnerFrame.this.getWidth(), m_titleBarHeight);
        }/*from   w  ww  . j ava 2s  .c om*/
    };
    m_titlePanel.setLayout(new BorderLayout());
    m_titlePanel.setOpaque(true);
    m_titlePanel.setBackground(TITLE_BAR_BG_COLOR);

    m_titleLabel = new JLabel();
    m_titleLabel.setForeground(Color.black);

    m_close = new InnerFrameButton(CLOSE_BUTTON_ICON);
    m_close.setPressedIcon(PRESS_CLOSE_BUTTON_ICON);
    m_close.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            InnerFrame.this.close();
        }
    });

    m_maximize = new InnerFrameButton(MAXIMIZE_BUTTON_ICON);
    m_maximize.setPressedIcon(PRESS_MAXIMIZE_BUTTON_ICON);
    m_maximize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            InnerFrame.this.setMaximized(!InnerFrame.this.isMaximized());
        }
    });

    m_iconize = new InnerFrameButton(ICONIZE_BUTTON_ICON);
    m_iconize.setPressedIcon(PRESS_ICONIZE_BUTTON_ICON);
    m_iconize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            InnerFrame.this.setIconified(!InnerFrame.this.isIconified());
        }
    });

    m_buttonWrapperPanel = new JPanel();
    m_buttonWrapperPanel.setOpaque(false);
    m_buttonPanel = new JPanel(new GridLayout(1, 3));
    m_buttonPanel.setOpaque(false);
    m_buttonPanel.add(m_iconize);
    m_buttonPanel.add(m_maximize);
    m_buttonPanel.add(m_close);
    m_buttonPanel.setAlignmentX(0.5f);
    m_buttonPanel.setAlignmentY(0.5f);
    m_buttonWrapperPanel.add(m_buttonPanel);

    m_iconLabel = new JLabel();
    m_iconLabel.setBorder(
            new EmptyBorder(FRAME_ICON_PADDING, FRAME_ICON_PADDING, FRAME_ICON_PADDING, FRAME_ICON_PADDING));
    if (m_frameIcon != null)
        m_iconLabel.setIcon(m_frameIcon);

    m_titlePanel.add(m_titleLabel, BorderLayout.CENTER);
    m_titlePanel.add(m_buttonWrapperPanel, BorderLayout.EAST);
    m_titlePanel.add(m_iconLabel, BorderLayout.WEST);

    InnerFrameTitleBarMouseAdapter iftbma = new InnerFrameTitleBarMouseAdapter(this);
    m_titlePanel.addMouseListener(iftbma);
    m_titlePanel.addMouseMotionListener(iftbma);
}

From source file:com.orthancserver.SelectImageDialog.java

public SelectImageDialog() {
    tree_ = new JTree();

    tree_.addTreeWillExpandListener(new TreeWillExpandListener() {
        @Override//from  w  w w . j a v  a2  s  .co m
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
            TreePath path = event.getPath();
            if (path.getLastPathComponent() instanceof MyTreeNode) {
                MyTreeNode node = (MyTreeNode) path.getLastPathComponent();
                node.LoadChildren((DefaultTreeModel) tree_.getModel());
            }
        }

        @Override
        public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
        }
    });

    tree_.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getNewLeadSelectionPath();
            if (path != null) {
                MyTreeNode node = (MyTreeNode) path.getLastPathComponent();
                if (node.UpdatePreview(preview_)) {
                    selectedType_ = node.GetResourceType();
                    selectedUuid_ = node.GetUuid();
                    selectedConnection_ = node.GetConnection();
                    okButton_.setEnabled(true);
                }

                removeServer_.setEnabled(node.GetResourceType() == ResourceType.SERVER);
            }
        }
    });

    tree_.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            TreePath path = tree_.getPathForLocation(e.getX(), e.getY());
            if (path != null) {
                MyTreeNode node = (MyTreeNode) path.getLastPathComponent();
                if (e.getClickCount() == 2 && node.GetResourceType() == ResourceType.INSTANCE) {
                    // Double click on an instance, close the dialog
                    isSuccess_ = true;
                    setVisible(false);
                }
            }
        }
    });

    final JPanel contentPanel = new JPanel();
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        JSplitPane splitPane = new JSplitPane();
        splitPane.setResizeWeight(0.6);
        contentPanel.add(splitPane);

        splitPane.setLeftComponent(new JScrollPane(tree_));
        splitPane.setRightComponent(preview_);
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton btnAddServer = new JButton("Add server");
            btnAddServer.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    OrthancConfigurationDialog dd = new OrthancConfigurationDialog();
                    dd.setLocationRelativeTo(null); // Center dialog on screen

                    OrthancConnection orthanc = dd.ShowModal();
                    if (orthanc != null) {
                        AddOrthancServer(orthanc);
                        ((DefaultTreeModel) tree_.getModel()).reload();
                    }
                }
            });
            buttonPane.add(btnAddServer);
        }

        {
            buttonPane.add(removeServer_);
            removeServer_.setEnabled(false);

            removeServer_.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    MyTreeNode selected = (MyTreeNode) tree_.getLastSelectedPathComponent();
                    if (selected.GetResourceType() == ResourceType.SERVER && JOptionPane.showConfirmDialog(null,
                            "Remove server \"" + selected.getUserObject() + "\"?", "WARNING",
                            JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                        ((DefaultTreeModel) tree_.getModel()).removeNodeFromParent(selected);
                    }
                }
            });
        }

        {
            okButton_.setEnabled(false);
            okButton_.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    isSuccess_ = true;
                    setVisible(false);
                }
            });
            buttonPane.add(okButton_);
            getRootPane().setDefaultButton(okButton_);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    setVisible(false);
                }
            });
            buttonPane.add(cancelButton);
        }
    }

    setUndecorated(false);
    setSize(500, 500);
    setTitle("Select some series or some instance in Orthanc");
    setModal(true);
}

From source file:edu.harvard.mcz.imagecapture.GeoreferenceDialog.java

private void init() {
    setBounds(100, 100, 450, 560);//w w w .  jav a2 s .co m
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new GridLayout(0, 2, 0, 0));
    {
        JLabel lblLatitude = new JLabel("Latitude");
        lblLatitude.setHorizontalAlignment(SwingConstants.RIGHT);
        contentPanel.add(lblLatitude);
    }

    textFieldDecimalLat = new JTextField();
    contentPanel.add(textFieldDecimalLat);
    textFieldDecimalLat.setColumns(10);

    JLabel lblLongitude = new JLabel("Longitude");
    lblLongitude.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongitude);
    {
        textFieldDecimalLong = new JTextField();
        contentPanel.add(textFieldDecimalLong);
        textFieldDecimalLong.setColumns(10);
    }
    {
        JLabel lblDatum = new JLabel("Datum");
        lblDatum.setHorizontalAlignment(SwingConstants.RIGHT);
        contentPanel.add(lblDatum);
    }

    @SuppressWarnings("unchecked")
    ComboBoxModel<String> datumModel = new ListComboBoxModel<String>(LatLong.getDatumValues());
    cbDatum = new JComboBox<String>(datumModel);
    contentPanel.add(cbDatum);

    JLabel lblMethod = new JLabel("Method");
    lblMethod.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblMethod);

    @SuppressWarnings("unchecked")
    ComboBoxModel<String> methodModel = new ListComboBoxModel<String>(LatLong.getGeorefMethodValues());
    cbMethod = new JComboBox<String>(new DefaultComboBoxModel<String>(new String[] { "not recorded", "unknown",
            "GEOLocate", "Google Earth", "Gazeteer", "GPS", "MaNIS/HertNet/ORNIS Georeferencing Guidelines" }));
    cbMethod.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setState();
        }
    });
    contentPanel.add(cbMethod);

    JLabel lblAccuracy = new JLabel("GPS Accuracy");
    lblAccuracy.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblAccuracy);

    txtGPSAccuracy = new JTextField();
    txtGPSAccuracy.setColumns(10);
    contentPanel.add(txtGPSAccuracy);

    JLabel lblNewLabel_1 = new JLabel("Original Units");
    lblNewLabel_1.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblNewLabel_1);

    comboBoxOrigUnits = new JComboBox<String>();
    comboBoxOrigUnits.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setState();
        }
    });
    comboBoxOrigUnits.setModel(new DefaultComboBoxModel<String>(
            new String[] { "decimal degrees", "deg. min. sec.", "degrees dec. minutes", "unknown" }));
    contentPanel.add(comboBoxOrigUnits);

    lblErrorRadius = new JLabel("Error Radius");
    lblErrorRadius.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblErrorRadius);

    txtErrorRadius = new JTextField();
    txtErrorRadius.setColumns(10);
    contentPanel.add(txtErrorRadius);

    JLabel lblErrorRadiusUnits = new JLabel("Error Radius Units");
    lblErrorRadiusUnits.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblErrorRadiusUnits);

    comboBoxErrorUnits = new JComboBox<String>();
    comboBoxErrorUnits.setModel(new DefaultComboBoxModel<String>(new String[] { "m", "ft", "km", "mi", "yd" }));
    contentPanel.add(comboBoxErrorUnits);

    JLabel lblLatDegrees = new JLabel("Lat Degrees");
    lblLatDegrees.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatDegrees);

    txtLatDegrees = new JTextField();
    txtLatDegrees.setColumns(4);
    contentPanel.add(txtLatDegrees);

    JLabel lblLatDecMin = new JLabel("Lat Dec Min");
    lblLatDecMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatDecMin);

    txtLatDecMin = new JTextField();
    txtLatDecMin.setColumns(6);
    contentPanel.add(txtLatDecMin);

    JLabel lblLatMin = new JLabel("Lat Min");
    lblLatMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatMin);

    txtLatMin = new JTextField();
    txtLatMin.setColumns(6);
    contentPanel.add(txtLatMin);

    JLabel lblLatSec = new JLabel("Lat Sec");
    lblLatSec.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatSec);

    txtLatSec = new JTextField();
    txtLatSec.setColumns(6);
    contentPanel.add(txtLatSec);

    JLabel lblLatDir = new JLabel("Lat N/S");
    lblLatDir.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLatDir);

    cbLatDir = new JComboBox<String>();
    cbLatDir.setModel(new DefaultComboBoxModel<String>(new String[] { "N", "S" }));
    contentPanel.add(cbLatDir);

    JLabel lblLongDegrees = new JLabel("Long Degrees");
    lblLongDegrees.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongDegrees);

    txtLongDegrees = new JTextField();
    txtLongDegrees.setColumns(4);
    contentPanel.add(txtLongDegrees);

    JLabel lblLongDecMin = new JLabel("Long Dec Min");
    lblLongDecMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongDecMin);

    txtLongDecMin = new JTextField();
    txtLongDecMin.setColumns(6);
    contentPanel.add(txtLongDecMin);

    JLabel lblLongMin = new JLabel("Long Min");
    lblLongMin.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongMin);

    txtLongMin = new JTextField();
    txtLongMin.setColumns(6);
    contentPanel.add(txtLongMin);

    JLabel lblLongSec = new JLabel("Long Sec");
    lblLongSec.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongSec);

    txtLongSec = new JTextField();
    txtLongSec.setColumns(6);
    contentPanel.add(txtLongSec);

    JLabel lblLongDir = new JLabel("Long E/W");
    lblLongDir.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblLongDir);

    cbLongDir = new JComboBox<String>();
    cbLongDir.setModel(new DefaultComboBoxModel<String>(new String[] { "E", "W" }));
    contentPanel.add(cbLongDir);

    JLabel lblDetBy = new JLabel("Determined By");
    lblDetBy.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblDetBy);

    textFieldDetBy = new JTextField();
    contentPanel.add(textFieldDetBy);
    textFieldDetBy.setColumns(10);

    JLabel lblDetDate = new JLabel("Date Determined");
    lblDetDate.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblDetDate);

    try {
        textDetDate = new JFormattedTextField(new MaskFormatter("####-##-##"));
    } catch (ParseException e1) {
        textDetDate = new JFormattedTextField();
    }
    textDetDate.setToolTipText("Date on which georeference was made yyyy-mm-dd");
    contentPanel.add(textDetDate);

    JLabel lblRef = new JLabel("Reference Source");
    lblRef.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblRef);

    textRefSource = new JTextField();
    contentPanel.add(textRefSource);
    textRefSource.setColumns(10);

    lblNewLabel = new JLabel("Remarks");
    lblNewLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    contentPanel.add(lblNewLabel);

    textFieldRemarks = new JTextField();
    contentPanel.add(textFieldRemarks);
    textFieldRemarks.setColumns(10);

    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            lblErrorLabel = new JLabel("Message");
            buttonPane.add(lblErrorLabel);
        }
        {
            okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    lblErrorLabel.setText("");

                    if (saveData()) {
                        setVisible(false);
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    loadData();
                    setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}

From source file:com.diversityarrays.kdxplore.boxplot.BoxPlotPanel.java

private Box generateControls() {

    for (JCheckBox jcb : Arrays.asList(showOutliers, showMean, showMedian)) {
        ActionListener optionsActionListener = new ActionListener() {
            @Override/* ww w. j a  v  a 2  s . com*/
            public void actionPerformed(ActionEvent e) {
                generateGraph(Why.OPTION_CHANGED);
                setSpinnerRanges();
            }
        };
        jcb.addActionListener(optionsActionListener);
        jcb.setSelected(true);
    }

    JLabel infoLabel = new JLabel(Msg.LABEL_SHOW_PARAMETERS());
    infoLabel.setBorder(new EmptyBorder(3, 3, 3, 3));

    Box hbox = Box.createHorizontalBox();
    hbox.add(syncedOption);
    hbox.add(minSpinner);
    hbox.add(new JLabel(" - ")); //$NON-NLS-1$
    hbox.add(maxSpinner);
    hbox.add(infoLabel);
    hbox.add(showOutliers);
    hbox.add(showMean);
    hbox.add(showMedian);

    return hbox;
}

From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java

private void initGuiComponents() {
    fileListModel = new FileListTableModel();
    fileList = new FileListTable(fileListModel);
    fileList.addKeyListener(new KeyAdapter() {
        @Override/*from www  .ja  va 2s  . c om*/
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                openSelectedFile();
                e.consume();
            }
        }
    });
    fileList.setAutoCreateColumnsFromModel(true);
    fileList.setDropMode(DropMode.ON_OR_INSERT_ROWS);
    fileList.setFillsViewportHeight(true);
    fileList.setGridColor(new Color(-1));

    fileListScrollPane = new JScrollPane(fileList);
    fileListScrollPane.setAutoscrolls(false);
    fileListScrollPane.setBackground(UIManager.getColor("TableHeader.background"));
    fileListScrollPane.setPreferredSize(new Dimension(100, 128));
    fileListScrollPane.setEnabled(false);

    //
    // toolbar
    //

    final JToolBar toolBar1 = new JToolBar();
    toolBar1.setBorderPainted(false);
    toolBar1.setFloatable(false);
    toolBar1.setRollover(true);
    toolBar1.putClientProperty("JToolBar.isRollover", Boolean.TRUE);

    homeDirectoryButton = new JButton();
    homeDirectoryButton.setHorizontalAlignment(2);
    homeDirectoryButton.setIcon(GUIHelper.HOME_ICON);
    homeDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    homeDirectoryButton.setText("");
    homeDirectoryButton.setToolTipText("Go to home directory");
    homeDirectoryButton.setEnabled(false);
    toolBar1.add(homeDirectoryButton);

    refreshButton = new JButton();
    refreshButton.setHorizontalAlignment(2);
    refreshButton.setIcon(new ImageIcon(getClass().getResource("/images/refresh.gif")));
    refreshButton.setMargin(new Insets(3, 3, 3, 3));
    refreshButton.setText("");
    refreshButton.setToolTipText("Refresh current directory listing");
    refreshButton.setEnabled(false);
    toolBar1.add(refreshButton);

    upDirectoryButton = new JButton();
    upDirectoryButton.setHideActionText(false);
    upDirectoryButton.setHorizontalAlignment(2);
    upDirectoryButton.setIcon(GUIHelper.UP_DIR_ICON);
    upDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    upDirectoryButton.setToolTipText("Up");
    upDirectoryButton.setEnabled(false);
    toolBar1.add(upDirectoryButton);

    browseDirectoryButton = new JButton();
    browseDirectoryButton.setHideActionText(false);
    browseDirectoryButton.setHorizontalAlignment(2);
    browseDirectoryButton.setIcon(GUIHelper.DIRECTORY_ICON);
    browseDirectoryButton.setMargin(new Insets(3, 3, 3, 3));
    browseDirectoryButton.setToolTipText(BROWSE_LFS_TEXT);
    browseDirectoryButton.setEnabled(false);
    toolBar1.add(browseDirectoryButton);

    profileModel = new ProfileComboBoxModel();
    profileSelectionCombo = new JComboBox(profileModel);
    profileSelectionCombo.setEnabled(false);
    profileSelectionCombo.setToolTipText("Select a namespace profile");
    profileSelectionCombo.setPrototypeDisplayValue("#");

    pathCombo = new JComboBox();
    pathCombo.setEditable(false);
    pathCombo.setEnabled(false);
    pathCombo.setToolTipText("Current directory path");
    pathCombo.setPrototypeDisplayValue("#");

    sslButton = new JButton();
    sslButton.setAlignmentY(0.0f);
    sslButton.setBorderPainted(false);
    sslButton.setHorizontalAlignment(2);
    sslButton.setHorizontalTextPosition(11);
    sslButton.setIcon(new ImageIcon(getClass().getResource("/images/lockedstate.gif")));
    sslButton.setMargin(new Insets(0, 0, 0, 0));
    sslButton.setMaximumSize(new Dimension(20, 20));
    sslButton.setMinimumSize(new Dimension(20, 20));
    sslButton.setPreferredSize(new Dimension(20, 20));
    sslButton.setText("");
    sslButton.setToolTipText("View certificate");
    sslButton.setEnabled(false);

    //
    // profile and toolbar buttons
    //
    JPanel profileAndToolbarPanel = new FixedHeightPanel();
    profileAndToolbarPanel.setLayout(new BoxLayout(profileAndToolbarPanel, BoxLayout.X_AXIS));
    profileAndToolbarPanel.add(profileSelectionCombo);
    profileAndToolbarPanel.add(Box.createHorizontalStrut(25));
    profileAndToolbarPanel.add(toolBar1);

    //
    // Path & SSLCert button
    //
    JPanel pathPanel = new FixedHeightPanel();
    pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.X_AXIS));
    pathCombo.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(pathCombo);
    pathPanel.add(Box.createHorizontalStrut(5));
    sslButton.setAlignmentY(CENTER_ALIGNMENT);
    pathPanel.add(sslButton);

    //
    // Put it all together
    //
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(profileAndToolbarPanel);
    add(Box.createVerticalStrut(5));
    add(pathPanel);
    add(Box.createVerticalStrut(5));
    add(fileListScrollPane);
    setBorder(new EmptyBorder(12, 12, 12, 12));
}

From source file:org.apache.jmeter.visualizers.CreateReport.java

/**
 * Main visualizer setup.// ww  w.  jav a 2 s.  c  om
 */
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();

    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(makeTitlePanel());
    mainPanel.add(createSavePanel());
    myJTable = new JTable(model);
    myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(myScrollPane, BorderLayout.CENTER);
    saveTable.addActionListener(this);
    JPanel opts = new JPanel();
    opts.add(useGroupName, BorderLayout.WEST);
    opts.add(saveTable, BorderLayout.CENTER);
    opts.add(saveHeaders, BorderLayout.EAST);
    this.add(opts, BorderLayout.SOUTH);
}

From source file:sim.util.media.chart.ChartGenerator.java

/** Generates a new ChartGenerator with a blank chart.  Before anything else, buildChart() is called.  */
public ChartGenerator() {
    // create the chart
    buildChart();//from  www  .  ja  va  2 s . com
    chart.getPlot().setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    split.setBorder(new EmptyBorder(0, 0, 0, 0));
    JScrollPane scroll = new JScrollPane();
    JPanel b = new JPanel();
    b.setLayout(new BorderLayout());
    b.add(seriesAttributes, BorderLayout.NORTH);
    b.add(new JPanel(), BorderLayout.CENTER);
    scroll.getViewport().setView(b);
    scroll.setBackground(getBackground());
    scroll.getViewport().setBackground(getBackground());
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    LabelledList list = new LabelledList("Chart Properties");
    DisclosurePanel pan1 = new DisclosurePanel("Chart Properties", list);
    globalAttributes.add(pan1);

    JLabel j = new JLabel("Right-Click or Control-Click");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);
    j = new JLabel("on Chart for More Options");
    j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC));
    list.add(j);

    titleField = new PropertyField() {
        public String newValue(String newValue) {
            setTitle(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    titleField.setValue(chart.getTitle().getText());

    list.add(new JLabel("Title"), titleField);

    buildGlobalAttributes(list);

    final JCheckBox legendCheck = new JCheckBox();
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                LegendTitle title = new LegendTitle(chart.getPlot());
                title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0, 8, 0, 4));
                chart.addLegend(title);
            } else {
                chart.removeLegend();
            }
        }
    };
    legendCheck.addItemListener(il);
    list.add(new JLabel("Legend"), legendCheck);
    legendCheck.setSelected(true);

    /*
      final JCheckBox aliasCheck = new JCheckBox();
      aliasCheck.setSelected(chart.getAntiAlias());
      il = new ItemListener()
      {
      public void itemStateChanged(ItemEvent e)
      {
      chart.setAntiAlias( e.getStateChange() == ItemEvent.SELECTED );
      }
      };
      aliasCheck.addItemListener(il);
      list.add(new JLabel("Antialias"), aliasCheck);
    */

    JPanel pdfButtonPanel = new JPanel();
    pdfButtonPanel.setBorder(new javax.swing.border.TitledBorder("Chart Output"));
    DisclosurePanel pan2 = new DisclosurePanel("Chart Output", pdfButtonPanel);

    pdfButtonPanel.setLayout(new BorderLayout());
    Box pdfbox = new Box(BoxLayout.Y_AXIS);
    pdfButtonPanel.add(pdfbox, BorderLayout.WEST);

    JButton pdfButton = new JButton("Save as PDF");
    pdfbox.add(pdfButton);
    pdfButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            FileDialog fd = new FileDialog(frame, "Choose PDF file...", FileDialog.SAVE);
            fd.setFile(chart.getTitle().getText() + ".pdf");
            fd.setVisible(true);
            String fileName = fd.getFile();
            if (fileName != null) {
                Dimension dim = chartPanel.getPreferredSize();
                PDFEncoder.generatePDF(chart, dim.width, dim.height,
                        new File(fd.getDirectory(), Utilities.ensureFileEndsWith(fd.getFile(), ".pdf")));
            }
        }
    });
    movieButton = new JButton("Create a Movie");
    pdfbox.add(movieButton);
    pdfbox.add(Box.createGlue());
    movieButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (movieMaker == null)
                startMovie();
            else
                stopMovie();
        }
    });

    globalAttributes.add(pan2);

    // we add into an outer box so we can later on add more global seriesAttributes
    // as the user instructs and still have glue be last
    Box outerAttributes = Box.createVerticalBox();
    outerAttributes.add(globalAttributes);
    outerAttributes.add(Box.createGlue());

    p.add(outerAttributes, BorderLayout.NORTH);
    p.add(scroll, BorderLayout.CENTER);
    p.setMinimumSize(new Dimension(0, 0));
    p.setPreferredSize(new Dimension(200, 0));
    split.setLeftComponent(p);

    // Add scale and proportion fields
    Box header = Box.createHorizontalBox();

    final double MAXIMUM_SCALE = 8;

    fixBox = new JCheckBox("Fill");
    fixBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setFixed(fixBox.isSelected());
        }
    });
    header.add(fixBox);
    fixBox.setSelected(true);

    // add the scale field
    scaleField = new NumberTextField("  Scale: ", 1.0, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0)
                newValue = currentValue;
            if (newValue > MAXIMUM_SCALE)
                newValue = currentValue;
            scale = newValue;
            resizeChart();
            return newValue;
        }
    };
    scaleField.setToolTipText("Zoom in and out");
    scaleField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    scaleField.setEnabled(false);
    scaleField.setText("");
    header.add(scaleField);

    // add the proportion field
    proportionField = new NumberTextField("  Proportion: ", 1.5, true) {
        public double newValue(double newValue) {
            if (newValue <= 0.0)
                newValue = currentValue;
            proportion = newValue;
            resizeChart();
            return newValue;
        }
    };
    proportionField.setToolTipText("Change the chart proportions (ratio of width to height)");
    proportionField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
    header.add(proportionField);

    chartHolder.setMinimumSize(new Dimension(0, 0));
    chartHolder.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    chartHolder.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    chartHolder.getViewport().setBackground(Color.gray);
    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(chartHolder, BorderLayout.CENTER);
    p2.add(header, BorderLayout.NORTH);
    split.setRightComponent(p2);
    setLayout(new BorderLayout());
    add(split, BorderLayout.CENTER);

    // set the default to be white, which looks good when printed
    chart.setBackgroundPaint(Color.WHITE);

    // JFreeChart has a hillariously broken way of handling font scaling.
    // It allows fonts to scale independently in X and Y.  We hack a workaround here.
    chartPanel.setMinimumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMaximumDrawHeight((int) DEFAULT_CHART_HEIGHT);
    chartPanel.setMinimumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setMaximumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion));
    chartPanel.setPreferredSize(new java.awt.Dimension((int) (DEFAULT_CHART_HEIGHT * DEFAULT_CHART_PROPORTION),
            (int) (DEFAULT_CHART_HEIGHT)));
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Initialisiere das Fenster Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * // ww  w  .  j  a  va2s  .  c o m
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 */
private void initDialog() {
    setResizable(false);
    setIconImage(Toolkit.getDefaultToolkit().getImage(
            ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/search.png")));
    // setVisible( true );
    setBounds(100, 100, 750, 417);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.SOUTH);
    {
        btnCancel = new JButton(LangStrings.getString("ProgramProperetysDialog.btnCancel.text")); //$NON-NLS-1$
        btnCancel.setIcon(new ImageIcon(
                ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/114.png")));
        btnCancel.setHorizontalAlignment(SwingConstants.LEFT);
        btnCancel.setIconTextGap(15);
        btnCancel.setPreferredSize(new Dimension(180, 40));
        btnCancel.setMaximumSize(new Dimension(160, 40));
        btnCancel.setMargin(new Insets(6, 30, 6, 30));
        btnCancel.setForeground(Color.RED);
        btnCancel.setBackground(new Color(255, 192, 203));
        btnCancel.setActionCommand("cancel");
        btnCancel.addActionListener(this);
        btnCancel.addMouseMotionListener(this);
    }
    {
        btnOk = new JButton(LangStrings.getString("ProgramProperetysDialog.btnOk.text")); //$NON-NLS-1$
        btnOk.setIconTextGap(15);
        btnOk.setHorizontalAlignment(SwingConstants.LEFT);
        btnOk.setIcon(new ImageIcon(
                ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/31.png")));
        btnOk.setPreferredSize(new Dimension(180, 40));
        btnOk.setMaximumSize(new Dimension(160, 40));
        btnOk.setMargin(new Insets(6, 30, 6, 30));
        btnOk.setForeground(new Color(0, 100, 0));
        btnOk.setBackground(new Color(152, 251, 152));
        btnOk.setActionCommand("set_propertys");
        btnOk.addActionListener(this);
        btnOk.addMouseMotionListener(this);
    }
    unitsPanel = new JPanel();
    unitsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), " UNITS ", TitledBorder.LEADING,
            TitledBorder.TOP, null, null));
    pahtsPanel = new JPanel();
    pahtsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), " DIRECTORYS ",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
    gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING).addGroup(
            Alignment.LEADING,
            gl_contentPanel.createSequentialGroup().addContainerGap().addGroup(gl_contentPanel
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(pahtsPanel, GroupLayout.PREFERRED_SIZE, 714, GroupLayout.PREFERRED_SIZE)
                    .addGroup(gl_contentPanel.createSequentialGroup()
                            .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 160,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED, 394, Short.MAX_VALUE)
                            .addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE))
                    .addComponent(unitsPanel, GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_contentPanel.createSequentialGroup()
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pahtsPanel, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(unitsPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 28,
                                    GroupLayout.PREFERRED_SIZE))));
    databaseDirLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.databaseDirLabel.text")); //$NON-NLS-1$
    databaseDirTextField = new JTextField();
    databaseDirTextField.setEditable(false);
    databaseDirTextField.addMouseMotionListener(this);
    databaseDirTextField.setColumns(10);
    logfileLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.logFileLabel.text")); //$NON-NLS-1$
    logfileNameTextField = new JTextField();
    logfileNameTextField.setEditable(false);
    logfileNameTextField.addMouseMotionListener(this);
    logfileNameTextField.setColumns(10);
    moveDataCheckBox = new JCheckBox(LangStrings.getString("ProgramProperetysDialog.moveDataCheckBox.text")); //$NON-NLS-1$
    moveDataCheckBox.addMouseMotionListener(this);
    databaseDirFileButton = new JButton("");
    databaseDirFileButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    databaseDirFileButton.addActionListener(this);
    databaseDirFileButton.setActionCommand("choose_datadir");
    databaseDirFileButton.addMouseMotionListener(this);
    logfileNameButton = new JButton("");
    logfileNameButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    logfileNameButton.addActionListener(this);
    logfileNameButton.setActionCommand("choose_logfile");
    logfileNameButton.addMouseMotionListener(this);
    exportDirLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.exportDirLabel.text")); //$NON-NLS-1$
    exportDirTextField = new JTextField();
    exportDirTextField.setEditable(false);
    exportDirTextField.setColumns(10);
    exportDirButton = new JButton("");
    exportDirButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    exportDirButton.setActionCommand("choose_exportdir");
    exportDirButton.addActionListener(this);
    exportDirButton.addMouseMotionListener(this);
    GroupLayout gl_pahtsPanel = new GroupLayout(pahtsPanel);
    gl_pahtsPanel.setHorizontalGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING).addGroup(gl_pahtsPanel
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup().addGroup(gl_pahtsPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_pahtsPanel.createSequentialGroup()
                                    .addComponent(databaseDirLabel, GroupLayout.DEFAULT_SIZE, 419,
                                            Short.MAX_VALUE)
                                    .addGap(193))
                            .addGroup(gl_pahtsPanel.createSequentialGroup()
                                    .addComponent(databaseDirTextField, GroupLayout.DEFAULT_SIZE, 606,
                                            Short.MAX_VALUE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                            .addComponent(databaseDirFileButton, GroupLayout.PREFERRED_SIZE, 72,
                                    GroupLayout.PREFERRED_SIZE))
                    .addComponent(moveDataCheckBox, Alignment.TRAILING)
                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup()
                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_pahtsPanel.createSequentialGroup()
                                            .addComponent(logfileLabel, GroupLayout.DEFAULT_SIZE, 345,
                                                    Short.MAX_VALUE)
                                            .addGap(267))
                                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup()
                                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                                                    .addComponent(exportDirLabel, Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
                                                    .addComponent(logfileNameTextField,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
                                                    .addComponent(exportDirTextField, Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE))
                                            .addPreferredGap(ComponentPlacement.RELATED)))
                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                                    .addComponent(logfileNameButton, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(exportDirButton, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE))))
            .addContainerGap()));
    gl_pahtsPanel.setVerticalGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_pahtsPanel.createSequentialGroup()
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(databaseDirFileButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_pahtsPanel.createSequentialGroup().addComponent(databaseDirLabel)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(databaseDirTextField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                    .addGap(1).addComponent(moveDataCheckBox).addGap(18)
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(logfileNameButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_pahtsPanel.createSequentialGroup().addComponent(logfileLabel)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(logfileNameTextField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addGap(18).addComponent(exportDirLabel).addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(exportDirTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(exportDirButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(24)));
    pahtsPanel.setLayout(gl_pahtsPanel);
    defaultUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.defaultUnitsRadioButton.text")); //$NON-NLS-1$
    defaultUnitsRadioButton.setSelected(true);
    defaultUnitsRadioButton.setActionCommand("rbutton");
    defaultUnitsRadioButton.addActionListener(this);
    metricUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.metricUnitsRadioButton.text")); //$NON-NLS-1$
    metricUnitsRadioButton.setActionCommand("rbutton");
    metricUnitsRadioButton.addActionListener(this);
    imperialUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.imperialUnitsRadioButton.text")); //$NON-NLS-1$
    imperialUnitsRadioButton.addActionListener(this);
    imperialUnitsRadioButton.setActionCommand("rbutton");
    defaultUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.defaultUnitsLabel.text")); //$NON-NLS-1$
    metricUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.metricUnitsLabel.text")); //$NON-NLS-1$
    imperialUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.imperialUnitsLabel.text")); //$NON-NLS-1$
    GroupLayout gl_untitsPanel = new GroupLayout(unitsPanel);
    gl_untitsPanel.setHorizontalGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_untitsPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING, false)
                            .addComponent(metricUnitsRadioButton, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(imperialUnitsRadioButton, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(defaultUnitsRadioButton, GroupLayout.PREFERRED_SIZE, 132,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
                            .addComponent(metricUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                            .addComponent(defaultUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                            .addComponent(imperialUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_untitsPanel.setVerticalGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_untitsPanel.createSequentialGroup()
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(defaultUnitsRadioButton).addComponent(defaultUnitsLabel))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(metricUnitsRadioButton).addComponent(metricUnitsLabel))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(imperialUnitsRadioButton).addComponent(imperialUnitsLabel))
                    .addContainerGap(10, Short.MAX_VALUE)));
    unitsPanel.setLayout(gl_untitsPanel);
    contentPanel.setLayout(gl_contentPanel);
    unitsButtonGroup = new ButtonGroup();
    unitsButtonGroup.add(defaultUnitsRadioButton);
    unitsButtonGroup.add(metricUnitsRadioButton);
    unitsButtonGroup.add(imperialUnitsRadioButton);
}

From source file:de.ailis.xadrian.frames.MainFrame.java

/**
 * Creates the status bar./*from ww w  .  j  a  va  2  s  . c  o m*/
 */
private void createStatusBar() {
    final JLabel statusBar = this.statusBar = new JLabel(" ");
    statusBar.setBorder(new EmptyBorder(2, 5, 2, 5));
    add(statusBar, BorderLayout.SOUTH);

    addWindowFocusListener(new WindowAdapter() {
        @Override
        public void windowLostFocus(final WindowEvent e) {
            statusBar.setText(" ");
        }
    });
}

From source file:brainflow.app.toplevel.BrainFlow.java

private void initializeMenu() {
    log.info("initializing Menu");

    GuiCommands.defaults().setButtonFactory(createToolBarButtonFactory());
    GuiCommands.defaults().setMenuFactory(createMenuFactory());
    //GuiCommands.defaults().

    GoToVoxelCommand gotoVoxelCommand = new GoToVoxelCommand();
    gotoVoxelCommand.bind(getApplicationFrame());
    gotoVoxelCommand.installShortCut(documentPane, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    CommandGroup fileMenuGroup = new CommandGroup("file-menu");
    fileMenuGroup.bind(getApplicationFrame());

    CommandGroup viewMenuGroup = new CommandGroup("view-menu");
    viewMenuGroup.bind(getApplicationFrame());

    CommandGroup gotoMenuGroup = new CommandGroup("goto-menu");
    gotoMenuGroup.bind(getApplicationFrame());

    CommandBar menuBar = new CommandMenuBar();
    menuBar.setBorder(new EmptyBorder(2, 2, 2, 2));
    //menuBar.setBorder(new LineBorder(Color.black, 1));
    menuBar.setStretch(true);//ww  w  . j a  v  a  2  s. c  om

    // for nimbus look and feel
    menuBar.setPaintBackground(false);
    // for nimbus look and feel

    menuBar.add(fileMenuGroup.createMenuItem());
    menuBar.add(viewMenuGroup.createMenuItem());
    menuBar.add(gotoMenuGroup.createMenuItem());
    menuBar.setKey("menu");
    brainFrame.getDockableBarManager().addDockableBar(menuBar);

    MountFileSystemCommand mountFileSystemCommand = new MountFileSystemCommand();
    mountFileSystemCommand.bind(getApplicationFrame());

    ExitApplicationCommand exitCommand = new ExitApplicationCommand();
    exitCommand.bind(getApplicationFrame());

    ExpansionPointBuilder builder = fileMenuGroup.getExpansionPointBuilder();
    builder.add(pathMenu.getCommandGroup());
    builder.applyChanges();

    menuBar.add(DockWindowManager.getInstance().getDockMenu());

    JMenuItem favMenu = favoritesMenu.getCommandGroup().createMenuItem();
    favMenu.setMnemonic('F');
    menuBar.add(favMenu);

}