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:au.org.ala.delta.intkey.Intkey.java

/**
 * Creates and shows the GUI. Called by the swing application framework
 *//*w ww  . ja  v a2  s. c o  m*/
@Override
protected void startup() {
    final JFrame mainFrame = getMainFrame();
    _defaultGlassPane = mainFrame.getGlassPane();
    mainFrame.setTitle("Intkey");
    mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    mainFrame.setIconImages(IconHelper.getRedIconList());

    _helpController = new HelpController(HELPSET_PATH);

    _taxonformatter = new ItemFormatter(false, CommentStrippingMode.STRIP_ALL, AngleBracketHandlingMode.REMOVE,
            true, false, true);
    _context = new IntkeyContext(new IntkeyUIInterceptor(this), new DirectivePopulatorInterceptor(this));

    _advancedModeOnlyDynamicButtons = new ArrayList<JButton>();
    _normalModeOnlyDynamicButtons = new ArrayList<JButton>();
    _activeOnlyWhenCharactersUsedButtons = new ArrayList<JButton>();
    _dynamicButtonsFullHelp = new HashMap<JButton, String>();

    ActionMap actionMap = getContext().getActionMap();

    _rootPanel = new JPanel();
    _rootPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    _rootPanel.setBackground(SystemColor.control);
    _rootPanel.setLayout(new BorderLayout(0, 0));

    _globalOptionBar = new JPanel();
    _globalOptionBar.setBorder(new EmptyBorder(0, 5, 0, 5));
    _rootPanel.add(_globalOptionBar, BorderLayout.NORTH);
    _globalOptionBar.setLayout(new BorderLayout(0, 0));

    _pnlDynamicButtons = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) _pnlDynamicButtons.getLayout();
    flowLayout_1.setVgap(0);
    flowLayout_1.setHgap(0);
    _globalOptionBar.add(_pnlDynamicButtons, BorderLayout.WEST);

    _btnContextHelp = new JButton();
    _btnContextHelp.setMinimumSize(new Dimension(30, 30));
    _btnContextHelp.setMaximumSize(new Dimension(30, 30));
    _btnContextHelp.setAction(actionMap.get("btnContextHelp"));
    _btnContextHelp.setPreferredSize(new Dimension(30, 30));
    _btnContextHelp.setMargin(new Insets(2, 5, 2, 5));
    _btnContextHelp.addActionListener(actionMap.get("btnContextHelp"));
    _globalOptionBar.add(_btnContextHelp, BorderLayout.EAST);

    _rootSplitPane = new JSplitPane();
    _rootSplitPane.setDividerSize(3);
    _rootSplitPane.setResizeWeight(0.5);
    _rootSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    _rootSplitPane.setContinuousLayout(true);
    _rootPanel.add(_rootSplitPane);

    _innerSplitPaneLeft = new JSplitPane();
    _innerSplitPaneLeft.setMinimumSize(new Dimension(25, 25));
    _innerSplitPaneLeft.setAlignmentX(Component.CENTER_ALIGNMENT);
    _innerSplitPaneLeft.setDividerSize(3);
    _innerSplitPaneLeft.setResizeWeight(0.5);

    _innerSplitPaneLeft.setContinuousLayout(true);
    _innerSplitPaneLeft.setOrientation(JSplitPane.VERTICAL_SPLIT);
    _rootSplitPane.setLeftComponent(_innerSplitPaneLeft);

    _pnlAvailableCharacters = new JPanel();
    _innerSplitPaneLeft.setLeftComponent(_pnlAvailableCharacters);
    _pnlAvailableCharacters.setLayout(new BorderLayout(0, 0));

    _sclPaneAvailableCharacters = new JScrollPane();
    _pnlAvailableCharacters.add(_sclPaneAvailableCharacters, BorderLayout.CENTER);

    _listAvailableCharacters = new JList();
    // _listAvailableCharacters.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    _listAvailableCharacters.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    _listAvailableCharacters.setCellRenderer(_availableCharactersListCellRenderer);
    _listAvailableCharacters.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                int selectedIndex = _listAvailableCharacters.getSelectedIndex();
                if (selectedIndex >= 0) {
                    try {
                        Character ch = (Character) _availableCharacterListModel.getElementAt(selectedIndex);
                        executeDirective(new UseDirective(), Integer.toString(ch.getCharacterId()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            }
        }
    });

    _sclPaneAvailableCharacters.setViewportView(_listAvailableCharacters);

    _pnlAvailableCharactersHeader = new JPanel();
    _pnlAvailableCharacters.add(_pnlAvailableCharactersHeader, BorderLayout.NORTH);
    _pnlAvailableCharactersHeader.setLayout(new BorderLayout(0, 0));

    _lblNumAvailableCharacters = new JLabel();
    _lblNumAvailableCharacters.setBorder(new EmptyBorder(0, 5, 0, 0));
    _lblNumAvailableCharacters.setFont(new Font("Tahoma", Font.PLAIN, 15));
    _lblNumAvailableCharacters.setText(MessageFormat.format(availableCharactersCaption, 0));
    _pnlAvailableCharactersHeader.add(_lblNumAvailableCharacters, BorderLayout.WEST);

    _pnlAvailableCharactersButtons = new JPanel();
    FlowLayout flowLayout = (FlowLayout) _pnlAvailableCharactersButtons.getLayout();
    flowLayout.setVgap(2);
    flowLayout.setHgap(2);
    _pnlAvailableCharactersHeader.add(_pnlAvailableCharactersButtons, BorderLayout.EAST);

    // All toolbar buttons should be disabled until a dataset is loaded.
    _btnRestart = new JButton();
    _btnRestart.setAction(actionMap.get("btnRestart"));
    _btnRestart.setPreferredSize(new Dimension(30, 30));
    _btnRestart.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnRestart);

    _btnBestOrder = new JButton();
    _btnBestOrder.setAction(actionMap.get("btnBestOrder"));
    _btnBestOrder.setPreferredSize(new Dimension(30, 30));
    _btnBestOrder.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnBestOrder);

    _btnSeparate = new JButton();
    _btnSeparate.setAction(actionMap.get("btnSeparate"));
    _btnSeparate.setVisible(_advancedMode);
    _btnSeparate.setPreferredSize(new Dimension(30, 30));
    _btnSeparate.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnSeparate);

    _btnNaturalOrder = new JButton();
    _btnNaturalOrder.setAction(actionMap.get("btnNaturalOrder"));
    _btnNaturalOrder.setPreferredSize(new Dimension(30, 30));
    _btnNaturalOrder.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnNaturalOrder);

    _btnDiffSpecimenTaxa = new JButton();
    _btnDiffSpecimenTaxa.setAction(actionMap.get("btnDiffSpecimenTaxa"));
    _btnDiffSpecimenTaxa.setEnabled(false);
    _btnDiffSpecimenTaxa.setPreferredSize(new Dimension(30, 30));
    _pnlAvailableCharactersButtons.add(_btnDiffSpecimenTaxa);

    _btnSetTolerance = new JButton();
    _btnSetTolerance.setAction(actionMap.get("btnSetTolerance"));
    _btnSetTolerance.setPreferredSize(new Dimension(30, 30));
    _btnSetTolerance.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnSetTolerance);

    _btnSetMatch = new JButton();
    _btnSetMatch.setAction(actionMap.get("btnSetMatch"));
    _btnSetMatch.setVisible(_advancedMode);
    _btnSetMatch.setPreferredSize(new Dimension(30, 30));
    _btnSetMatch.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnSetMatch);

    _btnSubsetCharacters = new JButton();
    _btnSubsetCharacters.setAction(actionMap.get("btnSubsetCharacters"));
    _btnSubsetCharacters.setPreferredSize(new Dimension(30, 30));
    _btnSubsetCharacters.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnSubsetCharacters);

    _btnFindCharacter = new JButton();
    _btnFindCharacter.setAction(actionMap.get("btnFindCharacter"));
    _btnFindCharacter.setPreferredSize(new Dimension(30, 30));
    _btnFindCharacter.setEnabled(false);
    _pnlAvailableCharactersButtons.add(_btnFindCharacter);

    _pnlAvailableCharactersButtons.setEnabled(false);

    _pnlUsedCharacters = new JPanel();
    _innerSplitPaneLeft.setRightComponent(_pnlUsedCharacters);
    _pnlUsedCharacters.setLayout(new BorderLayout(0, 0));

    _sclPnUsedCharacters = new JScrollPane();
    _pnlUsedCharacters.add(_sclPnUsedCharacters, BorderLayout.CENTER);

    _listUsedCharacters = new JList();
    _listUsedCharacters.setCellRenderer(_usedCharactersListCellRenderer);
    _listUsedCharacters.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    _listUsedCharacters.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                int selectedIndex = _listUsedCharacters.getSelectedIndex();
                if (selectedIndex >= 0) {
                    try {
                        Attribute attr = (Attribute) _usedCharacterListModel.getElementAt(selectedIndex);

                        if (_context.charactersFixed() && _context.getFixedCharactersList()
                                .contains(attr.getCharacter().getCharacterId())) {
                            return;
                        }

                        executeDirective(new ChangeDirective(),
                                Integer.toString(attr.getCharacter().getCharacterId()));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            }
        }
    });

    _sclPnUsedCharacters.setViewportView(_listUsedCharacters);

    _pnlUsedCharactersHeader = new JPanel();
    _pnlUsedCharacters.add(_pnlUsedCharactersHeader, BorderLayout.NORTH);
    _pnlUsedCharactersHeader.setLayout(new BorderLayout(0, 0));

    _lblNumUsedCharacters = new JLabel();
    _lblNumUsedCharacters.setBorder(new EmptyBorder(7, 5, 7, 0));
    _lblNumUsedCharacters.setFont(new Font("Tahoma", Font.PLAIN, 15));
    _lblNumUsedCharacters.setText(MessageFormat.format(usedCharactersCaption, 0));
    _pnlUsedCharactersHeader.add(_lblNumUsedCharacters, BorderLayout.WEST);

    _innerSplitPaneRight = new JSplitPane();
    _innerSplitPaneRight.setMinimumSize(new Dimension(25, 25));
    _innerSplitPaneRight.setDividerSize(3);
    _innerSplitPaneRight.setResizeWeight(0.5);
    _innerSplitPaneRight.setContinuousLayout(true);
    _innerSplitPaneRight.setOrientation(JSplitPane.VERTICAL_SPLIT);
    _rootSplitPane.setRightComponent(_innerSplitPaneRight);

    _pnlRemainingTaxa = new JPanel();
    _innerSplitPaneRight.setLeftComponent(_pnlRemainingTaxa);
    _pnlRemainingTaxa.setLayout(new BorderLayout(0, 0));

    _sclPnRemainingTaxa = new JScrollPane();
    _pnlRemainingTaxa.add(_sclPnRemainingTaxa, BorderLayout.CENTER);

    _listRemainingTaxa = new JList();

    _listRemainingTaxa.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                displayInfoForSelectedTaxa();
            }
        }
    });

    _sclPnRemainingTaxa.setViewportView(_listRemainingTaxa);

    _pnlRemainingTaxaHeader = new JPanel();
    _pnlRemainingTaxa.add(_pnlRemainingTaxaHeader, BorderLayout.NORTH);
    _pnlRemainingTaxaHeader.setLayout(new BorderLayout(0, 0));

    _lblNumRemainingTaxa = new JLabel();
    _lblNumRemainingTaxa.setBorder(new EmptyBorder(0, 5, 0, 0));
    _lblNumRemainingTaxa.setFont(new Font("Tahoma", Font.PLAIN, 15));
    _lblNumRemainingTaxa.setText(MessageFormat.format(remainingTaxaCaption, 0));
    _pnlRemainingTaxaHeader.add(_lblNumRemainingTaxa, BorderLayout.WEST);

    _pnlRemainingTaxaButtons = new JPanel();
    FlowLayout fl_pnlRemainingTaxaButtons = (FlowLayout) _pnlRemainingTaxaButtons.getLayout();
    fl_pnlRemainingTaxaButtons.setVgap(2);
    fl_pnlRemainingTaxaButtons.setHgap(2);
    _pnlRemainingTaxaHeader.add(_pnlRemainingTaxaButtons, BorderLayout.EAST);

    // All toolbar buttons should be disabled until a dataset is loaded.
    _btnTaxonInfo = new JButton();
    _btnTaxonInfo.setAction(actionMap.get("btnTaxonInfo"));
    _btnTaxonInfo.setPreferredSize(new Dimension(30, 30));
    _btnTaxonInfo.setEnabled(false);
    _pnlRemainingTaxaButtons.add(_btnTaxonInfo);

    _btnDiffTaxa = new JButton();
    _btnDiffTaxa.setAction(actionMap.get("btnDiffTaxa"));
    _btnDiffTaxa.setPreferredSize(new Dimension(30, 30));
    _btnDiffTaxa.setEnabled(false);
    _pnlRemainingTaxaButtons.add(_btnDiffTaxa);

    _btnSubsetTaxa = new JButton();
    _btnSubsetTaxa.setAction(actionMap.get("btnSubsetTaxa"));
    _btnSubsetTaxa.setPreferredSize(new Dimension(30, 30));
    _btnSubsetTaxa.setEnabled(false);
    _pnlRemainingTaxaButtons.add(_btnSubsetTaxa);

    _btnFindTaxon = new JButton();
    _btnFindTaxon.setAction(actionMap.get("btnFindTaxon"));
    _btnFindTaxon.setPreferredSize(new Dimension(30, 30));
    _btnFindTaxon.setEnabled(false);
    _pnlRemainingTaxaButtons.add(_btnFindTaxon);

    _pnlEliminatedTaxa = new JPanel();
    _innerSplitPaneRight.setRightComponent(_pnlEliminatedTaxa);
    _pnlEliminatedTaxa.setLayout(new BorderLayout(0, 0));

    _sclPnEliminatedTaxa = new JScrollPane();
    _pnlEliminatedTaxa.add(_sclPnEliminatedTaxa, BorderLayout.CENTER);

    _listEliminatedTaxa = new JList();

    _listEliminatedTaxa.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                displayInfoForSelectedTaxa();
            }
        }
    });

    _sclPnEliminatedTaxa.setViewportView(_listEliminatedTaxa);

    _pnlEliminatedTaxaHeader = new JPanel();
    _pnlEliminatedTaxa.add(_pnlEliminatedTaxaHeader, BorderLayout.NORTH);
    _pnlEliminatedTaxaHeader.setLayout(new BorderLayout(0, 0));

    _lblEliminatedTaxa = new JLabel();
    _lblEliminatedTaxa.setBorder(new EmptyBorder(7, 5, 7, 0));
    _lblEliminatedTaxa.setFont(new Font("Tahoma", Font.PLAIN, 15));
    _lblEliminatedTaxa.setText(MessageFormat.format(eliminatedTaxaCaption, 0));
    _pnlEliminatedTaxaHeader.add(_lblEliminatedTaxa, BorderLayout.WEST);

    JMenuBar menuBar = buildMenus(_advancedMode);
    getMainView().setMenuBar(menuBar);

    _txtFldCmdBar = new JTextField();
    _txtFldCmdBar.setCaretColor(Color.WHITE);
    _txtFldCmdBar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            String cmdStr = _txtFldCmdBar.getText();

            cmdStr = cmdStr.trim();
            if (_cmdMenus.containsKey(cmdStr)) {
                JMenu cmdMenu = _cmdMenus.get(cmdStr);
                cmdMenu.doClick();
            } else {
                _context.parseAndExecuteDirective(cmdStr);
            }
            _txtFldCmdBar.setText(null);
        }
    });

    _txtFldCmdBar.setFont(new Font("Courier New", Font.BOLD, 13));
    _txtFldCmdBar.setForeground(SystemColor.text);
    _txtFldCmdBar.setBackground(Color.BLACK);
    _txtFldCmdBar.setOpaque(true);
    _txtFldCmdBar.setVisible(_advancedMode);
    _rootPanel.add(_txtFldCmdBar, BorderLayout.SOUTH);
    _txtFldCmdBar.setColumns(10);

    _logDialog = new RtfReportDisplayDialog(getMainFrame(), new SimpleRtfEditorKit(null), null, logDialogTitle);

    // Set context-sensitive help keys for toolbar buttons
    _helpController.setHelpKeyForComponent(_btnRestart, HELP_ID_CHARACTERS_TOOLBAR_RESTART);
    _helpController.setHelpKeyForComponent(_btnBestOrder, HELP_ID_CHARACTERS_TOOLBAR_BEST);
    _helpController.setHelpKeyForComponent(_btnSeparate, HELP_ID_CHARACTERS_TOOLBAR_SEPARATE);
    _helpController.setHelpKeyForComponent(_btnNaturalOrder, HELP_ID_CHARACTERS_TOOLBAR_NATURAL);
    _helpController.setHelpKeyForComponent(_btnDiffSpecimenTaxa,
            HELP_ID_CHARACTERS_TOOLBAR_DIFF_SPECIMEN_REMAINING);
    _helpController.setHelpKeyForComponent(_btnSetTolerance, HELP_ID_CHARACTERS_TOOLBAR_TOLERANCE);
    _helpController.setHelpKeyForComponent(_btnSetMatch, HELP_ID_CHARACTERS_TOOLBAR_SET_MATCH);
    _helpController.setHelpKeyForComponent(_btnSubsetCharacters, HELP_ID_CHARACTERS_TOOLBAR_SUBSET_CHARACTERS);
    _helpController.setHelpKeyForComponent(_btnFindCharacter, HELP_ID_CHARACTERS_TOOLBAR_FIND_CHARACTERS);

    _helpController.setHelpKeyForComponent(_btnTaxonInfo, HELP_ID_TAXA_TOOLBAR_INFO);
    _helpController.setHelpKeyForComponent(_btnDiffTaxa, HELP_ID_TAXA_TOOLBAR_DIFF_TAXA);
    _helpController.setHelpKeyForComponent(_btnSubsetTaxa, HELP_ID_TAXA_TOOLBAR_SUBSET_TAXA);
    _helpController.setHelpKeyForComponent(_btnFindTaxon, HELP_ID_TAXA_TOOLBAR_FIND_TAXA);

    // This mouse listener on the default glasspane is to assist with
    // context senstive help. It intercepts the mouse events,
    // determines what component was being clicked on, then takes the
    // appropriate action to provide help for the component
    _defaultGlassPane.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            // Determine what point has been clicked on
            Point glassPanePoint = e.getPoint();
            Point containerPoint = SwingUtilities.convertPoint(getMainFrame().getGlassPane(), glassPanePoint,
                    getMainFrame().getContentPane());
            Component component = SwingUtilities.getDeepestComponentAt(getMainFrame().getContentPane(),
                    containerPoint.x, containerPoint.y);

            // Get the java help ID for this component. If none has been
            // defined, this will be null
            String helpID = _helpController.getHelpKeyForComponent(component);

            // change the cursor back to the normal one and take down the
            // classpane
            mainFrame.setCursor(Cursor.getDefaultCursor());
            mainFrame.getGlassPane().setVisible(false);

            // If a help ID was found, display the related help page in the
            // help viewer
            if (_helpController.getHelpKeyForComponent(component) != null) {
                _helpController.helpAction().actionPerformed(new ActionEvent(component, 0, null));
                _helpController.displayHelpTopic(mainFrame, helpID);
            } else {
                // If a dynamically-defined toolbar button was clicked, show
                // the help for this button in the ToolbarHelpDialog.
                if (component instanceof JButton) {
                    JButton button = (JButton) component;
                    if (_dynamicButtonsFullHelp.containsKey(button)) {
                        String fullHelpText = _dynamicButtonsFullHelp.get(button);
                        if (fullHelpText == null) {
                            fullHelpText = noHelpAvailableCaption;
                        }
                        RTFBuilder builder = new RTFBuilder();
                        builder.startDocument();
                        builder.appendText(fullHelpText);
                        builder.endDocument();
                        ToolbarHelpDialog dlg = new ToolbarHelpDialog(mainFrame, builder.toString(),
                                button.getIcon());
                        show(dlg);
                    }
                }
            }
        }
    });

    show(_rootPanel);
}

