当前位置: 首页>>代码示例>>Java>>正文


Java PanelBuilder.opaque方法代码示例

本文整理汇总了Java中com.jgoodies.forms.builder.PanelBuilder.opaque方法的典型用法代码示例。如果您正苦于以下问题:Java PanelBuilder.opaque方法的具体用法?Java PanelBuilder.opaque怎么用?Java PanelBuilder.opaque使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jgoodies.forms.builder.PanelBuilder的用法示例。


在下文中一共展示了PanelBuilder.opaque方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPanel

import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
public JPanel getPanel() {
	if (_panel == null) {
		PanelBuilder b = new PanelBuilder(new FormLayout(
			"center:pref",
			"max(140px;pref), 3dlu, pref, 2dlu, pref, 2dlu, pref, 2dlu, pref"
		));
		b.opaque(true);
		CellConstraints cc = new CellConstraints();
		b.add(icon, cc.xy(1, 1));
		b.add(label, cc.xy(1, 3, CellConstraints.CENTER, CellConstraints.DEFAULT));
		b.add(rendererProgressBar, cc.xy(1, 5));
		b.add(playing, cc.xy(1, 7, CellConstraints.CENTER, CellConstraints.DEFAULT));
		b.add(time, cc.xy(1, 9));
		_panel = b.getPanel();
	}
	return _panel;
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:18,代码来源:StatusTab.java

示例2: build

import com.jgoodies.forms.builder.PanelBuilder; //导入方法依赖的package包/类
/**
 * Set up the panel for the help tab and load its contents from a file.
 * @return The component containing the help tab and its contents
 */
public JComponent build() {
	FormLayout layout = new FormLayout(
		"left:pref, 0:grow",
		"pref, fill:default:grow"
	);
	PanelBuilder builder = new PanelBuilder(layout);
	builder.opaque(true);
	CellConstraints cc = new CellConstraints();
	editorPane = new JEditorPane();
	editorPane.setEditable(false);
	editorPane.setContentType("text/html");
	editorPane.setBackground(Color.WHITE);
	HTMLEditorKit editorKit = new HTMLEditorKit();
	StyleSheet styleSheet = ((HTMLDocument) editorKit.createDefaultDocument()).getStyleSheet();
	buildStyleSheet(styleSheet);
	editorKit.setStyleSheet(styleSheet);
	editorPane.setEditorKit(editorKit);

	updateContents();

	// Enable internal anchor links
	editorPane.addHyperlinkListener(new HyperlinkListener() {
		@Override
		public void hyperlinkUpdate(HyperlinkEvent event) {
			try {
				if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
					String urlString = event.getURL().toExternalForm();

					if (urlString.startsWith("http://") || urlString.startsWith("https://") || urlString.startsWith("ftp://")) {
						// Open external links in the desktop web browser
						URI uri = new URI(urlString);
						Desktop.getDesktop().browse(uri);
					} else {
						// Open anchor links in the editorPane
						editorPane.setPage(event.getURL());
					}
				}
			} catch (IOException | URISyntaxException e) {
				LOGGER.debug("Caught exception", e);
			}
		}
	});

	JScrollPane pane = new JScrollPane(editorPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	pane.setPreferredSize(new Dimension(500, 400));
	pane.setBorder(BorderFactory.createEmptyBorder());
	builder.add(pane, cc.xy(2, 2));

	return builder.getPanel();
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:55,代码来源:HelpTab.java


注:本文中的com.jgoodies.forms.builder.PanelBuilder.opaque方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。