本文整理了Java中javax.swing.JToolBar.getPreferredSize()
方法的一些代码示例,展示了JToolBar.getPreferredSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JToolBar.getPreferredSize()
方法的具体详情如下:
包路径:javax.swing.JToolBar
类名称:JToolBar
方法名:getPreferredSize
暂无
代码示例来源:origin: magefree/mage
private void setGUISize() {
Font font = GUISizeHelper.menuFont;
mageToolbar.setFont(font);
int newHeight = font.getSize() + 6;
Dimension mageToolbarDimension = mageToolbar.getPreferredSize();
mageToolbarDimension.height = newHeight + 6;
mageToolbar.setMinimumSize(mageToolbarDimension);
mageToolbar.setMaximumSize(mageToolbarDimension);
mageToolbar.setPreferredSize(mageToolbarDimension);
for (Component component : mageToolbar.getComponents()) {
if (component instanceof JButton || component instanceof JLabel || component instanceof JToggleButton) {
component.setFont(font);
Dimension d = component.getPreferredSize();
d.height = newHeight;
component.setMinimumSize(d);
component.setMaximumSize(d);
}
if (component instanceof javax.swing.JToolBar.Separator) {
Dimension d = component.getPreferredSize();
d.height = newHeight;
component.setMinimumSize(d);
component.setMaximumSize(d);
}
}
balloonTip.setFont(GUISizeHelper.balloonTooltipFont);
addTooltipContainer();
}
}
代码示例来源:origin: net.sf.taverna.t2.ui-exts/perspective-biocatalogue
/**
* Used for making preferred height of the search status label
* the same as the height of this toolbar.
*
* @return
*/
public Dimension getTreeToolbarPreferredSize() {
return this.tbFilterTreeToolbar.getPreferredSize();
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public Dimension getPreferredSize()
{
Dimension d=null;
try
{
d=super.getPreferredSize();
if(d.height>d.width)
{
if(d.width<w_) d.width=w_;
else w_=d.width;
}
else
{
if(d.height<h_) d.height=h_;
else h_=d.height;
}
}
catch(NullPointerException ex) { } // swing 1.03
return d;
}
}
代码示例来源:origin: com.metsci.glimpse/glimpse-docking
@Override
public Dimension preferredLayoutSize( Container parent )
{
int wTile = getWidth( );
int hBars = lineThickness + max( tabBar.getPreferredSize( ).height, max( overflowBar.getPreferredSize( ).height + lineThickness, cornerBar.getPreferredSize( ).height + lineThickness ) );
return new Dimension( wTile, hBars );
}
代码示例来源:origin: GoldenGnu/jeveassets
@Override
public Dimension getPreferredSize() {
if (orientation == Orientation.VERTICAL) {
return super.getPreferredSize();
} else {
if (height == null) {
height = getInsets().top + getInsets().bottom + Program.getButtonsHeight();
}
Dimension preferredSize = super.getPreferredSize();
return new Dimension(preferredSize.width, height);
}
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public Dimension getSuperPreferredSize()
{
Dimension r;
if(!isFloatable()&&(getComponentCount()==0))
r=new Dimension(0,0);
else
r=super.getPreferredSize();
return r;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders
Dimension result = super.getPreferredSize();
result.height = Math.max (result.height, minheight);
return result;
代码示例来源: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: us.ihmc/SensorProcessing
/**
* Updates the preferred, minimum, and maximum size using the mapDisplay
*/
public void resizeToFitMap() {
// there is bound to be a better way to do this. Solutions I found searching online didn't seem to work
Dimension dmap = mapDisplay.getPreferredSize();
Dimension dtool = toolbar.getPreferredSize();
setPreferredSize(new Dimension(dmap.width + 5, dtool.height + dmap.height + 5));
setMinimumSize(getPreferredSize());
setMaximumSize(getPreferredSize());
revalidate();
}
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
@Override
public void doLayout() {
Insets ins = getInsets();
Dimension lbll = lbl.getPreferredSize();
int height = lbll.height;
int right = getWidth() - ins.right;
if (!PropUtils.psNoHelpButton) {
Dimension bttn = PropUtils.isAqua ? btn.getPreferredSize() : toolbar.getPreferredSize();
height = Math.max(bttn.height, lbll.height);
right = getWidth() - (ins.right + bttn.width);
if( PropUtils.isAqua )
btn.setBounds(right, ins.top, bttn.width, height);
else
toolbar.setBounds(right, ins.top, bttn.width, height);
}
lbl.setBounds(ins.left, ins.top, right, height);
jsc.setBounds(ins.left, height, getWidth() - (ins.left + ins.right), getHeight() - height);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
if (offset == null)
Dimension size= toolBar.getPreferredSize();
offset= new Point(size.width / 2, size.height / 2);
dragWindow.setOffset(offset);
if (dragWindow.isVisible() == false)
Dimension size= toolBar.getPreferredSize();
dragWindow.setSize(size.width, size.height);
dragWindow.show();
内容来源于网络,如有侵权,请联系作者删除!