From source file:org.apache.jmeter.visualizers.CreateReport.java

public JPanel createSavePanel() {

    saveAsCsv.setSelected(true);/*from   w w  w . jav a2  s .  c  o  m*/

    browse.setActionCommand(BROWSE);
    browse.addActionListener(this);

    // createErrorLog.setActionCommand(CEL);
    JPanel basepathPanel = new JPanel();
    JPanel panel1 = new JPanel(new GridLayout(1, 3));
    JPanel panel2 = new JPanel();
    JPanel panel3 = new JPanel(new BorderLayout());
    JPanel panel5 = new JPanel(new BorderLayout());
    JPanel panel4 = new JPanel(new BorderLayout());

    GridLayout grid = new GridLayout(1, 2);
    grid.setHgap(50);
    panel2.setLayout(grid);

    panel1.add(saveAsCsv);
    panel1.add(saveAsPdf);
    // panel1.add(save);

    panel2.add(viewTestHistory);
    panel2.add(compareTestReports);
    panel3.add(panel1, BorderLayout.NORTH);
    panel3.add(panel2, BorderLayout.SOUTH);
    panel5.add(selectDir, BorderLayout.WEST);
    panel5.add(basepath, BorderLayout.CENTER);
    panel5.add(browse, BorderLayout.EAST);

    viewTestHistory.addActionListener(this);
    viewTestHistory.setEnabled(true);

    compareTestReports.addActionListener(this);
    compareTestReports.setEnabled(true);

    panel4.add(panel5, BorderLayout.NORTH);
    panel4.add(panel3, BorderLayout.SOUTH);

    return panel4;
}

