Java Code Examples for com.sun.swingset3.demos.JGridPanel#setHGap()

The following examples show how to use com.sun.swingset3.demos.JGridPanel#setHGap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileChooserDemo.java    From littleluck with Apache License 2.0 4 votes vote down vote up
private void initUI() {
    externalChooser.addChoosableFileFilter(new FileNameExtensionFilter("JPEG images", "jpg"));
    externalChooser.addChoosableFileFilter(new FileNameExtensionFilter("All supported images",
            ImageIO.getWriterFormatNames()));

    final FilePreview filePreview = new FilePreview();

    externalChooser.setAccessory(filePreview);
    externalChooser.addPropertyChangeListener(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY,
            new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    filePreview.loadFileInfo(externalChooser.getSelectedFile());
                }
            });

    embeddedChooser.setControlButtonsAreShown(false);

    embeddedChooser.addChoosableFileFilter(new FileNameExtensionFilter("JPEG images", "jpg"));

    FileNameExtensionFilter filter = new FileNameExtensionFilter("All supported images",
            ImageIO.getWriterFormatNames());

    embeddedChooser.addChoosableFileFilter(filter);
    embeddedChooser.setFileFilter(filter);

    for (int i = MIN_FILTER_ID; i <= MAX_FILTER_ID; i++) {
        cbFilters.addItem(new FilterItem(i, resourceManager.getString(FILTER_NAMES[i])));
    }

    JGridPanel pnFilter = new JGridPanel(2, 0);

    pnFilter.cell(cbFilters).
            cell(btnApplyFilter);

    JGridPanel pnRotateButtons = new JGridPanel(4, 3);

    pnRotateButtons.cell(btnRotateLeft).
            cell(btnRotateRight).
            cell(btnFlipHorizontal).
            cell(btnFlipVertical);

    JGridPanel pnBottom = new JGridPanel(4, 1);

    pnBottom.setHGap(JGridPanel.DEFAULT_GAP * 4);

    pnBottom.cell(btnSelect, JGridPanel.Layout.FILL).
            cell().
            cell(pnFilter).
            cell(btnSave, JGridPanel.Layout.FILL).
            cell(btnSelectWithPreview, JGridPanel.Layout.FILL).
            cell().
            cell(pnRotateButtons).
            cell(btnCancel, JGridPanel.Layout.FILL);

    pnContent.cell(pnImage);
    pnContent.cell(pnBottom, new Insets(10, 10, 10, 10));

    add(pnContent);

    setState(State.EMPTY, false);
}
 
Example 2
Source File: FileChooserDemo.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
private void initUI() {
    externalChooser.addChoosableFileFilter(new FileNameExtensionFilter("JPEG images", "jpg"));
    externalChooser.addChoosableFileFilter(new FileNameExtensionFilter("All supported images",
            ImageIO.getWriterFormatNames()));

    final FilePreview filePreview = new FilePreview();

    externalChooser.setAccessory(filePreview);
    externalChooser.addPropertyChangeListener(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY,
            new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    filePreview.loadFileInfo(externalChooser.getSelectedFile());
                }
            });

    embeddedChooser.setControlButtonsAreShown(false);

    embeddedChooser.addChoosableFileFilter(new FileNameExtensionFilter("JPEG images", "jpg"));

    FileNameExtensionFilter filter = new FileNameExtensionFilter("All supported images",
            ImageIO.getWriterFormatNames());

    embeddedChooser.addChoosableFileFilter(filter);
    embeddedChooser.setFileFilter(filter);

    for (int i = MIN_FILTER_ID; i <= MAX_FILTER_ID; i++) {
        cbFilters.addItem(new FilterItem(i, resourceManager.getString(FILTER_NAMES[i])));
    }

    JGridPanel pnFilter = new JGridPanel(2, 0);

    pnFilter.cell(cbFilters).
            cell(btnApplyFilter);

    JGridPanel pnRotateButtons = new JGridPanel(4, 3);

    pnRotateButtons.cell(btnRotateLeft).
            cell(btnRotateRight).
            cell(btnFlipHorizontal).
            cell(btnFlipVertical);

    JGridPanel pnBottom = new JGridPanel(4, 1);

    pnBottom.setHGap(JGridPanel.DEFAULT_GAP * 4);

    pnBottom.cell(btnSelect, JGridPanel.Layout.FILL).
            cell().
            cell(pnFilter).
            cell(btnSave, JGridPanel.Layout.FILL).
            cell(btnSelectWithPreview, JGridPanel.Layout.FILL).
            cell().
            cell(pnRotateButtons).
            cell(btnCancel, JGridPanel.Layout.FILL);

    pnContent.cell(pnImage);
    pnContent.cell(pnBottom, new Insets(10, 10, 10, 10));

    add(pnContent);

    setState(State.EMPTY, false);
}
 
Example 3
Source File: FileChooserDemo.java    From Darcula with Apache License 2.0 4 votes vote down vote up
private void initUI() {
    externalChooser.addChoosableFileFilter(new FileNameExtensionFilter("JPEG images", "jpg"));
    externalChooser.addChoosableFileFilter(new FileNameExtensionFilter("All supported images",
            ImageIO.getWriterFormatNames()));

    final FilePreview filePreview = new FilePreview();

    externalChooser.setAccessory(filePreview);
    externalChooser.addPropertyChangeListener(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY,
            new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    filePreview.loadFileInfo(externalChooser.getSelectedFile());
                }
            });

    embeddedChooser.setControlButtonsAreShown(false);

    embeddedChooser.addChoosableFileFilter(new FileNameExtensionFilter("JPEG images", "jpg"));

    FileNameExtensionFilter filter = new FileNameExtensionFilter("All supported images",
            ImageIO.getWriterFormatNames());

    embeddedChooser.addChoosableFileFilter(filter);
    embeddedChooser.setFileFilter(filter);

    for (int i = MIN_FILTER_ID; i <= MAX_FILTER_ID; i++) {
        cbFilters.addItem(new FilterItem(i, resourceManager.getString(FILTER_NAMES[i])));
    }

    JGridPanel pnFilter = new JGridPanel(2, 0);

    pnFilter.cell(cbFilters).
            cell(btnApplyFilter);

    JGridPanel pnRotateButtons = new JGridPanel(4, 3);

    pnRotateButtons.cell(btnRotateLeft).
            cell(btnRotateRight).
            cell(btnFlipHorizontal).
            cell(btnFlipVertical);

    JGridPanel pnBottom = new JGridPanel(4, 1);

    pnBottom.setHGap(JGridPanel.DEFAULT_GAP * 4);

    pnBottom.cell(btnSelect, JGridPanel.Layout.FILL).
            cell().
            cell(pnFilter).
            cell(btnSave, JGridPanel.Layout.FILL).
            cell(btnSelectWithPreview, JGridPanel.Layout.FILL).
            cell().
            cell(pnRotateButtons).
            cell(btnCancel, JGridPanel.Layout.FILL);

    pnContent.cell(pnImage);
    pnContent.cell(pnBottom, new Insets(10, 10, 10, 10));

    add(pnContent);

    setState(State.EMPTY, false);
}