Example usage for java.awt BorderLayout WEST

List of usage examples for java.awt BorderLayout WEST

Introduction

In this page you can find the example usage for java.awt BorderLayout WEST.

Prototype

String WEST

To view the source code for java.awt BorderLayout WEST.

Click Source Link

Document

The west layout constraint (left side of container).

Usage

From source file:com.qspin.qtaste.ui.MainPanel.java

public void genUI() {
    try {/*from   w  w  w  . ja  v a  2 s  . com*/
        getContentPane().setLayout(new BorderLayout());
        // prepare the top panel that contains the following panes:
        //   - logo
        //   - ConfigInfopanel
        //   - Current Date/time
        JPanel topanel = new JPanel(new BorderLayout());
        JPanel center = new JPanel(new GridBagLayout());
        ImageIcon topLeftLogo = ResourceManager.getInstance().getImageIcon("main/qspin");
        JLabel iconlabel = new JLabel(topLeftLogo);

        mHeaderPanel = new ConfigInfoPanel(this);
        mTestCasePanel = new TestCasePane(this);
        mTestCampaignPanel = new TestCampaignMainPanel(this);

        mHeaderPanel.init();

        GridBagLineAdder centeradder = new GridBagLineAdder(center);
        JLabel sep = new JLabel("  ");
        sep.setFont(ResourceManager.getInstance().getSmallFont());
        sep.setUI(new FillLabelUI(ResourceManager.getInstance().getLightColor()));
        centeradder.setWeight(1.0f, 0.0f);
        centeradder.add(mHeaderPanel);

        // prepare the right panels containg the main information:
        // the right pane is selected through the tabbed pane:
        //    - Test cases: management of test cases and test suites
        //    - Test campaign: management of test campaigns
        //    - Interactive: ability to invoke QTaste verbs one by one

        mRightPanels = new JPanel(new CardLayout());

        mRightPanels.add(mTestCasePanel, "Test Cases");
        mRightPanels.add(mTestCampaignPanel, "Test Campaign");

        final TestCaseInteractivePanel testInterractivePanel = new TestCaseInteractivePanel();
        mRightPanels.add(testInterractivePanel, "Interactive");

        mTreeTabsPanel = new JTabbedPane(JTabbedPane.BOTTOM);
        mTreeTabsPanel.setPreferredSize(new Dimension(TREE_TABS_WIDTH, HEIGHT));

        TestCaseTree tct = new TestCaseTree(mTestCasePanel);
        JScrollPane sp2 = new JScrollPane(tct);
        mTreeTabsPanel.addTab("Test Cases", sp2);

        // add tree view for test campaign definition
        com.qspin.qtaste.ui.testcampaign.TestCaseTree mtct = new com.qspin.qtaste.ui.testcampaign.TestCaseTree(
                mTestCampaignPanel.getTreeTable());
        JScrollPane sp3 = new JScrollPane(mtct);
        mTreeTabsPanel.addTab("Test Campaign", sp3);

        genMenu(tct);

        // add another tab contain used for Interactive mode
        TestAPIDocsTree jInteractive = new TestAPIDocsTree(testInterractivePanel);
        JScrollPane spInter = new JScrollPane(jInteractive);
        mTreeTabsPanel.addTab("Interactive", spInter);

        // init will do the link between the tree view and the pane
        testInterractivePanel.init();

        // Define the listener to display the pane depending on the selected tab
        mTreeTabsPanel.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                String componentName = mTreeTabsPanel.getTitleAt(mTreeTabsPanel.getSelectedIndex());
                CardLayout rcl = (CardLayout) mRightPanels.getLayout();
                rcl.show(mRightPanels, componentName);
            }
        });
        mTestCampaignPanel.addTestCampaignActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (e.getID() == TestCampaignMainPanel.RUN_ID) {
                    if (e.getActionCommand().equals(TestCampaignMainPanel.STARTED_CMD)) {
                        // open the tab test cases
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                mTreeTabsPanel.setSelectedIndex(0);
                                mTestCasePanel.setSelectedTab(TestCasePane.RESULTS_INDEX);
                            }
                        });

                        // update the buttons
                        mTestCasePanel.setExecutingTestCampaign(true,
                                ((TestCampaignMainPanel) e.getSource()).getExecutionThread());
                        mTestCasePanel.updateButtons(true);
                    } else if (e.getActionCommand().equals(TestCampaignMainPanel.STOPPED_CMD)) {
                        mTestCasePanel.setExecutingTestCampaign(false, null);
                        mTestCasePanel.updateButtons();
                    }
                }
            }
        });

        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mTreeTabsPanel, mRightPanels);
        splitPane.setDividerSize(4);
        GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
        int mainHorizontalSplitDividerLocation = guiConfiguration
                .getInt(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY, 285);
        splitPane.setDividerLocation(mainHorizontalSplitDividerLocation);

        splitPane.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals("dividerLocation")) {
                    GUIConfiguration guiConfiguration = GUIConfiguration.getInstance();
                    if (evt.getSource() instanceof JSplitPane) {
                        JSplitPane splitPane = (JSplitPane) evt.getSource();
                        guiConfiguration.setProperty(MAIN_HORIZONTAL_SPLIT_DIVIDER_LOCATION_PROPERTY,
                                splitPane.getDividerLocation());
                        try {
                            guiConfiguration.save();
                        } catch (ConfigurationException ex) {
                            logger.error("Error while saving GUI configuration: " + ex.getMessage());
                        }
                    }
                }
            }
        });

        topanel.add(iconlabel, BorderLayout.WEST);
        topanel.add(center);

        getContentPane().add(topanel, BorderLayout.NORTH);
        getContentPane().add(splitPane);
        this.pack();

        this.setExtendedState(Frame.MAXIMIZED_BOTH);
        if (mTestSuiteDir != null) {
            DirectoryTestSuite testSuite = DirectoryTestSuite.createDirectoryTestSuite(mTestSuiteDir);
            if (testSuite != null) {
                testSuite.setExecutionLoops(mNumberLoops, mLoopsInHour);
                setTestSuite(testSuite.getName());
                mTestCasePanel.runTestSuite(testSuite, false);
            }
        }
        setVisible(true);
        //treeTabs.setMinimumSize(new Dimension(100, this.HEIGHT));

    } catch (Exception e) {
        logger.fatal(e);
        e.printStackTrace();
        TestEngine.shutdown();
        System.exit(1);
    }

}