From source file:org.pentaho.reporting.designer.core.ReportDesignerFrame.java

public ReportDesignerFrame() throws XulException {
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    final ImageIcon icon = IconLoader.getInstance().getProductIcon();
    if (icon != null) {
        setIconImage(icon.getImage());/*  w w  w .j  a  v a 2s .c o  m*/
    }

    setTitle(Messages.getString("ReportDesignerFrame.Title"));
    addWindowListener(new WindowCloseHandler());

    viewController = new FrameViewController(this);
    context = new DefaultReportDesignerContext(viewController);
    viewController.initializeXulDesignerFrame(context);

    welcomePane = new WelcomePane(ReportDesignerFrame.this, getContext());
    fieldSelectorPaletteDialog = new FieldSelectorPaletteDialog(ReportDesignerFrame.this, getContext());

    statusBar = new StatusBar(context);

    reportEditorPane = new FancyTabbedPane();
    reportEditorPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    reportEditorPane.getModel().addChangeListener(new ReportTabActivationHandler());
    reportEditorPane.addMouseListener(new ReportTabPanePopupHandler());

    dockingPane = new GlobalPane(false);
    dockingPane.setMainComponent(reportEditorPane);

    attributeEditorPanel = new ElementPropertiesPanel();
    attributeEditorPanel.setAllowAttributeCard(true);
    attributeEditorPanel.setReportDesignerContext(context);

    treePanel = new TreeSidePanel(context, attributeEditorPanel);

    initializeToolWindows();

    paletteToolBar = createPaletteToolBar();

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(context.getToolBar("main-toolbar"), BorderLayout.NORTH); // NON-NLS
    contentPane.add(dockingPane, BorderLayout.CENTER);
    contentPane.add(statusBar, BorderLayout.SOUTH);
    contentPane.add(paletteToolBar, BorderLayout.WEST);
    setContentPane(contentPane);

    setJMenuBar(createMenuBar());
    setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, new DefaultDropTargetListener()));

    context.addPropertyChangeListener(ReportDesignerContext.ACTIVE_CONTEXT_PROPERTY,
            new ReportTabActivationHandler());
    context.addPropertyChangeListener(ReportDesignerContext.STATUS_TEXT_PROPERTY, new StatusTextHandler());
    context.addPropertyChangeListener(ReportDesignerContext.PAGE_PROPERTY, new PageTextHandler());
    context.addPropertyChangeListener(ReportDesignerContext.REPORT_RENDER_CONTEXT_PROPERTY,
            new ReportEditorContextHandler());

    Toolkit.getDefaultToolkit().addAWTEventListener(new DragSelectionToggleHandler(), AWTEvent.KEY_EVENT_MASK);

    if (MacOSXIntegration.MAC_OS_X) {
        try {
            final AboutAction aboutAction = new AboutAction();
            aboutAction.setReportDesignerContext(context);

            final SettingsAction settingsAction = new SettingsAction();
            settingsAction.setReportDesignerContext(context);

            final QuitAction quitAction = new QuitAction();
            quitAction.setReportDesignerContext(context);

            final OpenReportAction openReportAction = new OpenReportAction();
            openReportAction.setReportDesignerContext(context);

            MacOSXIntegration.setOpenFileAction(openReportAction);
            MacOSXIntegration.setAboutAction(aboutAction);
            MacOSXIntegration.setPreferencesAction(settingsAction);
            MacOSXIntegration.setQuitAction(quitAction);
        } catch (Throwable e) {
            DebugLog.log("Failed to activate MacOS-X integration", e); // NON-NLS
        }
    }

    visibleElementsUpdateHandler = new VisibleElementsUpdateHandler();
    WorkspaceSettings.getInstance().addSettingsListener(visibleElementsUpdateHandler);
}

