Example usage for javax.swing JPanel setMinimumSize

List of usage examples for javax.swing JPanel setMinimumSize

Introduction

In this page you can find the example usage for javax.swing JPanel setMinimumSize.

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:lcmc.gui.resources.ServiceInfo.java

/** Returns info panel with comboboxes for service parameters. */
@Override/*from  ww w  .j  a v a 2s . co m*/
public JComponent getInfoPanel() {
    if (!getResourceAgent().isMetaDataLoaded()) {
        final JPanel p = new JPanel();
        p.add(new JLabel(Tools.getString("ServiceInfo.LoadingMetaData")));
        return p;
    }
    final CloneInfo ci = getCloneInfo();
    if (ci == null) {
        getBrowser().getCRMGraph().pickInfo(this);
    } else {
        getBrowser().getCRMGraph().pickInfo(ci);
    }
    if (infoPanel != null) {
        return infoPanel;
    }
    /* init save button */
    final boolean abExisted = getApplyButton() != null;
    final ServiceInfo thisClass = this;
    final ButtonCallback buttonCallback = new ButtonCallback() {
        private volatile boolean mouseStillOver = false;

        /**
         * Whether the whole thing should be enabled.
         */
        @Override
        public final boolean isEnabled() {
            final Host dcHost = getBrowser().getDCHost();
            if (dcHost == null) {
                return false;
            }
            if (Tools.versionBeforePacemaker(dcHost)) {
                return false;
            }
            return true;
        }

        @Override
        public final void mouseOut() {
            if (!isEnabled()) {
                return;
            }
            mouseStillOver = false;
            getBrowser().getCRMGraph().stopTestAnimation(getApplyButton());
            getApplyButton().setToolTipText(null);
        }

        @Override
        public final void mouseOver() {
            if (!isEnabled()) {
                return;
            }
            mouseStillOver = true;
            getApplyButton().setToolTipText(ClusterBrowser.STARTING_PTEST_TOOLTIP);
            getApplyButton()
                    .setToolTipBackground(Tools.getDefaultColor("ClusterBrowser.Test.Tooltip.Background"));
            Tools.sleep(250);
            if (!mouseStillOver) {
                return;
            }
            mouseStillOver = false;
            final CountDownLatch startTestLatch = new CountDownLatch(1);
            getBrowser().getCRMGraph().startTestAnimation(getApplyButton(), startTestLatch);
            final Host dcHost = getBrowser().getDCHost();
            getBrowser().ptestLockAcquire();
            final ClusterStatus cs = getBrowser().getClusterStatus();
            cs.setPtestData(null);
            apply(dcHost, true);
            final PtestData ptestData = new PtestData(CRM.getPtest(dcHost));
            getApplyButton().setToolTipText(ptestData.getToolTip());
            cs.setPtestData(ptestData);
            getBrowser().ptestLockRelease();
            startTestLatch.countDown();
        }
    };
    if (getResourceAgent().isGroup()) {
        initApplyButton(buttonCallback, Tools.getString("Browser.ApplyGroup"));
    } else {
        initApplyButton(buttonCallback);
    }
    if (ci != null) {
        ci.setApplyButton(getApplyButton());
        ci.setRevertButton(getRevertButton());
    }
    /* add item listeners to the apply button. */
    if (!abExisted) {
        getApplyButton().addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        getBrowser().clStatusLock();
                        apply(getBrowser().getDCHost(), false);
                        getBrowser().clStatusUnlock();
                    }
                });
                thread.start();
            }
        });

        getRevertButton().addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        getBrowser().clStatusLock();
                        revert();
                        getBrowser().clStatusUnlock();
                    }
                });
                thread.start();
            }
        });
    }
    /* main, button and options panels */
    final JPanel mainPanel = new JPanel();
    mainPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    final JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setBackground(ClusterBrowser.BUTTON_PANEL_BACKGROUND);
    buttonPanel.setMinimumSize(new Dimension(0, 50));
    buttonPanel.setPreferredSize(new Dimension(0, 50));
    buttonPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, 50));

    final JPanel optionsPanel = new JPanel();
    optionsPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    optionsPanel.setLayout(new BoxLayout(optionsPanel, BoxLayout.Y_AXIS));
    optionsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    /* Actions */
    final JMenuBar mb = new JMenuBar();
    mb.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    AbstractButton serviceMenu;
    if (ci == null) {
        serviceMenu = getActionsButton();
    } else {
        serviceMenu = ci.getActionsButton();
    }
    buttonPanel.add(serviceMenu, BorderLayout.EAST);
    String defaultValue = PRIMITIVE_TYPE_STRING;
    if (ci != null) {
        if (ci.getService().isMaster()) {
            defaultValue = MASTER_SLAVE_TYPE_STRING;
        } else {
            defaultValue = CLONE_TYPE_STRING;
        }
    }
    if (!getResourceAgent().isClone() && getGroupInfo() == null) {
        typeRadioGroup = new Widget(defaultValue,
                new String[] { PRIMITIVE_TYPE_STRING, CLONE_TYPE_STRING, MASTER_SLAVE_TYPE_STRING },
                null, /* units */
                Widget.Type.RADIOGROUP, null, /* regexp */
                ClusterBrowser.SERVICE_LABEL_WIDTH + ClusterBrowser.SERVICE_FIELD_WIDTH, null, /* abbrv */
                new AccessMode(ConfigData.AccessType.ADMIN, false));

        if (!getService().isNew()) {
            typeRadioGroup.setEnabled(false);
        }
        typeRadioGroup.addListeners(new WidgetListener() {
            @Override
            public void check(final Object value) {
                changeType(((JRadioButton) value).getText());
            }
        });
        final JPanel tp = new JPanel();
        tp.setBackground(ClusterBrowser.PANEL_BACKGROUND);
        tp.setLayout(new BoxLayout(tp, BoxLayout.Y_AXIS));
        tp.add(typeRadioGroup);
        typeRadioGroup.setBackgroundColor(ClusterBrowser.PANEL_BACKGROUND);
        optionsPanel.add(tp);
    }
    if (ci != null) {
        /* add clone fields */
        addCloneFields(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH);
    }
    getResource().setValue(GUI_ID, getService().getId());

    /* get dependent resources and create combo boxes for ones, that
     * need parameters */
    final String[] params = getParametersFromXML();
    final Info savedMAIdRef = savedMetaAttrInfoRef;
    addParams(optionsPanel, params, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH,
            getSameAsFields(savedMAIdRef));
    if (ci == null) {
        /* score combo boxes */
        addHostLocations(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH);
    }

    for (final String param : params) {
        if (isMetaAttr(param)) {
            final Widget wi = getWidget(param, null);
            wi.setEnabled(savedMAIdRef == null);
        }
    }
    if (!getService().isNew()) {
        getWidget(GUI_ID, null).setEnabled(false);
    }
    if (!getResourceAgent().isGroup() && !getResourceAgent().isClone()) {
        /* Operations */
        addOperations(optionsPanel, ClusterBrowser.SERVICE_LABEL_WIDTH, ClusterBrowser.SERVICE_FIELD_WIDTH);
        /* add item listeners to the operations combos */
        for (final String op : getResourceAgent().getOperationNames()) {
            for (final String param : getBrowser().getCRMOperationParams(op)) {
                addOperationListeners(op, param);
            }
        }
    }
    /* add item listeners to the host scores combos */
    if (ci == null) {
        addHostLocationsListeners();
    } else {
        ci.addHostLocationsListeners();
    }
    /* apply button */
    addApplyButton(buttonPanel);
    addRevertButton(buttonPanel);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            /* invoke later on purpose  */
            setApplyButtons(null, params);
        }
    });
    mainPanel.add(optionsPanel);
    final JPanel newPanel = new JPanel();
    newPanel.setBackground(ClusterBrowser.PANEL_BACKGROUND);
    newPanel.setLayout(new BoxLayout(newPanel, BoxLayout.Y_AXIS));
    newPanel.add(buttonPanel);
    newPanel.add(
            getMoreOptionsPanel(ClusterBrowser.SERVICE_LABEL_WIDTH + ClusterBrowser.SERVICE_FIELD_WIDTH + 4));
    newPanel.add(new JScrollPane(mainPanel));
    /* if id textfield was changed and this id is not used,
     * enable apply button */
    infoPanel = newPanel;
    infoPanelDone();
    return infoPanel;
}