From source file:net.sourceforge.doddle_owl.utils.Utils.java

public static JComponent createWestPanel(JComponent p) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(p, BorderLayout.WEST);
    return panel;
}

From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java

private final JPanel buildProjectPanel() {
    JPanel projectPanel = new JPanel(new BorderLayout());
    projectPanel.setBorder(new TitledBorder("Projects"));

    // --- left-side -------------------------------------------------
    JPanel sidePanel = new JPanel(new BorderLayout());
    sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED));

    projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    projectList.addListSelectionListener(new ProjectListSelectionListener());

    sidePanel.add(new JScrollPane(projectList), BorderLayout.CENTER);
    projectPanel.add(sidePanel, BorderLayout.WEST);

    // --- right-side ------------------------------------------------
    sidePanel = new JPanel(new BorderLayout());
    sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED));

    JPanel rsTopPanel = new JPanel(new BorderLayout());
    rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50));

    JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5));
    labelPanel.add(new JLabel("Name:  "));
    labelPanel.add(new JLabel("Description:  "));

    JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5));
    infoPanel.add(projectName);//from   w  w w .  j  a  v a2s. c o m
    projectName.setEditable(false);

    infoPanel.add(projectDescription);
    projectDescription.setEditable(false);

    rsTopPanel.add(labelPanel, BorderLayout.WEST);
    rsTopPanel.add(infoPanel, BorderLayout.CENTER);

    sidePanel.add(rsTopPanel, BorderLayout.NORTH);

    projectPanel.add(sidePanel, BorderLayout.EAST);

    return projectPanel;
}