From source file:org.pentaho.reporting.ui.datasources.pmd.PmdDataSourceEditor.java

private JPanel createGlobalPropertiesPanel() {
    final JPanel filePanel = new JPanel();
    filePanel.setLayout(new BoxLayout(filePanel, BoxLayout.X_AXIS));
    filePanel.add(filenameField);/*from w  ww. j a  v  a  2  s. c  om*/
    filePanel.add(new JButton(new BrowseAction()));

    final JPanel queryListButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    queryListButtonsPanel.add(queryAddButton);
    queryListButtonsPanel.add(queryRemoveButton);

    final JPanel queryListButtonsPanelWrapper = new JPanel(new BorderLayout());
    queryListButtonsPanelWrapper.add(new JLabel(Messages.getString("PmdDataSourceEditor.AvailableQueries")),
            BorderLayout.WEST);
    queryListButtonsPanelWrapper.add(queryListButtonsPanel, BorderLayout.EAST);

    final JPanel dataSourceConfigurationPanel = new JPanel();
    dataSourceConfigurationPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH, VerticalLayout.TOP));
    dataSourceConfigurationPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.XmiFileLabel")));
    dataSourceConfigurationPanel.add(filePanel);
    dataSourceConfigurationPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.DomainId")));
    dataSourceConfigurationPanel.add(domainIdTextField);
    dataSourceConfigurationPanel.add(queryListButtonsPanelWrapper);
    dataSourceConfigurationPanel.add(new JScrollPane(queryNameList));
    dataSourceConfigurationPanel.add(new JLabel(Messages.getString("PmdDataSourceEditor.QueryName")));
    dataSourceConfigurationPanel.add(queryNameTextField);
    return dataSourceConfigurationPanel;
}

