本文整理汇总了Java中java.awt.Dimension.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java Dimension.setSize方法的具体用法?Java Dimension.setSize怎么用?Java Dimension.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Dimension
的用法示例。
在下文中一共展示了Dimension.setSize方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProgressPanel
import java.awt.Dimension; //导入方法依赖的package包/类
Dialog createProgressPanel(final String message, BoundedRangeModel model) {
Dialog dialog;
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout(10, 10));
panel.setBorder(new EmptyBorder(15, 15, 15, 15));
panel.add(new JLabel(message), BorderLayout.NORTH);
final Dimension ps = panel.getPreferredSize();
ps.setSize(Math.max(ps.getWidth(), DEFAULT_WIDTH), Math.max(ps.getHeight(), DEFAULT_HEIGHT));
panel.setPreferredSize(ps);
final JProgressBar progress = new JProgressBar();
if (model == null) {
progress.setIndeterminate(true);
} else {
progress.setStringPainted(true);
progress.setModel(model);
}
panel.add(progress, BorderLayout.SOUTH);
dialog = DialogDisplayer.getDefault().createDialog(new DialogDescriptor(panel, Bundle.ReferencesBrowserController_ProgressDialogCaption(), true, new Object[] { },
DialogDescriptor.CANCEL_OPTION, DialogDescriptor.RIGHT_ALIGN,
null, null));
return dialog;
}
示例2: setPreferredWidth
import java.awt.Dimension; //导入方法依赖的package包/类
/**
* Calculate the width needed to display the maximum line number
*/
private void setPreferredWidth()
{
Element root = component.getDocument().getDefaultRootElement();
int lines = root.getElementCount();
int digits = Math.max(String.valueOf(lines).length(), minimumDisplayDigits);
// Update sizes when number of digits in the line number changes
if (lastDigits != digits)
{
lastDigits = digits;
FontMetrics fontMetrics = getFontMetrics( getFont() );
int width = fontMetrics.charWidth( '0' ) * digits;
Insets insets = getInsets();
int preferredWidth = insets.left + insets.right + width;
Dimension d = getPreferredSize();
d.setSize(preferredWidth, HEIGHT);
setPreferredSize( d );
setSize( d );
}
}
示例3: init
import java.awt.Dimension; //导入方法依赖的package包/类
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
double theta = Math.toRadians(15);
double cos = Math.cos(theta);
double sin = Math.sin(theta);
double xsize = sin * h + cos * w;
double ysize = sin * w + cos * h;
double scale = Math.min(w / xsize, h / ysize);
xsize *= scale;
ysize *= scale;
AffineTransform at = new AffineTransform();
at.translate((w - xsize) / 2.0, (h - ysize) / 2.0);
at.translate(sin * h * scale, 0.0);
at.rotate(theta);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
示例4: init
import java.awt.Dimension; //导入方法依赖的package包/类
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.translate((w - (w*h)/(h + w*0.1)) / 2, 0.0);
at.shear(0.0, 0.1);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
示例5: getSizeRelatedToScreenSize
import java.awt.Dimension; //导入方法依赖的package包/类
/**
* Return the size in relation (scaled) to the screen size.
*/
private Dimension getSizeRelatedToScreenSize() {
// --- Default size ---------------------
Dimension frameSize = new Dimension(1150, 640);
// --- Scale relative to screen ---------
double scale = 0.9;
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
int frameWidth = (int) (screenDimension.getWidth() * scale);
int frameHeight = (int) (screenDimension.getHeight() * scale);
frameSize.setSize(frameWidth, frameHeight);
return frameSize;
}
示例6: init
import java.awt.Dimension; //导入方法依赖的package包/类
public void init(Graphics2D g2d, Context ctx, Dimension dim) {
int w = dim.width;
int h = dim.height;
AffineTransform at = new AffineTransform();
at.translate(0.0, (h - (w*h)/(w + h*0.1)) / 2);
at.shear(0.1, 0.0);
g2d.transform(at);
dim.setSize(scaleForTransform(at, dim));
}
示例7: setProcessHeight
import java.awt.Dimension; //导入方法依赖的package包/类
/**
* Sets the height for the given process. If {@link #getProcessSize(ExecutionUnit)} returns
* {@code null} for the specified process, does nothing.
*
* @param process
* the process for which the height should be set
* @param height
* the new height
*/
public void setProcessHeight(ExecutionUnit process, double height) {
if (process == null) {
throw new IllegalArgumentException("process must not be null!");
}
Dimension dim = processSizes.get(process);
if (dim == null) {
return;
}
dim.setSize(dim.getWidth(), height);
}
示例8: createPopup
import java.awt.Dimension; //导入方法依赖的package包/类
@Override
protected ComboPopup createPopup() {
BasicComboPopup popup = new BasicComboPopup(comboBox) {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void show() {
Dimension popupSize = ((SteppedComboBox) comboBox).getPopupSize();
popupSize.setSize(popupSize.width, getPopupHeightForRowCount(comboBox.getMaximumRowCount()));
Rectangle popupBounds = computePopupBounds(0, comboBox.getBounds().height, popupSize.width, popupSize.height);
scroller.setMaximumSize(popupBounds.getSize());
scroller.setPreferredSize(popupBounds.getSize());
scroller.setMinimumSize(popupBounds.getSize());
list.invalidate();
int selectedIndex = comboBox.getSelectedIndex();
if (selectedIndex == -1) {
list.clearSelection();
} else {
list.setSelectedIndex(selectedIndex);
}
list.ensureIndexIsVisible(list.getSelectedIndex());
setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());
show(comboBox, popupBounds.x, popupBounds.y);
}
};
popup.getAccessibleContext().setAccessibleParent(comboBox);
return popup;
}
示例9: getPreferredSize
import java.awt.Dimension; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize(JComponent c)
{
Dimension d = super.getPreferredSize(c);
if( mBorder != null )
{
Insets ins = mBorder.getBorderInsets(c);
d.setSize(d.width + ins.left + ins.right, d.height + ins.top + ins.bottom);
}
return d;
}
示例10: EyeTarget
import java.awt.Dimension; //导入方法依赖的package包/类
/** Creates a new instance of EyeTarget */
public EyeTarget() {
super(caps);
addGLEventListener(this);
setAutoSwapBufferMode(true);
glu=new GLU();
glut=new GLUT();
Dimension ss=Toolkit.getDefaultToolkit().getScreenSize();
ss.setSize(ss.width/2,ss.height/2);
setSize(ss);
target=new Target();
}
示例11: adjustSize
import java.awt.Dimension; //导入方法依赖的package包/类
/**
* @see samples.preview_new_graphdraw.transform.LayoutTransformer#adjustSize(java.awt.Dimension)
*/
public void adjustSize(Dimension d) {
// System.out.println("Incoming size = " + d);
d.setSize(d.getWidth() * percentage, d.getHeight() * percentage);
this.d = d;
// System.out.println(" Out size = " + d);
}
示例12: getMinimumSize
import java.awt.Dimension; //导入方法依赖的package包/类
@Override
public Dimension getMinimumSize() {
Dimension minSize = super.getMinimumSize();
minSize.setSize(75, minSize.getHeight());
return minSize;
}
示例13: getMaximumSize
import java.awt.Dimension; //导入方法依赖的package包/类
public Dimension getMaximumSize() {
Dimension d = getPreferredSize();
d.setSize(1000, d.getHeight());
return d;
}