Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:savant.util.swing.TrackChooser.java

private JPanel createFilterPanel() {
    JPanel filterPanel = new JPanel();
    filterPanel.setLayout(new BorderLayout());

    JLabel filterLabel = new JLabel("Filter By: ");
    filterPanel.add(filterLabel, BorderLayout.WEST);

    filterCombo = new JComboBox();
    filterPanel.add(filterCombo, BorderLayout.EAST);
    return filterPanel;
}

From source file:net.mariottini.swing.JFontChooser.java

/**
 * Construct a font chooser with the specified fonts, optionally showing a sample to the user. The
 * sample text is a default text, you can change it by calling <code>setSampleText</code>.
 * //from   w w  w .  ja va  2 s.c  om
 * @param fontNames
 *          the font family names to show to the user.
 * @param showSample
 *          true to show a sample of the selected font to the user.
 * @see #setSampleText
 */
public JFontChooser(String[] fontNames, boolean showSample) {
    setLayout(new BorderLayout());

    JPanel centerPanel = new JPanel(new BorderLayout());

    // Uncomment one of the two lines below to use a standard layout manager
    // instead of my MeshLayout manager. The result is ugly.
    // JPanel listsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));/*
    // JPanel listsPanel = new JPanel(new GridLayout(0, 3));/*
    net.mariottini.layout.MeshLayout mesh = new net.mariottini.layout.MeshLayout(0, 3, 0);
    mesh.setExpandColumn(0);
    JPanel listsPanel = new JPanel(mesh);// */

    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    panel.add(new JLabel("Family name:"), BorderLayout.NORTH);
    fontList = new JList<>(fontNames);
    fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    fontList.setVisibleRowCount(7);
    fontList.setSelectedIndex(0);
    panel.add(new JScrollPane(fontList), BorderLayout.CENTER);
    listsPanel.add(panel);

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 8));
    panel.add(new JLabel("Style:"), BorderLayout.NORTH);
    styleList = new JList<>(STYLE_NAMES);
    styleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    styleList.setVisibleRowCount(7);
    styleList.setSelectedIndex(0);
    panel.add(new JScrollPane(styleList), BorderLayout.CENTER);
    listsPanel.add(panel);

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 8));
    panel.add(new JLabel("Size:"), BorderLayout.NORTH);
    JPanel sizePanel = new JPanel(new BorderLayout());
    sizeText = new JTextField(String.valueOf(SIZES[0]), 4);
    sizePanel.add(sizeText, BorderLayout.NORTH);
    sizeList = new JList<>(ArrayUtils.toObject(SIZES));
    sizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    sizeList.setVisibleRowCount(6);
    sizePanel.add(new JScrollPane(sizeList), BorderLayout.CENTER);
    panel.add(sizePanel, BorderLayout.CENTER);
    listsPanel.add(panel);

    centerPanel.add(listsPanel, BorderLayout.NORTH);

    samplePanel = new JPanel(new BorderLayout());
    samplePanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 4, 8));
    samplePanel.add(new JLabel("Sample:"), BorderLayout.NORTH);
    sampleLabel = new JLabel(DEFAULT_SAMPLE_TEXT, JLabel.CENTER);
    sampleLabel.setMinimumSize(new Dimension(64, 48));
    sampleLabel.setOpaque(true);
    sampleLabel.setBackground(sizeList.getBackground());
    sampleLabel.setBorder(sizeText.getBorder());
    samplePanel.add(sampleLabel, BorderLayout.CENTER);
    samplePanel.setVisible(showSample);
    centerPanel.add(samplePanel, BorderLayout.CENTER);

    add(centerPanel, BorderLayout.CENTER);

    accessoryPanel = new JPanel(new BorderLayout());
    accessoryPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 4, 8));
    accessoryComponent = new JLabel("Accessory");
    accessoryComponent.setOpaque(true);
    accessoryComponent.setBackground(sizeList.getBackground());
    accessoryPanel.add(accessoryComponent, BorderLayout.CENTER);
    accessoryPanel.setVisible(false);
    add(accessoryPanel, BorderLayout.EAST);

    JPanel southPanel = new JPanel(new BorderLayout());
    southPanel.add(new JLabel(), BorderLayout.CENTER);
    JPanel buttonsPanel = new JPanel();
    ActionListener actionListener = new ButtonActionListener();
    JButton button = new JButton("OK");
    button.addActionListener(actionListener);
    button.setActionCommand(APPROVE_SELECTION);
    buttonsPanel.add(button);
    button = new JButton("Cancel");
    button.addActionListener(actionListener);
    button.setActionCommand(CANCEL_SELECTION);
    buttonsPanel.add(button);
    southPanel.add(buttonsPanel, BorderLayout.EAST);
    add(southPanel, BorderLayout.SOUTH);

    // * Fix list size (optional)
    Dimension d = fontList.getPreferredSize();
    d.width += 6;
    fontList.setPreferredSize(d);
    d = styleList.getPreferredSize();
    d.width += 6;
    styleList.setPreferredSize(d);
    d = sizeList.getPreferredSize();
    d.width += 6;
    sizeList.setPreferredSize(d);
    // */

    // Fix sample size
    Dimension pref = sampleLabel.getPreferredSize();
    Dimension min = sampleLabel.getMinimumSize();
    pref.width += 16;
    pref.height += 12;
    if (pref.width < min.width) {
        pref.width = min.width;
    }
    if (pref.height < min.height) {
        pref.height = min.height;
    }
    sampleLabel.setPreferredSize(pref);

    // set listener
    SampleListener pl = new SampleListener();
    fontList.addListSelectionListener(pl);
    styleList.addListSelectionListener(pl);
    sizeList.addListSelectionListener(pl);
    sizeList.addListSelectionListener(new SizeListListener());
    sizeText.getDocument().addDocumentListener(new SizeTextListener());
    sizeText.addFocusListener(new SizeTextFocusListener());
    sizeList.setSelectedIndex(5);
}

