Example usage for java.awt GridBagConstraints HORIZONTAL

List of usage examples for java.awt GridBagConstraints HORIZONTAL

Introduction

In this page you can find the example usage for java.awt GridBagConstraints HORIZONTAL.

Prototype

int HORIZONTAL

To view the source code for java.awt GridBagConstraints HORIZONTAL.

Click Source Link

Document

Resize the component horizontally but not vertically.

Usage

From source file:org.docx4all.swing.ExternalHyperlinkDialog.java

private void fillRow2(JPanel host, GridBagConstraints c) {
    c.gridx = 0;/*w  ww . ja v  a  2 s  .c o  m*/
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.insets = gridCellInsets;
    c.ipadx = 0;
    c.ipady = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.fill = GridBagConstraints.NONE;
    this.tooltipLabel = new JLabel("Tooltip Text");
    host.add(this.tooltipLabel, c);

    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 2;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.insets = gridCellInsets;
    c.ipadx = 0;
    c.ipady = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.tooltipField = new JTextField(70);
    //this.tooltipField.setMinimumSize(new Dimension(100, 70));
    //this.tooltipField.setPreferredSize(new Dimension(100, 70));
    host.add(this.tooltipField, c);
}

From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java

/**
 * This method initializes jPanel1   /* w  w w.ja  v  a2s  .com*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelForUserInfo() {
    if (jPanelForUserInfo == null) {
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints5.gridx = -1;
        gridBagConstraints5.gridy = -1;
        gridBagConstraints5.gridwidth = 1;
        gridBagConstraints5.anchor = GridBagConstraints.CENTER;
        gridBagConstraints5.weightx = 1.0;
        gridBagConstraints5.weighty = 0.0;
        //gridBagConstraints5.insets = new Insets(10, 10, 0, 20);
        jPanelForUserInfo = new JPanel();
        jPanelForUserInfo.setLayout(new GridBagLayout());
        jPanelForUserInfo.setBorder(BorderFactory.createTitledBorder(null, "User Info",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelForUserInfo.add(getJPanelUserInfo(), gridBagConstraints5);
    }
    return jPanelForUserInfo;
}

From source file:com.att.aro.ui.view.videotab.VideoTab.java

/**
 * MidPanel contains Video Requests//from  w  w  w.  j av a 2  s  .  c  om
 */
private JPanel buildRequestsGroup() {

    JPanel pane;
    pane = new JPanel(new GridBagLayout());

    int section = 0;

    VideoRequestPanel requestPanel = new VideoRequestPanel();
    pane.add(requestPanel, new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, noInsets, 0, 0));
    bpObservable.registerObserver(requestPanel);

    JPanel wrapper = getTitledWrapper("video.tab.request.title", null);
    wrapper.add(pane, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
            GridBagConstraints.HORIZONTAL, noInsets, 0, 0));
    return wrapper;
}

From source file:it.ventuland.ytd.ui.GUIClient.java

