Example usage for java.awt Component LEFT_ALIGNMENT

List of usage examples for java.awt Component LEFT_ALIGNMENT

Introduction

In this page you can find the example usage for java.awt Component LEFT_ALIGNMENT.

Prototype

float LEFT_ALIGNMENT

To view the source code for java.awt Component LEFT_ALIGNMENT.

Click Source Link

Document

Ease-of-use constant for getAlignmentX .

Usage

From source file:netcap.JcaptureConfiguration.java

/**
 * ????/*from   ww w . j  a  v a 2  s.co  m*/
 * @return
 */
private JPanel getProtocolFilterPanel() {
    JPanel filterPanel = ViewModules.createSimplePanel("?", Component.LEFT_ALIGNMENT, -1f,
            BoxLayout.Y_AXIS);
    JTextPane proType = ViewModules.createTextPane("???:");
    proFilterField = ViewModules.createTextField(20, "tcp", true);
    ViewModules.createSeparator(0);
    JTextPane domain = ViewModules.createTextPane("???/IP:");
    domainFilterField = ViewModules.createTextField(20, "", true);
    ViewModules.addComponent(filterPanel, proType, proFilterField, domain, domainFilterField);
    return filterPanel;
}

From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java

protected JPanel buildMeasureCountSubPanel() {
    // Add the results sub panel.
    JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

    panel.add(measureCountLabel = new MeasureCountLabel());

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return (panel);
}

From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java

protected JPanel buildFileSelectionSubPanel() {
    final JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(Box.createVerticalGlue());

    JButton openButton = new JButton(resourceBundle.getString("Select_file"));
    openButton.setMnemonic('O');
    openButton.setToolTipText(resourceBundle.getString("ToolTip.Select_file"));
    panel.add(openButton);/*from  w w  w .  j  a  va2s  .  co  m*/
    panel.add(Box.createRigidArea(new Dimension(10, 10)));

    JLabel fileLabel = new ABIFileLabel();
    panel.add(fileLabel);

    // Open button listener.
    openButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int returnVal = fileChooser.showOpenDialog(appWindow);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                abiFile = fileChooser.getSelectedFile();
                panel.repaint();
                saveButton.setEnabled(true);
            }
        }
    });

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return panel;
}

From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java

/**
 * Build action buttons sub panel/*from  w w  w  . j a v a 2s.  c o  m*/
 */
protected JPanel buildActionButtonSubPanel() {

    // Add the action buttons sub panel.
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

    JButton cancelButton = new JButton(resourceBundle.getString("Cancel"));
    cancelButton.setMnemonic('A');
    cancelButton.setToolTipText(resourceBundle.getString("ToolTip.Cancel_measurement"));
    panel.add(Box.createHorizontalGlue());
    panel.add(saveButton);
    panel.add(Box.createRigidArea(new Dimension(10, 0)));
    panel.add(cancelButton);

    // Save button listener.
    saveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            sendOutputToServer();
        }
    });

    // Cancel button listener.
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            confirmOnExit();
        }
    });

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return (panel);
}

From source file:org.jdal.swing.form.FormUtils.java

/**
 * Create a box with a coponent aligned to left.
 * @param c component//w  ww. ja  v a 2 s  .c o  m
 * @return Box with the compoenent
 */
public static Component newBoxForComponent(Component c) {
    return newBoxForComponent(c, Component.LEFT_ALIGNMENT);
}

From source file:org.obiba.onyx.jade.instrument.ricelake.RiceLakeWeightInstrumentRunner.java

protected JPanel buildMeasureCountSubPanel() {
    JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(measureCountLabel = new MeasureCountLabel());
    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return (panel);
}

From source file:net.pandoragames.far.ui.swing.FindFilePanel.java

private void initFileNamePatternPanel(SwingConfig config, ComponentRepository componentRepository) {

    JLabel labelPattern = new JLabel(localizer.localize("label.file-name-pattern"));
    labelPattern.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.add(labelPattern);

    listPattern = new JComboBox(config.getFileNamePatternListModel());
    listPattern.setEditable(true);/* www .ja va  2s. c  o m*/
    listPattern
            .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight()));

    JButton buttonSavePattern = new JButton(localizer.localize("button.save-pattern"));
    buttonSavePattern.setEnabled(false);
    TwoComponentsPanel linePattern = new TwoComponentsPanel(listPattern, buttonSavePattern);
    linePattern.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.add(linePattern);

    patternFlag = new JCheckBox(localizer.localize("label.regular-expression"));
    patternFlag.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternFlag.setSelected(dataModel.getFileNamePattern().isRegex());
    patternFlag.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            dataModel.getFileNamePattern().setRegex((ItemEvent.SELECTED == event.getStateChange()));
        }
    });
    patternFlag.addItemListener(componentRepository.getSearchBaseListener());
    browseButtonListener.setRegexCheckBox(patternFlag);
    browseButtonListener.addComponentToBeDisabledForSingleFiles(patternFlag);
    componentRepository.getSearchBaseListener().addToBeEnabled(patternFlag);
    componentRepository.getResetDispatcher().addToBeEnabled(patternFlag);
    listPattern.addActionListener(new PatternListListener(patternFlag, componentRepository.getMessageBox()));
    listPattern.addActionListener(componentRepository.getSearchBaseListener());
    ComboBoxEditor comboBoxEditor = new FileNamePatternEditor(buttonSavePattern);
    listPattern.setEditor(comboBoxEditor);
    browseButtonListener.setComboBox(listPattern);
    browseButtonListener.addComponentToBeDisabledForSingleFiles(listPattern);
    componentRepository.getSearchBaseListener().addToBeEnabled(listPattern);
    componentRepository.getResetDispatcher().addToBeEnabled(listPattern);
    buttonSavePattern.addActionListener(
            new SaveFileNamePatternListener(listPattern, patternFlag, config, componentRepository));
    this.add(patternFlag);

    datePanel = new DateRestrictionPanel(dataModel, componentRepository, config);
    componentRepository.getResetDispatcher().addResetable(datePanel);
    datePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.add(datePanel);

    this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING)));
    this.add(Box.createVerticalGlue());
}

From source file:org.obiba.onyx.jade.instrument.ricelake.RiceLakeWeightInstrumentRunner.java

protected JPanel buildResultsSubPanel() {
    final JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(new JLabel(resourceBundle.getString("Weight") + ":"));
    panel.add(Box.createRigidArea(new Dimension(10, 0)));
    panel.add(weightTxt);//from  www .j  a  va  2  s  .  c om
    panel.add(Box.createRigidArea(new Dimension(10, 0)));
    panel.add(new JLabel(resourceBundle.getString("kg")));
    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return panel;
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper method to set the left alignment.
 *
 * @param component/*from w  ww.  j  a  va  2 s  .c om*/
 *         the component to align
 * @return the aligned component
 */
protected <T extends JComponent> T alignLeft(T component) {
    return alignHorizontally(component, Component.LEFT_ALIGNMENT);
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

private <T extends JComponent> T alignHorizontally(T component, float alignment) {
    Preconditions.checkNotNull(component);

    if (!ComponentOrientation.getOrientation(i18n.getLocale()).isLeftToRight()) {
        if (alignment == Component.LEFT_ALIGNMENT) {
            alignment = Component.RIGHT_ALIGNMENT;
        } else if (alignment == Component.RIGHT_ALIGNMENT) {
            alignment = Component.LEFT_ALIGNMENT;
        }//  ww  w .  j a  va 2s.com
    }
    component.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    component.setAlignmentX(alignment);
    return component;
}