From source file:edu.ucla.stat.SOCR.chart.Chart.java

/**
 * make the show_all panel/* w w w.  ja  v  a  2  s  .com*/
 */
protected void setMixPanel() {
    dataPanel2.removeAll();
    graphPanel2.removeAll();

    graphPanel2.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 3));
    graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS));
    if (chartPanel != null)
        graphPanel2.add(chartPanel);
    if (legendPanelOn) {
        if (legendPanel != null)
            legendPanel.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5));
        JScrollPane legendPane = new JScrollPane(legendPanel);

        legendPane.setPreferredSize(new Dimension(CHART_SIZE_X * 2 / 3, CHART_SIZE_Y * 2 / 5));
        graphPanel2.add(legendPane);
    }
    graphPanel2.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Data"));
    JScrollPane dt = new JScrollPane(dataTable);
    dt.setRowHeaderView(headerTable);
    dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8));

    dataPanel2.add(dt);
    JScrollPane st = new JScrollPane(summaryPanel);
    st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6));
    dataPanel2.add(st);
    st.validate();

    dataPanel2.add(new JLabel(" "));
    dataPanel2.add(new JLabel("Mapping"));
    JScrollPane st2 = new JScrollPane(mapPanel);
    st2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2));
    dataPanel2.add(st2);

    dataPanel2.validate();

    mixPanel.removeAll();
    mixPanel.add(graphPanel2, BorderLayout.WEST);
    mixPanel.add(new JScrollPane(dataPanel2), BorderLayout.CENTER);
    mixPanel.validate();
}