From source file:org.n52.ifgicopter.spf.gui.SPFMainFrame.java

/**
 * the gui representation of the framework
 *//*from   w  w w  .  j  a v  a  2 s.c o m*/
public SPFMainFrame() {

    /*
     * handled by worker thread.
     */
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    this.setTitle("Sensor Platform Framework");

    this.menu = new JMenuBar();

    try {
        File f = new File("img/icon.png");
        InputStream in;
        if (!f.exists()) {
            in = ImageMapMarker.class.getResourceAsStream("/img/icon.png");
        } else {
            in = new FileInputStream(f);
        }

        this.setIconImage(ImageIO.read(in));
    } catch (IOException e) {
        this.log.warn(e.getMessage(), e);
    }

    /*
     * simple menu bar
     */
    JMenu file = new JMenu("File");
    JMenuItem exit = new JMenuItem("Exit");

    /*
     * shutdown the engine if closed
     */
    exit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            shutdownFrame();
        }
    });

    this.pnp = new JCheckBoxMenuItem("Plug'n'Play mode");
    this.pnp.setSelected(false);

    /*
     * switch the pnp mode
     */
    this.pnp.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean flag = SPFMainFrame.this.pnp.isSelected();

            if (flag && !SPFMainFrame.this.dontShow) {
                JCheckBox checkbox = new JCheckBox("Do not show this message again.");
                String message = "During Plug'n'Play mode the output generation is blocked.";
                Object[] params = { message, checkbox };
                JOptionPane.showMessageDialog(SPFMainFrame.this, params);
                SPFMainFrame.this.dontShow = checkbox.isSelected();
            }

            /*
             * check if we need to restart the output plugins
             */
            if (!flag && SPFMainFrame.this.inputChanged) {
                SPFRegistry.getInstance().restartOutputPlugins();
            }

            SPFRegistry.getInstance().setPNPMode(flag);
        }
    });

    JMenuItem restart = new JMenuItem("Restart");
    restart.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            shutdownFrame(RESTART_CODE);
        }
    });

    JMenuItem managePlugins = new JMenuItem("Manage available Plugins");
    managePlugins.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            PluginRegistrationDialog prd = new PluginRegistrationDialog(SPFMainFrame.this);

            if (prd.isCanceled())
                return;

            updateConfigurationFile(prd.getSelectedNewPlugins(), prd.getSelectedOldPlugins());

            int ret = JOptionPane.showConfirmDialog(SPFMainFrame.this,
                    "<html><body><div>" + "Changes will have effect after restart of the application. "
                            + "</div><div>A restart is highly recommended due to memory usage."
                            + "</div><div><br />Restart now?</div></body></html>",
                    "Restart application", JOptionPane.YES_NO_OPTION);

            if (ret == 0) {
                shutdownFrame(RESTART_CODE);
            }
        }
    });
    file.add(managePlugins);

    file.add(this.pnp);
    file.add(new FixedSeparator());
    file.add(restart);
    file.add(new FixedSeparator());
    file.add(exit);
    this.menu.add(file);
    this.inputPluginMenu = new JMenu("InputPlugins");
    this.outputPluginMenu = new JMenu("OutputPlugins");
    this.menu.add(this.inputPluginMenu);
    this.menu.add(this.outputPluginMenu);

    /*
     * help
     */
    this.aboutDialog = new AboutDialog(SPFMainFrame.this);
    JMenu help = new JMenu("Help");
    JMenuItem about = new JMenuItem("About");
    about.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SPFMainFrame.this.aboutDialog.showSelf(SPFMainFrame.this);
        }
    });

    help.add(about);
    this.menu.add(help);
    this.setJMenuBar(this.menu);

    /*
     * the tabbed pane. every tab represents a input plugin
     */
    this.pane = new JTabbedPane();
    this.pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

    /*
     * shutdown the engine if closed
     */
    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            SPFMainFrame.this.shutdownFrame();
        }

    });

    /*
     * the framework core tab
     */
    this.corePanel = new FrameworkCorePanel();
    this.addTab(this.corePanel, "Framework Core", BLUE_IMAGE);

    /*
     * the map panel
     */
    if (Boolean.parseBoolean(SPFRegistry.getInstance().getConfigProperty(SPFRegistry.OVERVIEW_MAP_ENABLED))) {
        this.mapPanel = new MapPanel();
        this.addTab(this.mapPanel, "Overview Map", BLUE_IMAGE);
    }

    /*
     * other stuff
     */
    this.getContentPane().add(this.pane);

    JPanel statusBar = new JPanel();
    statusBar.setLayout(new BorderLayout());
    statusBar.setPreferredSize(new Dimension(200, 25));
    JPanel statusBarWrapper = new JPanel(new BorderLayout());
    statusBarWrapper.add(Box.createRigidArea(new Dimension(3, 3)), BorderLayout.WEST);
    statusBarWrapper.add(statusBar);
    statusBarWrapper.add(Box.createRigidArea(new Dimension(3, 3)), BorderLayout.EAST);

    this.statusLabel = new JLabel("SPFramework startup finished.");
    statusBar.add(this.statusLabel, BorderLayout.EAST);

    this.outputLabel = new JLabel("(no output yet)");
    statusBar.add(this.outputLabel, BorderLayout.WEST);

    this.getContentPane().add(statusBarWrapper, BorderLayout.SOUTH);

    this.getContentPane().setBackground(this.pane.getBackground());

    this.setPreferredSize(new Dimension(1280, 720));
    this.pack();

    /*
     * full screen?
     */
    if (Boolean.parseBoolean(SPFRegistry.getInstance().getConfigProperty(SPFRegistry.MAXIMIZED))) {
        this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
    }

    this.setLocationRelativeTo(null);
}

