Example usage for javax.swing SwingConstants RIGHT

List of usage examples for javax.swing SwingConstants RIGHT

Introduction

In this page you can find the example usage for javax.swing SwingConstants RIGHT.

Prototype

int RIGHT

To view the source code for javax.swing SwingConstants RIGHT.

Click Source Link

Document

Box-orientation constant used to specify the right side of a box.

Usage

From source file:gui.MainGUI.java

private void initComponents() {

    panelExploration = new javax.swing.JPanel();
    scrollPaneImage = new javax.swing.JScrollPane();
    labelImageHolder = new javax.swing.JLabel();
    buttonStart = new javax.swing.JButton();
    toggleHierarchy = new javax.swing.JToggleButton();
    toggleEnv = new javax.swing.JToggleButton();
    buttonStep = new javax.swing.JButton();
    buttonStop = new javax.swing.JButton();
    labelCycleUpdate = new javax.swing.JLabel();
    labelCycle = new javax.swing.JLabel();
    labelExploredUpdate = new javax.swing.JLabel();
    labelExplored = new javax.swing.JLabel();
    buttonData = new javax.swing.JButton();
    labelSpeed = new javax.swing.JLabel();
    sliderSpeed = new javax.swing.JSlider();
    scrollPaneRobots = new javax.swing.JScrollPane();
    panelRobotInfo = new javax.swing.JPanel();
    labelAvgCycle = new javax.swing.JLabel();
    labelAvgCycleUpdate = new javax.swing.JLabel();
    MainMenu1 = new javax.swing.JMenuBar();
    menuExploration1 = new javax.swing.JMenu();
    menuCommunication1 = new javax.swing.JMenu();
    menuEnvironment1 = new javax.swing.JMenu();
    menuRobots1 = new javax.swing.JMenu();
    menuLogs1 = new javax.swing.JMenu();

    setTitle("Multi-robot Exploration Simulator (MRESim) v2.0");
    setName("OuterFrame"); // NOI18N
    setResizable(false);//from w  ww .  j av a  2s. com

    panelExploration.setMaximumSize(new java.awt.Dimension(800, 600));
    panelExploration.setMinimumSize(new java.awt.Dimension(800, 600));
    panelExploration.setRequestFocusEnabled(false);

    labelImageHolder.setBackground(new java.awt.Color(255, 255, 102));
    labelImageHolder.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelImageHolder.setMaximumSize(new java.awt.Dimension(800, 600));
    labelImageHolder.setMinimumSize(new java.awt.Dimension(800, 600));
    labelImageHolder.setPreferredSize(new java.awt.Dimension(800, 600));
    scrollPaneImage.setViewportView(labelImageHolder);

    javax.swing.GroupLayout panelExplorationLayout = new javax.swing.GroupLayout(panelExploration);
    panelExploration.setLayout(panelExplorationLayout);
    panelExplorationLayout.setHorizontalGroup(
            panelExplorationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    scrollPaneImage, javax.swing.GroupLayout.PREFERRED_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE));
    panelExplorationLayout.setVerticalGroup(
            panelExplorationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    scrollPaneImage, javax.swing.GroupLayout.PREFERRED_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE));

    buttonStart.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    buttonStart.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonPlay.png"))); // NOI18N
    buttonStart.setToolTipText("Start simulation");
    buttonStart.setBorderPainted(false);
    buttonStart.setContentAreaFilled(false);
    buttonStart.setIconTextGap(0);
    buttonStart.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonStart.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonStart.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonStart.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonStartActionPerformed(evt);
        }
    });

    toggleHierarchy
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonHierarchy.png"))); // NOI18N
    toggleHierarchy.setSelected(true);
    toggleHierarchy.setToolTipText("Toggle hierarchy");
    toggleHierarchy.setBorderPainted(false);
    toggleHierarchy.setContentAreaFilled(false);
    toggleHierarchy.setMaximumSize(new java.awt.Dimension(36, 36));
    toggleHierarchy.setMinimumSize(new java.awt.Dimension(36, 36));
    toggleHierarchy.setPreferredSize(new java.awt.Dimension(36, 36));
    toggleHierarchy.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toggleHierarchyActionPerformed(evt);
        }
    });

    toggleEnv.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonEnvironment.png"))); // NOI18N
    toggleEnv.setSelected(true);
    toggleEnv.setToolTipText("Toggle environment");
    toggleEnv.setBorderPainted(false);
    toggleEnv.setContentAreaFilled(false);
    toggleEnv.setMaximumSize(new java.awt.Dimension(36, 36));
    toggleEnv.setMinimumSize(new java.awt.Dimension(36, 36));
    toggleEnv.setPreferredSize(new java.awt.Dimension(36, 36));
    toggleEnv.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toggleEnvActionPerformed(evt);
        }
    });

    buttonStep.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    buttonStep.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonStep.png"))); // NOI18N
    buttonStep.setToolTipText("Take one step");
    buttonStep.setBorderPainted(false);
    buttonStep.setContentAreaFilled(false);
    buttonStep.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonStep.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonStep.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonStep.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonStepActionPerformed(evt);
        }
    });

    buttonStop.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    buttonStop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonStop.png"))); // NOI18N
    buttonStop.setToolTipText("Reset simulation");
    buttonStop.setBorderPainted(false);
    buttonStop.setContentAreaFilled(false);
    buttonStop.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonStop.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonStop.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonStop.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonStopActionPerformed(evt);
        }
    });

    labelCycleUpdate.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelCycleUpdate.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelCycleUpdate.setText("0");

    labelCycle.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelCycle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelCycle.setText("Cycle:");

    labelExploredUpdate.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelExploredUpdate.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelExploredUpdate.setText("0");

    labelExplored.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelExplored.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelExplored.setText("% Explored:");

    buttonData.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/buttonData.png"))); // NOI18N
    buttonData.setBorderPainted(false);
    buttonData.setContentAreaFilled(false);
    buttonData.setMaximumSize(new java.awt.Dimension(36, 36));
    buttonData.setMinimumSize(new java.awt.Dimension(36, 36));
    buttonData.setPreferredSize(new java.awt.Dimension(36, 36));
    buttonData.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonDataActionPerformed(evt);
        }
    });

    labelSpeed.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelSpeed.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelSpeed.setText("Speed:");

    sliderSpeed.setMajorTickSpacing(1);
    sliderSpeed.setMaximum(10);
    sliderSpeed.setSnapToTicks(true);
    sliderSpeed.setToolTipText("Simulation speed");
    sliderSpeed.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            sliderSpeedStateChanged(evt);
        }
    });

    scrollPaneRobots.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPaneRobots.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPaneRobots.setMinimumSize(new java.awt.Dimension(21, 22));
    scrollPaneRobots.setPreferredSize(new java.awt.Dimension(0, 0));

    panelRobotInfo.setPreferredSize(new java.awt.Dimension(273, 600));

    javax.swing.GroupLayout panelRobotInfoLayout = new javax.swing.GroupLayout(panelRobotInfo);
    panelRobotInfo.setLayout(panelRobotInfoLayout);
    panelRobotInfoLayout.setHorizontalGroup(panelRobotInfoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 273, Short.MAX_VALUE));
    panelRobotInfoLayout.setVerticalGroup(panelRobotInfoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 600, Short.MAX_VALUE));

    scrollPaneRobots.setViewportView(panelRobotInfo);

    labelAvgCycle.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelAvgCycle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    labelAvgCycle.setText("Avg Cycle:");

    labelAvgCycleUpdate.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    labelAvgCycleUpdate.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    labelAvgCycleUpdate.setText("0");

    MainMenu1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N

    menuExploration1.setText("Exploration");
    menuExploration1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuExploration1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuExplorationMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuExplorationMouseReleased(evt);
        }
    });
    menuExploration1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuExplorationMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuExploration1);

    menuCommunication1.setText("Communication");
    menuCommunication1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuCommunication1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuCommunicationMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuCommunicationMouseReleased(evt);
        }
    });
    menuCommunication1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuCommunicationMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuCommunication1);

    menuEnvironment1.setText("Environment");
    menuEnvironment1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuEnvironment1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuEnvironmentMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuEnvironmentMouseReleased(evt);
        }
    });
    menuEnvironment1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuEnvironmentMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuEnvironment1);

    menuRobots1.setText("Robots");
    menuRobots1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuRobots1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuRobotsMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuRobotsMouseReleased(evt);
        }
    });
    menuRobots1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuRobotsMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuRobots1);

    menuLogs1.setText("Logs");
    menuLogs1.setFont(new java.awt.Font("Arial", 0, 11)); // NOI18N
    menuLogs1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            menuLogsMouseClicked(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            menuLogsMouseReleased(evt);
        }
    });
    menuLogs1.addMenuDragMouseListener(new javax.swing.event.MenuDragMouseListener() {
        public void menuDragMouseDragged(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseEntered(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseExited(javax.swing.event.MenuDragMouseEvent evt) {
        }

        public void menuDragMouseReleased(javax.swing.event.MenuDragMouseEvent evt) {
            menuLogsMenuDragMouseReleased(evt);
        }
    });
    MainMenu1.add(menuLogs1);

    setJMenuBar(MainMenu1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(panelExploration, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(scrollPaneRobots, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(labelSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, 44,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(sliderSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, 89,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(164, 164, 164)
                            .addComponent(buttonStart, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(buttonStep, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(buttonStop, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(231, 231, 231)
                            .addGroup(layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(labelCycle).addComponent(labelExplored,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 70,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(labelExploredUpdate,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(labelCycleUpdate,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(layout.createSequentialGroup()
                                            .addComponent(labelAvgCycle, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(labelAvgCycleUpdate,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(65, 65, 65)
                            .addComponent(toggleEnv, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(toggleHierarchy, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(buttonData, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(46, 89, Short.MAX_VALUE)))
                    .addContainerGap()));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
                    .createSequentialGroup().addContainerGap().addGroup(layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addComponent(
                                    panelExploration, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(scrollPaneRobots, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(labelCycleUpdate).addComponent(labelCycle))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.BASELINE)
                                                    .addComponent(labelExploredUpdate)
                                                    .addComponent(labelExplored))
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.BASELINE)
                                                    .addComponent(labelAvgCycleUpdate)
                                                    .addComponent(labelAvgCycle)))
                                    .addGroup(layout.createSequentialGroup().addGroup(layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(buttonStop,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(
                                                            buttonStep, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(buttonStart,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(labelSpeed)
                                            .addComponent(sliderSpeed, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(buttonData, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(toggleHierarchy,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(toggleEnv, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(0, 0, Short.MAX_VALUE)))
                    .addContainerGap()));

    pack();
}

From source file:jchrest.gui.VisualSearchPane.java

private JPanel analysePanel() {
    _analysisScreen = new JTextArea();

    Box buttons = Box.createVerticalBox();
    buttons.add(new JLabel("Find frequency of nodes used by model when scanning scenes"));

    JSpinner numFixations = new JSpinner(new SpinnerNumberModel(20, 1, 1000, 1));

    JPanel labelledSpinner = new JPanel();
    labelledSpinner.setLayout(new GridLayout(1, 2));
    labelledSpinner.add(new JLabel("Number of fixations: ", SwingConstants.RIGHT));
    labelledSpinner.add(numFixations);/*  ww  w. ja va  2s .co  m*/

    buttons.add(labelledSpinner);
    buttons.add(runAnalysisButtons(numFixations));

    // main panel
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    panel.add(buttons, BorderLayout.NORTH);

    panel.add(new JScrollPane(_analysisScreen));

    Box displayButtons = Box.createHorizontalBox();
    displayButtons.add(new JButton(new SaveAction(_analysisScreen)));
    displayButtons.add(new JButton(new ClearAction(_analysisScreen)));
    panel.add(displayButtons, BorderLayout.SOUTH);

    return panel;
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private JLabel getHiPointLabel() {
    if (hiPointLabel == null) {
        hiPointLabel = new JLabel();
        hiPointLabel.setText(new Message(Messages.HIGHEST_POINT).toString());
        hiPointLabel.setBounds(20, 55, 80, 20);
        hiPointLabel.setFont(GUIConstants.DIALOG_10);
        hiPointLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    }// w  w  w  .  j av a  2s.  c  o m
    return hiPointLabel;
}

From source file:com.all.login.view.NewAccountFormPanel.java

private JLabel getSecurityLabel() {
    if (securityLabel == null) {
        securityLabel = new JLabel();
        securityLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        securityLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
        securityLabel.setBounds(SECURITY_LABEL_BOUNDS);
        securityLabel.setName(SynthFonts.PLAIN_FONT10_GRAY77_77_77);
    }/*  ww  w  .  j  a v a 2  s.  c  o m*/
    return securityLabel;
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private JLabel getLowPointLabel() {
    if (lowPointLabel == null) {
        lowPointLabel = new JLabel();
        lowPointLabel.setText(new Message(Messages.LOWEST_POINT).toString()); //$NON-NLS-1$
        lowPointLabel.setFont(GUIConstants.DIALOG_10);
        lowPointLabel.setBounds(10, 30, 90, 20);
        lowPointLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    }//  ww  w.j av  a 2 s.com
    return lowPointLabel;
}

From source file:lejos.pc.charting.LogChartFrame.java

/** All the setup of components, etc. What's scary is Swing is a "lightweight" GUI framework...
 * @throws Exception// ww w .  j  a va2s .co  m
 */
private void jbInit() throws Exception {
    this.setJMenuBar(menuBar);
    this.setSize(new Dimension(819, 613));
    this.setMinimumSize(new Dimension(819, 613));
    this.setTitle("NXT Charting Logger");
    this.setEnabled(true);
    // enforce minimum window size
    this.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            JFrame theFrame = (JFrame) e.getSource();
            Dimension d1 = theFrame.getMinimumSize();
            Dimension d2 = theFrame.getSize();
            boolean enforce = false;
            if (theFrame.getWidth() < d1.getWidth()) {
                d2.setSize(d1.getWidth(), d2.getHeight());
                enforce = true;
            }
            if (theFrame.getHeight() < d1.getHeight()) {
                d2.setSize(d2.getWidth(), d1.getHeight());
                enforce = true;
            }
            if (enforce)
                theFrame.setSize(d2);
        }
    });

    this.getContentPane().setLayout(gridBagLayout1);
    MenuActionListener menuItemActionListener = new MenuActionListener();
    MenuEventListener menuListener = new MenuEventListener();

    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    menuBar.add(menu);
    menuItem = new JMenuItem("Copy Chart Image", KeyEvent.VK_I);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("Copy Data Log", KeyEvent.VK_D);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);

    menu = new JMenu("View");
    menu.setMnemonic(KeyEvent.VK_V);
    menu.setActionCommand("VIEW_MENU");
    menu.addMenuListener(menuListener);
    menuBar.add(menu);
    menuItem = new JMenuItem("Expand Chart", KeyEvent.VK_F);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("Chart in New Window", KeyEvent.VK_N);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);

    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(menu);
    menuItem = new JMenuItem("Chart controls", KeyEvent.VK_C);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("Generate sample data", KeyEvent.VK_G);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("About", KeyEvent.VK_A);
    menuItem.addActionListener(menuItemActionListener);
    jTabbedPane1.setPreferredSize(new Dimension(621, 199));
    jTabbedPane1.setMinimumSize(new Dimension(621, 199));
    menu.add(menuItem);

    jButtonConnect.setText("Connect");
    jButtonConnect.setBounds(new Rectangle(25, 65, 115, 25));
    jButtonConnect.setToolTipText("Connect/disconnect toggle");
    jButtonConnect.setMnemonic('C');
    jButtonConnect.setSelected(true);
    jButtonConnect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonConnect_actionPerformed(e);
        }
    });
    UIPanel.setSize(new Dimension(820, 200));
    UIPanel.setLayout(null);
    UIPanel.setPreferredSize(new Dimension(300, 200));
    UIPanel.setMinimumSize(new Dimension(300, 200));
    UIPanel.setBounds(new Rectangle(0, 350, 820, 200));
    UIPanel.setMaximumSize(new Dimension(300, 32767));
    connectionPanel.setBounds(new Rectangle(10, 10, 175, 100));
    connectionPanel.setBorder(BorderFactory.createTitledBorder("Connection"));
    connectionPanel.setLayout(null);
    connectionPanel.setFont(new Font("Tahoma", 0, 11));

    jLabel1logfilename.setText("Log File:");
    jLabel1logfilename.setBounds(new Rectangle(10, 125, 165, 20));
    jLabel1logfilename.setHorizontalTextPosition(SwingConstants.RIGHT);
    jLabel1logfilename.setHorizontalAlignment(SwingConstants.LEFT);
    jLabel1logfilename.setToolTipText("Specify the name of your log file here");

    jTextFieldNXTName.setBounds(new Rectangle(5, 40, 165, 20));
    jTextFieldNXTName.setToolTipText(
            "The name or Address of the NXT. Leave empty and the first one found will be used.");

    jTextFieldNXTName.requestFocus();

    jTextAreaStatus.setLineWrap(true);
    jTextAreaStatus.setFont(new Font("Tahoma", 0, 11));
    jTextAreaStatus.setWrapStyleWord(true);
    jTextAreaStatus.setBackground(SystemColor.window);

    dataLogTextArea.setLineWrap(false);
    dataLogTextArea.setFont(new Font("Tahoma", 0, 11));
    dataLogTextArea.setBackground(SystemColor.window);

    FQPathTextArea.setBounds(new Rectangle(5, 170, 185, 40));
    FQPathTextArea.setLineWrap(true);
    FQPathTextArea.setText(getCanonicalName(new File(".", "")));
    FQPathTextArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    FQPathTextArea.setRows(2);

    FQPathTextArea.setFont(new Font("Tahoma", 0, 9));
    FQPathTextArea.setOpaque(false);
    FQPathTextArea.setEditable(false);

    selectFolderButton.setText("Folder...");
    selectFolderButton.setBounds(new Rectangle(120, 125, 70, 20));
    selectFolderButton.setMargin(new Insets(1, 1, 1, 1));
    selectFolderButton.setFocusable(false);
    selectFolderButton.setMnemonic('F');
    selectFolderButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            selectFolderButton_actionPerformed(e);
        }
    });

    // domain display limits GUI
    chartOptionsPanel.setLayout(null);
    chartDomLimitsPanel.setBounds(new Rectangle(5, 35, 180, 135));
    chartDomLimitsPanel.setLayout(gridLayout1);
    chartDomLimitsPanel.setBorder(BorderFactory.createTitledBorder("Domain Display Limiting"));
    domainDisplayLimitSlider.setEnabled(false);
    domainDisplayLimitSlider.setMaximum(MAXDOMAIN_DATAPOINT_LIMIT);
    domainDisplayLimitSlider.setMinimum(MINDOMAIN_LIMIT);
    domainDisplayLimitSlider.setValue(MAXDOMAIN_DATAPOINT_LIMIT);
    domainDisplayLimitSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            domainDisplayLimitSlider_stateChanged(e);
        }
    });
    useTimeRadioButton.setText("By Time");
    useTimeRadioButton.setEnabled(false);
    useTimeRadioButton.setMnemonic('I');
    useTimeRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            domainDisplayLimitRadioButton_actionPerformed(e);
        }
    });
    useDataPointsRadioButton.setText("By Data Points");
    ButtonGroup bg1 = new ButtonGroup();
    bg1.add(useTimeRadioButton);
    bg1.add(useDataPointsRadioButton);
    useDataPointsRadioButton.setSelected(true);
    useDataPointsRadioButton.setEnabled(false);
    useDataPointsRadioButton.setMnemonic('P');
    useDataPointsRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            domainDisplayLimitRadioButton_actionPerformed(e);
        }
    });
    datasetLimitEnableCheckBox.setText("Enable");
    datasetLimitEnableCheckBox.setRolloverEnabled(true);
    datasetLimitEnableCheckBox.setMnemonic('A');
    datasetLimitEnableCheckBox.setToolTipText("Enable Domain Clipping");
    datasetLimitEnableCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            datasetLimitEnableCheckBox_actionPerformed(e);
        }
    });
    domainLimitLabel.setText(String.format("%1$,d datapoints", MAXDOMAIN_DATAPOINT_LIMIT).toString());
    domainLimitLabel.setEnabled(false);
    gridLayout1.setRows(5);
    gridLayout1.setColumns(1);

    jLabel1.setText("Chart Title:");
    jLabel1.setBounds(new Rectangle(200, 10, 85, 20));
    jLabel1.setPreferredSize(new Dimension(115, 14));
    jLabel2.setText("Range Axis 1 Label:");
    jLabel2.setBounds(new Rectangle(200, 35, 115, 20));
    jLabel2.setSize(new Dimension(115, 20));
    jLabel3.setText("Range Axis 2 Label:");
    jLabel3.setBounds(new Rectangle(200, 60, 115, 20));
    jLabel3.setSize(new Dimension(115, 20));
    jLabel4.setText("Range Axis 3 Label:");
    jLabel4.setBounds(new Rectangle(200, 85, 115, 20));
    jLabel4.setSize(new Dimension(115, 20));
    jLabel6.setText("Range Axis 4 Label:");
    jLabel6.setBounds(new Rectangle(200, 110, 115, 20));
    jLabel6.setSize(new Dimension(115, 20));
    titleLabelChangeNotifier notifier = new titleLabelChangeNotifier();
    chartTitleTextField.setBounds(new Rectangle(315, 10, 290, 20));
    chartTitleTextField.getDocument().addDocumentListener(notifier);
    axis1LabelTextField.setBounds(new Rectangle(315, 35, 290, 20));
    axis1LabelTextField.getDocument().addDocumentListener(notifier);
    axis2LabelTextField.setBounds(new Rectangle(315, 60, 290, 20));
    axis2LabelTextField.getDocument().addDocumentListener(notifier);
    axis3LabelTextField.setBounds(new Rectangle(315, 85, 290, 20));
    axis3LabelTextField.getDocument().addDocumentListener(notifier);
    axis4LabelTextField.setBounds(new Rectangle(315, 110, 290, 20));
    showCommentsCheckBox.setText("Show Comment Markers");
    showCommentsCheckBox.setBounds(new Rectangle(200, 140, 185, 25));
    showCommentsCheckBox.setToolTipText("Show/Hide any comment markers on the chart");
    showCommentsCheckBox.setRolloverEnabled(true);
    showCommentsCheckBox.setSelected(true);
    showCommentsCheckBox.setMnemonic('M');
    showCommentsCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            customChartPanel.setCommentsVisible(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    scrollDomainCheckBox.setText("Scroll Domain");
    scrollDomainCheckBox.setBounds(new Rectangle(10, 5, 175, 20));
    scrollDomainCheckBox.setSize(new Dimension(175, 25));
    scrollDomainCheckBox.setSelected(true);
    scrollDomainCheckBox.setMnemonic('O');
    scrollDomainCheckBox.setToolTipText("Checked to scroll domain as new data is received");
    scrollDomainCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scrollDomainCheckBox_actionPerformed(e);
        }
    });
    axis4LabelTextField.getDocument().addDocumentListener(notifier);

    logFileTextField.setBounds(new Rectangle(10, 145, 180, 20));
    logFileTextField.setText("NXTData.txt");
    logFileTextField.setPreferredSize(new Dimension(180, 20));
    logFileTextField.setToolTipText("File name. Leave empty to not log to file.");
    statusScrollPane.setOpaque(false);
    dataLogScrollPane.setOpaque(false);

    customChartPanel.setMinimumSize(new Dimension(400, 300));
    customChartPanel.setPreferredSize(new Dimension(812, 400));

    jLabel5.setText("NXT Name/Address:");
    jLabel5.setBounds(new Rectangle(5, 20, 160, 20));
    jLabel5.setToolTipText(jTextFieldNXTName.getToolTipText());
    jLabel5.setHorizontalTextPosition(SwingConstants.RIGHT);
    jLabel5.setHorizontalAlignment(SwingConstants.LEFT);

    connectionPanel.add(jTextFieldNXTName, null);
    connectionPanel.add(jButtonConnect, null);
    connectionPanel.add(jLabel5, null);
    dataLogScrollPane.setViewportView(dataLogTextArea);
    jTabbedPane1.addTab("Data Log", dataLogScrollPane);
    statusScrollPane.setViewportView(jTextAreaStatus);
    jTabbedPane1.addTab("Status", statusScrollPane);
    jTabbedPane1.addTab("Chart", chartOptionsPanel);
    chartDomLimitsPanel.add(datasetLimitEnableCheckBox, null);
    chartDomLimitsPanel.add(useDataPointsRadioButton, null);
    chartDomLimitsPanel.add(useTimeRadioButton, null);
    chartDomLimitsPanel.add(domainDisplayLimitSlider, null);
    chartDomLimitsPanel.add(domainLimitLabel, null);
    chartOptionsPanel.add(scrollDomainCheckBox, null);
    chartOptionsPanel.add(showCommentsCheckBox, null);
    chartOptionsPanel.add(axis4LabelTextField, null);
    chartOptionsPanel.add(axis3LabelTextField, null);
    chartOptionsPanel.add(axis2LabelTextField, null);
    chartOptionsPanel.add(axis1LabelTextField, null);
    chartOptionsPanel.add(chartTitleTextField, null);
    chartOptionsPanel.add(jLabel6, null);
    chartOptionsPanel.add(jLabel4, null);
    chartOptionsPanel.add(jLabel3, null);
    chartOptionsPanel.add(jLabel2, null);
    chartOptionsPanel.add(jLabel1, null);
    chartOptionsPanel.add(chartDomLimitsPanel, null);

    tglbtnpauseplay = new JToggleButton("");
    tglbtnpauseplay.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (lpm == null)
                return;
            boolean doPause = false;
            if (e.getStateChange() == ItemEvent.SELECTED) {
                doPause = true;
            }
            lpm.setReaderPaused(doPause);
        }
    });
    //        tglbtnpauseplay.addChangeListener(new ChangeListener() {
    //           public void stateChanged(ChangeEvent e) {
    //              System.out.println(e.toString());
    //              //lpm.setReaderPaused(doPause)
    //           }
    //        });
    tglbtnpauseplay
            .setSelectedIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/play.png")));
    tglbtnpauseplay.setIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/pause.png")));
    tglbtnpauseplay.setBounds(571, 135, 30, 30);
    chartOptionsPanel.add(tglbtnpauseplay);

    jTabbedPane1.setToolTipTextAt(0, "The tab-delimited log of the data sent from the NXT");
    jTabbedPane1.setToolTipTextAt(1, "Status output");
    jTabbedPane1.setToolTipTextAt(2, "Chart options");
    jTabbedPane1.setMnemonicAt(0, KeyEvent.VK_D);
    jTabbedPane1.setMnemonicAt(1, KeyEvent.VK_S);
    jTabbedPane1.setMnemonicAt(2, KeyEvent.VK_T);
    this.getContentPane().add(customChartPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    this.getContentPane().add(UIPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), -107, 0));

    this.getContentPane().add(jTabbedPane1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
            GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    UIPanel.add(connectionPanel, null);
    UIPanel.add(selectFolderButton, null);
    UIPanel.add(logFileTextField, null);
    UIPanel.add(jLabel1logfilename, null);
    UIPanel.add(FQPathTextArea, null);
    ActionListener taskPerformer = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            String theData = null;
            for (;;) {
                theData = LogChartFrame.this.logDataQueue.poll();
                if (theData == null)
                    break;
                try {
                    dataLogTextArea.getDocument().insertString(dataLogTextArea.getDocument().getLength(),
                            theData, null);
                } catch (BadLocationException e) {
                    System.out.print(
                            "BadLocationException in datalog textarea updater thread:" + e.toString() + "\n");
                }
            }
        }
    };
    this.updateLogTextAreaTimer = new Timer(1000, taskPerformer);
    this.updateLogTextAreaTimer.start();
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private JLabel getClimbingSumLabel() {
    if (climbingSumLabel == null) {
        climbingSumLabel = new JLabel();
        climbingSumLabel.setText(new Message(Messages.UPHILL_SUM).toString());
        climbingSumLabel.setFont(GUIConstants.DIALOG_10);
        climbingSumLabel.setBounds(10, 80, 90, 20);
        climbingSumLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    }// w w w  .j a  va2 s .co  m
    return climbingSumLabel;
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private JLabel getDownhillSumLabel() {
    if (downhillSumLabel == null) {
        downhillSumLabel = new JLabel();
        downhillSumLabel.setText(new Message(Messages.DOWNHILL_SUM).toString());
        downhillSumLabel.setFont(GUIConstants.DIALOG_10);
        downhillSumLabel.setBounds(0, 105, 100, 20);
        downhillSumLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    }/*from   w w  w. j  a v a2  s. com*/
    return downhillSumLabel;
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private JLabel getLength2dLabel() {
    if (length2dLabel == null) {
        length2dLabel = new JLabel();
        length2dLabel.setText(new Message(Messages._2D_LENGTH).toString());
        length2dLabel.setFont(GUIConstants.DIALOG_10);
        length2dLabel.setBounds(30, 130, 70, 20);
        length2dLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    }/*from  w ww.  j av  a  2  s. com*/
    return length2dLabel;
}

From source file:com.all.login.view.NewAccountFormPanel.java

private JLabel getPasswordLabel() {
    if (passwordLabel == null) {
        passwordLabel = new JLabel();
        passwordLabel.setBounds(PASSWORD_LABEL_BOUNDS);
        passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        passwordLabel.setName(SynthFonts.PLAIN_FONT16_GRAY100_100_100);
        passwordLabel.setIcon(BULLET_ICON);
        passwordLabel.setIconTextGap(REQUIRE_ICON_TEXT_GAP);
    }/*w  w  w .j av  a2 s .  c  om*/
    return passwordLabel;
}