Example usage for java.awt ComponentOrientation LEFT_TO_RIGHT

List of usage examples for java.awt ComponentOrientation LEFT_TO_RIGHT

Introduction

In this page you can find the example usage for java.awt ComponentOrientation LEFT_TO_RIGHT.

Prototype

ComponentOrientation LEFT_TO_RIGHT

To view the source code for java.awt ComponentOrientation LEFT_TO_RIGHT.

Click Source Link

Document

Items run left to right and lines flow top to bottom Examples: English, French.

Usage

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel testPanelItems2() {
    JPanel panel = new JPanel();
    panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    /*panel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Test Parameters-1"),
                BorderFactory.createEmptyBorder()));*/
    float w = (float) ((float) width * 0.4);
    //panel.setPreferredSize(new Dimension((int)w, 100));
    panel.add(new JLabel("Data Path-2:"));
    t3_o1 = new JCheckBox("Loopback");
    if (mode == LandingPage.PERFORMANCE_MODE_GENCHK || mode == LandingPage.PERFORMANCE_MODE_GENCHK_DV)
        t3_o1.setToolTipText("This loops back software generated traffic at DMA user interface");
    else if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV)
        t3_o1.setToolTipText("This loops back software generated raw Ethernet frames at 10G PHY");

    t3_o1.setSelected(true);//from w w  w.ja  v a2s .  c  o m
    t3_o1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) {
                t3_o1.setSelected(true);
                return;
            }
            if (t3_o1.isSelected()) {
                // disable others
                test3_option = DriverInfo.ENABLE_LOOPBACK;
                t3_o2.setSelected(false);
                t3_o3.setSelected(false);
            } else {
                if (!t3_o2.isSelected() && !t3_o3.isSelected()) {
                    test3_option = DriverInfo.CHECKER;
                    t3_o2.setSelected(true);
                }
            }
        }
    });
    //b1.setSelected(true);
    t3_o2 = new JCheckBox("HW Checker");
    if (mode == LandingPage.PERFORMANCE_MODE_GENCHK || mode == LandingPage.PERFORMANCE_MODE_GENCHK_DV)
        t3_o2.setToolTipText(
                "This enables Checker in hardware at DMA user interface verifying traffic generated by software");
    t3_o2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (t3_o2.isSelected()) {
                // disable others
                test3_option = DriverInfo.CHECKER;
                t3_o1.setSelected(false);
                //t2_o3.setSelected(false);
                if (t3_o3.isSelected())
                    test3_option = DriverInfo.CHECKER_GEN;
            } else {
                if (t3_o3.isSelected())
                    test3_option = DriverInfo.GENERATOR;
                else {
                    test3_option = DriverInfo.ENABLE_LOOPBACK;
                    t3_o1.setSelected(true);
                }
            }
        }
    });
    //b2.setEnabled(false);
    t3_o3 = new JCheckBox("HW Generator");
    if (mode == LandingPage.PERFORMANCE_MODE_GENCHK || mode == LandingPage.PERFORMANCE_MODE_GENCHK_DV)
        t3_o3.setToolTipText("This enables traffic generator in hardware at the DMA user interface");
    t3_o3.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (t3_o3.isSelected()) {
                // disable others
                test3_option = DriverInfo.GENERATOR;
                t3_o1.setSelected(false);
                //t2_o2.setSelected(false);
                if (t3_o2.isSelected())
                    test3_option = DriverInfo.CHECKER_GEN;
            } else {
                if (t3_o2.isSelected())
                    test3_option = DriverInfo.CHECKER;
                else {
                    test3_option = DriverInfo.ENABLE_LOOPBACK;
                    t3_o1.setSelected(true);
                }
            }
        }
    });
    //b3.setEnabled(false);
    JPanel ip = new JPanel();
    ip.setLayout(new BoxLayout(ip, BoxLayout.PAGE_AXIS));
    ip.add(t3_o1);
    ip.add(t3_o2);
    ip.add(t3_o3);
    panel.add(ip);
    panel.add(new JLabel("Packet Size (bytes):"));
    t3_psize = new JTextField("32768", 5);
    panel.add(t3_psize);
    s3test = new JButton("Start");
    //s3test.setEnabled(false);
    s3test.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            //Check for led status and start the test
            if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) {
                if (lstats.ddrCalib1 == LED_OFF && lstats.ddrCalib2 == LED_OFF
                        && (lstats.phy2 == LED_ON && lstats.phy3 == LED_ON)) {
                    JOptionPane.showMessageDialog(null, "DDR3 is not calibrated. Test cannot be started",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                } else if (lstats.ddrCalib1 == LED_OFF && lstats.ddrCalib2 == LED_OFF
                        && (lstats.phy2 == LED_OFF || lstats.phy3 == LED_OFF)) {
                    JOptionPane.showMessageDialog(null,
                            "DDR3 is not calibrated and 10G-PHY link is down. Test cannot be started", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                } else if (lstats.ddrCalib1 == LED_ON && lstats.ddrCalib2 == LED_ON
                        && (lstats.phy2 == LED_OFF || lstats.phy3 == LED_OFF)) {
                    JOptionPane.showMessageDialog(null, "10G-PHY link is down. Test cannot be started", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
            }

            if (s3test.getText().equals("Start")) {
                int psize = 0;
                dataMismatch4 = errcnt2 = false;
                try {
                    psize = Integer.parseInt(t3_psize.getText());
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "Only Natural numbers are allowed", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
                if (psize < minpkt1 || psize > maxpkt1) {
                    JOptionPane.showMessageDialog(null,
                            "Packet size must be within " + minpkt1 + " to " + maxpkt1 + " bytes", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
                di.startTest(2, test3_option, psize);
                t3_o1.setEnabled(false);
                t3_o2.setEnabled(false);
                t3_o3.setEnabled(false);
                t3_psize.setEnabled(false);
                s3test.setText("Stop");
                testStarted2 = true;
                updateLog("[Test Started for Data Path-2]", logStatus);

            } else if (s3test.getText().equals("Stop")) {
                // Disable button to avoid multiple clicks
                s3test.setEnabled(false);
                SwingWorker worker = new SwingWorker<Void, Void>() {

                    @Override
                    protected Void doInBackground() throws Exception {
                        try {
                            stopTest3();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        return null;
                    }

                };
                worker.execute();
            }
        }
    });
    panel.add(s3test);
    if ((mode == LandingPage.APPLICATION_MODE) || (mode == LandingPage.APPLICATION_MODE_P2P)) {
        t3_o1.setSelected(false);
        t3_o2.setSelected(false);
        t3_o3.setSelected(false);
        t3_o1.setEnabled(false);
        t3_o2.setEnabled(false);
        t3_o3.setEnabled(false);
        t3_psize.setEnabled(false);
        t3_psize.setText("");
        s3test.setEnabled(false);
    }
    return panel;
}

From source file:com.xilinx.virtex7.MainScreen.java

private JPanel testPanelItems3() {
    JPanel panel = new JPanel();
    panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    /*panel.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createTitledBorder("Test Parameters-1"),
                BorderFactory.createEmptyBorder()));*/
    float w = (float) ((float) width * 0.4);
    //panel.setPreferredSize(new Dimension((int)w, 100));
    panel.add(new JLabel("Data Path-3:"));
    t4_o1 = new JCheckBox("Loopback");
    if (mode == LandingPage.PERFORMANCE_MODE_GENCHK || mode == LandingPage.PERFORMANCE_MODE_GENCHK_DV)
        t4_o1.setToolTipText("This loops back software generated traffic at DMA user interface");
    else if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV)
        t4_o1.setToolTipText("This loops back software generated raw Ethernet frames at 10G PHY");

    t4_o1.setSelected(true);//from  w w  w.j  av a2s  .  c  o m
    t4_o1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) {
                t4_o1.setSelected(true);
                return;
            }
            if (t4_o1.isSelected()) {
                // disable others
                test4_option = DriverInfo.ENABLE_LOOPBACK;
                t4_o2.setSelected(false);
                t4_o3.setSelected(false);
            } else {
                if (!t4_o2.isSelected() && !t4_o3.isSelected()) {
                    test4_option = DriverInfo.CHECKER;
                    t4_o2.setSelected(true);
                }
            }
        }
    });
    //b1.setSelected(true);
    t4_o2 = new JCheckBox("HW Checker");
    if (mode == LandingPage.PERFORMANCE_MODE_GENCHK || mode == LandingPage.PERFORMANCE_MODE_GENCHK_DV)
        t4_o2.setToolTipText(
                "This enables Checker in hardware at DMA user interface verifying traffic generated by software");
    t4_o2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (t4_o2.isSelected()) {
                // disable others
                test4_option = DriverInfo.CHECKER;
                t4_o1.setSelected(false);
                //t2_o3.setSelected(false);
                if (t4_o3.isSelected())
                    test4_option = DriverInfo.CHECKER_GEN;
            } else {
                if (t4_o3.isSelected())
                    test4_option = DriverInfo.GENERATOR;
                else {
                    test4_option = DriverInfo.ENABLE_LOOPBACK;
                    t4_o1.setSelected(true);
                }
            }
        }
    });
    //b2.setEnabled(false);
    t4_o3 = new JCheckBox("HW Generator");
    if (mode == LandingPage.PERFORMANCE_MODE_GENCHK || mode == LandingPage.PERFORMANCE_MODE_GENCHK_DV)
        t4_o3.setToolTipText("This enables traffic generator in hardware at the DMA user interface");
    t4_o3.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            if (t4_o3.isSelected()) {
                // disable others
                test4_option = DriverInfo.GENERATOR;
                t4_o1.setSelected(false);
                //t2_o2.setSelected(false);
                if (t4_o2.isSelected())
                    test4_option = DriverInfo.CHECKER_GEN;
            } else {
                if (t4_o2.isSelected())
                    test4_option = DriverInfo.CHECKER;
                else {
                    test4_option = DriverInfo.ENABLE_LOOPBACK;
                    t4_o1.setSelected(true);
                }
            }
        }
    });
    //b3.setEnabled(false);
    JPanel ip = new JPanel();
    ip.setLayout(new BoxLayout(ip, BoxLayout.PAGE_AXIS));
    ip.add(t4_o1);
    ip.add(t4_o2);
    ip.add(t4_o3);
    panel.add(ip);
    panel.add(new JLabel("Packet Size (bytes):"));
    t4_psize = new JTextField("32768", 5);
    panel.add(t4_psize);
    s4test = new JButton("Start");
    if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) {

    } else
        stest.setEnabled(false);
    s4test.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent ae) {
            //Check for led status and start the test
            if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) {
                if (lstats.ddrCalib1 == LED_OFF && lstats.ddrCalib2 == LED_OFF
                        && (lstats.phy2 == LED_ON && lstats.phy3 == LED_ON)) {
                    JOptionPane.showMessageDialog(null, "DDR3 is not calibrated. Test cannot be started",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                } else if (lstats.ddrCalib1 == LED_OFF && lstats.ddrCalib2 == LED_OFF
                        && (lstats.phy2 == LED_OFF || lstats.phy3 == LED_OFF)) {
                    JOptionPane.showMessageDialog(null,
                            "DDR3 is not calibrated and 10G-PHY link is down. Test cannot be started", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                } else if (lstats.ddrCalib1 == LED_ON && lstats.ddrCalib2 == LED_ON
                        && (lstats.phy2 == LED_OFF || lstats.phy3 == LED_OFF)) {
                    JOptionPane.showMessageDialog(null, "10G-PHY link is down. Test cannot be started", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
            }

            if (s4test.getText().equals("Start")) {
                int psize = 0;
                dataMismatch6 = errcnt3 = false;
                try {
                    psize = Integer.parseInt(t4_psize.getText());
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "Only Natural numbers are allowed", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
                if (psize < minpkt1 || psize > maxpkt1) {
                    JOptionPane.showMessageDialog(null,
                            "Packet size must be within " + minpkt1 + " to " + maxpkt1 + " bytes", "Error",
                            JOptionPane.ERROR_MESSAGE);
                    return;
                }
                di.startTest(3, test4_option, psize);
                t4_o1.setEnabled(false);
                t4_o2.setEnabled(false);
                t4_o3.setEnabled(false);
                t4_o2.setEnabled(false);
                t4_psize.setEnabled(false);
                s4test.setText("Stop");
                testStarted3 = true;
                updateLog("[Test Started for Data Path-3]", logStatus);

            } else if (s4test.getText().equals("Stop")) {
                // Disable button to avoid multiple clicks
                s4test.setEnabled(false);
                SwingWorker worker = new SwingWorker<Void, Void>() {

                    @Override
                    protected Void doInBackground() throws Exception {
                        try {
                            stopTest4();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        return null;
                    }

                };
                worker.execute();
            }
        }
    });
    panel.add(s4test);
    if ((mode == LandingPage.APPLICATION_MODE) || (mode == LandingPage.APPLICATION_MODE_P2P)) {
        t4_o1.setSelected(false);
        t4_o2.setSelected(false);
        t4_o3.setSelected(false);
        t4_o1.setEnabled(false);
        t4_o2.setEnabled(false);
        t4_o3.setEnabled(false);
        t4_psize.setEnabled(false);
        t4_psize.setText("");
        s4test.setEnabled(false);
    }
    return panel;
}

From source file:org.freeplane.view.swing.features.filepreview.AudioViewerFactory.java

public JComponent createViewer(final ExternalResource resource, final URI uri, int maximumWidth)
        throws MalformedURLException, IOException {
    String vlcPath = "C:\\Program Files\\VideoLAN\\VLC";
    NativeLibrary.addSearchPath("libvlc", vlcPath);
    System.setProperty("jna.library.path", vlcPath);

    final URI mediaPath = uri;

    JComponent jc = new JPanel();
    jc.setLayout(new GridLayout(3, 2, 5, 10));
    JLabel FileType = new JLabel("FILE TYPE: ");
    JLabel FileName = new JLabel("AUDIO FILE");

    JLabel Title = new JLabel("TITLE: ");
    tField = new TextField(20);
    tField.setEditable(true);//from   ww w. j  a  v  a  2  s.  c o  m
    //tField.setText(new Scanner(new File("fieldSave.txt")).useDelimiter("\\A").next());
    //   JLabel TitleData = new JLabel("________________________");

    JButton TitleButton = new JButton("Save Title");
    JButton playAudio = new JButton("Play Audio");

    jc.add(FileType);
    jc.add(FileName);
    jc.add(Title);
    jc.add(tField);
    //      jc.add(TitleData);
    jc.add(TitleButton);
    jc.add(playAudio);

    playAudio.addActionListener(new PlayAudio(mediaPath, vlcPath));
    TitleButton.addActionListener(new AddTitleData());

    jc.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    return jc;
}

From source file:org.freeplane.view.swing.features.filepreview.VideoViewerFactory.java

public JComponent createViewer(final ExternalResource resource, final URI uri, int maximumWidth)
        throws MalformedURLException, IOException {
    String vlcPath = "C:\\Program Files\\VideoLAN\\VLC";
    NativeLibrary.addSearchPath("libvlc", vlcPath);
    System.setProperty("jna.library.path", vlcPath);

    final URI mediaPath = uri;

    JComponent jc = new JPanel();
    jc.setLayout(new GridLayout(3, 2, 5, 10));
    JLabel FileType = new JLabel("FILE TYPE: ");
    JLabel FileName = new JLabel("VIDEO FILE");

    JLabel Title = new JLabel("TITLE: ");
    tField = new TextField(20);
    tField.setEditable(true);/*w w  w. j  a  va2s  . c o  m*/
    //tField.setText(new Scanner(new File("fieldSave.txt")).useDelimiter("\\A").next());

    //   JLabel TitleData = new JLabel("________________________");

    JButton TitleButton = new JButton("Save Title");
    JButton playVideo = new JButton("Play Video");

    jc.add(FileType);
    jc.add(FileName);
    jc.add(Title);
    jc.add(tField);
    //      jc.add(TitleData);
    jc.add(TitleButton);
    jc.add(playVideo);

    playVideo.addActionListener(new PlayAudio(mediaPath, vlcPath));
    TitleButton.addActionListener(new AddTitleData());

    tField.addActionListener(new AddTitleData());

    jc.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    return jc;
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private JPanel createButtonPanel() {
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    buttonPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, SystemColor.windowBorder));
    buttonPanel.setOpaque(true);//  ww w. ja  v a 2  s .c o  m
    buttonPanel.setBackground(ColorAndFontConstants.MID_BACKGROUND_COLOR);
    buttonPanel.setComponentOrientation(
            ComponentOrientation.getOrientation(controller.getLocaliser().getLocale()));

    Action helpAction;
    if (ComponentOrientation.LEFT_TO_RIGHT == ComponentOrientation
            .getOrientation(controller.getLocaliser().getLocale())) {
        helpAction = new HelpContextAction(controller, ImageLoader.HELP_CONTENTS_BIG_ICON_FILE,
                "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText",
                HelpContentsPanel.HELP_PREFERENCES_URL);
    } else {
        helpAction = new HelpContextAction(controller, ImageLoader.HELP_CONTENTS_BIG_RTL_ICON_FILE,
                "multiBitFrame.helpMenuText", "multiBitFrame.helpMenuTooltip", "multiBitFrame.helpMenuText",
                HelpContentsPanel.HELP_PREFERENCES_URL);
    }
    HelpButton helpButton = new HelpButton(helpAction, controller);
    helpButton.setText("");
    helpButton.setToolTipText(controller.getLocaliser().getString("multiBitFrame.helpMenuTooltip"));
    helpButton.setHorizontalAlignment(SwingConstants.LEADING);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 0.3;
    constraints.weighty = 0.1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    buttonPanel.add(helpButton, constraints);

    ShowPreferencesSubmitAction submitAction = new ShowPreferencesSubmitAction(this.bitcoinController,
            this.exchangeController, this, ImageLoader.createImageIcon(ImageLoader.PREFERENCES_ICON_FILE),
            mainFrame);
    MultiBitButton submitButton = new MultiBitButton(submitAction, controller);
    buttonPanel.add(submitButton);

    UndoPreferencesChangesSubmitAction undoChangesAction = new UndoPreferencesChangesSubmitAction(controller,
            ImageLoader.createImageIcon(ImageLoader.UNDO_ICON_FILE));
    undoChangesButton = new MultiBitButton(undoChangesAction, controller);

    buttonPanel.add(undoChangesButton);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.weightx = 0.1;
    constraints.weighty = 1.0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    buttonPanel.add(submitButton, constraints);

    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = 2;
    constraints.gridy = 0;
    constraints.weightx = 0.1;
    constraints.weighty = 1.0;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_START;
    buttonPanel.add(undoChangesButton, constraints);

    JPanel fill1 = new JPanel();
    fill1.setOpaque(false);
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 2;
    constraints.gridy = 0;
    constraints.weightx = 200;
    constraints.weighty = 1;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.LINE_END;
    buttonPanel.add(fill1, constraints);

    return buttonPanel;
}