本文整理了Java中javax.swing.JToolBar.isFloatable()
方法的一些代码示例,展示了JToolBar.isFloatable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JToolBar.isFloatable()
方法的具体详情如下:
包路径:javax.swing.JToolBar
类名称:JToolBar
方法名:isFloatable
暂无
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInCurrentThread
private static void checkFloatable(@Nonnull JToolBar toolBar) {
if (!toolBar.isFloatable()) {
String msg = String.format("JToolbar <%s> is not floatable", format(toolBar));
throw new IllegalStateException(msg);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
if (((JToolBar) c).isFloatable()) {
Graphics2D g2D = (Graphics2D) g;
Composite savedComposite = g2D.getComposite();
代码示例来源:origin: com.github.arnabk/pgslookandfeel
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
g.translate(x, y);
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
PgsUtils.drawVerticalBumps(g, 2, 4, c.getHeight() - 6);
} else {
PgsUtils.drawHorizontalBumps(g, 4, 2, c.getWidth() - 6);
}
}
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
g.setColor(MetalLookAndFeel.getControlShadow());
//g.drawLine(0, h - 2, w, h - 2);
g.setColor(UIManager.getColor("ToolBar.borderColor"));
g.drawLine(0, h - 1, w, h - 1);
}
g.translate(-x, -y);
}
代码示例来源:origin: net.sf.nimrod/nimrod-laf
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height) {
Icon icon = null;
int desp = 0;
if ( ((JToolBar)c).isFloatable() ) {
if ( ((JToolBar)c).getOrientation() == HORIZONTAL ) {
icon = UIManager.getIcon( "ScrollBar.verticalThumbIconImage");
desp = icon.getIconHeight();
for ( int i = 0; i < 5; i++) {
icon.paintIcon( c, g, x+1, y+1+(desp*i));
}
}
else {
icon = UIManager.getIcon( "ScrollBar.horizontalThumbIconImage");
desp = icon.getIconWidth();
for ( int i = 0; i < 5; i++) {
icon.paintIcon( c, g, x+1+(desp*i), y+1);
}
}
}
}
代码示例来源:origin: net.sf.tinylaf/tinylaf
protected void drawXPBorder(Component c, Graphics g, int x, int y, int w, int h) {
g.translate(x, y);
if(((JToolBar)c).isFloatable()) {
// paint grip
if(((JToolBar)c).getOrientation() == HORIZONTAL) {
int xoff = 3;
if(!c.getComponentOrientation().isLeftToRight()) {
xoff = c.getBounds().width - TinyToolBarUI.FLOATABLE_GRIP_SIZE + 3;
}
g.setColor(Theme.toolGripLightColor.getColor());
g.drawLine(xoff, 3, xoff + 1, 3);
g.drawLine(xoff, 3, xoff, h - 5);
g.setColor(Theme.toolGripDarkColor.getColor());
g.drawLine(xoff, h - 4, xoff + 1, h - 4);
g.drawLine(xoff + 2, 3, xoff + 2, h - 4);
} else { // vertical
g.setColor(Theme.toolGripLightColor.getColor());
g.drawLine(3, 3, 3, 4);
g.drawLine(3, 3, w - 4, 3);
g.setColor(Theme.toolGripDarkColor.getColor());
g.drawLine(w - 4, 4, w - 4, 5);
g.drawLine(3, 5, w - 4, 5);
}
}
g.translate(-x, -y);
}
}
代码示例来源:origin: com.jtattoo/JTattoo
public Insets getBorderInsets(Component c) {
Insets insets = new Insets(2, 2, 2, 2);
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
if (JTattooUtilities.isLeftToRight(c)) {
insets.left = 15;
} else {
insets.right = 15;
}
} else {
insets.top = 15;
}
}
Insets margin = ((JToolBar) c).getMargin();
if (margin != null) {
insets.left += margin.left;
insets.top += margin.top;
insets.right += margin.right;
insets.bottom += margin.bottom;
}
return insets;
}
代码示例来源:origin: com.jtattoo/JTattoo
public Insets getBorderInsets(Component c) {
Insets insets = new Insets(2, 2, 2, 2);
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
if (JTattooUtilities.isLeftToRight(c)) {
insets.left = 15;
} else {
insets.right = 15;
}
} else {
insets.top = 15;
}
}
Insets margin = ((JToolBar) c).getMargin();
if (margin != null) {
insets.left += margin.left;
insets.top += margin.top;
insets.right += margin.right;
insets.bottom += margin.bottom;
}
return insets;
}
代码示例来源:origin: com.jtattoo/JTattoo
public Insets getBorderInsets(Component c) {
Insets insets = new Insets(2, 2, 2, 2);
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
if (JTattooUtilities.isLeftToRight(c)) {
insets.left = 15;
} else {
insets.right = 15;
}
} else {
insets.top = 15;
}
}
Insets margin = ((JToolBar) c).getMargin();
if (margin != null) {
insets.left += margin.left;
insets.top += margin.top;
insets.right += margin.right;
insets.bottom += margin.bottom;
}
return insets;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
if (preferredHeight == -1) {
JToolBar tb = new JToolBar();
tb.setBorder(toolbar.getBorder());
tb.setBorderPainted(toolbar.isBorderPainted());
tb.setRollover(toolbar.isRollover());
tb.setFloatable(toolbar.isFloatable());
Icon icon = Icons.getIcon(GeneralIcons.SAVE);
JButton b = new JButton("Button", icon); // NOI18N
tb.add(b);
JToggleButton t = new JToggleButton("Button", icon); // NOI18N
tb.add(t);
JComboBox c = new JComboBox();
c.setEditor(new BasicComboBoxEditor());
c.setRenderer(new BasicComboBoxRenderer());
tb.add(c);
tb.addSeparator();
preferredHeight = tb.getPreferredSize().height;
}
dim.height = Math.max(dim.height, preferredHeight);
return dim;
}
public void doLayout() {
代码示例来源:origin: com.jtattoo/JTattoo
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
int x1 = 4;
int y1 = (h - HOR_RUBBER_ICON.getIconHeight()) / 2;
HOR_RUBBER_ICON.paintIcon(c, g, x1, y1);
} else {
int x1 = (w - VER_RUBBER_ICON.getIconWidth()) / 2 + 2;
int y1 = 4;
VER_RUBBER_ICON.paintIcon(c, g, x1, y1);
}
}
}
代码示例来源:origin: com.jtattoo/JTattoo
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
int x1 = 4;
int y1 = (h - HOR_RUBBER_ICON.getIconHeight()) / 2;
HOR_RUBBER_ICON.paintIcon(c, g, x1, y1);
} else {
int x1 = (w - VER_RUBBER_ICON.getIconWidth()) / 2 + 2;
int y1 = 4;
VER_RUBBER_ICON.paintIcon(c, g, x1, y1);
}
}
}
代码示例来源:origin: net.sf.nimrod/nimrod-laf
public Insets getBorderInsets( Component c, Insets ins) {
ins.top = ins.left = ins.bottom = ins.right = 3;
if ( ((JToolBar)c).isFloatable() ) {
if ( ((JToolBar)c).getOrientation() == HORIZONTAL ) {
if (c.getComponentOrientation().isLeftToRight()) {
ins.left += bumpWidth;
} else {
ins.right += bumpWidth;
}
} else {// vertical
ins.top += bumpWidth;
}
}
Insets margin = ((JToolBar)c).getMargin();
if ( margin != null ) {
ins.left += margin.left;
ins.top += margin.top;
ins.right += margin.right;
ins.bottom += margin.bottom;
}
return ins;
}
}
代码示例来源:origin: net.sf.tinylaf/tinylaf
public Insets getBorderInsets(Component c, Insets newInsets) {
newInsets.top = newInsets.left = newInsets.bottom = newInsets.right = 2;
// we cannot assume that c is a JToolBar
if(!(c instanceof JToolBar)) return newInsets;
if(((JToolBar)c).isFloatable()) {
if(((JToolBar)c).getOrientation() == HORIZONTAL) {
if(c.getComponentOrientation().isLeftToRight()) {
newInsets.left = TinyToolBarUI.FLOATABLE_GRIP_SIZE + 2;
} else {
newInsets.right = TinyToolBarUI.FLOATABLE_GRIP_SIZE + 2;
}
} else { // vertical
newInsets.top = TinyToolBarUI.FLOATABLE_GRIP_SIZE + 2;
}
}
Insets margin = ((JToolBar)c).getMargin();
if(margin != null) {
newInsets.left += margin.left;
newInsets.top += margin.top;
newInsets.right += margin.right;
newInsets.bottom += margin.bottom;
}
return newInsets;
}
代码示例来源:origin: com.github.arnabk/pgslookandfeel
public Insets getBorderInsets(Component c, Insets newInsets) {
newInsets.left = 2;
newInsets.top = 1;
newInsets.bottom = 2;
newInsets.right = 2;
if (((JToolBar) c).isFloatable()) {
if (((JToolBar) c).getOrientation() == HORIZONTAL) {
if (c.getComponentOrientation().isLeftToRight()) {
newInsets.left = 16;
} else {
newInsets.right = 16;
}
} else {
newInsets.top = 16;
}
}
Insets margin = ((JToolBar) c).getMargin();
if (margin != null) {
newInsets.left += margin.left;
newInsets.top += margin.top;
newInsets.right += margin.right;
newInsets.bottom += margin.bottom;
}
return newInsets;
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
public void windowClosing(WindowEvent w)
{
if (toolBar.isFloatable() == true)
{
if (dragWindow != null)
dragWindow.setVisible(false);
floating= false;
if (floatingToolBar == null)
floatingToolBar= createFloatingWindow(toolBar);
if (floatingToolBar instanceof Window)
((Window) floatingToolBar).setVisible(false);
floatingToolBar.getContentPane().remove(toolBar);
String constraint= constraintBeforeFloating;
int orientation= mapConstraintToOrientation(constraint);
setOrientation(orientation);
if (dockingSource == null)
dockingSource= toolBar.getParent();
if (propertyListener != null)
UIManager.removePropertyChangeListener(propertyListener);
dockingSource.add(constraint, toolBar);
dockingSource.invalidate();
Container dockingSourceParent= dockingSource.getParent();
if (dockingSourceParent != null)
dockingSourceParent.validate();
dockingSource.repaint();
setFloating(false, null);
}
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
protected void floatAt(Point position, Point origin) {
if (toolBar.isFloatable() == true) {
try {
Point offset = dragWindow.getOffset();
if (offset == null) {
offset = position;
dragWindow.setOffset(offset);
}
Point global = new Point(origin.x + position.x,
origin.y + position.y);
setFloatingLocation(global.x - offset.x,
global.y - offset.y);
if (dockingSource != null) {
Point dockingPosition = dockingSource.getLocationOnScreen();
Point comparisonPoint = new Point(global.x - dockingPosition.x,
global.y - dockingPosition.y);
if (canDock(dockingSource, comparisonPoint)) {
setFloating(false, comparisonPoint);
} else {
setFloating(true, null);
}
} else {
setFloating(true, null);
}
dragWindow.setOffset(null);
} catch (IllegalComponentStateException e) {
}
}
}
代码示例来源:origin: abbot/abbot
/** Drag the tool bar to the given location, causing it to float.
* @throws ActionFailedException if the toolbar is not floatable
*/
public void actionFloat(Component c, int x, int y) {
JToolBar bar = (JToolBar)c;
if (!bar.isFloatable()) {
throw new ActionFailedException("The JToolBar is not floatable");
}
if (isFloating(bar)) {
throw new ActionFailedException("The JToolBar is already floating");
}
Window w = SwingUtilities.getWindowAncestor(c);
// NOTE: should x, y be the window coordinates or where the
// cursor moves when the jtoolbar is dropped?
JToolBarLocation loc = new JToolBarLocation();
actionDrag(c, loc);
actionDrop(w, x - w.getX(), y - w.getY());
if (!isFloating(bar))
throw new ActionFailedException("Bar not floated");
}
代码示例来源:origin: khuxtable/seaglass
protected void paint(SeaGlassContext context, Graphics g) {
if (handleIcon != null && toolBar.isFloatable()) {
int startX = toolBar.getComponentOrientation().isLeftToRight() ? 0 : toolBar.getWidth()
- SeaGlassIcon.getIconWidth(handleIcon, context);
SeaGlassIcon.paintIcon(handleIcon, context, g, startX, 0, SeaGlassIcon.getIconWidth(handleIcon, context), SeaGlassIcon.getIconHeight(
handleIcon, context));
}
SeaGlassContext subcontext = getContext(toolBar, Region.TOOL_BAR_CONTENT, contentStyle);
// paintContent(subcontext, g, contentRect);
subcontext.dispose();
}
代码示例来源:origin: com.github.insubstantial/substance
if (toolbar.isFloatable()) {
int dragInset = SubstanceSizeUtils
.getToolBarDragInset(SubstanceSizeUtils
代码示例来源:origin: org.java.net.substance/substance
if (toolbar.isFloatable()) {
int dragInset = SubstanceSizeUtils
.getToolBarDragInset(SubstanceSizeUtils
内容来源于网络,如有侵权,请联系作者删除!