From source file:org.rdv.ui.ControlPanel.java

/**
 * Setup the UI.//from  ww w  .j a  va 2 s . c o  m
 */
private void initPanel() {
    setLayout(new BorderLayout());

    GridBagConstraints c = new GridBagConstraints();

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

    Box firstRowPanel = new Box(BoxLayout.LINE_AXIS);

    beginButton = new JButton();
    beginButton.setName("beginButton");
    beginButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setLocationBegin();
        }
    });
    firstRowPanel.add(beginButton);

    rtButton = new JButton();
    rtButton.setName("rtButton");
    rtButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (rtButton.isSelected()) {
                rbnbController.pause();
            } else {
                rbnbController.monitor();
            }
        }
    });
    firstRowPanel.add(rtButton);

    playButton = new JButton();
    playButton.setName("playButton");
    playButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (playButton.isSelected()) {
                rbnbController.pause();
            } else {
                rbnbController.play();
            }
        }
    });
    firstRowPanel.add(playButton);

    endButton = new JButton();
    endButton.setName("endButton");
    endButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setLocationEnd();
        }
    });
    firstRowPanel.add(endButton);

    firstRowPanel.add(Box.createHorizontalStrut(8));

    SpinnerListModel playbackRateModel = new SpinnerListModel(playbackRates);
    playbackRateSpinner = new JSpinner(playbackRateModel);
    playbackRateSpinner.setName("playbackRateSpinner");
    JSpinner.ListEditor playbackRateEditor = new JSpinner.ListEditor(playbackRateSpinner);
    playbackRateEditor.getTextField().setEditable(false);
    playbackRateSpinner.setEditor(playbackRateEditor);
    playbackRateSpinner.setPreferredSize(new Dimension(80, playbackRateSpinner.getPreferredSize().height));
    playbackRateSpinner.setMinimumSize(playbackRateSpinner.getPreferredSize());
    playbackRateSpinner.setMaximumSize(playbackRateSpinner.getPreferredSize());
    playbackRateSpinner.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            playbackRateChanged();
        }
    });
    firstRowPanel.add(playbackRateSpinner);

    firstRowPanel.add(Box.createHorizontalStrut(8));

    timeScaleComboBox = new JComboBox();
    timeScaleComboBox.setName("timeScaleComboBox");
    timeScaleComboBox.setEditable(true);
    timeScaleComboBox.setPreferredSize(new Dimension(96, timeScaleComboBox.getPreferredSize().height));
    timeScaleComboBox.setMinimumSize(timeScaleComboBox.getPreferredSize());
    timeScaleComboBox.setMaximumSize(timeScaleComboBox.getPreferredSize());
    for (int i = 0; i < timeScales.length; i++) {
        timeScaleComboBox.addItem(DataViewer.formatSeconds(timeScales[i]));
    }
    timeScaleComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            timeScaleChange();
        }
    });
    firstRowPanel.add(timeScaleComboBox);

    firstRowPanel.add(Box.createHorizontalGlue());

    locationButton = new JButton();
    locationButton.setName("locationButton");
    locationButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            TimeRange timeRange = RBNBHelper.getChannelsTimeRange();
            double time = DateTimeDialog.showDialog(ControlPanel.this, rbnbController.getLocation(),
                    timeRange.start, timeRange.end);
            if (time >= 0) {
                rbnbController.setLocation(time);
            }
        }
    });
    firstRowPanel.add(locationButton);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 8, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(firstRowPanel, c);

    zoomTimeSlider = new TimeSlider();
    zoomTimeSlider.setRangeChangeable(false);
    zoomTimeSlider.addTimeAdjustmentListener(this);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(0, 8, 0, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(zoomTimeSlider, c);

    JPanel zoomTimePanel = new JPanel();
    zoomTimePanel.setLayout(new BorderLayout());

    zoomMinimumLabel = new JLabel();
    zoomMinimumLabel.setName("zoomMinimumLabel");
    zoomTimePanel.add(zoomMinimumLabel, BorderLayout.WEST);

    zoomRangeLabel = new JLabel();
    zoomRangeLabel.setName("zoomRangeLabel");
    zoomRangeLabel.setHorizontalAlignment(JLabel.CENTER);
    zoomTimePanel.add(zoomRangeLabel, BorderLayout.CENTER);

    zoomMaximumLabel = new JLabel();
    zoomMaximumLabel.setName("zoomMaximumLabel");
    zoomTimePanel.add(zoomMaximumLabel, BorderLayout.EAST);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 0, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(zoomTimePanel, c);

    globalTimeSlider = new TimeSlider();
    globalTimeSlider.setValueChangeable(false);
    globalTimeSlider.addTimeAdjustmentListener(this);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 1;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 8, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(globalTimeSlider, c);

    add(container, BorderLayout.CENTER);

    log.info("Initialized control panel.");
}