private void addComponentsToPane(final Container pane) {
    this.panel = new JPanel();
    this.panel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.WEST;

    ActionManager lActionManager = new ActionManager();

    dlm = new DefaultListModel<String>();
    this.urllist = new JList<String>(dlm);
    // TODO maybe we add a button to remove added URLs from list?
    //this.userlist.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
    this.urllist.setFocusable(false);
    textarea = new JTextArea(2, 2);
    textarea.setEditable(true);/*from   w  ww .j av  a2s . co m*/
    textarea.setFocusable(false);

    JScrollPane leftscrollpane = new JScrollPane(this.urllist);
    JScrollPane rightscrollpane = new JScrollPane(textarea);
    this.middlepane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftscrollpane, rightscrollpane);
    this.middlepane.setOneTouchExpandable(true);
    this.middlepane.setDividerLocation(150);

    Dimension minimumSize = new Dimension(25, 25);
    leftscrollpane.setMinimumSize(minimumSize);
    rightscrollpane.setMinimumSize(minimumSize);

    this.directorybutton = new JButton("", createImageIcon("images/open.png", ""));
    gbc.gridx = 0;
    gbc.gridy = 0;
    this.directorybutton.addActionListener(lActionManager);
    this.panel.add(this.directorybutton, gbc);

    this.saveconfigcheckbox = new JCheckBox("Save config");
    this.saveconfigcheckbox.setSelected(false);

    this.panel.add(this.saveconfigcheckbox);

    this.saveconfigcheckbox.setEnabled(false);

    // TODO check if initial download directory exists
    // assume that at least the users homedir exists
    String shomedir = System.getProperty("user.home").concat(File.separator);

    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    this.directorytextfield = new JTextField(shomedir, 20 + (mIsDebug ? 48 : 0));
    this.directorytextfield.setEnabled(false);
    this.directorytextfield.setFocusable(true);
    this.directorytextfield.addActionListener(lActionManager);
    this.panel.add(this.directorytextfield, gbc);

    JLabel dirhint = new JLabel("Download to folder:");

    gbc.gridx = 0;
    gbc.gridy = 1;
    this.panel.add(dirhint, gbc);

    this.middlepane.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width / 3,
            Toolkit.getDefaultToolkit().getScreenSize().height / 4 + (mIsDebug ? 200 : 0)));

    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 2;
    gbc.weightx = 2;
    gbc.gridwidth = 2;
    this.panel.add(this.middlepane, gbc);

    // radio buttons for resolution to download
    mVideoResolutionBtnGrp = new ButtonGroup();
    JPanel lRadioPanel = new JPanel(new GridLayout(1, 0));
    List<Object> lVidQ = mAppContext.getList("youtube-downloader.video-quality");
    JRadioButton lRadioButton = null;
    for (Object obj : lVidQ) {
        String lQuality = (String) obj;
        String lToolTip = mAppContext.getString("youtube-downloader.video-quality." + lQuality + ".tooltip");
        boolean lSelected = mAppContext
                .getBoolean("youtube-downloader.video-quality." + lQuality + ".selected");
        boolean lEnabled = mAppContext.getBoolean("youtube-downloader.video-quality." + lQuality + ".enabled");
        lRadioButton = new JRadioButton(lQuality);
        lRadioButton.setName(lQuality);
        lRadioButton.setActionCommand(lQuality.toLowerCase());
        lRadioButton.addActionListener(lActionManager);
        lRadioButton.setToolTipText(lToolTip);
        lRadioButton.setSelected(lSelected);
        lRadioButton.setEnabled(lEnabled);
        mVideoResolutionBtnGrp.add(lRadioButton);
        lRadioPanel.add(lRadioButton);
    }

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridheight = 0;
    gbc.gridwidth = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    this.panel.add(lRadioPanel, gbc);

    // radio buttons for video format to download
    mVideoQualityBtnGrp = new ButtonGroup();
    lRadioPanel = new JPanel(new GridLayout(1, 0));
    save3dcheckbox = new JCheckBox("3D");
    save3dcheckbox.setToolTipText("stereoscopic video");
    save3dcheckbox.setSelected(false);
    save3dcheckbox.setEnabled(true);
    lRadioPanel.add(save3dcheckbox);
    List<Object> lVidR = mAppContext.getList("youtube-downloader.video-resolution");
    lRadioButton = null;
    for (Object obj : lVidR) {
        String lResolution = (String) obj;
        String lToolTip = mAppContext
                .getString("youtube-downloader.video-resolution." + lResolution + ".tooltip");
        boolean lSelected = mAppContext
                .getBoolean("youtube-downloader.video-resolution." + lResolution + ".selected");
        boolean lEnabled = mAppContext
                .getBoolean("youtube-downloader.video-resolution." + lResolution + ".enabled");
        lRadioButton = new JRadioButton(lResolution);
        lRadioButton.setName(lResolution);
        lRadioButton.setActionCommand(lResolution.toLowerCase());
        lRadioButton.addActionListener(lActionManager);
        lRadioButton.setToolTipText(lToolTip);
        lRadioButton.setSelected(lSelected);
        lRadioButton.setEnabled(lEnabled);
        mVideoQualityBtnGrp.add(lRadioButton);
        lRadioPanel.add(lRadioButton);
    }

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridheight = 0;
    gbc.gridwidth = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    this.panel.add(lRadioPanel, gbc);

    JLabel hint = new JLabel("Type, paste or drag'n drop a YouTube video address:");

    gbc.fill = 0;
    gbc.gridwidth = 0;
    gbc.gridheight = 1;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.WEST;
    this.panel.add(hint, gbc);

    textinputfield = new JTextField(20);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 2;
    textinputfield.setEnabled(true);
    textinputfield.setFocusable(true);
    textinputfield.addActionListener(lActionManager);
    textinputfield.getDocument().addDocumentListener(new UrlInsertListener());
    this.panel.add(textinputfield, gbc);

    this.quitbutton = new JButton("", createImageIcon("images/exit.png", ""));
    gbc.gridx = 2;
    gbc.gridy = 5;
    gbc.gridwidth = 0;
    this.quitbutton.addActionListener(lActionManager);
    this.quitbutton.setActionCommand("quit");
    this.quitbutton.setToolTipText("Exit.");

    this.panel.add(this.quitbutton, gbc);

    pane.add(this.panel);
    addWindowListener(new GUIWindowAdapter());

    this.setDropTarget(new DropTarget(this, new DragDropListener()));
    textarea.setTransferHandler(null); // otherwise the dropped text would be inserted

}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes jPanelDefaultReportLocation   
 *    /*from   www  . j a  v a2s.  co  m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelDefaultReportLocation() {
    if (jPanelDefaultReportLocation == null) {
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.gridx = 1;
        gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints5.insets = new Insets(0, 5, 0, 0);
        gridBagConstraints5.gridy = 0;
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.fill = GridBagConstraints.BOTH;
        gridBagConstraints4.gridy = 0;
        gridBagConstraints4.weightx = 1.0;
        gridBagConstraints4.gridx = 0;
        jPanelDefaultReportLocation = new JPanel();
        jPanelDefaultReportLocation.setLayout(new GridBagLayout());
        jPanelDefaultReportLocation.add(getJTextFieldDefaultReportLocation(), gridBagConstraints4);
        jPanelDefaultReportLocation.add(getJButtonDefaultReportLocation(), gridBagConstraints5);
    }
    return jPanelDefaultReportLocation;
}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java

private JPanel createInstantDataPanel() {
    I18nLabel timeLabel = new I18nLabel("dive.time");
    instantDepthLabel = new JLabel();
    setDephtLabelText();/*from   w  w  w.j  a  v  a2 s  .c  om*/

    instantTimeTf = new JTextField(6);
    instantTimeTf.setText(null);
    instantTimeTf.setEditable(false);
    instantTimeTf.setFocusable(false);

    instantDepthTf = new JTextField(6);
    instantDepthTf.setText(null);
    instantDepthTf.setEditable(false);
    instantDepthTf.setFocusable(false);

    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(3, 3, 3, 3);

    JPanel instantDataPanel = new DetailPanel();
    instantDataPanel.setLayout(new GridBagLayout());
    instantDataPanel.setOpaque(false);

    GridBagLayoutManager.addComponent(instantDataPanel, timeLabel, c, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    GridBagLayoutManager.addComponent(instantDataPanel, instantTimeTf, c, 1, 0, 1, 1, 1, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(instantDataPanel, instantDepthLabel, c, 0, 1, 1, 1, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GridBagLayoutManager.addComponent(instantDataPanel, instantDepthTf, c, 1, 1, 1, 1, 1, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    return instantDataPanel;
}

From source file:gov.loc.repository.bagger.ui.SaveBagFrame.java

private JPanel createComponents() {
    Border border = new EmptyBorder(5, 5, 5, 5);

    TitlePane titlePane = new TitlePane();
    initStandardCommands();//w  ww  .  j  a  v a  2s . co  m
    JPanel pageControl = new JPanel(new BorderLayout());
    JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("SaveBagFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Define the Bag settings")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    JPanel contentPane = new JPanel();

    // TODO: Add bag name field
    // TODO: Add save name file selection button
    JLabel location = new JLabel("Save in:");
    browseButton = new JButton(getMessage("bag.button.browse"));
    browseButton.addActionListener(new SaveBagAsHandler());
    browseButton.setEnabled(true);
    browseButton.setToolTipText(getMessage("bag.button.browse.help"));
    String fileName = "";
    DefaultBag bag = bagView.getBag();
    if (bag != null) {
        fileName = bag.getName();
    }
    bagNameField = new JTextField(fileName);
    bagNameField.setCaretPosition(fileName.length());
    bagNameField.setEditable(false);
    bagNameField.setEnabled(false);

    // Holey bag control
    JLabel holeyLabel = new JLabel(bagView.getPropertyMessage("bag.label.isholey"));
    holeyLabel.setToolTipText(bagView.getPropertyMessage("bag.isholey.help"));
    holeyCheckbox = new JCheckBox(bagView.getPropertyMessage("bag.checkbox.isholey"));
    holeyCheckbox.setBorder(border);
    holeyCheckbox.setSelected(bag.isHoley());
    holeyCheckbox.addActionListener(new HoleyBagHandler());
    holeyCheckbox.setToolTipText(bagView.getPropertyMessage("bag.isholey.help"));

    urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    urlLabel.setEnabled(bag.isHoley());
    urlField = new JTextField("");
    try {
        urlField.setText(bag.getFetch().getBaseURL());
    } catch (Exception e) {
        log.error("fetch baseURL: " + e.getMessage());
    }
    urlField.setEnabled(false);

    // TODO: Add format label
    JLabel serializeLabel;
    serializeLabel = new JLabel(getMessage("bag.label.ispackage"));
    serializeLabel.setToolTipText(getMessage("bag.serializetype.help"));

    // TODO: Add format selection panel
    noneButton = new JRadioButton(getMessage("bag.serializetype.none"));
    noneButton.setEnabled(true);
    AbstractAction serializeListener = new SerializeBagHandler();
    noneButton.addActionListener(serializeListener);
    noneButton.setToolTipText(getMessage("bag.serializetype.none.help"));

    zipButton = new JRadioButton(getMessage("bag.serializetype.zip"));
    zipButton.setEnabled(true);
    zipButton.addActionListener(serializeListener);
    zipButton.setToolTipText(getMessage("bag.serializetype.zip.help"));

    /*
    tarButton = new JRadioButton(getMessage("bag.serializetype.tar"));
    tarButton.setEnabled(true);
    tarButton.addActionListener(serializeListener);
    tarButton.setToolTipText(getMessage("bag.serializetype.tar.help"));
            
    tarGzButton = new JRadioButton(getMessage("bag.serializetype.targz"));
    tarGzButton.setEnabled(true);
    tarGzButton.addActionListener(serializeListener);
    tarGzButton.setToolTipText(getMessage("bag.serializetype.targz.help"));
            
    tarBz2Button = new JRadioButton(getMessage("bag.serializetype.tarbz2"));
    tarBz2Button.setEnabled(true);
    tarBz2Button.addActionListener(serializeListener);
    tarBz2Button.setToolTipText(getMessage("bag.serializetype.tarbz2.help"));
    */

    short mode = bag.getSerialMode();
    if (mode == DefaultBag.NO_MODE) {
        this.noneButton.setEnabled(true);
    } else if (mode == DefaultBag.ZIP_MODE) {
        this.zipButton.setEnabled(true);
    } /*else if (mode == DefaultBag.TAR_MODE) {
       this.tarButton.setEnabled(true);
      } else if (mode == DefaultBag.TAR_GZ_MODE) {
       this.tarGzButton.setEnabled(true);
      } else if (mode == DefaultBag.TAR_BZ2_MODE) {
       this.tarBz2Button.setEnabled(true);
      } */else {
        this.noneButton.setEnabled(true);
    }

    ButtonGroup serializeGroup = new ButtonGroup();
    serializeGroup.add(noneButton);
    serializeGroup.add(zipButton);
    //serializeGroup.add(tarButton);
    //serializeGroup.add(tarGzButton);
    //serializeGroup.add(tarBz2Button);
    serializeGroupPanel = new JPanel(new FlowLayout());
    serializeGroupPanel.add(serializeLabel);
    serializeGroupPanel.add(noneButton);
    serializeGroupPanel.add(zipButton);
    //serializeGroupPanel.add(tarButton);
    //serializeGroupPanel.add(tarGzButton);
    //serializeGroupPanel.add(tarBz2Button);
    serializeGroupPanel.setBorder(border);
    serializeGroupPanel.setEnabled(true);
    serializeGroupPanel.setToolTipText(bagView.getPropertyMessage("bag.serializetype.help"));

    JLabel tagLabel = new JLabel(getMessage("bag.label.istag"));
    tagLabel.setToolTipText(getMessage("bag.label.istag.help"));
    isTagCheckbox = new JCheckBox();
    isTagCheckbox.setBorder(border);
    isTagCheckbox.setSelected(bag.isBuildTagManifest());
    isTagCheckbox.addActionListener(new TagManifestHandler());
    isTagCheckbox.setToolTipText(getMessage("bag.checkbox.istag.help"));

    JLabel tagAlgorithmLabel = new JLabel(getMessage("bag.label.tagalgorithm"));
    tagAlgorithmLabel.setToolTipText(getMessage("bag.label.tagalgorithm.help"));
    ArrayList<String> listModel = new ArrayList<String>();
    for (Algorithm algorithm : Algorithm.values()) {
        listModel.add(algorithm.bagItAlgorithm);
    }
    tagAlgorithmList = new JComboBox(listModel.toArray());
    tagAlgorithmList.setName(getMessage("bag.tagalgorithmlist"));
    tagAlgorithmList.setSelectedItem(bag.getTagManifestAlgorithm());
    tagAlgorithmList.addActionListener(new TagAlgorithmListHandler());
    tagAlgorithmList.setToolTipText(getMessage("bag.tagalgorithmlist.help"));

    JLabel payloadLabel = new JLabel(getMessage("bag.label.ispayload"));
    payloadLabel.setToolTipText(getMessage("bag.ispayload.help"));
    isPayloadCheckbox = new JCheckBox();
    isPayloadCheckbox.setBorder(border);
    isPayloadCheckbox.setSelected(bag.isBuildPayloadManifest());
    isPayloadCheckbox.addActionListener(new PayloadManifestHandler());
    isPayloadCheckbox.setToolTipText(getMessage("bag.ispayload.help"));

    JLabel payAlgorithmLabel = new JLabel(bagView.getPropertyMessage("bag.label.payalgorithm"));
    payAlgorithmLabel.setToolTipText(getMessage("bag.payalgorithm.help"));
    payAlgorithmList = new JComboBox(listModel.toArray());
    payAlgorithmList.setName(getMessage("bag.payalgorithmlist"));
    payAlgorithmList.setSelectedItem(bag.getPayloadManifestAlgorithm());
    payAlgorithmList.addActionListener(new PayAlgorithmListHandler());
    payAlgorithmList.setToolTipText(getMessage("bag.payalgorithmlist.help"));

    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints glbc = new GridBagConstraints();
    JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(location, glbc);
    panel.add(location);

    buildConstraints(glbc, 2, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.EAST);
    glbc.ipadx = 5;
    layout.setConstraints(browseButton, glbc);
    glbc.ipadx = 0;
    panel.add(browseButton);

    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    glbc.ipadx = 5;
    layout.setConstraints(bagNameField, glbc);
    glbc.ipadx = 0;
    panel.add(bagNameField);

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(holeyLabel, glbc);
    panel.add(holeyLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.WEST, GridBagConstraints.WEST);
    layout.setConstraints(holeyCheckbox, glbc);
    panel.add(holeyCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(serializeLabel, glbc);
    panel.add(serializeLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    layout.setConstraints(serializeGroupPanel, glbc);
    panel.add(serializeGroupPanel);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagLabel, glbc);
    panel.add(tagLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(isTagCheckbox, glbc);
    panel.add(isTagCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagAlgorithmLabel, glbc);
    panel.add(tagAlgorithmLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(tagAlgorithmList, glbc);
    panel.add(tagAlgorithmList);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(payloadLabel, glbc);
    panel.add(payloadLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(isPayloadCheckbox, glbc);
    panel.add(isPayloadCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(payAlgorithmLabel, glbc);
    panel.add(payAlgorithmLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(payAlgorithmList, glbc);
    panel.add(payAlgorithmList);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:org.openconcerto.erp.core.finance.accounting.ui.GrandLivrePanel.java

private JPanel creerComptePanel(final Compte compte) {

    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy = 0;//from w  w  w .  j  ava  2s .co  m
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    // Intitul du compte
    final JPanel panelCompte = new JPanel();
    panelCompte.setOpaque(false);
    panelCompte.setLayout(new GridBagLayout());
    panelCompte.setBorder(BorderFactory.createTitledBorder(compte.getNumero() + " " + compte.getNom()));

    // Bouton Dtails +/- du compte
    JButton boutonShow = new JButton("+/-");
    boutonShow.setOpaque(false);
    boutonShow.setHorizontalAlignment(SwingConstants.RIGHT);

    // Total du Compte
    JLabel labelCompteDebit = new JLabel(
            "Total Debit : " + GestionDevise.currencyToString(compte.getTotalDebit()));
    JLabel labelCompteCredit = new JLabel(
            " Credit : " + GestionDevise.currencyToString(compte.getTotalCredit()));
    // labelCompte.setFont(new Font(labelCompte.getFont().getFontName(), Font.BOLD, 12));
    labelCompteDebit.setHorizontalAlignment(SwingUtilities.LEFT);
    labelCompteCredit.setHorizontalAlignment(SwingUtilities.LEFT);

    JLabel labelTmp = new JLabel(compte.getNumero() + " " + compte.getNom());
    labelTmp.setHorizontalAlignment(SwingUtilities.LEFT);

    panelCompte.add(labelTmp, c);
    panelCompte.add(labelCompteDebit, c);
    panelCompte.add(labelCompteCredit, c);
    c.weightx = 1;
    c.anchor = GridBagConstraints.NORTHEAST;
    panelCompte.add(boutonShow, c);

    boutonShow.addActionListener(new ActionListener() {
        private boolean isShow = false;
        private JScrollPane scroll = null;

        public void actionPerformed(ActionEvent e) {

            System.err.println(this.isShow);
            // Afficher la JTable du compte
            if (!this.isShow) {
                // if (this.scroll == null) {
                System.err.println(compte);
                JTable tableCpt = createJTableCompte(compte);

                this.scroll = new JScrollPane(tableCpt);

                // calcul de la taille du JScrollPane
                Dimension d;
                System.err.println(tableCpt);
                if (tableCpt.getPreferredSize().height > 200) {
                    d = new Dimension(this.scroll.getPreferredSize().width, 200);
                } else {
                    d = new Dimension(this.scroll.getPreferredSize().width,
                            tableCpt.getPreferredSize().height + 30);
                }
                this.scroll.setPreferredSize(d);

                c.gridy++;
                c.gridwidth = 4;
                c.weightx = 1;
                c.fill = GridBagConstraints.HORIZONTAL;
                c.anchor = GridBagConstraints.NORTHWEST;
                panelCompte.add(this.scroll, c);
                /*
                 * } else { this.scroll.setVisible(true); }
                 */

            } else {
                // if (this.scroll != null) {
                panelCompte.remove(this.scroll);
                System.out.println("Hide scrollPane");
                // this.scroll.setVisible(false);

                // this.scroll.repaint();
                panelCompte.repaint();
                panelCompte.revalidate();
                // }
            }

            this.isShow = !this.isShow;
            SwingUtilities.getRoot(panelCompte).repaint();
        }
    });

    return panelCompte;
}

From source file:com.sshtools.common.ui.SshToolsApplication.java

public void openChangelog(Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    String changelog = "";
    try {// w w  w  . ja  v  a  2 s  . c  o  m
        BufferedReader br = new BufferedReader(
                new InputStreamReader(getClass().getResourceAsStream("/changelog")));
        String line = br.readLine();
        while (line != null) {
            changelog += line + "\n";
            line = br.readLine();
        }
        br.close();
    } catch (Exception e) {
        changelog = "<Error opening changelog>\n";
    }

    javax.swing.JTextArea message = new javax.swing.JTextArea(changelog);
    message.setEditable(false);
    message.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 4));
    javax.swing.JLabel jl = new javax.swing.JLabel();
    message.setFont(jl.getFont());
    message.setBackground(jl.getBackground());

    //   MultilineLabel x = new MultilineLabel(changelog);
    //   x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    //   x.setFont(x.getFont().deriveFont(12f));   
    javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane();
    scrollPane.getViewport().add(message);
    scrollPane.setSize(400, 200);
    scrollPane.setPreferredSize(new java.awt.Dimension(400, 200));
    UIUtil.jGridBagAdd(p, scrollPane, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "Change log", JOptionPane.PLAIN_MESSAGE,
            getApplicationLargeIcon());
}

From source file:ffx.ui.KeywordPanel.java

private void initialize() {
    // Load the Keyword Definitions
    loadXML();/*from w w  w  . jav a  2 s  . c o  m*/
    // TextAreas
    flatfileTextArea = new JTextArea();
    flatfileTextArea.setEditable(false);
    flatfileTextArea.setFont(Font.decode("monospaced plain 12"));
    Insets insets = flatfileTextArea.getInsets();
    insets.set(5, 5, 5, 5);
    flatfileTextArea.setMargin(insets);
    // Keyword Edit Panel
    editPanel = new JPanel(flowLayout);
    ClassLoader loader = getClass().getClassLoader();
    ImageIcon icKeyPanel = new ImageIcon(loader.getResource("ffx/ui/icons/page_key.png"));
    noSystemLabel.setIcon(icKeyPanel);
    ImageIcon icon = new ImageIcon(loader.getResource("ffx/ui/icons/information.png"));
    noKeywordLabel.setIcon(icon);
    noKeywordPanel.add(noKeywordLabel);
    editScrollPane = new JScrollPane(editPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    descriptScrollPane = new JScrollPane(descriptTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    Border eb = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
    descriptScrollPane.setBorder(eb);
    // Add the Keyword Group Panel and Decription Panel to a JSplitPane
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editScrollPane, descriptScrollPane);
    splitPane.setResizeWeight(1.0);
    splitPane.setOneTouchExpandable(true);
    statusLabel.setBorder(eb);
    // Add the main pieces to the overall KeywordPanel (except the ToolBar)
    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);
    add(statusLabel, BorderLayout.SOUTH);
    // Init the GridBagContraints
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    gridBagConstraints.gridheight = 1;
    gridBagConstraints.gridwidth = 1;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    initToolBar();
    add(toolBar, BorderLayout.NORTH);
    setParamPath();
    loadPrefs();
    loadKeywordGroup();
}