当前位置: 首页>>代码示例>>Java>>正文


Java Dimension.setSize方法代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ReferencesBrowserController.java

示例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 );
	}
}
 
开发者ID:BlidiWajdi,项目名称:Mujeed-Arabic-Prolog,代码行数:26,代码来源:TextLineNumber.java

示例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));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:GraphicsTests.java

示例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));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:GraphicsTests.java

示例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;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:17,代码来源:MainWindow.java

示例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));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:GraphicsTests.java

示例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);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:ProcessRendererModel.java

示例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;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:34,代码来源:SteppedComboBoxUI.java

示例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;
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:FlatterButtonUI.java

示例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();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:EyeTarget.java

示例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);
    }
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:10,代码来源:SlightMarginTransformer.java

示例12: getMinimumSize

import java.awt.Dimension; //导入方法依赖的package包/类
@Override
public Dimension getMinimumSize() {
	Dimension minSize = super.getMinimumSize();
	minSize.setSize(75, minSize.getHeight());
	return minSize;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:7,代码来源:FancyDropDownButton.java

示例13: getMaximumSize

import java.awt.Dimension; //导入方法依赖的package包/类
public Dimension getMaximumSize() {
    Dimension d = getPreferredSize();
    d.setSize(1000, d.getHeight());
    return d;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:6,代码来源:FilterPanel.java


注:本文中的java.awt.Dimension.setSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。