From source file:net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportConfigView.java

private void layoutPanel() {
    setPreferredSize(new Dimension(450, 400));
    setLayout(new BorderLayout());

    page1 = new JPanel(new GridBagLayout());
    page2 = new JPanel(new GridBagLayout());

    contentPanel = new JPanel(cardLayout);
    contentPanel.add(page1, "page1");
    contentPanel.add(page2, "page2");
    add(contentPanel, BorderLayout.CENTER);

    // title//from   w w w  .  ja v a  2 s  . c  o m
    titlePanel.setBorder(new CompoundBorder(titlePanel.getBorder(), new EmptyBorder(10, 10, 0, 10)));
    add(titlePanel, BorderLayout.NORTH);
    titlePanel.add(titleLabel, BorderLayout.NORTH);
    titlePanel.add(titleIcon, BorderLayout.WEST);
    titlePanel.add(titleMessage, BorderLayout.CENTER);

    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;

    // column range
    c.insets = new Insets(10, 10, 0, 10);
    page1.add(columnLabel, c);

    c.insets = new Insets(10, 25, 0, 0);
    c.gridwidth = 1;
    c.weightx = 0;
    page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c);
    c.insets = new Insets(10, 0, 0, 0);
    c.gridx = 1;
    page1.add(columnFromValue, c);
    c.gridx = 2;
    page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c);
    c.gridx = 3;
    page1.add(columnToValue, c);

    c.gridx = 0;
    c.weightx = 1;
    c.insets = new Insets(10, 10, 0, 10);
    c.gridwidth = GridBagConstraints.REMAINDER;

    // row range
    page1.add(rowLabel, c);

    c.insets = new Insets(10, 25, 0, 0);
    c.gridwidth = 1;
    c.gridx = 0;
    c.weightx = 0;
    page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.from")), c);
    c.insets = new Insets(10, 0, 0, 0);
    c.gridx = 1;
    page1.add(rowFromValue, c);
    c.gridx = 2;
    page1.add(new JLabel(SpreadsheetImportUIText.getString("SpreadsheetImportConfigView.to")), c);
    c.gridx = 3;
    page1.add(rowToValue, c);
    c.gridx = 4;
    page1.add(rowSelectAllOption, c);
    c.gridx = 5;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(10, 0, 0, 10);
    page1.add(rowExcludeFirstOption, c);
    c.insets = new Insets(10, 25, 0, 0);
    c.gridx = 0;
    page1.add(rowIgnoreBlankRows, c);

    c.gridx = 0;

    // empty cells
    c.insets = new Insets(10, 10, 10, 10);
    page1.add(emptyCellLabel, c);

    c.insets = new Insets(0, 25, 0, 10);
    page1.add(emptyCellEmptyStringOption, c);
    JPanel userDefinedPanel = new JPanel(new BorderLayout());
    userDefinedPanel.add(emptyCellUserDefinedOption, BorderLayout.WEST);
    userDefinedPanel.add(emptyCellUserDefinedValue, BorderLayout.CENTER);
    page1.add(userDefinedPanel, c);
    c.weighty = 1;
    c.anchor = GridBagConstraints.NORTHWEST;
    page1.add(emptyCellErrorValueOption, c);

    // output format
    c.insets = new Insets(10, 10, 10, 10);
    c.weighty = 0;
    c.weightx = 1;
    page2.add(outputFormatLabel, c);

    c.insets = new Insets(0, 25, 0, 10);
    page2.add(outputFormatMultiplePort, c);
    page2.add(outputFormatSinglePort, c);

    c.insets = new Insets(0, 50, 0, 10);
    JPanel outputFormatDelimiterPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    outputFormatDelimiterPanel.add(outputFormatDelimiterLabel);
    outputFormatDelimiterPanel.add(outputFormatDelimiter);
    page2.add(outputFormatDelimiterPanel, c);

    // column mapping
    c.insets = new Insets(10, 10, 0, 10);
    page2.add(columnMappingLabel, c);

    c.insets = new Insets(10, 10, 10, 10);
    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1;
    page2.add(new JScrollPane(columnMappingTable), c);

    buttonPanel.add(backButton);
    buttonPanel.add(nextButton);
    add(buttonPanel, BorderLayout.SOUTH);
}

