本文整理汇总了Java中org.jdesktop.swingx.JXStatusBar类的典型用法代码示例。如果您正苦于以下问题:Java JXStatusBar类的具体用法?Java JXStatusBar怎么用?Java JXStatusBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JXStatusBar类属于org.jdesktop.swingx包,在下文中一共展示了JXStatusBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintBackground
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override protected void paintBackground(Graphics2D g, JXStatusBar statusBar) {
if (leftImage == null || middleImage == null || rightImage == null) {
log.severe("Failed to initialize necessary assets. Set logging to FINE to see more details.");
return;
}
//if bidi, reverse the image painting order
//TODO need to handle vertical stretching better
g.drawImage(leftImage, 0, 0, leftImage.getWidth(), statusBar.getHeight(), null);
if (statusBar.isResizeHandleEnabled()) {
g.drawImage(middleImage, leftImage.getWidth(), 0, statusBar.getWidth() - leftImage.getWidth() - rightImage.getWidth(), statusBar.getHeight(), null);
g.drawImage(rightImage, statusBar.getWidth() - rightImage.getWidth(), 0, rightImage.getWidth(), statusBar.getHeight(), null);
} else {
g.drawImage(middleImage, leftImage.getWidth(), 0, statusBar.getWidth() - leftImage.getWidth(), statusBar.getHeight(), null);
}
}
示例2: paintBackground
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override protected void paintBackground(Graphics2D g, JXStatusBar bar) {
g.setColor(bar.getBackground());
g.fillRect(0, 0, bar.getWidth(), bar.getHeight());
//paint an inset border around each component. This suggests that
//there is an extra border around the status bar...!
Border b = BorderFactory.createBevelBorder(BevelBorder.LOWERED,
Color.WHITE, bar.getBackground(), bar.getBackground(), Color.GRAY);
Insets insets = new Insets(0, 0, 0, 0);
for (Component c : bar.getComponents()) {
getSeparatorInsets(insets);
int x = c.getX() - insets.right;
int y = c.getY() - 2;
int w = c.getWidth() + insets.left + insets.right;
int h = c.getHeight() + 4;
b.paintBorder(c, g, x, y, w, h);
}
}
示例3: addWindowsDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addWindowsDefaults(addon, defaults);
if (OS.isUsingWindowsVisualStyles()) {
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.windows.WindowsStatusBarUI");
String xpStyle = OS.getWindowsVisualStyle();
if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE.equalsIgnoreCase(xpStyle)
|| WindowsLookAndFeelAddons.VISTA_VISUAL_STYLE.equalsIgnoreCase(xpStyle)) {
defaults.add("StatusBar.leftImage", "resources/silver-statusbar-left.png");
defaults.add("StatusBar.middleImage", "resources/silver-statusbar-middle.png");
defaults.add("StatusBar.rightImage", "resources/silver-statusbar-right.png");
} else {
defaults.add("StatusBar.leftImage", "resources/statusbar-left.png");
defaults.add("StatusBar.middleImage", "resources/statusbar-middle.png");
defaults.add("StatusBar.rightImage", "resources/statusbar-right.png");
}
} else {
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.windows.WindowsClassicStatusBarUI");
}
}
示例4: addWindowsDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addWindowsDefaults(addon, defaults);
if (OS.isUsingWindowsVisualStyles()) {
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.windows.WindowsStatusBarUI");
String xpStyle = OS.getWindowsVisualStyle();
if (WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE.equalsIgnoreCase(xpStyle)) {
defaults.add("StatusBar.leftImage", "resources/silver-statusbar-left.png");
defaults.add("StatusBar.middleImage", "resources/silver-statusbar-middle.png");
defaults.add("StatusBar.rightImage", "resources/silver-statusbar-right.png");
} else {
defaults.add("StatusBar.leftImage", "resources/statusbar-left.png");
defaults.add("StatusBar.middleImage", "resources/statusbar-middle.png");
defaults.add("StatusBar.rightImage", "resources/statusbar-right.png");
}
} else {
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.windows.WindowsClassicStatusBarUI");
}
}
示例5: init
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
private void init() {
final BorderLayout layout = new BorderLayout();
final Container contentPane = getContentPane();
contentPane.setLayout(layout);
// window has 3 main elements: toolbar, dock area, status bar
// each element is retrieved using the view model
final EditorViewModel viewModel = getViewModel();
// toolbar
final SessionEditorToolbar tb = getToolbar();
add(tb, BorderLayout.NORTH);
// status bar
final JXStatusBar sb = (JXStatusBar) getStatusBar();
add(sb, BorderLayout.SOUTH);
// setup content/dock area
final Container dock = viewModel.getRoot();
contentPane.add(dock, BorderLayout.CENTER);
setupEditorActions();
}
示例6: paintBackground
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override
protected void paintBackground(Graphics2D g, JXStatusBar bar) {
int w = bar.getWidth(); //TODO deal with insets
int h = bar.getHeight(); //TODO deal with insets
//This list is comprised of floats and Colors, which together
//constitute the gradient.
List<?> gradient = (List<?>) UIManager.get("MenuBar.gradient");
if (gradient != null && w > 0 && 0 < h) {
float ratio1 = ((Number)gradient.get(0)).floatValue();
float ratio2 = ((Number)gradient.get(1)).floatValue();
Color c1 = (Color)gradient.get(2);
Color c2 = (Color)gradient.get(3);
Color c3 = (Color)gradient.get(4);
int mid = (int)(ratio1 * h);
int mid2 = (int)(ratio2 * h);
if (mid > 0) {
g.setPaint(new GradientPaint((float)0, (float)0, c1, (float)0,
(float)mid, c2));
g.fillRect(0, 0, w, mid);
}
if (mid2 > 0) {
g.setColor(c2);
g.fillRect(0, mid, w, mid2);
}
if (mid > 0) {
g.setPaint(new GradientPaint((float)0, (float)mid + mid2, c2,
(float)0, (float)mid * 2 + mid2, c1));
g.fillRect(0, mid + mid2, w, mid);
}
if (h - mid * 2 - mid2 > 0) {
g.setPaint(new GradientPaint((float)0, (float)mid * 2 + mid2, c1,
(float)0, (float)h, c3));
g.fillRect(0, mid * 2 + mid2, w, h - mid * 2 - mid2);
}
}
}
示例7: installDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void installDefaults(JXStatusBar sb) {
super.installDefaults(sb);
LookAndFeel.installProperty(statusBar, "opaque", Boolean.FALSE);
}
示例8: addBasicDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addBasicDefaults(addon, defaults);
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.basic.BasicStatusBarUI");
}
示例9: addMacDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override
protected void addMacDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMacDefaults(addon, defaults);
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.macosx.MacOSXStatusBarUI");
}
示例10: addMetalDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
super.addMetalDefaults(addon, defaults);
defaults.add(JXStatusBar.uiClassID,
"org.jdesktop.swingx.plaf.metal.MetalStatusBarUI");
}
示例11: installDefaults
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
protected void installDefaults(JXStatusBar sb) {
//only set the border if it is an instanceof UIResource
//In other words, only replace the border if it has not been
//set by the developer. UIResource is the flag we use to indicate whether
//the value was set by the UIDelegate, or by the developer.
Border b = statusBar.getBorder();
if (b == null || b instanceof UIResource) {
statusBar.setBorder(createBorder());
}
LookAndFeel.installProperty(sb, "opaque", Boolean.TRUE);
}
示例12: installListeners
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
/**
* Create and install the listeners for the status bar.
* This method is called when the UI is installed.
*/
protected void installListeners(JXStatusBar sb) {
if ((mouseListener = createMouseListener()) != null) {
statusBar.addMouseListener(mouseListener);
}
if ((mouseMotionListener = createMouseMotionListener()) != null) {
statusBar.addMouseMotionListener(mouseMotionListener);
}
if ((propertyChangeListener = createPropertyChangeListener()) != null) {
statusBar.addPropertyChangeListener(propertyChangeListener);
}
}
示例13: uninstallListeners
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
/**
* Remove the installed listeners from the status bar.
* The number and types of listeners removed in this method should be
* the same that were added in <code>installListeners</code>
*/
protected void uninstallListeners(JXStatusBar sb) {
if (mouseListener != null) {
statusBar.removeMouseListener(mouseListener);
}
if (mouseMotionListener != null) {
statusBar.removeMouseMotionListener(mouseMotionListener);
}
if (propertyChangeListener != null) {
statusBar.removePropertyChangeListener(propertyChangeListener);
}
}
示例14: paintSeparator
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
protected void paintSeparator(Graphics2D g, JXStatusBar bar, int x, int y, int w, int h) {
Color fg = UIManagerExt.getSafeColor("Separator.foreground", Color.BLACK);
Color bg = UIManagerExt.getSafeColor("Separator.background", Color.WHITE);
x += w / 2;
g.setColor(fg);
g.drawLine(x, y, x, h);
g.setColor(bg);
g.drawLine(x+1, y, x+1, h);
}
示例15: createStatusBar
import org.jdesktop.swingx.JXStatusBar; //导入依赖的package包/类
protected Container createStatusBar() {
JXStatusBar statusBar = new JXStatusBar();
statusBar.putClientProperty("auto-add-separator", Boolean.FALSE);
// Left status area
statusBar.add(Box.createRigidArea(new Dimension(10, 22)));
statusBarLeft = Box.createHorizontalBox();
statusBar.add(statusBarLeft, JXStatusBar.Constraint.ResizeBehavior.FILL);
actionStatus = new JLabel();
actionStatus.setName("loadingStatusLabel");
actionStatus.setHorizontalAlignment(JLabel.LEADING);
statusBarLeft.add(actionStatus);
// Middle (should stretch)
// statusBar.add(Box.createHorizontalGlue());
// statusBar.add(Box.createHorizontalGlue());
statusBar.add(Box.createVerticalGlue());
statusBar.add(Box.createRigidArea(new Dimension(50, 0)));
// Right status area
tableStatus = new JLabel();
tableStatus.setName("rowCountLabel");
JComponent bar = Box.createHorizontalBox();
bar.add(tableStatus);
tableRows = new JLabel("0");
bar.add(tableRows);
statusBar.add(bar);
statusBar.add(Box.createHorizontalStrut(12));
return statusBar;
}