From source file:hr.restart.util.chart.ChartXY.java

public void initFrame() throws Exception {

    if (isInstanciated()) {
        if (chartPanel != null)
            mainPanel.remove(chartPanel);
        chartPanel = initGraph();//from   w  w  w.  j a v  a2  s.  c  om
        mainPanel.add(chartPanel, BorderLayout.CENTER);
        return;
    }

    setInstanciated(true);

    verifyDialog();

    charts = new ArrayList();
    charts.add(BAR_CHART);
    charts.add(PIE_CHART);

    mainPanel = new JPanel(new BorderLayout());

    buttonsPanel = new JPanel(new FlowLayout());

    JPanel actionsPanel = new JPanel(new BorderLayout());
    JPanel savePanel = new JPanel();

    //adding combobox
    comboBox = new JComboBox(charts.toArray());
    comboBox.addActionListener(this);

    buttonsPanel.add(comboBox);

    //adding filechooser
    JButton btSave = new JButton("Snimi");
    btSave.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent ev) {

            try {
                chartPanel.doSaveAs();
            } catch (IOException e) {
                // 
                e.printStackTrace();
                System.out.println(e);
            }
        }
    });
    savePanel.add(btSave);

    //adding printing button
    JButton btPrint = new JButton("Ispis");
    btPrint.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {

            chartPanel.createChartPrintJob();
        }
    });
    savePanel.add(btPrint);

    //creates datasets
    barDataset = createDataSet();
    pieDataset = DatasetUtilities.createPieDatasetForRow(barDataset, 0);

    String value;
    if (jcb == null)
        value = getAxisY();
    else
        value = colNamesY[jcb.getSelectedIndex()];

    PlotOrientation orientation = PlotOrientation.VERTICAL;

    pieChart = createPieChart(pieDataset, value);
    barChart = createBarChart(barDataset, value, orientation);

    //adding orientation box
    String[] orientations = { "Vertikalni", "Horizontalni" };
    comboBoxOrientation = new JComboBox(orientations);
    comboBoxOrientation.setVisible(false);
    comboBoxOrientation.addItemListener(new ItemListener() {

        /* (non-Javadoc)
           * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
           */
        public void itemStateChanged(ItemEvent e) {
            // TODO Auto-generated method stub
            if (comboBoxOrientation.getSelectedItem() == "Vertikalni")
                selectionChanged(PlotOrientation.VERTICAL);
            else
                selectionChanged(PlotOrientation.HORIZONTAL);
        }
    });

    buttonsPanel.add(comboBoxOrientation);

    // adding combobox
    String[] quantity = { "5", "10", "15" };
    comboBoxQuantity = new JComboBox(quantity);
    comboBoxQuantity.setEditable(true);
    comboBoxQuantity.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {

            try {
                mainPanel.remove(chartPanel);
            } catch (RuntimeException e1) {
                //e1.printStackTrace();               
            }

            selectionChanged(PlotOrientation.VERTICAL);
        }

    });

    comboBoxQuantity.setSelectedItem(new Integer(getNumberOfElements()).toString());
    buttonsPanel.add(comboBoxQuantity);

    if (jcb != null) {
        if (getDefaultSelectedItem() != null) {
            if (getDefaultSelectedItem().compareTo("") != 0)
                jcb.setSelectedItem(getDefaultSelectedItem());
        }

        buttonsPanel.add(jcb);
    }

    // adding OKPanel
    final OKpanel okPanel = new OKpanel() {
        public void jBOK_actionPerformed() {
            //ok_action();
            chartPanel.createChartPrintJob();
        }

        public void jPrekid_actionPerformed() {
            //            firstESC();
            cancelPressed();

        }
    };

    okPanel.addAncestorListener(new AncestorListener() {
        public void ancestorAdded(AncestorEvent e) {
            //                register the keys action

            okPanel.registerOKPanelKeys(getJdialog());
        }

        public void ancestorMoved(AncestorEvent e) {

        }

        public void ancestorRemoved(AncestorEvent e) {
            okPanel.unregisterOKPanelKeys(getJdialog());
        }
    });

    okPanel.jBOK.setText("Ispis");
    okPanel.jBOK.setIcon(raImages.getImageIcon(raImages.IMGPRINT));

    JButton btSnimi = new JButton("Snimi");
    btSnimi.setIcon(raImages.getImageIcon(raImages.IMGSAVE));
    btSnimi.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            try {
                chartPanel.doSaveAs();
            } catch (IOException e) {
                // 
                e.printStackTrace();
                System.out.println(e);
            }
        }

    });
    okPanel.add(btSnimi, BorderLayout.WEST);
    mainPanel.add(okPanel, BorderLayout.SOUTH);

    actionsPanel.add(buttonsPanel, BorderLayout.CENTER);
    //actionsPanel.add(savePanel,BorderLayout.SOUTH);   
    actionsPanel.add(okPanel, BorderLayout.SOUTH);
    mainPanel.add(actionsPanel, BorderLayout.SOUTH);

    chartPanel = initGraph();
    mainPanel.add(chartPanel, BorderLayout.CENTER);

    this.getContentPane().add(mainPanel);
}