From source file:org.pentaho.reporting.designer.core.util.FormulaEditorPanel.java

/**
 * Creates a new <code>JPanel</code> with a double buffer and a flow layout.
 *//* www . j a  va 2 s.c  om*/
public FormulaEditorPanel() {
    this.listenerList = new EventListenerList();
    this.dataAttributeContext = new DefaultDataAttributeContext();
    setLayout(new BorderLayout());

    ellipsisButton = new EllipsisButton("...");
    ellipsisButton.setDefaultCapable(false);
    ellipsisButton.setMargin(new Insets(0, 0, 0, 0));
    ellipsisButton.addActionListener(new OpenFormulaEditorAction());

    changeEventGenerator = new ValueChangeEventGenerator();

    tagModel = new DefaultComboBoxModel();
    tagModel.addListDataListener(changeEventGenerator);

    formulaBox = new JComboBox(tagModel);
    formulaBox.setEditable(true);
    formulaBox.addKeyListener(new KeyEventForwarder());

    formulaField = new JTextField();
    formulaField.getDocument().addDocumentListener(changeEventGenerator);
    formulaBox.addKeyListener(new KeyEventForwarder());

    add(formulaField, BorderLayout.CENTER);
    add(ellipsisButton, BorderLayout.EAST);
}

From source file:LayeredPaneDemo.java

protected void createTitleBar() {
    m_titlePanel = new JPanel() {
        public Dimension getPreferredSize() {
            return new Dimension(InnerFrame.this.getWidth(), m_titleBarHeight);
        }/* w  ww .j a va2s .  co  m*/
    };
    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_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, 2));
    m_buttonPanel.setOpaque(false);
    m_buttonPanel.add(m_iconize);
    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:org.kootox.episodesmanager.ui.EpisodesManagerMainUIHandler.java

