Java Code Examples for javax.swing.JSeparator#setBorder()

The following examples show how to use javax.swing.JSeparator#setBorder() . 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: CakePHP3StatusLineElementProvider.java    From cakephp3-netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Create Component(JPanel) and add separator and JLabel to it.
 *
 * @param cell JLabel
 * @return panel
 */
private Component panelWithSeparator(JLabel cell) {
    // create separator
    JSeparator separator = new JSeparator(SwingConstants.VERTICAL) {
        private static final long serialVersionUID = -6385848933295984637L;

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(3, 3);
        }
    };
    separator.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    // create panel
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(separator, BorderLayout.WEST);
    panel.add(cell, BorderLayout.EAST);
    panel.add(versionLabel, BorderLayout.CENTER);
    return panel;
}
 
Example 2
Source File: StatusLineFactories.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static Component panelWithSeparator(JLabel cell) {
    JSeparator separator = new JSeparator(SwingConstants.VERTICAL) {
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(3, 3); // Y-unimportant -> gridlayout will stretch it
        }
    };
    separator.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(separator, BorderLayout.WEST);
    panel.add(cell);
    return panel;
}
 
Example 3
Source File: CRLFStatus.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static Component panelWithSeparator(JLabel cell) {
    JSeparator separator = new JSeparator(SwingConstants.VERTICAL) {
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(3, 3); // Y-unimportant -> gridlayout will stretch it
        }
    };
    separator.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(separator, BorderLayout.WEST);
    panel.add(cell);
    return panel;
}
 
Example 4
Source File: WebLaF.java    From Cafebabe with GNU General Public License v3.0 4 votes vote down vote up
public static JSeparator createSeparator() {
	JSeparator sep = new JSeparator();
	sep.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
	sep.setPreferredSize(new Dimension(5, 2));
	return sep;
}
 
Example 5
Source File: StatusLineComponent.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void createSeparator() {
        discardSeparator();
        separator = new JSeparator(JSeparator.VERTICAL);
//        separator.setPreferredSize(new Dimension(5, prefferedHeight));
        separator.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, 0));
    }
 
Example 6
Source File: ResultView.java    From Raccoon with Apache License 2.0 4 votes vote down vote up
/**
 * Construct a new app listing
 * 
 * @param searchView
 *          the searchview that will handle button presses.
 * 
 * @param doc
 *          the source from which to draw app info
 */
private ResultView(SearchView searchView, DocV2 doc) {
	this.doc = doc;
	this.searchView = searchView;

	model = new HashMap<String, Object>();
	model.put("i18n_installs", Messages.getString("ResultView.1")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_rating", Messages.getString("ResultView.3")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_price", Messages.getString("ResultView.5")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_date", Messages.getString("ResultView.7")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_version", Messages.getString("ResultView.2")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_size", Messages.getString("ResultView.9")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_permissions", Messages.getString("ResultView.27")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_permissions_none", Messages.getString("ResultView.22")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("i18n_changelog", Messages.getString("ResultView.4")); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("title", doc.getTitle()); //$NON-NLS-1$
	model.put("installs", doc.getDetails().getAppDetails().getNumDownloads()); //$NON-NLS-1$
	model.put("rating", String.format("%.2f", doc.getAggregateRating().getStarRating())); //$NON-NLS-1$ //$NON-NLS-2$
	model.put("package", doc.getBackendDocid()); //$NON-NLS-1$
	model.put("author", doc.getCreator()); //$NON-NLS-1$
	model.put("price", doc.getOffer(0).getFormattedAmount()); //$NON-NLS-1$
	model.put("date", doc.getDetails().getAppDetails().getUploadDate()); //$NON-NLS-1$
	model.put("size", Archive.humanReadableByteCount(doc.getDetails().getAppDetails() //$NON-NLS-1$
			.getInstallationSize(), true));
	File icon = SearchWorker.getImageCacheFile(doc.getBackendDocid(), 4);
	if (icon.exists()) {
		model.put("icon", icon.toURI()); //$NON-NLS-1$
	}
	else {
		model.put("icon", getClass().getResource("/rsrc/icons/icon_missing.png").toString());
	}

	JPanel buttons = new JPanel();
	buttons.setLayout(new GridLayout(0, 1, 0, 4));
	buttons.setOpaque(false);
	download = new JButton(Messages.getString("ResultView.25"), iconDownload); //$NON-NLS-1$
	gplay = new JButton(Messages.getString("ResultView.26")); //$NON-NLS-1$
	details = new JToggleButton(Messages.getString("ResultView.6")); //$NON-NLS-1$
	permissions = new JToggleButton(Messages.getString("ResultView.27")); //$NON-NLS-1$
	buttons.add(download);
	buttons.add(gplay);
	buttons.add(details);
	buttons.add(permissions);
	entry = new HypertextPane(TmplTool.transform("app.html", model)); //$NON-NLS-1$
	entry.setMargin(new Insets(10, 10, 10, 10));
	entry.addHyperlinkListener(new BrowseUtil());
	// Keep enclosing scrollpanes steady
	DefaultCaret caret = (DefaultCaret) entry.getCaret();
	caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
	JPanel outer = new JPanel(); // Needed to simplify the layout code.
	outer.setOpaque(false);
	JPanel container = new JPanel();
	container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
	container.setOpaque(false);
	container.add(buttons);
	container.add(Box.createVerticalStrut(10));
	container.add(createBadges(doc.getDetails().getAppDetails().getPermissionList()));
	container.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	outer.add(container);
	JSeparator sep = new JSeparator(JSeparator.VERTICAL);
	sep.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	add(outer);
	add(sep);
	add(entry);
}