本文整理了Java中javax.swing.AbstractButton.getPreferredSize()
方法的一些代码示例,展示了AbstractButton.getPreferredSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractButton.getPreferredSize()
方法的具体详情如下:
包路径:javax.swing.AbstractButton
类名称:AbstractButton
方法名:getPreferredSize
暂无
代码示例来源:origin: net.sf.sfac/sfac-core
@Override
protected void updateInsets(Insets insetToUpdate) {
if (controlButton != null) {
Dimension dim = controlButton.getPreferredSize();
if (insetToUpdate.top < dim.height) insetToUpdate.top = dim.height;
}
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Adjusts the <code>Rectangle</code> <code>available</code> based on if
* the vertical scrollbar is needed (<code>wantsVSB</code>).
* The location of the vsb is updated in <code>vsbR</code>, and
* the viewport border insets (<code>vpbInsets</code>) are used to offset
* the vsb. This is only called when <code>wantsVSB</code> has
* changed, eg you shouldn't invoke adjustForVSB(true) twice.
*/
private void adjustForScrollUpAndDown(boolean wantsVSB, Rectangle available,
Rectangle upR, Rectangle downR, Insets vpbInsets) {
if (wantsVSB) {
int buttonWidth = Math.max(0, Math.max(available.width + vpbInsets.left + vpbInsets.right, Math.max(_scrollUp.getPreferredSize().width, _scrollDown.getPreferredSize().width)));
available.height -= upR.height;
available.height -= downR.height;
upR.width = buttonWidth;
downR.width = buttonWidth;
upR.x = available.x - vpbInsets.left;
downR.x = available.x - vpbInsets.left;
upR.y = available.y - vpbInsets.top;
available.y += upR.height;
downR.y = available.y + available.height + vpbInsets.bottom;
}
}
代码示例来源:origin: com.jidesoft/jide-oss
/**
* Adjusts the <code>Rectangle</code> <code>available</code> based on if
* the horizontal scrollbar is needed (<code>wantsHSB</code>).
* The location of the hsb is updated in <code>hsbR</code>, and
* the viewport border insets (<code>vpbInsets</code>) are used to offset
* the hsb. This is only called when <code>wantsHSB</code> has
* changed, eg you shouldn't invoked adjustForHSB(true) twice.
*/
private void adjustForScrollLeftAndRight(boolean wantsHSB, Rectangle available,
Rectangle leftR, Rectangle rightR, Insets vpbInsets) {
if (wantsHSB) {
int buttonHeight = Math.max(0, Math.max(available.height + vpbInsets.top + vpbInsets.bottom, Math.max(_scrollLeft.getPreferredSize().height, _scrollRight.getPreferredSize().height)));
available.width -= leftR.width;
available.width -= rightR.width;
leftR.height = buttonHeight;
rightR.height = buttonHeight;
leftR.y = available.y - vpbInsets.top;
rightR.y = available.y - vpbInsets.top;
leftR.x = available.x - vpbInsets.left;
available.x += leftR.width;
rightR.x = available.x + available.width + vpbInsets.right;
}
}
代码示例来源:origin: bcdev/beam
@Override
public Dimension getPreferredSize() {
Runtime.getRuntime().maxMemory();
Dimension size1 = getXEditorButton().getPreferredSize();
Dimension size2 = new JTextField(1).getPreferredSize();
int height = Math.max(size1.height, size2.height);
return new Dimension(3 * height, height);
}
代码示例来源:origin: net.sf.sfac/sfac-core
@Override
protected void layoutExtraComponents(Container cont) {
if (controlButton != null) {
Dimension dim = controlButton.getPreferredSize();
int posX = x + width - CONTROL_BUTTON_SPACE - dim.width;
int posY = y + ((getUpdatedInsets(cont).top - dim.height) / 2);
controlButton.setBounds(posX, posY, dim.width, dim.height);
}
}
代码示例来源:origin: com.jidesoft/jide-oss
public Dimension getPreferredScrollableViewportSize() {
Dimension size = getPreferredSize();
Dimension screenSize = PortingUtils.getLocalScreenSize(this);
Container container = SwingUtilities.getAncestorOfClass(SimpleScrollPane.class, this);
if (container instanceof SimpleScrollPane) {
SimpleScrollPane scrollPane = (SimpleScrollPane) container;
int height = screenSize.height;
// limit it to the height determined by the visible menu item count
if (getVisibleMenuItemCount() > 0) {
int totalHeight = getVisibleMenuItemCount() * getScrollableUnitIncrement(null, 0, 0);
if (height > totalHeight) {
height = totalHeight;
}
}
size.height = Math.min(size.height, height - scrollPane.getScrollUpButton().getPreferredSize().height - scrollPane.getScrollDownButton().getPreferredSize().height);
}
return size;
}
代码示例来源:origin: bcdev/beam
@Override
protected void initUI() {
super.initUI(); // creates the default label components for us
initUIChild();
_xEditorPane = new XEditorPane();
nameComponent(_xEditorPane, "XEditor");
final JComponent editorComponentChild = getEditorComponentChild();
_xEditorPane.add(BorderLayout.CENTER, editorComponentChild);
final JPanel buttonPanel = new JPanel(new BorderLayout());
nameComponent(buttonPanel, "ButtonPanel");
final AbstractButton xEditorButton = getXEditorButton();
if (editorComponentChild instanceof JTextField) {
buttonPanel.add(BorderLayout.CENTER, xEditorButton);
} else {
final Dimension size = xEditorButton.getPreferredSize();
xEditorButton.setPreferredSize(new Dimension(size.width, size.width));
buttonPanel.add(BorderLayout.NORTH, xEditorButton);
}
_xEditorPane.add(BorderLayout.EAST, buttonPanel);
}
代码示例来源:origin: sdedit/sdedit
maxWidth = Math.max(maxWidth, button.getPreferredSize().width);
maxHeight = Math.max(maxHeight, button.getPreferredSize().height);
add(button);
add(Box.createRigidArea(new Dimension(GAP_WIDTH, 1)));
代码示例来源:origin: org.swinglabs.swingx/swingx-core
int prefHeight = parent.getHeight();
final Insets insets = parent.getInsets();
int pw = detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += reportButton.isVisible() ? (5 + reportButton.getPreferredSize().width) : 0;
pw += closeButton.isVisible() ? (5 + closeButton.getPreferredSize().width) : 0;
prefWidth = Math.max(prefWidth, pw) + insets.left + insets.right;
代码示例来源:origin: org.swinglabs.swingx/swingx-all
int prefHeight = parent.getHeight();
final Insets insets = parent.getInsets();
int pw = detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += reportButton.isVisible() ? (5 + reportButton.getPreferredSize().width) : 0;
pw += closeButton.isVisible() ? (5 + closeButton.getPreferredSize().width) : 0;
prefWidth = Math.max(prefWidth, pw) + insets.left + insets.right;
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
int prefHeight = parent.getHeight();
final Insets insets = parent.getInsets();
int pw = detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += reportButton.isVisible() ? (5 + reportButton.getPreferredSize().width) : 0;
pw += closeButton.isVisible() ? (5 + closeButton.getPreferredSize().width) : 0;
prefWidth = Math.max(prefWidth, pw) + insets.left + insets.right;
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
int prefHeight = parent.getHeight();
final Insets insets = parent.getInsets();
int pw = detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += reportButton.isVisible() ? (5 + reportButton.getPreferredSize().width) : 0;
pw += closeButton.isVisible() ? (5 + closeButton.getPreferredSize().width) : 0;
prefWidth = Math.max(prefWidth, pw) + insets.left + insets.right;
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
int prefHeight = parent.getHeight();
final Insets insets = parent.getInsets();
int pw = detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += detailButton.isVisible() ? detailButton.getPreferredSize().width : 0;
pw += reportButton.isVisible() ? (5 + reportButton.getPreferredSize().width) : 0;
pw += closeButton.isVisible() ? (5 + closeButton.getPreferredSize().width) : 0;
prefWidth = Math.max(prefWidth, pw) + insets.left + insets.right;
代码示例来源:origin: org.swinglabs.swingx/swingx-all
int rightEdge = parent.getWidth() - insets.right;
x = rightEdge;
dim = detailButton.getPreferredSize(); //all buttons should be the same height!
int buttonY = y + 5;
if (detailButton.isVisible()) {
dim = detailButton.getPreferredSize();
x -= dim.width;
detailButton.setBounds(x, buttonY, dim.width, dim.height);
dim = reportButton.getPreferredSize();
x -= dim.width;
x -= 5;
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
int rightEdge = parent.getWidth() - insets.right;
x = rightEdge;
dim = detailButton.getPreferredSize(); //all buttons should be the same height!
int buttonY = y + 5;
if (detailButton.isVisible()) {
dim = detailButton.getPreferredSize();
x -= dim.width;
detailButton.setBounds(x, buttonY, dim.width, dim.height);
dim = reportButton.getPreferredSize();
x -= dim.width;
x -= 5;
代码示例来源:origin: org.swinglabs.swingx/swingx-core
int rightEdge = parent.getWidth() - insets.right;
x = rightEdge;
dim = detailButton.getPreferredSize(); //all buttons should be the same height!
int buttonY = y + 5;
if (detailButton.isVisible()) {
dim = detailButton.getPreferredSize();
x -= dim.width;
detailButton.setBounds(x, buttonY, dim.width, dim.height);
dim = reportButton.getPreferredSize();
x -= dim.width;
x -= 5;
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
int rightEdge = parent.getWidth() - insets.right;
x = rightEdge;
dim = detailButton.getPreferredSize(); //all buttons should be the same height!
int buttonY = y + 5;
if (detailButton.isVisible()) {
dim = detailButton.getPreferredSize();
x -= dim.width;
detailButton.setBounds(x, buttonY, dim.width, dim.height);
dim = reportButton.getPreferredSize();
x -= dim.width;
x -= 5;
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
int rightEdge = parent.getWidth() - insets.right;
x = rightEdge;
dim = detailButton.getPreferredSize(); //all buttons should be the same height!
int buttonY = y + 5;
if (detailButton.isVisible()) {
dim = detailButton.getPreferredSize();
x -= dim.width;
detailButton.setBounds(x, buttonY, dim.width, dim.height);
dim = reportButton.getPreferredSize();
x -= dim.width;
x -= 5;
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
((EqualSizeJButton)detailButton).setGroup(buttons);
reportButton.setMinimumSize(reportButton.getPreferredSize());
detailButton.setMinimumSize(detailButton.getPreferredSize());
代码示例来源:origin: org.swinglabs.swingx/swingx-core
((EqualSizeJButton)detailButton).setGroup(buttons);
reportButton.setMinimumSize(reportButton.getPreferredSize());
detailButton.setMinimumSize(detailButton.getPreferredSize());
内容来源于网络,如有侵权,请联系作者删除!