protected void showAbout(EpisodesManagerMainUI ui) {

    AboutPanel about = new AboutPanel() {

        private static final long serialVersionUID = 1L;

        @Override// w  w  w . j  a v  a2  s .  c  om
        public void buildTopPanel() {
            topPanel.setLayout(new BorderLayout());
            JLabel labelIcon;
            Icon logoIcon;
            logoIcon = Resource.getIcon("/icons/logo-OT_web.png");
            labelIcon = new JLabel(logoIcon);
            topPanel.add(labelIcon, BorderLayout.WEST);

            logoIcon = Resource.getIcon("/icons/logo_ird.png");
            labelIcon = new JLabel(logoIcon);
            topPanel.add(labelIcon, BorderLayout.EAST);
        }
    };

    about.setTitle(_("episodesmanager.title.about"));
    about.setAboutText(_("episodesmanager.about.message"));

    String bottomText = "Episodes Manager -v." + EpisodesManagerContext.getConfig().getApplicationVersion()
            + " -Copyright2009 - 2011 Jean Couteau";

    about.setBottomText(bottomText);
    //about.setIconPath("/icons/logo-OT_web.png");
    about.setLicenseFile("META-INF/episodesmanager-swing-LICENSE.txt");
    about.setThirdpartyFile("META-INF/episodesmanager-swing-THIRD-PARTY.txt");
    about.init();
    about.showInDialog(ui, true);
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.preenchedor_formulario.PanelPreenchedorFormulario.java

private void criaInterfaceVisualEscalavel() {
    miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR);
    painel = new JPanel();
    textAreaSourceCode = new G_TextAreaSourceCode();
    // frameSilvinha.setJMenuBar(this.criaMenuBar());
    new OnChange(textAreaSourceCode, this);

    textAreaSourceCode.setTipoHTML();//w  ww .  j av  a 2s .  co m
    textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE));

    painel.setLayout(new GridLayout(2, 1));
    setBackground(frameSilvinha.corDefault);

    Container contentPane = this;
    contentPane.setLayout(new GridLayout(1, 1));
    painel.add(textAreaSourceCode);

    JPanel panelBtnTabela = new JPanel();

    panelBtnTabela.setLayout(new BorderLayout());

    /*
     * Barra de botes
     */
    btnPanel = new JPanel();
    btnPanel.setLayout(null);
    btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR);
    btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR);
    btn_salvar.setBounds(10, 0, 150, 25);
    btnPanel.add(btn_salvar);

    btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR);
    btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR);
    btn_abrir.setBounds(165, 0, 150, 25);
    btnPanel.add(btn_abrir);

    btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO);
    btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO);
    btn_salvarComo.setBounds(320, 0, 150, 25);
    btnPanel.add(btn_salvarComo);

    btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR);
    btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR);
    btn_cancelar.setBounds(480, 0, 150, 25);
    btnPanel.add(btn_cancelar);

    btnPanel.setPreferredSize(new Dimension(430, 30));

    /*
     * Barra de correcao
     */
    btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR);
    btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR);
    btnAplicar.setEnabled(false);

    texto = new JTextField();

    texto.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel borda = new JPanel(new BorderLayout());
    JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO);
    lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO);
    borda.add(lbl_texto, BorderLayout.WEST);
    borda.add(texto, BorderLayout.CENTER);
    borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    borda.setOpaque(false);
    panelCorretor = new JPanel(new BorderLayout());
    panelCorretor.add(borda, BorderLayout.CENTER);
    panelCorretor.add(btnAplicar, BorderLayout.EAST);
    //panelCorretor.add(btnPanel, BorderLayout.WEST);
    panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    panelCorretor.setOpaque(false);

    /*
     * Tabela de erros
     */
    tabelaDeErros = new TabelaErros();
    scrollPaneTabela = new JScrollPane();
    scrollPaneTabela.setViewportView(tabelaDeErros);
    panelBtnTabela.add(panelCorretor, BorderLayout.NORTH);
    panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER);
    panelBtnTabela.add(btnPanel, BorderLayout.SOUTH);
    scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS));
    painel.add(panelBtnTabela);

    btnPanel.setBackground(frameSilvinha.corDefault);

    if (!original) {
        reverter = new JButton("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                frameSilvinha.showPainelPreencheCampo();
                setVisible(true);
            }
        });
        //reverter.setActionCommand("Reverter");
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(640, 0, 150, 25);
        btnPanel.add(reverter);
    }

    panelBtnTabela.setBackground(frameSilvinha.corDefault);
    painel.setBackground(frameSilvinha.corDefault);
    contentPane.setBackground(frameSilvinha.corDefault);
    scrollPaneTabela.setBackground(frameSilvinha.corDefault);
    textAreaSourceCode.setBackground(frameSilvinha.corDefault);
    miBtnSalvar.setEnabled(false);
    btn_salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), btn_salvar,
            miBtnSalvar, frameSilvinha);
    contentPane.add(painel);
    // pack();
    this.setVisible(true);
}