From source file:org.rdv.viz.image.ImageViz.java

private void initIrisControls() {
    irisControls = new JPanel();
    irisControls.setLayout(new BorderLayout());

    JButton closeIrisButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-close.gif"));
    closeIrisButton.setBorder(null);//from   www .ja  v  a  2  s . c  o  m
    closeIrisButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            irisClose();
        }
    });
    irisControls.add(closeIrisButton, BorderLayout.WEST);

    JButton irisControlButton = new StrechIconButton(
            DataViewer.getIcon("icons/ptz/robotic_control-irisbar-medium.gif"));
    irisControlButton.setBorder(null);
    irisControlButton.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JButton button = (JButton) e.getComponent();
            int iris = Math.round(100f * e.getPoint().x / button.getWidth());
            iris(iris);
        }
    });
    irisControls.add(irisControlButton, BorderLayout.CENTER);

    JPanel irisControlsRight = new JPanel();
    irisControlsRight.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));

    JButton openIrisButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-open.gif"));
    openIrisButton.setBorder(null);
    openIrisButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            irisOpen();
        }
    });
    irisControlsRight.add(openIrisButton);

    JButton autoIrisButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-auto.gif"));
    autoIrisButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            irisAuto();
        }
    });
    autoIrisButton.setBorder(null);
    irisControlsRight.add(autoIrisButton);

    irisControls.add(irisControlsRight, BorderLayout.EAST);
}

