javax.swing.JSeparator#setBorder ( )源码实例Demo

下面列出了javax.swing.JSeparator#setBorder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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;
}
 
源代码2 项目: netbeans   文件: StatusLineFactories.java
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;
}
 
源代码3 项目: netbeans   文件: CRLFStatus.java
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;
}
 
源代码4 项目: Cafebabe   文件: WebLaF.java
public static JSeparator createSeparator() {
	JSeparator sep = new JSeparator();
	sep.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
	sep.setPreferredSize(new Dimension(5, 2));
	return sep;
}
 
源代码5 项目: netbeans   文件: StatusLineComponent.java
private void createSeparator() {
        discardSeparator();
        separator = new JSeparator(JSeparator.VERTICAL);
//        separator.setPreferredSize(new Dimension(5, prefferedHeight));
        separator.setBorder(BorderFactory.createEmptyBorder(1, 0, 2, 0));
    }
 
源代码6 项目: Raccoon   文件: ResultView.java
/**
 * 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);
}