From source file:javanews.gui.internalframe.LinkChart.java

/**
 * Initialises the class and internal logger. Uses the supplied arguments to
 * receive data from the application and add data to the charts dynamically.
 * @param title The title of the charts on display. Whether the displayed
 *               data is for <code>new</code> or <code>old</code> links.
 *               That is whether the data is for newly discovered links or
 *               existing (old) links already stored within the database.
 * @param parent The instance of <code>COMPortClient</code> that acts as
 *                the data source for the charts.
 *//*from   w  w  w.  j  av  a2s. c  o  m*/
public LinkChart(String title, COMPortClient parent) {
    super("Charts", true, true, true, true);
    super.setLayer(1);
    identifier = title.toLowerCase();
    // Obtain an instance of Logger for the class
    log = LoggerFactory.getLogger(className);
    owner = parent;
    // Setup a hashtable to hold the values for up, down and unknown link states
    Hashtable<String, Integer> linkStats = new Hashtable<String, Integer>();
    if (identifier.equals("old")) {
        this.setTitle("Recognised Link Status on " + owner.getPortName() + ":");
        // Get the current figures from the link table
        linkStats = ((LinkTable) owner.getLinkTable().getModel()).getInitialFigures();
    } else if (identifier.equals("new")) {
        this.setTitle("Discovered Link Status on " + owner.getPortName() + ":");
        linkStats = ((LinkTable) owner.getNewLinkTable().getModel()).getInitialFigures();
    } else {
        // If the identifier was set to something other than old or new then it's not right.
        log.warning("An instance of LinkChart has been created for an unknown purpose.");
        return;
    }
    // Initialise the dataset for the pie chart
    dpdCurrentData = new DefaultPieDataset();
    dpdCurrentData.insertValue(0, "Link Down", linkStats.get("down"));
    dpdCurrentData.insertValue(1, "Link Up", linkStats.get("up"));
    dpdCurrentData.insertValue(2, "Link State Unknown", linkStats.get("unknown"));
    // Initialise the dataset for the line chart
    dcdPreviousData = new DefaultCategoryDataset();
    dcdPreviousData.addValue(linkStats.get("down"), "Link Down", Calendar.getInstance().getTime().toString());
    dcdPreviousData.addValue(linkStats.get("up"), "Link Up", Calendar.getInstance().getTime().toString());
    dcdPreviousData.addValue(linkStats.get("unknown"), "Link State Unknown",
            Calendar.getInstance().getTime().toString());
    // Set the variables we need for holding the charts
    JFreeChart jfcCurrentStatus; // This will be displayed as a pie chart
    JFreeChart jfcPreviousStatus; // This will be displayed as a line chart
    ChartPanel cpCurrent; // Chartpanels hold the JFreeChart
    ChartPanel cpPrevious;
    // Use the factory to create the charts
    jfcCurrentStatus = ChartFactory.createPieChart("Current Status", dpdCurrentData, true, true, false);
    jfcPreviousStatus = ChartFactory.createLineChart("Previous Status", "Time received", "Number of Links",
            dcdPreviousData, PlotOrientation.VERTICAL, true, true, false);
    // Add them to the chart panels
    cpCurrent = new ChartPanel(jfcCurrentStatus);
    cpPrevious = new ChartPanel(jfcPreviousStatus);
    // Add the chart panels to the content pane
    this.add(cpCurrent, BorderLayout.EAST);
    this.add(cpPrevious, BorderLayout.WEST);
    // Change the layout to show them next to each other
    this.setLayout(new GridLayout(1, 2));
    // Add a listener to the window
    this.addInternalFrameListener(new CloseLinkChart(this));
    log.finest("Adding frame to the desktop");
    // Set the window properties and display it
    Client.getJNWindow().addToDesktop(this);
    this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    this.setSize(650, 400);
    this.setVisible(true);
    owner.addChartWindow(title, this);
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Creates a panel with the "..." icon./*from w ww .  ja va  2 s . c o m*/
 * @param comp the component to put into the panel
 */
public JPanel createIconPanel(final JComponent comp) {
    JPanel panel = new JPanel(new BorderLayout());
    JButton btn = createButton("...");
    panel.add(btn, BorderLayout.WEST);
    panel.add(comp, BorderLayout.EAST);
    return panel;
}

From source file:org.colombbus.tangara.CommandSelection.java

/**
 * This method initializes mainPanel//ww  w .j  av  a 2s .  c o m
 *
 * @return javax.swing.JPanel
 */
private JPanel getMainPanel() {
    if (mainPanel == null) {
        mainPanel = new JPanel();
        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(getHelpText(), BorderLayout.NORTH);
        mainPanel.add(Box.createHorizontalStrut(MARGIN_X), BorderLayout.WEST);
        mainPanel.add(getCentralPanel(), BorderLayout.CENTER);
        mainPanel.add(Box.createHorizontalStrut(MARGIN_X), BorderLayout.EAST);
        mainPanel.add(getPanelButtons(), BorderLayout.SOUTH);
    }
    return mainPanel;
}

From source file:org.accretegb.modules.phenotype.PhenotypeInfoPanel.java

public void initializePanel() {
    MigLayout layout = new MigLayout("insets 10, gap 5");
    setLayout(layout);// w w w  . ja  v  a  2 s  .c  o m
    populateFieldTable();
    populateParameterNames();
    setSubsetListComboBox();
    tagname = new JTextField();
    add(getSearchComponentsPanel(), "h 50%");
    add(getFieldTablePanel(), "growx, spanx, pushx, h 50%, wrap");
    add(new JLabel(""), "align label");
    add(submitButton, "tag submit, sizegroup bttn, alignx right,wrap");
    submitButton.setToolTipText("Only one of the filters [tag name, subsets, fields] can be applied");
    submitButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (getSelectedParameters().size() == 0) {
                JOptionPane.showMessageDialog(null, "Please select traits.");
            } else {
                executeTask();
            }

        }
    });

    progressBar.setAlignmentX(0f);
    add(progressBarValue, "span");
    add(progressBar, "gapleft 5, gapright 5, span, grow, wrap");
    Utils.setTableSize(tableOutput, 1.0f, 10);
    add(new JScrollPane(tableOutput), "gapleft 5, gapright 5, h 50%, span, grow, wrap");
    JPanel exportTablePanel = new JPanel();
    exportTablePanel.setLayout(new BorderLayout());
    exportTablePanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    exportTablePanel.add(exportButton, BorderLayout.EAST);
    add(exportTablePanel, "span, grow, wrap");
    setBorder(BorderFactory.createLineBorder(Color.BLACK));
    exportButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            saveTableToFile(getTableOutput(), null, "phenotype.csv");
        }
    });
}