Example usage for java.awt FlowLayout RIGHT

List of usage examples for java.awt FlowLayout RIGHT

Introduction

In this page you can find the example usage for java.awt FlowLayout RIGHT.

Prototype

int RIGHT

To view the source code for java.awt FlowLayout RIGHT.

Click Source Link

Document

This value indicates that each row of components should be right-justified.

Usage

From source file:course_generator.frmMain.java

/**
 * Create the status bar// w ww  .  j a v a  2 s. c  om
 */
private void Create_Statusbar() {
    StatusBar = new javax.swing.JPanel();
    FlowLayout fl = new FlowLayout(FlowLayout.RIGHT);
    fl.setVgap(0);
    StatusBar.setLayout(fl);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Total distance
    // ----------------------------------------------------
    LbInfoTotalDist = new javax.swing.JLabel();
    LbInfoTotalDist.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/distance.png")));
    StatusBar.add(LbInfoTotalDist);

    // -- Total distance - value
    // ----------------------------------------------------
    LbInfoTotalDistVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoTotalDistVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Ascent
    // ------------------------------------------------------
    LbInfoDp = new javax.swing.JLabel();
    LbInfoDp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/dp.png")));
    StatusBar.add(LbInfoDp);

    // -- Ascent value
    // ------------------------------------------------------
    LbInfoDpVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoDpVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Descent
    // -----------------------------------------------------
    LbInfoDm = new javax.swing.JLabel();
    LbInfoDm.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/dm.png")));
    StatusBar.add(LbInfoDm);

    // -- Descent value
    // -----------------------------------------------------
    LbInfoDmVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoDmVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Total time
    // --------------------------------------------------------
    LbInfoTime = new javax.swing.JLabel();
    LbInfoTime.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/chronometer.png")));
    StatusBar.add(LbInfoTime);

    // -- Total time value
    // --------------------------------------------------------
    LbInfoTimeVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoTimeVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Curve
    // --------------------------------------------------------
    LbInfoCurve = new javax.swing.JLabel();
    LbInfoCurve
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/curve.png")));
    StatusBar.add(LbInfoCurve);

    // -- Curve value
    // --------------------------------------------------------
    LbInfoCurveVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoCurveVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Time limit
    // --------------------------------------------------------
    LbTimeLimit = new javax.swing.JLabel(" " + bundle.getString("frmMain.LbTimeLimit.text") + " ");
    LbTimeLimit.setOpaque(true);
    LbTimeLimit.setBackground(Color.RED);
    LbTimeLimit.setForeground(Color.WHITE);
    StatusBar.add(LbTimeLimit);

    //-- Separator
    sepTimeLimit = createStatusbarSeparator();
    StatusBar.add(sepTimeLimit);

    // -- Modified
    // --------------------------------------------------------
    LbModified = new javax.swing.JLabel();
    LbModified.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/edit.png")));
    StatusBar.add(LbModified);

    // -- Modified status
    // --------------------------------------------------------
    LbModifiedVal = new javax.swing.JLabel();
    StatusBar.add(LbModifiedVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Calculation needed
    // ------------------------------------------------
    LbInfoCalculate = new javax.swing.JLabel();
    LbInfoCalculate
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/calc.png")));
    StatusBar.add(LbInfoCalculate);

    // -- Calculation needed value
    // ------------------------------------------------
    LbInfoCalculateVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoCalculateVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Internet connection present
    // ----------------------------------------
    LbInfoInternet = new javax.swing.JLabel();
    LbInfoInternet
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/earth.png")));
    StatusBar.add(LbInfoInternet);

    // -- Internet connection present value
    // ----------------------------------------
    LbInfoInternetVal = new javax.swing.JLabel();

    StatusBar.add(LbInfoInternetVal);

    //-- Separator
    StatusBar.add(createStatusbarSeparator());

    // -- Unit
    // ----------------------------------------
    LbInfoUnit = new javax.swing.JLabel();
    LbInfoUnit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/unit.png")));
    StatusBar.add(LbInfoUnit);

    // -- Unit value
    // ----------------------------------------
    LbInfoUnitVal = new javax.swing.JLabel();
    StatusBar.add(LbInfoUnitVal);

}

From source file:de.bwravencl.controllerbuddy.gui.Main.java

private void onControllersChanged(final boolean selectFirstTab) {
    final var presentJids = new HashSet<Integer>();
    for (var jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
        if (glfwJoystickPresent(jid) && glfwJoystickIsGamepad(jid)) {
            presentJids.add(jid);//w w w  .jav a 2s  . c  o m

            if (!isSelectedJidValid())
                setSelectedJid(jid);
        }

    final var controllerConnected = !presentJids.isEmpty();
    if (!controllerConnected)
        selectedJid = INVALID_JID;

    final var previousSelectedTabIndex = tabbedPane.getSelectedIndex();
    fileMenu.remove(newMenuItem);
    fileMenu.remove(openMenuItem);
    fileMenu.remove(saveMenuItem);
    fileMenu.remove(saveAsMenuItem);
    if (fileMenu.getItemCount() > 1)
        fileMenu.remove(0);
    deviceMenu.removeAll();
    menuBar.remove(deviceMenu);
    menuBar.remove(localMenu);
    menuBar.remove(serverMenu);
    tabbedPane.remove(modesPanel);
    tabbedPane.remove(assignmentsComponent);
    tabbedPane.remove(overlayPanel);

    if (controllerConnected) {
        fileMenu.insert(newMenuItem, 0);
        fileMenu.insert(openMenuItem, 1);
        fileMenu.insert(saveMenuItem, 2);
        fileMenu.insert(saveAsMenuItem, 3);
        fileMenu.insertSeparator(4);

        for (final var jid : presentJids)
            deviceMenu.add(new SelectControllerAction(jid));
        menuBar.add(deviceMenu, 1);

        if (windows)
            menuBar.add(localMenu, 2);

        menuBar.add(serverMenu, windows ? 4 : 2);

        modesPanel = new JPanel(new BorderLayout());
        tabbedPane.insertTab(rb.getString("MODES_TAB"), null, modesPanel, null,
                tabbedPane.indexOfComponent(settingsScrollPane));

        modesListPanel = new JPanel();
        modesListPanel.setLayout(new GridBagLayout());

        modesScrollPane = new JScrollPane();
        modesScrollPane.setViewportBorder(
                BorderFactory.createMatteBorder(10, 10, 0, 10, modesListPanel.getBackground()));
        modesPanel.add(modesScrollPane, BorderLayout.CENTER);

        addModePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        final var addButton = new JButton(new AddModeAction());
        addButton.setPreferredSize(BUTTON_DIMENSION);
        addModePanel.add(addButton);
        modesPanel.add(addModePanel, BorderLayout.SOUTH);

        assignmentsComponent = new AssignmentsComponent(this);
        tabbedPane.insertTab(rb.getString("ASSIGNMENTS_TAB"), null, assignmentsComponent, null,
                tabbedPane.indexOfComponent(settingsScrollPane));

        overlayPanel = new JPanel(new BorderLayout());

        indicatorsListPanel = new JPanel();
        indicatorsListPanel.setLayout(new GridBagLayout());

        indicatorsScrollPane = new JScrollPane();
        indicatorsScrollPane.setViewportBorder(
                BorderFactory.createMatteBorder(10, 10, 0, 10, indicatorsListPanel.getBackground()));
        overlayPanel.add(indicatorsScrollPane, BorderLayout.CENTER);
        tabbedPane.insertTab(rb.getString("OVERLAY_TAB"), null, overlayPanel, null,
                tabbedPane.indexOfComponent(settingsScrollPane));
    }

    if (selectFirstTab || !controllerConnected)
        tabbedPane.setSelectedIndex(0);
    else if (previousSelectedTabIndex < tabbedPane.getTabCount())
        tabbedPane.setSelectedIndex(previousSelectedTabIndex);

    updateModesPanel();
    updateOverlayPanel();
    updatePanelAccess();

    frame.getContentPane().invalidate();
    frame.getContentPane().repaint();
}

From source file:Assignment2.FarmManagementGUI.java

private void btnAirTempChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAirTempChartActionPerformed
    //Set up chart data/key
    XYSeries signal = new XYSeries("amount");
    XYSeriesCollection dataset = new XYSeriesCollection(signal);

    JFrame f = new JFrame(selectedPlot.getName() + " air temperature chart"); //set up new JFrame
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //dispose frame on close
    JFreeChart chart = ChartFactory.createXYLineChart(selectedPlot.getName(), "Reading number", "Reading",
            dataset); //create chart and add data/keys
    f.add(new ChartPanel(chart)); //add chart to frame
    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    signal.clear();/*from  www.  j a  va  2s .  c o m*/
    Sensor sensor;
    SensorData sensorData;
    //For each sensor in selected plot:
    for (int i = 0; i < selectedPlot.getSensors().size(); i++) {
        sensor = selectedPlot.getSensors().get(i);
        if (sensor.getSensorType() == SensorType.AIR_TEMPERATURE) {
            //For each sensor data in sensor:
            for (int j = 0; j < sensor.getSensorDataList().size(); j++) {
                sensorData = sensor.getSensorDataList().get(j);
                signal.add(j, sensorData.getDataRepresentationType()); //add the data to the chart
            }
        }
    }
    //set up frame and show:
    f.add(p, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:Assignment2.FarmManagementGUI.java

private void btnPressureChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPressureChartActionPerformed
    XYSeries signal = new XYSeries("amount");
    XYSeriesCollection dataset = new XYSeriesCollection(signal);

    JFrame f = new JFrame(selectedPlot.getName() + " pressure sensor chart");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JFreeChart chart = ChartFactory.createXYLineChart(selectedPlot.getName(), "Reading number", "Reading",
            dataset);//from   ww w .j  a va2s.  c o  m
    f.add(new ChartPanel(chart));
    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    signal.clear();
    Sensor sensor;
    SensorData sensorData;
    for (int i = 0; i < selectedPlot.getSensors().size(); i++) {
        sensor = selectedPlot.getSensors().get(i);
        if (sensor.getSensorType() == SensorType.PRESSURE) {
            for (int j = 0; j < sensor.getSensorDataList().size(); j++) {
                sensorData = sensor.getSensorDataList().get(j);
                signal.add(j, sensorData.getDataRepresentationType());
            }
        }
    }

    f.add(p, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:Assignment2.FarmManagementGUI.java

private void btnSoilMoistureChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSoilMoistureChartActionPerformed
    XYSeries signal = new XYSeries("amount");
    XYSeriesCollection dataset = new XYSeriesCollection(signal);

    JFrame f = new JFrame(selectedPlot.getName() + " soil moisture sensor chart");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JFreeChart chart = ChartFactory.createXYLineChart(selectedPlot.getName(), "Reading number", "Reading",
            dataset);// www  .j a  va 2s  .c om
    f.add(new ChartPanel(chart));
    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    signal.clear();
    Sensor sensor;
    SensorData sensorData;
    for (int i = 0; i < selectedPlot.getSensors().size(); i++) {
        sensor = selectedPlot.getSensors().get(i);
        if (sensor.getSensorType() == SensorType.SOIL_MOISTURE) {
            for (int j = 0; j < sensor.getSensorDataList().size(); j++) {
                sensorData = sensor.getSensorDataList().get(j);
                signal.add(j, sensorData.getDataRepresentationType());
            }
        }
    }

    f.add(p, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:Assignment2.FarmManagementGUI.java

private void btnSoilTempChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSoilTempChartActionPerformed
    XYSeries signal = new XYSeries("amount");
    XYSeriesCollection dataset = new XYSeriesCollection(signal);

    JFrame f = new JFrame(selectedPlot.getName() + " soil temperature sensor chart");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JFreeChart chart = ChartFactory.createXYLineChart(selectedPlot.getName(), "Reading number", "Reading",
            dataset);/*from  w ww . j a  v a  2 s .com*/
    f.add(new ChartPanel(chart));
    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    signal.clear();
    Sensor sensor;
    SensorData sensorData;
    for (int i = 0; i < selectedPlot.getSensors().size(); i++) {
        sensor = selectedPlot.getSensors().get(i);
        if (sensor.getSensorType() == SensorType.SOIL_TEMPERATURE) {
            for (int j = 0; j < sensor.getSensorDataList().size(); j++) {
                sensorData = sensor.getSensorDataList().get(j);
                signal.add(j, sensorData.getDataRepresentationType());
            }
        }
    }

    f.add(p, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:Assignment2.FarmManagementGUI.java

private void btnAcidityChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAcidityChartActionPerformed
    XYSeries signal = new XYSeries("amount");
    XYSeriesCollection dataset = new XYSeriesCollection(signal);

    JFrame f = new JFrame(selectedPlot.getName() + " soil acidity sensor chart");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JFreeChart chart = ChartFactory.createXYLineChart(selectedPlot.getName(), "Reading number", "Reading",
            dataset);//from  ww w.  j a v  a 2  s . c o m
    f.add(new ChartPanel(chart));
    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    signal.clear();
    Sensor sensor;
    SensorData sensorData;
    for (int i = 0; i < selectedPlot.getSensors().size(); i++) {
        sensor = selectedPlot.getSensors().get(i);
        if (sensor.getSensorType() == SensorType.ACIDITY) {
            for (int j = 0; j < sensor.getSensorDataList().size(); j++) {
                sensorData = sensor.getSensorDataList().get(j);
                signal.add(j, sensorData.getDataRepresentationType());
            }
        }
    }

    f.add(p, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:de.bwravencl.controllerbuddy.gui.Main.java

private void updateOverlayAlignment(final Rectangle maxWindowBounds) {
    final var inLowerHalf = overlayFrame.getY() + overlayFrame.getHeight() / 2 < maxWindowBounds.height / 2;

    overlayFrame.remove(labelCurrentMode);
    overlayFrame.add(labelCurrentMode, inLowerHalf ? BorderLayout.PAGE_START : BorderLayout.PAGE_END);

    var alignment = SwingConstants.RIGHT;
    var flowLayoutAlignment = FlowLayout.RIGHT;
    if (overlayFrame.getX() + overlayFrame.getWidth() / 2 < maxWindowBounds.width / 2) {
        alignment = SwingConstants.LEFT;
        flowLayoutAlignment = FlowLayout.LEFT;
    }//from   w  w  w .ja va  2  s.  c om

    labelCurrentMode.setHorizontalAlignment(alignment);

    indicatorPanelFlowLayout.setAlignment(flowLayoutAlignment);
    indicatorPanel.invalidate();

    overlayFrame.setBackground(TRANSPARENT);
    overlayFrame.pack();
}

From source file:Assignment2.FarmManagementGUI.java

private void btnLightChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLightChartActionPerformed
    XYSeries signal = new XYSeries("amount");
    XYSeriesCollection dataset = new XYSeriesCollection(signal);

    JFrame f = new JFrame(selectedPlot.getName() + " light sensor chart");
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JFreeChart chart = ChartFactory.createXYLineChart(selectedPlot.getName(), "Reading number", "Reading",
            dataset);/*w ww  .j  av a2  s . co m*/
    f.add(new ChartPanel(chart));
    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    signal.clear();
    Sensor sensor;
    SensorData sensorData;
    for (int i = 0; i < selectedPlot.getSensors().size(); i++) {
        sensor = selectedPlot.getSensors().get(i);
        if (sensor.getSensorType() == SensorType.LIGHT_SENSOR) {
            for (int j = 0; j < sensor.getSensorDataList().size(); j++) {
                sensorData = sensor.getSensorDataList().get(j);
                signal.add(j, sensorData.getDataRepresentationType());
            }
        }
    }

    f.add(p, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}