Example usage for javax.swing BoxLayout X_AXIS

List of usage examples for javax.swing BoxLayout X_AXIS

Introduction

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

Prototype

int X_AXIS

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

Click Source Link

Document

Specifies that components should be laid out left to right.

Usage

From source file:medsavant.uhn.cancer.SetCommentStatusDialog.java

private JPanel getStatusEditorPanel() {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(Box.createHorizontalGlue());
    statusIconPanel = new StatusIconPanel(ICON_WIDTH, ICON_HEIGHT, true, parentComment.isApproved(),
            parentComment.isIncluded(), parentComment.isDeleted());
    p.add(statusIconPanel);/*  w  w w .j  av  a 2  s .  co  m*/
    p.add(Box.createHorizontalGlue());
    return p;
}

From source file:com.idealista.solrmeter.view.statistic.CacheHistoryPanel.java

/**
 * Constructor to be injected by Guice/*from www. ja v  a2 s  .c o  m*/
 * @param statistic
 */
@Inject
public CacheHistoryPanel(CacheHistoryStatistic statistic) {
    super();
    this.statistic = statistic;
    this.xyDataset = new DefaultXYDataset();
    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    this.add(this.createLeftPanel());
    this.add(this.createChartPanel());
    this.setShowingSpecificData(false);//Show the hit ratio chart as default
}

From source file:mergedoc.ui.FileChooserField.java

/**
 * ??/*from   www .j  ava2  s  .c om*/
 */
public FileChooserField() {

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    // ?
    int maxWidth = (int) ComponentFactory.createMaxDimension().getWidth();
    textField.setMaximumSize(new Dimension(maxWidth, 20));
    textField.setTransferHandler(new FileDropHandler());

    // ?
    ComponentFactory.ensureSize(button, 20, 18);
    button.setText("...");

    // ??
    CharsetSortedModel charsetModel = new CharsetSortedModel();
    charsetModel.add("EUC-JP");
    charsetModel.add("EUC-JP-LINUX");
    charsetModel.add("ISO-2022-JP");
    charsetModel.add("MS932");
    charsetModel.add("Shift_JIS");
    charsetModel.add("UTF-16");
    charsetModel.add("UTF-16BE");
    charsetModel.add("UTF-16LE");
    charsetModel.add("UTF-8");
    charsetModel.add(ENCODING_DEFAULT);
    charsetModel.fireAdded();

    // ???
    add(label);
    add(ComponentFactory.createSpacer(10, 0));
    add(textField);
    add(button);
    add(ComponentFactory.createSpacer(5, 0));
    add(combo);

    // ??
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            int result = chooser.showOpenDialog(FileChooserField.this);
            if (result == JFileChooser.APPROVE_OPTION) {
                setFile(chooser.getSelectedFile());
                if (chooseListener != null) {
                    chooseListener.actionPerformed(e);
                }
            }
        }
    });
}

From source file:medsavant.uhn.cancer.AddNewCommentDialog.java

private JPanel getHeader(String str) {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(new JLabel(str));
    p.add(Box.createHorizontalGlue());
    return p;//from   w w  w.ja v a  2 s .  c o m
}

From source file:PlotsBuilding.PlotPanel.java

public void updateChart(ArrayList<PlotsData> plotscollection) {
    ArrayList<PlotsData> plotscollection1 = plotscollection;
    remove(chartPanel);//from   ww w.j  a  va  2 s  . c  o  m
    remove(pointsPanel);
    chartPanel = new ChartPanel(fillCollection(plotscollection1));
    chartPanel.addChartMouseListener(new MyChartMouseListener());
    chartPanel.setPreferredSize(new Dimension(800, 450));
    chartPanel.setBackground(Color.WHITE);
    pointsPanel = new JPanel();
    pointsPanel.setLayout(new BoxLayout(pointsPanel, BoxLayout.X_AXIS));
    cursorInfo = new JTextArea(2, 10);
    cursorInfo.setVisible(true);
    pointsPanel.add(cursorInfo);
    add(chartPanel);
    add(pointsPanel);
    repaint();
    revalidate();
}

From source file:it.iit.genomics.cru.igb.bundles.mi.view.StructuresPanel.java

