本文整理汇总了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;
}
示例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();
}