本文整理汇总了Java中org.jdesktop.swingx.JXHeader类的典型用法代码示例。如果您正苦于以下问题:Java JXHeader类的具体用法?Java JXHeader怎么用?Java JXHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JXHeader类属于org.jdesktop.swingx包,在下文中一共展示了JXHeader类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: installComponentDefaults
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* Configures the component default properties from the given header.
*
* @param header the header to install the components into.
*/
protected void installComponentDefaults(JXHeader header) {
// JW: force a not UIResource for properties which have ui default values
// like color, font, ??
titleLabel.setFont(getAsNotUIResource(header.getTitleFont()));
titleLabel.setForeground(getAsNotUIResource(header.getTitleForeground()));
titleLabel.setText(header.getTitle());
descriptionPane.setFont(getAsNotUIResource(header.getDescriptionFont()));
descriptionPane.setForeground(getAsNotUIResource(header.getDescriptionForeground()));
descriptionPane.setOpaque(false);
descriptionPane.setText(header.getDescription());
descriptionPane.setLineWrap(true);
imagePanel.setIcon(header.getIcon());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:BasicHeaderUI.java
示例2: onPropertyChange
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
protected void onPropertyChange(JXHeader h, String propertyName, Object oldValue, final Object newValue) {
if ("title".equals(propertyName)) {
titleLabel.setText(h.getTitle());
} else if ("description".equals(propertyName)) {
descriptionPane.setText(h.getDescription());
} else if ("icon".equals(propertyName)) {
imagePanel.setIcon(h.getIcon());
} else if ("enabled".equals(propertyName)) {
boolean enabled = h.isEnabled();
titleLabel.setEnabled(enabled);
descriptionPane.setEnabled(enabled);
imagePanel.setEnabled(enabled);
} else if ("titleFont".equals(propertyName)) {
titleLabel.setFont((Font)newValue);
} else if ("descriptionFont".equals(propertyName)) {
descriptionPane.setFont((Font)newValue);
} else if ("titleForeground".equals(propertyName)) {
titleLabel.setForeground((Color)newValue);
} else if ("descriptionForeground".equals(propertyName)) {
descriptionPane.setForeground((Color)newValue);
} else if ("iconPosition".equals(propertyName)) {
resetLayout(h);
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:25,代码来源:BasicHeaderUI.java
示例3: addBasicDefaults
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addBasicDefaults(addon, defaults);
defaults.add(JXHeader.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicHeaderUI");
//TODO image is missing
defaults.add("JXHeader.defaultIcon",
LookAndFeel.makeIcon(HeaderAddon.class, "basic/resources/header-default.png"));
//TODO use safe methods
defaults.add("JXHeader.titleFont", new FontUIResource(UIManager.getFont("Label.font").deriveFont(Font.BOLD)));
defaults.add("JXHeader.titleForeground", UIManager.getColor("Label.foreground"));
defaults.add("JXHeader.descriptionFont", UIManager.getFont("Label.font"));
defaults.add("JXHeader.descriptionForeground", UIManager.getColor("Label.foreground"));
defaults.add("JXHeader.background",
UIManagerExt.getSafeColor("control", new ColorUIResource(Color.decode("#C0C0C0"))));
defaults.add("JXHeader.startBackground", new ColorUIResource(Color.WHITE));
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:HeaderAddon.java
示例4: BugDialog
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
public BugDialog(Frame owner, Throwable thrown) {
super(owner, true);
this.thrown = thrown;
this.errorLog = BugUtils.getErrorLog();
//
// header
//
final JXHeader header = new JXHeader(
Resources.getString("BugDialog.heading"),
Resources.getString("BugDialog.message"),
new ImageIcon(BugDialog.class.getResource("/icons/48x48/bug.png"))
);
//
// dialog
//
setTitle(Resources.getString("BugDialog.title"));
setLocationRelativeTo(owner);
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setResizable(true);
addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
if (checkRequest != null)
checkRequest.cancel(true);
if (sendRequest != null)
sendRequest.cancel(true);
}
});
add(header, BorderLayout.NORTH);
add(buildContentsPanel(), BorderLayout.CENTER);
add(buildButtonPanel(), BorderLayout.SOUTH);
showVersionCheckPanel();
pack();
}
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:41,代码来源:BugDialog.java
示例5: installComponents
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* Creates, configures, adds contained components.
* PRE: header's default properties must be set before calling this.
*
* @param header the header to install the components into.
*/
protected void installComponents(JXHeader header) {
titleLabel = new JLabel();
descriptionPane = new DescriptionPane();
imagePanel = new JLabel();
installComponentDefaults(header);
header.setLayout(new GridBagLayout());
resetLayout(header);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:BasicHeaderUI.java
示例6: uninstallComponents
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* Unconfigures, removes and nulls contained components.
*
* @param header the header to install the components into.
*/
protected void uninstallComponents(JXHeader header) {
uninstallComponentDefaults(header);
header.remove(titleLabel);
header.remove(descriptionPane);
header.remove(imagePanel);
titleLabel = null;
descriptionPane = null;
imagePanel = null;
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:BasicHeaderUI.java
示例7: installListeners
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
protected void installListeners(final JXHeader header) {
propListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
};
boundsListener = new HierarchyBoundsAdapter() {
@Override
public void ancestorResized(HierarchyEvent e) {
if (header == e.getComponent()) {
View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
// view might get lost on LAF change ...
if (v == null) {
descriptionPane.putClientProperty(BasicHTML.propertyKey,
MultiLineSupport.createView(descriptionPane));
v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
}
if (v != null) {
Container tla = header.getTopLevelAncestor();
if (tla == null) {
tla = header.getParent();
while (tla.getParent() != null) {
tla = tla.getParent();
}
}
int h = Math.max(descriptionPane.getHeight(), tla.getHeight());
int w = Math.min(tla.getWidth(), header.getParent().getWidth());
// 35 = description pane insets, TODO: obtain dynamically
w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x;
v.setSize(w, h);
descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
}
}
}};
header.addPropertyChangeListener(propListener);
header.addHierarchyBoundsListener(boundsListener);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:39,代码来源:BasicHeaderUI.java
示例8: resetLayout
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
private void resetLayout(JXHeader h) {
h.remove(titleLabel);
h.remove(descriptionPane);
h.remove(imagePanel);
if (h.getIconPosition() == null || h.getIconPosition() == IconPosition.RIGHT) {
h.add(titleLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(12, 12, 0, 11), 0, 0));
h.add(descriptionPane, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.BOTH, new Insets(0, 24, 12, 11), 0, 0));
h.add(imagePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 1.0, GridBagConstraints.FIRST_LINE_END, GridBagConstraints.NONE, new Insets(12, 0, 11, 11), 0, 0));
} else {
h.add(titleLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(12, 12, 0, 11), 0, 0));
h.add(descriptionPane, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.BOTH, new Insets(0, 24, 12, 11), 0, 0));
h.add(imagePanel, new GridBagConstraints(0, 0, 1, 2, 0.0, 1.0, GridBagConstraints.FIRST_LINE_END, GridBagConstraints.NONE, new Insets(12, 11, 0, 11), 0, 0));
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:15,代码来源:BasicHeaderUI.java
示例9: installListeners
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
protected void installListeners(final JXHeader header) {
propListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
}
};
boundsListener = new HierarchyBoundsAdapter() {
@Override
public void ancestorResized(HierarchyEvent e) {
if (header == e.getComponent()) {
View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
// view might get lost on LAF change ...
if (v == null) {
descriptionPane.putClientProperty(BasicHTML.propertyKey,
descriptionPane.getMultiLineSupport().createView(descriptionPane));
v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
}
if (v != null) {
Container tla = header.getTopLevelAncestor();
if (tla == null) {
tla = header.getParent();
while (tla.getParent() != null) {
tla = tla.getParent();
}
}
int h = Math.max(descriptionPane.getHeight(), tla.getHeight());
int w = Math.min(tla.getWidth(), header.getParent().getWidth());
// 35 = description pane insets, TODO: obtain dynamically
w -= 35 + header.getInsets().left + header.getInsets().right + descriptionPane.getInsets().left + descriptionPane.getInsets().right + imagePanel.getInsets().left + imagePanel.getInsets().right + imagePanel.getWidth() + descriptionPane.getBounds().x;
v.setSize(w, h);
descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
}
}
}};
header.addPropertyChangeListener(propListener);
header.addHierarchyBoundsListener(boundsListener);
}
开发者ID:sing-group,项目名称:aibench-project,代码行数:38,代码来源:BasicHeaderUI.java
示例10: installDefaults
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* Installs default header properties.
* <p>
*
* NOTE: this method is called before the children are created, so must not
* try to access any of those!.
*
* @param header the header to install.
*/
protected void installDefaults(JXHeader header) {
gradientLightColor = UIManagerExt.getColor("JXHeader.startBackground");
if (gradientLightColor == null) {
// fallback to white
gradientLightColor = Color.WHITE;
}
gradientDarkColor = UIManagerExt.getColor("JXHeader.background");
// for backwards compatibility (mostly for substance and synthetica,
// I suspect) I'll fall back on the "control" color if
// JXHeader.background
// isn't specified.
if (gradientDarkColor == null) {
gradientDarkColor = UIManagerExt.getColor("control");
}
if (isUIInstallable(header.getBackgroundPainter())) {
header.setBackgroundPainter(createBackgroundPainter());
}
// title properties
if (isUIInstallable(header.getTitleFont())) {
Font titleFont = UIManager.getFont("JXHeader.titleFont");
// fallback to label font
header.setTitleFont(titleFont != null ? titleFont : UIManager
.getFont("Label.font"));
}
if (isUIInstallable(header.getTitleForeground())) {
Color titleForeground = UIManagerExt
.getColor("JXHeader.titleForeground");
// fallback to label foreground
header.setTitleForeground(titleForeground != null ? titleForeground
: UIManagerExt.getColor("Label.foreground"));
}
// description properties
if (isUIInstallable(header.getDescriptionFont())) {
Font descFont = UIManager.getFont("JXHeader.descriptionFont");
// fallback to label font
header.setDescriptionFont(descFont != null ? descFont : UIManager
.getFont("Label.font"));
}
if (isUIInstallable(header.getDescriptionForeground())) {
Color descForeground = UIManagerExt
.getColor("JXHeader.descriptionForeground");
// fallback to label foreground
header.setDescriptionForeground(descForeground != null ? descForeground
: UIManagerExt.getColor("Label.foreground"));
}
// icon label properties
if (isUIInstallable(header.getIcon())) {
header.setIcon(UIManager.getIcon("Header.defaultIcon"));
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:64,代码来源:BasicHeaderUI.java
示例11: uninstallListeners
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
protected void uninstallListeners(JXHeader h) {
h.removePropertyChangeListener(propListener);
h.removeHierarchyBoundsListener(boundsListener);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:5,代码来源:BasicHeaderUI.java
示例12: uninstallDefaults
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* Uninstalls the given header's default properties. This implementation
* does nothing.
*
* @param h the header to ininstall the properties from.
*/
protected void uninstallDefaults(JXHeader h) {
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:BasicHeaderUI.java
示例13: uninstallComponentDefaults
import org.jdesktop.swingx.JXHeader; //导入依赖的package包/类
/**
* Uninstalls component defaults. This implementation does nothing.
*
* @param header the header to uninstall from.
*/
protected void uninstallComponentDefaults(JXHeader header) {
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:8,代码来源:BasicHeaderUI.java
注:本文中的org.jdesktop.swingx.JXHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论