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:org.jajuk.ui.widgets.JajukJMenuBar.java

/**
 * Instantiates a new jajuk j menu bar./*  w  w  w. java  2  s.  co m*/
 */
private JajukJMenuBar() {
    setAlignmentX(0.0f);
    // File menu
    file = new JMenu(Messages.getString("JajukJMenuBar.0"));
    jmiFileExit = new JMenuItem(ActionManager.getAction(JajukActions.EXIT));
    file.add(jmiFileExit);
    // Properties menu
    properties = new JMenu(Messages.getString("JajukJMenuBar.5"));
    jmiNewProperty = new JMenuItem(ActionManager.getAction(CUSTOM_PROPERTIES_ADD));
    jmiRemoveProperty = new JMenuItem(ActionManager.getAction(CUSTOM_PROPERTIES_REMOVE));
    jmiActivateTags = new JMenuItem(ActionManager.getAction(EXTRA_TAGS_WIZARD));
    properties.add(jmiNewProperty);
    properties.add(jmiRemoveProperty);
    properties.add(jmiActivateTags);
    // View menu
    views = new JMenu(Messages.getString("JajukJMenuBar.8"));
    jmiRestoreDefaultViews = new JMenuItem(ActionManager.getAction(VIEW_RESTORE_DEFAULTS));
    jmiRestoreDefaultViewsAllPerpsectives = new JMenuItem(
            ActionManager.getAction(JajukActions.ALL_VIEW_RESTORE_DEFAULTS));
    views.add(jmiRestoreDefaultViews);
    views.add(jmiRestoreDefaultViewsAllPerpsectives);
    views.addSeparator();
    // Add the list of available views parsed in XML files at startup
    JMenu jmViews = new JMenu(Messages.getString("JajukJMenuBar.25"));
    for (final Class<? extends IView> view : ViewFactory.getKnownViews()) {
        JMenuItem jmi = null;
        try {
            jmi = new JMenuItem(view.newInstance().getDesc(), IconLoader.getIcon(JajukIcons.LOGO_FRAME));
        } catch (Exception e1) {
            Log.error(e1);
            continue;
        }
        jmi.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // Simply add the new view in the current perspective
                PerspectiveAdapter current = (PerspectiveAdapter) PerspectiveManager.getCurrentPerspective();
                IView newView = ViewFactory.createView(view, current,
                        Math.abs(UtilSystem.getRandom().nextInt()));
                newView.initUI();
                newView.setPopulated();
                current.addDockable(newView);
            }
        });
        jmViews.add(jmi);
    }
    views.add(jmViews);
    // Mode menu
    String modeText = Messages.getString("JajukJMenuBar.9");
    mode = new JMenu(ActionUtil.strip(modeText));
    jcbmiRepeat = new JCheckBoxMenuItem(ActionManager.getAction(REPEAT_MODE));
    jcbmiRepeat.setSelected(Conf.getBoolean(Const.CONF_STATE_REPEAT));
    jcbmiRepeatAll = new JCheckBoxMenuItem(ActionManager.getAction(REPEAT_ALL_MODE));
    jcbmiRepeatAll.setSelected(Conf.getBoolean(Const.CONF_STATE_REPEAT_ALL));
    jcbmiShuffle = new JCheckBoxMenuItem(ActionManager.getAction(SHUFFLE_MODE));
    jcbmiShuffle.setSelected(Conf.getBoolean(Const.CONF_STATE_SHUFFLE));
    jcbmiContinue = new JCheckBoxMenuItem(ActionManager.getAction(CONTINUE_MODE));
    jcbmiContinue.setSelected(Conf.getBoolean(Const.CONF_STATE_CONTINUE));
    jcbmiIntro = new JCheckBoxMenuItem(ActionManager.getAction(INTRO_MODE));
    jcbmiIntro.setSelected(Conf.getBoolean(Const.CONF_STATE_INTRO));
    jcbmiKaraoke = new JCheckBoxMenuItem(ActionManager.getAction(JajukActions.KARAOKE_MODE));
    if (Conf.getBoolean(Const.CONF_BIT_PERFECT)) {
        jcbmiKaraoke.setEnabled(false);
        jcbmiKaraoke.setSelected(false);
        Conf.setProperty(Const.CONF_STATE_KARAOKE, Const.FALSE);
    } else {
        jcbmiKaraoke.setSelected(Conf.getBoolean(Const.CONF_STATE_KARAOKE));
    }
    mode.add(jcbmiRepeat);
    mode.add(jcbmiRepeatAll);
    mode.add(jcbmiShuffle);
    mode.add(jcbmiContinue);
    mode.add(jcbmiIntro);
    mode.add(jcbmiKaraoke);
    // Smart Menu
    smart = new JMenu(Messages.getString("JajukJMenuBar.29"));
    jmiShuffle = new SizedJMenuItem(ActionManager.getAction(JajukActions.SHUFFLE_GLOBAL));
    jmiBestof = new SizedJMenuItem(ActionManager.getAction(JajukActions.BEST_OF));
    jmiNovelties = new SizedJMenuItem(ActionManager.getAction(JajukActions.NOVELTIES));
    jmiFinishAlbum = new SizedJMenuItem(ActionManager.getAction(JajukActions.FINISH_ALBUM));
    smart.add(jmiShuffle);
    smart.add(jmiBestof);
    smart.add(jmiNovelties);
    smart.add(jmiFinishAlbum);
    // Tools Menu
    tools = new JMenu(Messages.getString("JajukJMenuBar.28"));
    jmiduplicateFinder = new JMenuItem(ActionManager.getAction(JajukActions.FIND_DUPLICATE_FILES));
    jmialarmClock = new JMenuItem(ActionManager.getAction(JajukActions.ALARM_CLOCK));
    jmiprepareParty = new JMenuItem(ActionManager.getAction(JajukActions.PREPARE_PARTY));
    tools.add(jmiduplicateFinder);
    tools.add(jmialarmClock);
    tools.add(jmiprepareParty);
    // tools.addSeparator();
    // Configuration menu
    configuration = new JMenu(Messages.getString("JajukJMenuBar.21"));
    jmiDJ = new JMenuItem(ActionManager.getAction(CONFIGURE_DJS));
    // Overwrite default icon
    jmiDJ.setIcon(IconLoader.getIcon(JajukIcons.DIGITAL_DJ_16X16));
    jmiAmbience = new JMenuItem(ActionManager.getAction(CONFIGURE_AMBIENCES));
    jmiWizard = new JMenuItem(ActionManager.getAction(SIMPLE_DEVICE_WIZARD));
    jmiOptions = new JMenuItem(ActionManager.getAction(OPTIONS));
    jmiUnmounted = new JCheckBoxMenuItem(ActionManager.getAction(JajukActions.UNMOUNTED));
    jmiUnmounted.setSelected(Conf.getBoolean(Const.CONF_OPTIONS_HIDE_UNMOUNTED));
    jmiUnmounted.putClientProperty(Const.DETAIL_ORIGIN, jmiUnmounted);
    jcbShowPopups = new JCheckBoxMenuItem(Messages.getString("ParameterView.228"));
    jcbShowPopups.setSelected(Conf.getBoolean(Const.CONF_SHOW_POPUPS));
    jcbShowPopups.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Conf.setProperty(Const.CONF_SHOW_POPUPS, Boolean.toString(jcbShowPopups.isSelected()));
            // force parameter view to take this into account
            ObservationManager.notify(new JajukEvent(JajukEvents.PARAMETERS_CHANGE));
        }
    });
    jcbNoneInternetAccess = new JCheckBoxMenuItem(Messages.getString("ParameterView.264"));
    jcbNoneInternetAccess.setToolTipText(Messages.getString("ParameterView.265"));
    jcbNoneInternetAccess.setSelected(Conf.getBoolean(Const.CONF_NETWORK_NONE_INTERNET_ACCESS));
    jcbNoneInternetAccess.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Conf.setProperty(Const.CONF_NETWORK_NONE_INTERNET_ACCESS,
                    Boolean.toString(jcbNoneInternetAccess.isSelected()));
            // force parameter view to take this into account
            ObservationManager.notify(new JajukEvent(JajukEvents.PARAMETERS_CHANGE));
        }
    });
    configuration.add(jmiUnmounted);
    configuration.add(jcbShowPopups);
    configuration.add(jcbNoneInternetAccess);
    configuration.addSeparator();
    configuration.add(jmiDJ);
    configuration.add(jmiAmbience);
    configuration.add(jmiWizard);
    configuration.add(jmiOptions);
    // Help menu
    String helpText = Messages.getString("JajukJMenuBar.14");
    help = new JMenu(ActionUtil.strip(helpText));
    jmiHelp = new JMenuItem(ActionManager.getAction(HELP_REQUIRED));
    jmiDonate = new JMenuItem(ActionManager.getAction(SHOW_DONATE));
    jmiAbout = new JMenuItem(ActionManager.getAction(SHOW_ABOUT));
    jmiTraces = new JMenuItem(ActionManager.getAction(SHOW_TRACES));
    jmiTraces = new JMenuItem(ActionManager.getAction(SHOW_TRACES));
    jmiCheckforUpdates = new JMenuItem(ActionManager.getAction(JajukActions.CHECK_FOR_UPDATES));
    jmiTipOfTheDay = new JMenuItem(ActionManager.getAction(TIP_OF_THE_DAY));
    help.add(jmiHelp);
    help.add(jmiTipOfTheDay);
    // Install this action only if Desktop class is supported, it is used to
    // open default mail client
    if (UtilSystem.isBrowserSupported()) {
        jmiQualityAgent = new JMenuItem(ActionManager.getAction(QUALITY));
        help.add(jmiQualityAgent);
    }
    help.add(jmiTraces);
    help.add(jmiCheckforUpdates);
    help.add(jmiDonate);
    help.add(jmiAbout);
    mainmenu = new JMenuBar();
    mainmenu.add(file);
    mainmenu.add(views);
    mainmenu.add(properties);
    mainmenu.add(mode);
    mainmenu.add(smart);
    mainmenu.add(tools);
    mainmenu.add(configuration);
    mainmenu.add(help);
    // Apply mnemonics (Alt + first char of the menu keystroke)
    applyMnemonics();
    if (SessionService.isTestMode()) {
        jbGC = new JajukButton(ActionManager.getAction(JajukActions.GC));
    }
    jbSlim = new JajukButton(ActionManager.getAction(JajukActions.SLIM_JAJUK));
    jbFull = new JajukButton(ActionManager.getAction(JajukActions.FULLSCREEN_JAJUK));
    JMenuBar eastmenu = new JMenuBar();
    // only show GC-button in test-mode
    if (SessionService.isTestMode()) {
        eastmenu.add(jbGC);
    }
    eastmenu.add(jbSlim);
    eastmenu.add(jbFull);
    setLayout(new BorderLayout());
    add(mainmenu, BorderLayout.WEST);
    add(eastmenu, BorderLayout.EAST);
    // Check for new release and display the icon if a new release is available
    SwingWorker<Void, Void> sw = new SwingWorker<Void, Void>() {
        @Override
        public Void doInBackground() {
            UpgradeManager.checkForUpdate();
            return null;
        }

        @Override
        public void done() {
            // add the new release label if required
            if (UpgradeManager.getNewVersionName() != null) {
                jlUpdate = new JLabel(" ", IconLoader.getIcon(JajukIcons.UPDATE_MANAGER), SwingConstants.RIGHT);
                String newRelease = UpgradeManager.getNewVersionName();
                if (newRelease != null) {
                    jlUpdate.setToolTipText(Messages.getString("UpdateManager.0") + newRelease
                            + Messages.getString("UpdateManager.1"));
                }
                add(Box.createHorizontalGlue());
                add(jlUpdate);
            }
        }
    };
    // Search online for upgrade if the option is set and if the none Internet
    // access option is not set
    if (Conf.getBoolean(Const.CONF_CHECK_FOR_UPDATE)
            && !Conf.getBoolean(Const.CONF_NETWORK_NONE_INTERNET_ACCESS)) {
        sw.execute();
    }
    ObservationManager.register(this);
}