public StructuresPanel(IgbService service, String label) {

    super("MI Structures", "MI Structures", "Display structure", true);

    igbLogger = IGBLogger.getInstance(label);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    // Create hidden JmolFrame
    jmolFrame = new JFrame();

    jmolPanel = new JmolPanel();

    jmolPanel.setPreferredSize(new Dimension(500, 500));

    Box jmolBox = new Box(BoxLayout.Y_AXIS);
    Box jmolButtonBox = new Box(BoxLayout.X_AXIS);
    jmolFrame.add(jmolBox);//  w  w w  . j  av a  2  s  .  c om
    jmolBox.add(jmolPanel);
    jmolBox.add(jmolButtonBox);

    jmolButtonBox.add(new JLabel("Display type:"));

    ButtonGroup displayGroup = new ButtonGroup();
    JRadioButton cartoonButton = new JRadioButton(JMOL_DISPLAY_CARTOON);
    JRadioButton ballAndSticksButton = new JRadioButton(JMOL_DISPLAY_BALL_AND_STICK);

    JmolDisplayListener listener = new JmolDisplayListener();
    cartoonButton.addActionListener(listener);
    ballAndSticksButton.addActionListener(listener);

    displayGroup.add(cartoonButton);
    displayGroup.add(ballAndSticksButton);

    jmolButtonBox.add(cartoonButton);
    jmolButtonBox.add(ballAndSticksButton);

    ballAndSticksButton.setSelected(true);

    jmolFrame.pack();
    jmolFrame.setVisible(false);

    jmolButton.addActionListener(new JmolActionListener());
    jmolButton.setIcon(new ImageIcon(getClass().getResource("/jmol.jpg")));

    linkButton.addActionListener(new ExternalLinkActionListener());
    linkButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/searchweb.png"));

    StructureTableModel model = new StructureTableModel(new ArrayList<StructureItem>(0));

    structureList = new StructureTable(model, service);
    structureList.setTableHeader(null);

    structureList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane structureListPane = new JScrollPane(structureList);

    add(structureListPane);
}

From source file:davmail.ui.SettingsFrame.java

protected void addSettingComponent(JPanel panel, String label, JComponent component, String toolTipText) {
    JLabel fieldLabel = new JLabel(label);
    fieldLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    fieldLabel.setVerticalAlignment(SwingConstants.CENTER);
    panel.add(fieldLabel);//w w  w. j ava 2  s . co m
    component.setMaximumSize(component.getPreferredSize());
    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));
    innerPanel.add(component);
    panel.add(innerPanel);
    if (toolTipText != null) {
        fieldLabel.setToolTipText(toolTipText);
        component.setToolTipText(toolTipText);
    }
}

From source file:es.emergya.ui.gis.popups.GPSDialog.java

public GPSDialog(Recurso r) {
    super();/*  w  w w  . j a  v  a 2  s  .c  om*/
    setAlwaysOnTop(true);
    setResizable(false);
    iconTransparente = LogicConstants.getIcon("48x48_transparente");
    iconEnviando = LogicConstants.getIcon("anim_actualizando");
    target = r;
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setPreferredSize(new Dimension(400, 150));
    setTitle(i18n.getString("window.gps.titleBar") + " " + target.getIdentificador());
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }

    JPanel base = new JPanel();

    base.setBackground(Color.WHITE);
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    final JLabel titleLabel = new JLabel(i18n.getString("window.gps.title"),
            LogicConstants.getIcon("tittleventana_icon_actualizargps"), JLabel.LEFT);

    titleLabel.setFont(LogicConstants.deriveBoldFont(12f));
    title.add(titleLabel);
    title.setOpaque(false);
    base.add(title);

    // Area para mensajes
    JPanel notificationArea = new JPanel();

    notificationArea.setOpaque(false);
    notification = new JLabel("PLACEHOLDER");
    notification.setForeground(Color.WHITE);
    notificationArea.add(notification);
    base.add(notificationArea);

    JPanel buttons = new JPanel();

    buttons.setOpaque(false);
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    actualizar = new JButton(i18n.getString("window.gps.button.actualizar"),
            LogicConstants.getIcon("ventanacontextual_button_solicitargps"));
    actualizar.addActionListener(this);
    buttons.add(actualizar);
    buttons.add(Box.createHorizontalGlue());
    progressIcon = new JLabel(iconTransparente);
    buttons.add(progressIcon);
    buttons.add(Box.createHorizontalGlue());

    JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));

    cancel.addActionListener(this);
    buttons.add(cancel);
    base.add(buttons);
    getContentPane().add(base);
    pack();

    int x;
    int y;
    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent arg0) {
            deleteErrorMessage();
        }

        @Override
        public void windowClosed(WindowEvent arg0) {
            deleteErrorMessage();
        }

        @Override
        public void windowClosing(WindowEvent arg0) {
            deleteErrorMessage();
        }

        private void deleteErrorMessage() {
            SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {
                @Override
                protected Object doInBackground() throws Exception {
                    if (last_bandejaSalida != null) {
                        MessageGenerator.remove(last_bandejaSalida.getId());
                    }

                    return null;
                }

                @Override
                protected void done() {
                    super.done();
                    GPSDialog.this.progressIcon.setIcon(iconTransparente);
                    GPSDialog.this.progressIcon.repaint();
                    last_bandejaSalida = null;
                    GPSDialog.this.notification.setText("");
                    GPSDialog.this.notification.repaint();
                }
            };

            sw.execute();
        }
    });
}