From source file:eu.delving.sip.Application.java

private JPanel createStatePanel() {
    statusPanel.setReaction(ABSENT, allFrames.prepareForNothing());
    statusPanel.setReaction(NO_DATA, importAction);
    statusPanel.setReaction(IMPORTED, new InputAnalyzer());
    statusPanel.setReaction(ANALYZED_IMPORT, allFrames.prepareForDelimiting());
    statusPanel.setReaction(DELIMITED, new ConvertPerformer());
    statusPanel.setReaction(SOURCED, new InputAnalyzer());
    statusPanel.setReaction(ANALYZED_SOURCE, allFrames.prepareForMapping(desktop));
    statusPanel.setReaction(MAPPING, validateAction);
    if (uploadAction == null) {
        statusPanel.setReaction(VALIDATED, allFrames.prepareForNothing());
    } else {/*from   www  . ja  v a  2  s  .  c  o  m*/
        statusPanel.setReaction(VALIDATED, uploadAction);
    }
    JPanel p = new JPanel(new GridLayout(1, 0, 6, 6));
    p.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createBevelBorder(0),
            BorderFactory.createEmptyBorder(6, 6, 6, 6)));
    p.add(statusPanel);
    JPanel rightPanel = new JPanel(new BorderLayout());
    rightPanel.add(new WorkPanel(sipModel), BorderLayout.CENTER);
    rightPanel.add(createButtonPanel(), BorderLayout.WEST);
    p.add(rightPanel);
    return p;
}

From source file:task5.deneme.java

private void display() {
    JFrame f = new JFrame("Histogram");

    f.add(createChartPanel());// ww w  .  jav a  2s  .c om
    f.add(createControlPanel(), BorderLayout.SOUTH);
    f.add(new JLabel(new ImageIcon(img)), BorderLayout.WEST);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:com.opendoorlogistics.studio.AppFrame.java

private void initToolbar(Container con) {
    con.add(toolbar, BorderLayout.WEST);
    toolbar.setFloatable(false);/*from  www .  ja v  a  2 s  .  co m*/
    for (MyAction action : fileActions) {
        if (action != null && action.getConfig().getLargeicon() != null) {
            toolbar.add(action);
        }
    }
    for (Action action : editActions) {
        if (action != null) {
            toolbar.add(action);
        }
    }

    toolbar.add(initGotoWebsiteAction());

}