From source file:com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService.java

private void createToolWindowResultEditor(ToolWindow toolWindow) {

    final LightVirtualFile virtualFile = new LightVirtualFile("GraphQL.result.json", JsonFileType.INSTANCE, "");
    fileEditor = PsiAwareTextEditorProvider.getInstance().createEditor(myProject, virtualFile);

    if (fileEditor instanceof TextEditor) {
        final Editor editor = ((TextEditor) fileEditor).getEditor();
        final EditorEx editorEx = (EditorEx) editor;

        // set read-only mode
        editorEx.setViewer(true);//from   w w  w .java 2  s  .co  m
        editorEx.getSettings().setShowIntentionBulb(false);
        editor.getSettings().setAdditionalLinesCount(0);
        editor.getSettings().setCaretRowShown(false);
        editor.getSettings().setBlinkCaret(false);

        // query result header
        final JSGraphQLEditorHeaderComponent header = new JSGraphQLEditorHeaderComponent();

        querySuccessLabel = new JBLabel();
        querySuccessLabel.setVisible(false);
        querySuccessLabel.setIconTextGap(0);
        header.add(querySuccessLabel, BorderLayout.WEST);

        queryResultLabel = new JBLabel("", null, SwingConstants.LEFT);
        queryResultLabel.setBorder(new EmptyBorder(4, 6, 4, 6));
        queryResultLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        queryResultLabel.setVisible(false);
        queryResultLabel.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                final String fileUrl = (String) queryResultLabel.getClientProperty(FILE_URL_PROPERTY);
                if (fileUrl != null) {
                    final VirtualFile queryFile = VirtualFileManager.getInstance().findFileByUrl(fileUrl);
                    if (queryFile != null) {
                        final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
                        fileEditorManager.openFile(queryFile, true, true);
                    }
                }
            }
        });
        header.add(queryResultLabel, BorderLayout.CENTER);

        // finally set the header as permanent such that it's restored after searches
        editor.setHeaderComponent(header);
        editorEx.setPermanentHeaderComponent(header);
    }

    Disposer.register(this, fileEditor);

    final ContentImpl content = new ContentImpl(fileEditor.getComponent(), "Query result", true);
    content.setCloseable(false);
    toolWindow.getContentManager().addContent(content);

}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphActionsPane() {
    JPanel buttonPanel = new JPanel(new BorderLayout());
    JPanel displayPane = new JPanel();
    displayPane.add(displayButton);//ww w .j a  v  a2  s  .c o m
    displayButton.addActionListener(this);
    buttonPanel.add(displayPane, BorderLayout.WEST);

    JPanel savePane = new JPanel();
    savePane.add(saveGraph);
    savePane.add(saveTable);
    savePane.add(saveHeaders);
    saveGraph.addActionListener(this);
    saveTable.addActionListener(this);
    syncWithName.addActionListener(this);
    buttonPanel.add(savePane, BorderLayout.EAST);

    return buttonPanel;
}