From source file:de.cismet.cids.custom.objecteditors.wunda_blau.WebDavPicturePanel.java

/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
 * content of this method is always regenerated by the Form Editor.
 *//*w ww .  j a  v  a  2 s.  c  o m*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    GridBagConstraints gridBagConstraints;
    bindingGroup = new BindingGroup();

    final RoundedPanel pnlFotos = new RoundedPanel();
    final SemiRoundedPanel pnlHeaderFotos = new SemiRoundedPanel();
    final JLabel lblHeaderFotos = new JLabel();
    final JPanel jPanel2 = new JPanel();
    final JPanel jPanel1 = new JPanel();
    final JScrollPane jspFotoList = new JScrollPane();
    lstFotos = new JList();
    final JPanel pnlCtrlButtons = new JPanel();
    btnAddImg = new JButton();
    btnRemoveImg = new JButton();
    final JPanel pnlMap = new JPanel();
    final RoundedPanel pnlVorschau = new RoundedPanel();
    final SemiRoundedPanel semiRoundedPanel2 = new SemiRoundedPanel();
    final JLabel lblVorschau = new JLabel();
    final JPanel jPanel3 = new JPanel();
    pnlFoto = new JPanel();
    lblPicture = new JLabel();
    lblBusy = new JXBusyLabel(new Dimension(75, 75));
    final JPanel pnlCtrlBtn = new JPanel();
    btnPrevImg = new JButton();
    btnNextImg = new JButton();

    final FormListener formListener = new FormListener();

    setName("Form"); // NOI18N
    setOpaque(false);
    setLayout(new GridBagLayout());

    pnlFotos.setMinimumSize(new Dimension(400, 200));
    pnlFotos.setName("pnlFotos"); // NOI18N
    pnlFotos.setPreferredSize(new Dimension(400, 200));
    pnlFotos.setLayout(new GridBagLayout());

    pnlHeaderFotos.setBackground(new Color(51, 51, 51));
    pnlHeaderFotos.setForeground(new Color(51, 51, 51));
    pnlHeaderFotos.setName("pnlHeaderFotos"); // NOI18N
    pnlHeaderFotos.setLayout(new FlowLayout());

    lblHeaderFotos.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblHeaderFotos,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblHeaderFotos.text")); // NOI18N
    lblHeaderFotos.setName("lblHeaderFotos"); // NOI18N
    pnlHeaderFotos.add(lblHeaderFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlFotos.add(pnlHeaderFotos, gridBagConstraints);

    jPanel2.setName("jPanel2"); // NOI18N
    jPanel2.setOpaque(false);
    jPanel2.setLayout(new GridBagLayout());

    jPanel1.setName("jPanel1"); // NOI18N
    jPanel1.setOpaque(false);
    jPanel1.setLayout(new GridBagLayout());

    jspFotoList.setMinimumSize(new Dimension(250, 130));
    jspFotoList.setName("jspFotoList"); // NOI18N

    lstFotos.setMinimumSize(new Dimension(250, 130));
    lstFotos.setName("lstFotos"); // NOI18N
    lstFotos.setPreferredSize(new Dimension(250, 130));

    final ELProperty eLProperty = ELProperty.create("${cidsBean." + beanCollProp + "}");
    final JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE,
            this, eLProperty, lstFotos);
    bindingGroup.addBinding(jListBinding);

    lstFotos.addListSelectionListener(formListener);
    jspFotoList.setViewportView(lstFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel1.add(jspFotoList, gridBagConstraints);

    pnlCtrlButtons.setName("pnlCtrlButtons"); // NOI18N
    pnlCtrlButtons.setOpaque(false);
    pnlCtrlButtons.setLayout(new GridBagLayout());

    btnAddImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_add_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnAddImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnAddImg.text")); // NOI18N
    btnAddImg.setBorderPainted(false);
    btnAddImg.setContentAreaFilled(false);
    btnAddImg.setName("btnAddImg"); // NOI18N
    btnAddImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(0, 0, 5, 0);
    pnlCtrlButtons.add(btnAddImg, gridBagConstraints);

    btnRemoveImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_remove_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnRemoveImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnRemoveImg.text")); // NOI18N
    btnRemoveImg.setBorderPainted(false);
    btnRemoveImg.setContentAreaFilled(false);
    btnRemoveImg.setName("btnRemoveImg"); // NOI18N
    btnRemoveImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new Insets(5, 0, 0, 0);
    pnlCtrlButtons.add(btnRemoveImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    jPanel1.add(pnlCtrlButtons, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 10, 0);
    jPanel2.add(jPanel1, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(0, 0, 2, 0);
    pnlFotos.add(jPanel2, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 0, 5, 5);
    add(pnlFotos, gridBagConstraints);

    pnlMap.setBorder(BorderFactory.createEtchedBorder());
    pnlMap.setMinimumSize(new Dimension(400, 200));
    pnlMap.setName("pnlMap"); // NOI18N
    pnlMap.setPreferredSize(new Dimension(400, 200));
    pnlMap.setLayout(new BorderLayout());
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.VERTICAL;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(5, 0, 0, 5);
    add(pnlMap, gridBagConstraints);
    pnlMap.add(map, BorderLayout.CENTER);

    pnlVorschau.setName("pnlVorschau"); // NOI18N
    pnlVorschau.setLayout(new GridBagLayout());

    semiRoundedPanel2.setBackground(new Color(51, 51, 51));
    semiRoundedPanel2.setName("semiRoundedPanel2"); // NOI18N
    semiRoundedPanel2.setLayout(new FlowLayout());

    lblVorschau.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblVorschau,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblVorschau.text")); // NOI18N
    lblVorschau.setName("lblVorschau"); // NOI18N
    semiRoundedPanel2.add(lblVorschau);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlVorschau.add(semiRoundedPanel2, gridBagConstraints);

    jPanel3.setName("jPanel3"); // NOI18N
    jPanel3.setOpaque(false);
    jPanel3.setLayout(new GridBagLayout());

    pnlFoto.setName("pnlFoto"); // NOI18N
    pnlFoto.setOpaque(false);
    pnlFoto.setLayout(new GridBagLayout());

    lblPicture.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(lblPicture,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblPicture.text")); // NOI18N
    lblPicture.setName("lblPicture"); // NOI18N
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblPicture, gridBagConstraints);

    lblBusy.setHorizontalAlignment(SwingConstants.CENTER);
    lblBusy.setMaximumSize(new Dimension(140, 40));
    lblBusy.setMinimumSize(new Dimension(140, 60));
    lblBusy.setName("lblBusy"); // NOI18N
    lblBusy.setPreferredSize(new Dimension(140, 60));
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblBusy, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 0, 10);
    jPanel3.add(pnlFoto, gridBagConstraints);

    pnlCtrlBtn.setName("pnlCtrlBtn"); // NOI18N
    pnlCtrlBtn.setOpaque(false);
    pnlCtrlBtn.setPreferredSize(new Dimension(100, 50));
    pnlCtrlBtn.setLayout(new GridBagLayout());

    btnPrevImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-left.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnPrevImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnPrevImg.text")); // NOI18N
    btnPrevImg.setBorderPainted(false);
    btnPrevImg.setFocusPainted(false);
    btnPrevImg.setName("btnPrevImg"); // NOI18N
    btnPrevImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnPrevImg, gridBagConstraints);

    btnNextImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-right.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnNextImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnNextImg.text")); // NOI18N
    btnNextImg.setBorderPainted(false);
    btnNextImg.setFocusPainted(false);
    btnNextImg.setName("btnNextImg"); // NOI18N
    btnNextImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnNextImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(0, 10, 10, 10);
    jPanel3.add(pnlCtrlBtn, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlVorschau.add(jPanel3, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    add(pnlVorschau, gridBagConstraints);

    bindingGroup.bind();
}

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes planInfoFramePanel
 *
 * @return javax.swing.JPanel/* w w  w.j  a  va2s  . c  o  m*/
 */
private ItFramePanel getPlanInfoFramePanel() {
    if (planInfoFramePanel == null) {
        JPanel planInfoPanel = new JPanel(new BorderLayout());
        planInfoPanel.setMinimumSize(new Dimension(100, 40));
        planInfoFramePanel = new ItFramePanel(":: Console", ItFramePanel.MINIMIZE_MAXIMIZE);
        //informationPanel.setMinimumSize(new Dimension(100,25));

        //planInfoEditorPane = new JEditorPane();
        //planInfoEditorPane.setContentType("text/html");
        //planInfoEditorPane.setEditable(false);
        //planInfoEditorPane.setCursor(new Cursor(Cursor.TEXT_CURSOR));
        //planInfoEditorPane.setBackground(Color.WHITE);

        outputEditorPane = new JTextArea();
        //outputEditorPane.setContentType("text/html");
        outputEditorPane.setEditable(false);
        outputEditorPane.setLineWrap(true);
        outputEditorPane.setWrapStyleWord(true);
        outputEditorPane.setCursor(new Cursor(Cursor.TEXT_CURSOR));

        // tabbed panes with jtrees
        JTabbedPane outputPane = new JTabbedPane();
        outputPane.addTab("Output", new JScrollPane(outputEditorPane));
        //outputPane.addTab("Results", new JScrollPane(planInfoEditorPane));

        //planInfoFramePanel.setContent(planInfoEditorPane, true);
        planInfoFramePanel.setContent(outputPane, false);
        planInfoFramePanel.setParentSplitPane(planInfoSplitPane);

        planInfoPanel.add(planInfoFramePanel, BorderLayout.CENTER);
    }
    return planInfoFramePanel;
}

From source file:net.sourceforge.squirrel_sql.client.gui.ProgressAbortDialog.java

private void createGUI() {
    JPanel dialogPanel = new JPanel(new GridBagLayout());
    dialogPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
    GridBagConstraints c;//from   ww w  .j  av  a  2  s  . c o m

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 0.5;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(4, 0, 4, 0);
    taskDescriptionComponent = createTaskDescripion();
    dialogPanel.add(taskDescriptionComponent, c);

    c.gridy++;
    JPanel progressPanel = new JPanel(new GridBagLayout());
    progressPanel.setMinimumSize(new Dimension(400, 200));
    progressPanel.setPreferredSize(new Dimension(400, 200));
    progressPanel.setBorder(BorderFactory.createTitledBorder("Progress"));
    dialogPanel.add(progressPanel, c);

    c.gridy = 0;
    c.gridx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.insets = new Insets(4, 10, 4, 10);
    statusLabel = new JLabel(i18n.INITIAL_LOADING_PREFIX);
    progressPanel.add(statusLabel, c);

    c.gridy++;
    c.insets = new Insets(4, 10, 4, 10);
    additionalStatusLabel = new JLabel(" "); // Must be a space :-)
    progressPanel.add(additionalStatusLabel, c);

    c.gridy++;
    c.weightx = 1.0;
    progressBar = new JProgressBar(0, itemCount);
    progressBar.setIndeterminate(indeterminate);
    progressPanel.add(progressBar, c);

    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    historyArea = new JTextArea();
    historyArea.setEditable(false);
    JScrollPane jScrollPane = new JScrollPane(historyArea);
    progressPanel.add(jScrollPane, c);

    if (abortHandler != null) {
        cancelButton = new JButton(new CancelAction());

        c.gridy++;
        c.anchor = GridBagConstraints.WEST;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 0.0;
        c.weighty = 0.0;
        dialogPanel.add(cancelButton, c);
    }

    super.getContentPane().add(dialogPanel);
    super.pack();
    super.setSize(new Dimension(450, 450));
    super.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    super.addWindowListener(new WindowCloseListener());
}

From source file:net.sourceforge.squirrel_sql.client.preferences.WikiTablePreferencesPanel.java

/**
 * The detail panel contains all information of a specific configuration.
 * The user can edit the configuration in this panel.
 *//*from w w w .  ja va  2  s  .c o  m*/
private JPanel createDetailPanel() {
    JPanel jp = new JPanel(new GridBagLayout());
    jp.setBorder(BorderFactory
            .createTitledBorder(s_stringMgr.getString("WikiTablePreferencesPanel.titleDetailPanel"))); //$NON-NLS-1$
    jp.setMinimumSize(new Dimension(400, 50));

    final GridBagConstraints gbc = new GridBagConstraints();

    int row = 0;

    setLabelConstraints(gbc, row);
    nameLable = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.name"), SwingConstants.RIGHT); //$NON-NLS-1$
    jp.add(nameLable, gbc);

    setFieldConstraints(gbc, row);
    name = new JTextField(30);
    jp.add(name, gbc);

    setLabelConstraints(gbc, ++row);
    tableStartTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.tableStartTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(tableStartTagLabel, gbc);

    setFieldConstraints(gbc, row);
    tableStartTag = new JTextField(30);
    jp.add(tableStartTag, gbc);

    setLabelConstraints(gbc, ++row);
    headerStartTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.headerStartTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(headerStartTagLabel, gbc);

    setFieldConstraints(gbc, row);
    headerStartTag = new JTextField(30);
    jp.add(headerStartTag, gbc);

    setLabelConstraints(gbc, ++row);
    headerCellTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.headerCellTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(headerCellTagLabel, gbc);

    setFieldConstraints(gbc, row);
    headerCellTag = new JTextField(30);
    jp.add(headerCellTag, gbc);

    setLabelConstraints(gbc, ++row);
    headerEndTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.headerEndTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(headerEndTagLabel, gbc);

    setFieldConstraints(gbc, row);
    headerEndTag = new JTextField(30);
    jp.add(headerEndTag, gbc);

    setLabelConstraints(gbc, ++row);
    rowStartTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.rowStartTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(rowStartTagLabel, gbc);

    setFieldConstraints(gbc, row);
    rowStartTag = new JTextField(30);
    jp.add(rowStartTag, gbc);

    setLabelConstraints(gbc, ++row);
    cellTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.cellTag"), SwingConstants.RIGHT); //$NON-NLS-1$
    jp.add(cellTagLabel, gbc);

    setFieldConstraints(gbc, row);
    cellTag = new JTextField(30);
    jp.add(cellTag, gbc);

    setLabelConstraints(gbc, ++row);
    rowEndTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.rowEndTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(rowEndTagLabel, gbc);

    setFieldConstraints(gbc, row);
    rowEndTag = new JTextField(30);
    jp.add(rowEndTag, gbc);

    setLabelConstraints(gbc, ++row);
    tableEndTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.tableEndTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(tableEndTagLabel, gbc);

    setFieldConstraints(gbc, row);
    tableEndTag = new JTextField(30);
    jp.add(tableEndTag, gbc);

    setLabelConstraints(gbc, ++row);
    noWikiTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.noWikiTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(noWikiTagLabel, gbc);

    setFieldConstraints(gbc, row);
    noWikiTag = new JTextField(30);
    jp.add(noWikiTag, gbc);

    setLabelConstraints(gbc, ++row);
    noWikiTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.enabled"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(noWikiTagLabel, gbc);

    setFieldConstraints(gbc, row);
    enabled = new JCheckBox();
    jp.add(enabled, gbc);

    addFocusLostListeners();

    return jp;
}

From source file:org.apache.cayenne.modeler.editor.EditorView.java

private void initView() {

    // init widgets
    JButton collapseButton = getAction(CollapseTreeAction.class).buildButton();
    collapseButton.setPreferredSize(new Dimension(30, 20));
    JButton filterButton = getAction(FilterAction.class).buildButton();
    filterButton.setPreferredSize(new Dimension(30, 20));
    actionManager.getAction(CollapseTreeAction.class).setAlwaysOn(true);
    actionManager.getAction(FilterAction.class).setAlwaysOn(true);

    JToolBar barPanel = new JToolBar();
    barPanel.setMinimumSize(new Dimension(75, 25));
    barPanel.setBorder(BorderFactory.createEtchedBorder());
    barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    barPanel.add(Box.createHorizontalStrut(3));
    barPanel.add(filterButton);/*from w  w  w.j a  v a2 s.  c o  m*/
    barPanel.addSeparator();
    barPanel.add(collapseButton);

    treePanel = new ProjectTreeView(eventController);
    treePanel.setMinimumSize(new Dimension(75, 180));
    JPanel treeNavigatePanel = new JPanel();
    treeNavigatePanel.setMinimumSize(new Dimension(75, 220));
    treeNavigatePanel.setLayout(new BorderLayout());
    treeNavigatePanel.add(treePanel, BorderLayout.CENTER);

    this.detailPanel = new JPanel();
    this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    this.leftPanel = new JPanel(new BorderLayout());
    // assemble...

    this.detailLayout = new CardLayout();
    detailPanel.setLayout(detailLayout);

    // some but not all panels must be wrapped in a scroll pane
    // those that are not wrapped usually have there own scrollers
    // in subpanels...

    detailPanel.add(new JPanel(), EMPTY_VIEW);

    dataDomainView = new DataDomainTabbedView(eventController);
    detailPanel.add(dataDomainView, DOMAIN_VIEW);

    DataNodeEditor nodeController = new DataNodeEditor(eventController);
    detailPanel.add(nodeController.getView(), NODE_VIEW);

    dataNodeView = nodeController.getTabComponent();

    dataMapView = new DataMapTabbedView(eventController);
    detailPanel.add(dataMapView, DATA_MAP_VIEW);

    procedureView = new ProcedureTabbedView(eventController);
    detailPanel.add(procedureView, PROCEDURE_VIEW);

    selectQueryView = new SelectQueryTabbedView(eventController);
    detailPanel.add(selectQueryView, SELECT_QUERY_VIEW);

    sqlTemplateView = new SQLTemplateTabbedView(eventController);
    detailPanel.add(sqlTemplateView, SQL_TEMPLATE_VIEW);

    Component procedureQueryView = new ProcedureQueryView(eventController);
    detailPanel.add(new JScrollPane(procedureQueryView), PROCEDURE_QUERY_VIEW);

    ejbqlQueryView = new EjbqlTabbedView(eventController);
    detailPanel.add(ejbqlQueryView, EJBQL_QUERY_VIEW);

    embeddableView = new EmbeddableTabbedView(eventController);
    detailPanel.add(embeddableView, EMBEDDABLE_VIEW);

    objDetailView = new ObjEntityTabbedView(eventController);
    detailPanel.add(objDetailView, OBJ_VIEW);

    dbDetailView = new DbEntityTabbedView(eventController);
    detailPanel.add(dbDetailView, DB_VIEW);

    leftPanel.add(barPanel, BorderLayout.NORTH);
    leftPanel.add(new JScrollPane(treeNavigatePanel), BorderLayout.CENTER);
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(detailPanel);

    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);

}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

/**
 * This method defines the Panel for the HTTP path, 'Follow Redirects'
 * 'Use KeepAlive', and 'Use multipart for HTTP POST' elements.
 *
 * @return JPanel The Panel for the path, 'Follow Redirects' and 'Use
 *         KeepAlive' elements.//from   w  w w. j a v  a 2s  .  co  m
 */
protected Component getPathPanel() {
    path = new JTextField(15);

    JLabel label = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$
    label.setLabelFor(path);

    if (notConfigOnly) {
        followRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects")); // $NON-NLS-1$
        followRedirects.setFont(null);
        followRedirects.setSelected(true);
        followRedirects.addChangeListener(this);

        autoRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto")); //$NON-NLS-1$
        autoRedirects.setFont(null);
        autoRedirects.addChangeListener(this);
        autoRedirects.setSelected(false);// Default changed in 2.3 and again in 2.4

        useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$
        useKeepAlive.setFont(null);
        useKeepAlive.setSelected(true);

        useMultipartForPost = new JCheckBox(JMeterUtils.getResString("use_multipart_for_http_post")); // $NON-NLS-1$
        useMultipartForPost.setFont(null);
        useMultipartForPost.setSelected(false);

        useBrowserCompatibleMultipartMode = new JCheckBox(
                JMeterUtils.getResString("use_multipart_mode_browser")); // $NON-NLS-1$
        useBrowserCompatibleMultipartMode.setFont(null);
        useBrowserCompatibleMultipartMode
                .setSelected(HTTPSamplerBase.BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT);

    }

    JPanel pathPanel = new HorizontalPanel();
    pathPanel.add(label);
    pathPanel.add(path);

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(pathPanel);
    if (notConfigOnly) {
        JPanel optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        optionPanel.setFont(FONT_SMALL); // all sub-components with setFont(null) inherit this font
        optionPanel.add(autoRedirects);
        optionPanel.add(followRedirects);
        optionPanel.add(useKeepAlive);
        optionPanel.add(useMultipartForPost);
        optionPanel.add(useBrowserCompatibleMultipartMode);
        optionPanel.setMinimumSize(optionPanel.getPreferredSize());
        panel.add(optionPanel);
    }

    return panel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

protected JPanel getProtocolAndMethodPanel() {

    // Implementation
    if (showImplementation) {
        httpImplementation = new JLabeledChoice(JMeterUtils.getResString("http_implementation"), // $NON-NLS-1$
                HTTPSamplerFactory.getImplementations());
        httpImplementation.addValue("");
    }//from   w  ww .j av  a  2  s .c  om

    // PROTOCOL
    protocol = new JTextField(4);
    JLabel protocolLabel = new JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$
    protocolLabel.setLabelFor(protocol);

    // CONTENT_ENCODING
    contentEncoding = new JTextField(10);
    JLabel contentEncodingLabel = new JLabel(JMeterUtils.getResString("content_encoding")); // $NON-NLS-1$
    contentEncodingLabel.setLabelFor(contentEncoding);

    if (notConfigOnly) {
        method = new JLabeledChoice(JMeterUtils.getResString("method"), // $NON-NLS-1$
                HTTPSamplerBase.getValidMethodsAsArray(), true, false);
        method.addChangeListener(this);
    }

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));

    if (showImplementation) {
        panel.add(httpImplementation);
    }
    panel.add(protocolLabel);
    panel.add(protocol);
    panel.add(Box.createHorizontalStrut(5));

    if (notConfigOnly) {
        panel.add(method);
    }
    panel.setMinimumSize(panel.getPreferredSize());
    panel.add(Box.createHorizontalStrut(5));

    panel.add(contentEncodingLabel);
    panel.add(contentEncoding);
    panel.setMinimumSize(panel.getPreferredSize());
    return panel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGuiClassifier.java

/**
 * This method defines the Panel for the HTTP path, 'Follow Redirects'
 * 'Use KeepAlive', and 'Use multipart for HTTP POST' elements.
 *
 * @return JPanel The Panel for the path, 'Follow Redirects' and 'Use
 *         KeepAlive' elements.//from w  w  w .  j a v  a2  s.  com
 */
protected Component getPathPanel() {
    path = new JTextField(15);

    JLabel label = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$
    label.setLabelFor(path);

    if (notConfigOnly) {
        followRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects")); // $NON-NLS-1$
        followRedirects.setSelected(true);
        followRedirects.addChangeListener(this);

        autoRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto")); //$NON-NLS-1$
        autoRedirects.addChangeListener(this);
        autoRedirects.setSelected(false);// Default changed in 2.3 and again in 2.4

        useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$
        useKeepAlive.setSelected(true);

        useMultipartForPost = new JCheckBox(JMeterUtils.getResString("use_multipart_for_http_post")); // $NON-NLS-1$
        useMultipartForPost.setSelected(false);

        useBrowserCompatibleMultipartMode = new JCheckBox(
                JMeterUtils.getResString("use_multipart_mode_browser")); // $NON-NLS-1$
        useBrowserCompatibleMultipartMode
                .setSelected(HTTPSamplerBase.BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT);

    }

    JPanel pathPanel = new JPanel(new BorderLayout(5, 0));
    pathPanel.add(label, BorderLayout.WEST);
    pathPanel.add(path, BorderLayout.CENTER);
    pathPanel.setMinimumSize(pathPanel.getPreferredSize());

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(pathPanel);
    if (notConfigOnly) {
        JPanel optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        optionPanel.add(autoRedirects);
        optionPanel.add(followRedirects);
        optionPanel.add(useKeepAlive);
        optionPanel.add(useMultipartForPost);
        optionPanel.add(useBrowserCompatibleMultipartMode);
        optionPanel.setMinimumSize(optionPanel.getPreferredSize());
        panel.add(optionPanel);
    }

    return panel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGuiClassifier.java

protected JPanel getProtocolAndMethodPanel() {

    // Implementation

    if (showImplementation) {
        httpImplementation = new JLabeledChoice(JMeterUtils.getResString("http_implementation"), // $NON-NLS-1$
                HTTPSamplerFactory.getImplementations());
        httpImplementation.addValue("");
    }//www . j av  a2  s.  c  o  m
    // PROTOCOL
    protocol = new JTextField(4);
    JLabel protocolLabel = new JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$
    protocolLabel.setLabelFor(protocol);

    // CONTENT_ENCODING
    contentEncoding = new JTextField(10);
    JLabel contentEncodingLabel = new JLabel(JMeterUtils.getResString("content_encoding")); // $NON-NLS-1$
    contentEncodingLabel.setLabelFor(contentEncoding);

    if (notConfigOnly) {
        method = new JLabeledChoice(JMeterUtils.getResString("method"), // $NON-NLS-1$
                HTTPSamplerBase.getValidMethodsAsArray());
    }

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));

    if (showImplementation) {
        panel.add(httpImplementation);
    }
    panel.add(protocolLabel);
    panel.add(protocol);
    panel.add(Box.createHorizontalStrut(5));

    if (notConfigOnly) {
        panel.add(method);
    }
    panel.setMinimumSize(panel.getPreferredSize());
    panel.add(Box.createHorizontalStrut(5));

    panel.add(contentEncodingLabel);
    panel.add(contentEncoding);
    panel.setMinimumSize(panel.getPreferredSize());
    return panel;
}