From source file:de.juwimm.cms.content.panel.PanDocuments.java

private void jbInit() throws Exception {
    mimeType = "";
    btnDelete.setText("Datei lschen");
    panBottom.setLayout(new BorderLayout());
    panDocumentButtons.setLayout(panDocumentsLayout);
    btnAdd.setText("Datei hinzufgen");
    lbLinkDescription.setText(" Linkbeschreibung  ");
    this.setLayout(new BorderLayout());
    panLinkName.setLayout(panLinkNameLayout);
    panDocumentsLayout.setAlignment(FlowLayout.LEFT);
    panDocumentButtons.setBackground(SystemColor.text);
    this.add(panBottom, BorderLayout.SOUTH);
    panBottom.add(panFileAction, BorderLayout.EAST);
    panFileAction.add(btnUpdate, null);/*www  .j a v a 2 s .  c  o m*/
    panFileAction.add(btnAdd, null);
    panFileAction.add(btnDelete, null);
    panFileAction.add(btnPreview, null);
    panBottom.add(panLinkName, BorderLayout.NORTH);
    panLinkName.add(lbLinkDescription, new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
    panLinkName.add(txtLinkDesc, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.BASELINE_LEADING,
            GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
    if (showDocumentProperties) {
        panLinkName.add(lbDocumentLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(txtDocumentLabel, new GridBagConstraints(1, 1, 1, 1, 1, 0,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(lbDocumentDescription, new GridBagConstraints(0, 2, 1, 1, 0, 0,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(txtDocumentDescription, new GridBagConstraints(1, 2, 1, 1, 1, 0,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(lbAuthor, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.BASELINE_LEADING,
                GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(txtAuthor, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.BASELINE_LEADING,
                GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(lbCategory, new GridBagConstraints(0, 4, 1, 1, 0, 0,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(txtCategory, new GridBagConstraints(1, 4, 1, 1, 1, 0,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
        panLinkName.add(ckbDocumentSearchable, new GridBagConstraints(0, 5, 2, 1, 1, 1,
                GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 2, 2));
    }
    panBottom.add(cbxDisplayTypeInline, BorderLayout.WEST);
    this.add(scrollPane, BorderLayout.CENTER);
    if (showRegionCombo) {
        this.add(cboRegion, BorderLayout.NORTH);
    }

    this.add(getViewSelectPan(), BorderLayout.WEST);
    scrollPane.getViewport().add(tblDocuments, null);
    scrollPane.setTransferHandler(new FileTransferHandler(this));
}

From source file:ca.sqlpower.architect.swingui.enterprise.SecurityPanel.java

private User createUserFromPrompter() {
    JTextField nameField = new JTextField(15);
    JTextField passField = new JPasswordField(15);
    JTextField confirmField = new JPasswordField(15);

    JPanel namePanel = new JPanel(new BorderLayout());
    namePanel.add(new JLabel("User Name"), BorderLayout.WEST);
    namePanel.add(nameField, BorderLayout.EAST);

    JPanel passPanel = new JPanel(new BorderLayout());
    passPanel.add(new JLabel("Password"), BorderLayout.WEST);
    passPanel.add(passField, BorderLayout.EAST);

    JPanel confirmPanel = new JPanel(new BorderLayout());
    confirmPanel.add(new JLabel("Confirm Password"), BorderLayout.WEST);
    confirmPanel.add(confirmField, BorderLayout.EAST);

    Object[] messages = new Object[] { "Specify the User's Name and Password.", namePanel, passPanel,
            confirmPanel };//from ww w  .  j  av  a 2s .com

    String[] options = { "OK", "Cancel", };
    int option = JOptionPane.showOptionDialog(getPanel(), messages, "Specify the User's Name and Password",
            JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);

    if (nameField.getText().equals("") || nameField.getText() == null || passField.getText().equals("")
            || passField.getText() == null) {
        return null;
    }

    if (!passField.getText().equals(confirmField.getText())) {
        JOptionPane.showMessageDialog(getPanel(), "The passwords you entered do not match.", "Error",
                JOptionPane.ERROR_MESSAGE);
        return null;
    }

    User user = null;
    if (option == 0) {
        String password;
        try {
            password = new String(Hex.encodeHex(digester.digest(passField.getText().getBytes("UTF-8"))));
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("Unable to encode password", e);
        }
        user = new User(nameField.getText(), password);
    }

    return user;
}

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

private JComponent createHeaderComponent(FileEditor fileEditor, Editor editor) {

    final JSGraphQLEditorHeaderComponent headerComponent = new JSGraphQLEditorHeaderComponent();

    // variables & settings actions
    final DefaultActionGroup settingsActions = new DefaultActionGroup();
    settingsActions.add(new JSGraphQLEditEndpointsAction());
    settingsActions.add(new JSGraphQLToggleVariablesAction());

    final JComponent settingsToolbar = createToolbar(settingsActions);
    headerComponent.add(settingsToolbar, BorderLayout.WEST);

    // query execute
    final DefaultActionGroup queryActions = new DefaultActionGroup();
    final AnAction executeGraphQLAction = ActionManager.getInstance()
            .getAction(JSGraphQLExecuteEditorAction.class.getName());
    queryActions.add(executeGraphQLAction);
    final JComponent queryToolbar = createToolbar(queryActions);

    // configured endpoints combo box
    final List<JSGraphQLEndpoint> endpoints = JSGraphQLConfigurationProvider.getService(myProject)
            .getEndpoints();/*from ww  w .  j ava2s  .com*/
    final JSGraphQLEndpointsModel endpointsModel = new JSGraphQLEndpointsModel(endpoints,
            PropertiesComponent.getInstance(myProject));
    final ComboBox endpointComboBox = new ComboBox(endpointsModel);
    endpointComboBox.setToolTipText("GraphQL endpoint");
    editor.putUserData(JS_GRAPH_QL_ENDPOINTS_MODEL, endpointsModel);
    final JPanel endpointComboBoxPanel = new JPanel(new BorderLayout());
    endpointComboBoxPanel.setBorder(BorderFactory.createEmptyBorder(1, 2, 2, 2));
    endpointComboBoxPanel.add(endpointComboBox);

    // splitter to resize endpoints
    final OnePixelSplitter splitter = new OnePixelSplitter(false, .25F);
    splitter.setBorder(BorderFactory.createEmptyBorder());
    splitter.setFirstComponent(endpointComboBoxPanel);
    splitter.setSecondComponent(queryToolbar);
    splitter.setHonorComponentsMinimumSize(true);
    splitter.setAndLoadSplitterProportionKey("JSGraphQLEndpointSplitterProportion");
    splitter.setOpaque(false);
    splitter.getDivider().setOpaque(false);

    headerComponent.add(splitter, BorderLayout.CENTER);

    // variables editor
    final LightVirtualFile virtualFile = new LightVirtualFile(GRAPH_QL_VARIABLES_JSON, JsonFileType.INSTANCE,
            "");
    final FileEditor variablesFileEditor = PsiAwareTextEditorProvider.getInstance().createEditor(myProject,
            virtualFile);
    final EditorEx variablesEditor = (EditorEx) ((TextEditor) variablesFileEditor).getEditor();
    virtualFile.putUserData(IS_GRAPH_QL_VARIABLES_VIRTUAL_FILE, Boolean.TRUE);
    variablesEditor.setPlaceholder("{ variables }");
    variablesEditor.setShowPlaceholderWhenFocused(true);
    variablesEditor.getSettings().setRightMarginShown(false);
    variablesEditor.getSettings().setAdditionalLinesCount(0);
    variablesEditor.getSettings().setShowIntentionBulb(false);
    variablesEditor.getSettings().setFoldingOutlineShown(false);
    variablesEditor.getSettings().setLineNumbersShown(false);
    variablesEditor.getSettings().setLineMarkerAreaShown(false);
    variablesEditor.getSettings().setCaretRowShown(false);
    variablesEditor.putUserData(JS_GRAPH_QL_ENDPOINTS_MODEL, endpointsModel);

    // hide variables by default
    variablesEditor.getComponent().setVisible(false);

    // link the query and variables editor together
    variablesEditor.putUserData(GRAPH_QL_QUERY_EDITOR, editor);
    editor.putUserData(GRAPH_QL_VARIABLES_EDITOR, variablesEditor);

    final NonOpaquePanel variablesPanel = new NonOpaquePanel(variablesFileEditor.getComponent());
    variablesPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));

    Disposer.register(fileEditor, variablesFileEditor);

    headerComponent.add(variablesPanel, BorderLayout.SOUTH);

    return headerComponent;
}

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

/**
 * Main visualizer setup./*  www .  j a  v a 2  s  .  co  m*/
 */
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();

    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(makeTitlePanel());
    mainPanel.add(createSavePanel());
    myJTable = new JTable(model);
    myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(myScrollPane, BorderLayout.CENTER);
    saveTable.addActionListener(this);
    JPanel opts = new JPanel();
    opts.add(useGroupName, BorderLayout.WEST);
    opts.add(saveTable, BorderLayout.CENTER);
    opts.add(saveHeaders, BorderLayout.EAST);
    this.add(opts, BorderLayout.SOUTH);
}

From source file:shuffle.fwk.service.roster.EditRosterService.java

private Component makeBottomPanel() {
    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.insets = new Insets(0, 10, 0, 10);
    c.weightx = 1.0;/*from   ww  w  .j a  v  a 2s.  c om*/
    c.weighty = 0.0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx++;
    selectedDisplayLabel = new JLabel(getString(KEY_NONE_SELECTED));
    selectedDisplayLabel.setToolTipText(getString(KEY_SELECTED_TOOLTIP));
    ;
    ret.add(selectedDisplayLabel, c);
    c.insets = new Insets(0, 0, 0, 0);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 1.0;
    c.gridx++;
    teamFilter = new JCheckBox(getString(KEY_TEAM));
    JPanel teamFilterPanel = new JPanel(new BorderLayout());
    teamFilterPanel.add(teamFilter, BorderLayout.WEST);
    teamFilter.setToolTipText(getString(KEY_TEAM_TOOLTIP));
    ret.add(teamFilterPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    activeEffect = new EffectChooser(false, EffectChooser.DefaultEntry.SPECIES);
    JPanel activeEffectPanel = new JPanel(new BorderLayout());
    activeEffectPanel.add(activeEffect, BorderLayout.WEST);
    activeEffect.setToolTipText(getString(KEY_ACTIVE_EFFECT));
    ret.add(activeEffectPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JPanel skillPanel = new JPanel(new BorderLayout());
    ImageIcon skillBoosterIcon = getUser().getImageManager().getImageFor(KEY_SKILL_BOOSTER);
    JLabel skillBoosterLabel = new JLabel(skillBoosterIcon);
    skillPanel.add(skillBoosterLabel, BorderLayout.EAST);
    skillLevels = new JComboBox<Integer>();
    skillLevels.setEnabled(false);
    skillLevels.addItem(1);
    skillPanel.add(skillLevels, BorderLayout.WEST);
    skillPanel.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP));
    skillLevels.setToolTipText(getString(KEY_SKILL_BOOSTER_TOOLTIP));
    ret.add(skillPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JPanel speedupPanel = new JPanel(new BorderLayout());
    ImageIcon candyIcon = getUser().getImageManager().getImageFor(KEY_CANDY_ICON);
    JLabel candyLabel = new JLabel(candyIcon);
    speedupPanel.add(candyLabel, BorderLayout.EAST);
    speedups = new JComboBox<Integer>();
    speedups.setEnabled(false);
    speedups.addItem(0);
    speedupPanel.add(speedups, BorderLayout.WEST);
    speedupPanel.setToolTipText(getString(KEY_CANDY_TOOLTIP));
    speedups.setToolTipText(getString(KEY_CANDY_TOOLTIP));
    ret.add(speedupPanel, c);

    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.0;
    c.gridx++;
    JButton okButton = new JButton(getString(KEY_OK));
    okButton.setToolTipText(getString(KEY_OK_TOOLTIP));
    ret.add(okButton, c);
    setDefaultButton(okButton);

    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 0.0;
    c.gridx++;
    JButton applyButton = new JButton(getString(KEY_APPLY));
    applyButton.setToolTipText(getString(KEY_APPLY_TOOLTIP));
    ret.add(applyButton, c);

    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.0;
    c.gridx++;
    JButton cancelButton = new JButton(new DisposeAction(getString(KEY_CANCEL), this));
    cancelButton.setToolTipText(getString(KEY_CANCEL_TOOLTIP));
    ret.add(cancelButton, c);

    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onOK();
        }
    });
    applyButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            onApply();
        }
    });
    addSpeedupsListener();
    return ret;
}

From source file:org.pentaho.ui.xul.swing.tags.SwingDialog.java

private void createDialog() {

    if (getParent() instanceof XulDialog) {
        Object parentObj = ((SwingDialog) getParent()).getDialog();
        dialog = new JDialog((Dialog) parentObj);
        centerComp = (Component) parentObj;
    } else if (getParent() instanceof XulWindow) {

        Object parentObj = getParent().getManagedObject();
        dialog = new JDialog((Frame) parentObj);
        centerComp = (Component) parentObj;
    } else {/*from   w w  w . jav  a 2s .c  om*/

        Document doc = getDocument();
        Element rootElement = doc.getRootElement();
        XulWindow window = null;
        if (rootElement != this) { // dialog is root, no JFrame Parent
            window = (XulWindow) rootElement;
        }

        if (window != null) {
            frame = (JFrame) window.getManagedObject();
            dialog = new JDialog(frame);
            centerComp = frame;
        } else {

            final Object context = domContainer.getOuterContext();
            if (context instanceof JFrame) {
                frame = (JFrame) context;
                centerComp = (Component) context;
                dialog = new JDialog(frame);
            } else if (context instanceof JDialog) {
                dialog = new JDialog((JDialog) context);
                centerComp = (Component) context;
            } else if (context instanceof JComponent) {
                dialog = new JDialog();
                centerComp = (Component) context;
            } else {
                dialog = new JDialog();
            }
        }
    }

    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setResizable(getResizable());
    dialog.setLayout(new BorderLayout());

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setOpaque(true);
    int pad = (this.getPadding() > -1) ? getPadding() : 3;
    mainPanel.setBorder(BorderFactory.createEmptyBorder(pad, pad, pad, pad));

    dialog.setTitle(title);
    dialog.setModal(isModal());
    dialog.add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(container, BorderLayout.CENTER);
    container.setOpaque(false);

    if (this.header != null) {

        JPanel headerPanel = new JPanel(new BorderLayout());
        headerPanel.setBackground(Color.decode("#5F86C0"));
        headerPanel.setOpaque(true);
        JPanel headerPanelInner = new JPanel(new BorderLayout());
        headerPanelInner.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
        headerPanelInner.setOpaque(false);

        headerPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.decode("#8FB1E5"),
                Color.decode("#446CA9")));

        JLabel title = new JLabel(this.header.getTitle());

        title.setForeground(Color.white);
        headerPanelInner.add(title, BorderLayout.WEST);

        JLabel desc = new JLabel(this.header.getDescription());
        desc.setForeground(Color.white);
        headerPanelInner.add(desc, BorderLayout.EAST);

        headerPanel.add(headerPanelInner, BorderLayout.CENTER);

        mainPanel.add(headerPanel, BorderLayout.NORTH);
    }

    populateButtonPanel();
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    dialog.setSize(new Dimension(getWidth(), getHeight()));
    dialog.setPreferredSize(new Dimension(getWidth(), getHeight()));
    dialog.setMinimumSize(new Dimension(getWidth(), getHeight()));

    if (this.getBgcolor() != null) {
        mainPanel.setBackground(Color.decode(this.getBgcolor()));
    }

}

From source file:WizardDialog.java

/**
 * Standard constructor - creates panel with the specified button labels.
 * //from  www  . j  a v a 2 s  . c o  m
 * @param label1
 *          the label for button 1.
 * @param label2
 *          the label for button 2.
 * @param label3
 *          the label for button 3.
 * @param label4
 *          the label for button 4.
 */
public L1R3ButtonPanel(final String label1, final String label2, final String label3, final String label4) {

    setLayout(new BorderLayout());

    // create the pieces...
    final JPanel panel = new JPanel(new BorderLayout());
    final JPanel panel2 = new JPanel(new BorderLayout());
    this.left = new JButton(label1);
    this.right1 = new JButton(label2);
    this.right2 = new JButton(label3);
    this.right3 = new JButton(label4);

    // ...and put them together
    panel.add(this.left, BorderLayout.WEST);
    panel2.add(this.right1, BorderLayout.EAST);
    panel.add(panel2, BorderLayout.CENTER);
    panel.add(this.right2, BorderLayout.EAST);
    add(panel, BorderLayout.CENTER);
    add(this.right3, BorderLayout.EAST);

}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.script.PainelScript.java

private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) {
    Ferramenta_Scripts.carregaTexto(TokenLang.LANG);
    JPanel regraFonteBtn = new JPanel();
    regraFonteBtn.setLayout(new BorderLayout());

    textAreaSourceCode = new G_TextAreaSourceCode();
    textAreaSourceCode.setTipoHTML();// w w w .  j  a va2  s  . co  m
    new OnChange(textAreaSourceCode, this);
    tableLinCod = new TabelaDescricao(erros);
    arTextPainelCorrecao = new ArTextPainelCorrecao();
    salvar = new JButton();
    abrir = new JButton();
    cancelar = new JButton();
    strConteudoalt = new String();
    btnSalvar = new JMenuItem("Salvar");
    salvar.setEnabled(false);
    salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar,
            new JMenuItem(), parentFrame);

    pnRegra = new JPanel();
    lbRegras1 = new JLabel();
    lbRegras2 = new JLabel();
    pnSetaDescricao = new JPanel();
    new JScrollPane();
    tArParticipRotulo = new TArParticipRotulo();
    conteudoDoAlt = new JTextArea();
    pnListaErros = new JPanel();
    scrollPanetabLinCod = new JScrollPane();
    pnBotoes = new JPanel();
    new JButton();
    aplicar = new JButton();
    conteudoParticRotulo = new ArrayList<String>();
    setBackground(CoresDefault.getCorPaineis());
    Container contentPane = this;// ??
    contentPane.setLayout(new GridLayout(2, 1));
    {
        pnRegra.setBorder(criaBorda(Ferramenta_Scripts.TITULO_REGRA));
        pnRegra.setLayout(new GridLayout(2, 1));
        pnRegra.add(lbRegras1);
        lbRegras1.setText(Ferramenta_Scripts.REGRAP1);
        lbRegras2.setText(Ferramenta_Scripts.REGRAP2);
        lbRegras1.setHorizontalAlignment(SwingConstants.CENTER);

        lbRegras2.setHorizontalAlignment(SwingConstants.CENTER);
        pnRegra.add(lbRegras1);
        pnRegra.add(lbRegras2);
        pnRegra.setPreferredSize(new Dimension(700, 60));
    }
    // ---- Salvar ----
    salvar.setText(Ferramenta_Scripts.BTN_SALVAR);
    salvar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            salvarActionPerformed(e);
        }
    });

    salvar.setToolTipText(Ferramenta_Scripts.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_SALVAR);
    salvar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_SALVAR);
    salvar.setBounds(10, 0, 150, 25);

    abrir.setText(Ferramenta_Scripts.BTN_ABRIR);
    abrir.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AbrirActionPerformed(e);
        }
    });

    abrir.setToolTipText(Ferramenta_Scripts.DICA_ABRIR);
    abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_ABRIR_HTML);
    abrir.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_ABRIR_HTML);
    abrir.setBounds(165, 0, 150, 25);

    cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR);
    cancelar.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            CancelarActionPerformed(e);
        }
    });

    cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_TELA_ANTERIOR);
    cancelar.setBounds(320, 0, 150, 25);
    GridBagConstraints cons = new GridBagConstraints();

    cons.fill = GridBagConstraints.BOTH;
    cons.weighty = 1;

    pnSetaDescricao.setLayout(new BorderLayout());
    cons.anchor = GridBagConstraints.WEST;
    cons.insets = new Insets(0, 0, 0, 0);
    JScrollPane sp = new JScrollPane();
    sp.setBorder(criaBorda(Ferramenta_Scripts.CONTEUDO_ALTER));
    sp.setViewportView(conteudoDoAlt);
    sp.setPreferredSize(new Dimension(500, 300));
    pnSetaDescricao.setPreferredSize(new Dimension(400, 60));
    pnListaErros.setBorder(criaBorda(Ferramenta_Scripts.LISTA_ERROS));
    pnListaErros.setLayout(new BorderLayout());
    scrollPanetabLinCod.setViewportView(tableLinCod);
    pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER);
    {
        pnBotoes.setLayout(null);
        aplicar.setEnabled(false);
        aplicar.setText(Ferramenta_Scripts.BTN_APLICAR);
        aplicar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                aplicarRotuloActionPerformed(e);
            }
        });

        aplicar.setToolTipText(Ferramenta_Scripts.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_APLICAR);
        aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_APLICAR);
        aplicar.setBounds(3, 3, 120, 30);
        pnBotoes.add(aplicar);
    }

    /*
     * Colocar os controles
     */
    pnRegra.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.add(pnRegra, BorderLayout.NORTH);
    textAreaSourceCode.setBorder(criaBorda(""));
    textAreaSourceCode.setBackground(CoresDefault.getCorPaineis());

    JSplitPane splitPane = null;

    Dimension minimumSize = new Dimension(0, 0);
    sp.setMinimumSize(minimumSize);
    sp.setPreferredSize(new Dimension(150, 90));
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode);
    splitPane.setOneTouchExpandable(true);
    int w = parentFrame.getWidth();
    int s = w / 4;
    splitPane.setDividerLocation(s);
    regraFonteBtn.add(splitPane, BorderLayout.CENTER);
    pnBotoes.setPreferredSize(new Dimension(600, 35));
    pnBotoes.setBackground(CoresDefault.getCorPaineis());
    regraFonteBtn.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(regraFonteBtn);

    JPanel textoErrosBtn = new JPanel();
    textoErrosBtn.setLayout(new BorderLayout());
    pnSetaDescricao.setBackground(CoresDefault.getCorPaineis());
    pnSetaDescricao.add(pnBotoes, BorderLayout.WEST);
    textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH);

    textoErrosBtn.add(pnListaErros, BorderLayout.CENTER);
    JPanel pnSalvarCancelar = new JPanel();
    pnSalvarCancelar.setLayout(null);
    pnSalvarCancelar.setPreferredSize(new Dimension(600, 35));
    pnSalvarCancelar.add(salvar);
    pnSalvarCancelar.add(abrir);
    pnSalvarCancelar.add(cancelar);
    if (!original) {
        reverter = new JButton("Reverter");
        reverter.setText(TradPainelRelatorio.REVERTER);
        reverter.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                setVisible(false);
                TxtBuffer.setContent(TxtBuffer.getContentOriginal());
                parentFrame.showPainelFerramentaScriptPArq(TxtBuffer.getContentOriginal());
                setVisible(true);
            }

        });
        reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
        reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
        reverter.setBounds(485, 0, 150, 25);
        pnSalvarCancelar.add(reverter);
    }
    pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis());
    textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH);
    pnListaErros.setBackground(CoresDefault.getCorPaineis());
    if (tableLinCod.getRowCount() == 0)
        tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS);
    contentPane.setBackground(CoresDefault.getCorPaineis());
    contentPane.add(textoErrosBtn);
    this.setVisible(true);
}

From source file:io.gameover.utilities.pixeleditor.Pixelizer.java

public JPanel getAnimationPanel() {
    if (this.animationPanel == null) {
        this.animationPanel = new JPanel(new BorderLayout());
        this.animationPanel.add(getAnimation(), BorderLayout.CENTER);
        this.animationPanel.add(getSelectFramePanel(), BorderLayout.WEST);
    }//from  w  w w .j av a2 s  . co  m
    return animationPanel;
}