From source file:com.apatar.ui.JFeatureRequestHelpDialog.java

private void createDialog() {
    setLayout(new BorderLayout(5, 5));

    setSize(400, 400);//from w ww. j  a  va2 s  . c o m

    JPanel textPanel = new JPanel(new BorderLayout(5, 5));
    textPanel.setBorder(new EmptyBorder(10, 5, 5, 5));
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    text.setFont(UiUtils.NORMAL_SIZE_12_FONT);

    textPanel.add(new JLabel("What new Apatar features would you like to request? Please describe them:"),
            BorderLayout.NORTH);
    textPanel.add(new JScrollPane(text), BorderLayout.CENTER);

    JPanel contactPanel = new JPanel();
    contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS));

    JPanel firstNamePanel = new JPanel();
    firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS));
    firstNamePanel.add(new JLabel("Your First Name:"));
    firstNamePanel.add(Box.createHorizontalStrut(5));
    firstNamePanel.add(firstNameField);

    JPanel lastNamePanel = new JPanel();
    lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS));
    lastNamePanel.add(new JLabel("Your Last Name:"));
    lastNamePanel.add(Box.createHorizontalStrut(5));
    lastNamePanel.add(lastNameField);

    JPanel emailPanel = new JPanel();
    emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS));
    emailPanel.add(new JLabel("Your E-mail:"));
    emailPanel.add(Box.createHorizontalStrut(28));
    emailPanel.add(emailField);

    contactPanel.add(firstNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(lastNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(emailPanel);

    textPanel.add(contactPanel, BorderLayout.SOUTH);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(sendButton);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.add(cancel);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0));

    getContentPane().add(textPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}

From source file:com.apatar.ui.JSubmitHelpDialog.java

private void createDialog() {
    setLayout(new BorderLayout(5, 5));

    setSize(400, 400);/*from  w w  w . ja  v a  2s.c o m*/

    JPanel textPanel = new JPanel(new BorderLayout(5, 5));
    textPanel.setBorder(new EmptyBorder(10, 5, 5, 5));
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    text.setFont(UiUtils.NORMAL_SIZE_12_FONT);

    textPanel.add(new JLabel("If you found a bug, please submit it here:"), BorderLayout.NORTH);
    textPanel.add(new JScrollPane(text), BorderLayout.CENTER);

    JPanel contactPanel = new JPanel();
    contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS));

    JPanel firstNamePanel = new JPanel();
    firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS));
    firstNamePanel.add(new JLabel("Your First Name:"));
    firstNamePanel.add(Box.createHorizontalStrut(5));
    firstNamePanel.add(firstNameField);

    JPanel lastNamePanel = new JPanel();
    lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS));
    lastNamePanel.add(new JLabel("Your Last Name:"));
    lastNamePanel.add(Box.createHorizontalStrut(5));
    lastNamePanel.add(lastNameField);

    JPanel emailPanel = new JPanel();
    emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS));
    emailPanel.add(new JLabel("Your E-mail:"));
    emailPanel.add(Box.createHorizontalStrut(28));
    emailPanel.add(emailField);

    contactPanel.add(firstNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(lastNamePanel);
    contactPanel.add(Box.createVerticalStrut(5));
    contactPanel.add(emailPanel);

    textPanel.add(contactPanel, BorderLayout.SOUTH);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(sendButton);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.add(cancel);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0));

    getContentPane().add(textPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}