From source file:org.nuclos.client.ui.collect.SubForm.java

private void init() {
    contentPane.add(toolbar,/*from  w  w  w  .j av a2  s. c o  m*/
            toolbar.getOrientation() == JToolBar.HORIZONTAL ? BorderLayout.NORTH : BorderLayout.WEST);

    // Configure table
    scrollPane.getViewport().setBackground(subformtbl.getBackground());
    subformtbl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    subformtbl.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    //      subformtbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    scrollPane.getViewport().setView(subformtbl);
    JLabel labCorner = new JLabel();
    labCorner.setEnabled(false);
    labCorner.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, Color.GRAY));
    labCorner.setBackground(Color.LIGHT_GRAY);
    scrollPane.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, labCorner);

    rowHeader = createTableRowHeader(subformtbl, scrollPane);
    subformtbl.setRowHeaderTable(rowHeader);

    // subformtbl.addMouseListener(newToolbarContextMenuListener(subformtbl, subformtbl));
    addToolbarMouseListener(subformtbl, subformtbl, subformtbl);
    // scrollPane.getViewport().addMouseListener(newToolbarContextMenuListener(scrollPane.getViewport(), subformtbl));
    addToolbarMouseListener(scrollPane.getViewport(), scrollPane.getViewport(), subformtbl);
}

From source file:net.sourceforge.pmd.util.designer.Designer.java

private JPanel createXPathQueryPanel() {
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    xpathQueryArea.setBorder(BorderFactory.createLineBorder(Color.black));
    makeTextComponentUndoable(xpathQueryArea);
    JScrollPane scrollPane = new JScrollPane(xpathQueryArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    final JButton b = createGoButton();

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    topPanel.add(new JLabel("XPath Query (if any):"), BorderLayout.WEST);
    topPanel.add(createXPathVersionPanel(), BorderLayout.EAST);

    p.add(topPanel, BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    p.add(b, BorderLayout.SOUTH);

    return p;//from w ww .  j  a va2  s  .  c  o m
}