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


Java JLabel.setMaximumSize方法代码示例

本文整理汇总了Java中javax.swing.JLabel.setMaximumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.setMaximumSize方法的具体用法?Java JLabel.setMaximumSize怎么用?Java JLabel.setMaximumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.setMaximumSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: IOObjectCacheEntryPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Creates a new {@link IOObjectCacheEntryPanel}.
 *
 * @param icon
 *            The {@link Icon} associated with the entry's type.
 * @param entryType
 *            Human readable representation of the entry's type (e.g., 'Data Table').
 * @param openAction
 *            The action to be performed when clicking in the entry.
 * @param removeAction
 *            An action triggering the removal of the entry.
 */
public IOObjectCacheEntryPanel(Icon icon, String entryType, Action openAction, Action removeAction) {
	super(ENTRY_LAYOUT);

	this.openAction = openAction;

	// add icon label
	JLabel iconLabel = new JLabel(icon);
	add(iconLabel, ICON_CONSTRAINTS);

	// add object type label
	JLabel typeLabel = new JLabel(entryType);
	typeLabel.setMaximumSize(new Dimension(MAX_TYPE_WIDTH, 24));
	typeLabel.setPreferredSize(typeLabel.getMaximumSize());
	typeLabel.setToolTipText(entryType);
	add(typeLabel, TYPE_CONSTRAINTS);

	// add link button performing the specified action, the label displays the entry's key name
	LinkLocalButton openButton = new LinkLocalButton(openAction);
	openButton.setMargin(new Insets(0, 0, 0, 0));
	add(openButton, KEY_CONSTRAINTS);

	// add removal button
	JButton removeButton = new JButton(removeAction);
	removeButton.setBorderPainted(false);
	removeButton.setOpaque(false);
	removeButton.setMinimumSize(buttonSize);
	removeButton.setPreferredSize(buttonSize);
	removeButton.setContentAreaFilled(false);
	removeButton.setText(null);
	add(removeButton, REMOVE_BUTTON_CONSTRAINTS);

	// register mouse listeners
	addMouseListener(hoverMouseListener);
	iconLabel.addMouseListener(dispatchMouseListener);
	typeLabel.addMouseListener(dispatchMouseListener);
	openButton.addMouseListener(dispatchMouseListener);
	removeButton.addMouseListener(dispatchMouseListener);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:51,代码来源:IOObjectCacheEntryPanel.java

示例2: initGUI

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Initializes the GUI.
 */
private void initGUI() {
	realOuterPanel = new JPanel(new BorderLayout());

	outerLayer = new JLayer<JPanel>(realOuterPanel);
	savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON,
			I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f);
	outerLayer.setGlassPane(savingGlassPane);
	savingGlassPane.setVisible(false);

	JPanel pagePanel = new JPanel(new BorderLayout());

	// list of configurables
	JPanel configPanel = createConfigPanel();
	// force size so it does not resize itself depending on entered values
	configPanel.setMinimumSize(CONFIG_LIST_SIZE);
	configPanel.setMaximumSize(CONFIG_LIST_SIZE);
	configPanel.setPreferredSize(CONFIG_LIST_SIZE);
	buttonPanel = createConfigurableButtonPanel();
	// create middle spacer
	JLabel spacer = new JLabel();
	spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE);
	// add both to an outer panel for layout reasons
	JPanel outerConfigPanel = new JPanel(new BorderLayout());
	outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY));
	outerConfigPanel.add(configPanel, BorderLayout.CENTER);
	outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH);
	// another panel for layouting
	JPanel outermostConfigPanel = new JPanel(new BorderLayout());
	outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER);
	outermostConfigPanel.add(spacer, BorderLayout.EAST);

	// glass pane showed if the user is not able to edit connections due to an old version of
	// the server
	simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f);

	// panel displaying the selected configurable
	JPanel paramPanel = createParameterPanel();

	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1;
	c.weighty = 0.3;
	c.gridwidth = GridBagConstraints.REMAINDER;

	// add panels to page panel
	pagePanel.add(outermostConfigPanel, BorderLayout.WEST);
	pagePanel.add(paramPanel, BorderLayout.CENTER);

	// add page and button panel to outer panel
	realOuterPanel.add(pagePanel, BorderLayout.CENTER);

	layoutDefault(outerLayer, makeSaveButton(), makeCancel());
	setDefaultSize(ButtonDialog.HUGE);
	setLocationRelativeTo(ApplicationFrame.getApplicationFrame());
	setModal(true);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new WindowAdapter() {

		@Override
		public void windowClosing(WindowEvent e) {
			cancelButton.doClick();
		}
	});

	updateButtonState(true);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:72,代码来源:ConfigurableDialog.java

示例3: createP1

import javax.swing.JLabel; //导入方法依赖的package包/类
void createP1() {
	Box p11 = Box.createVerticalBox();
	p11.setBackground(Color.white);
	p11.setOpaque(true);
	p1 = new JPanel(new BorderLayout());
	Box b1 = Box.createHorizontalBox();
	b1.setBackground(Color.white);
	b1.setOpaque(true);
	b1.setBorder(new EmptyBorder(25, 15, 10, 15));
	JLabel lbl = new JLabel();
	lbl.setText(StringResource.getString("YT_LBL1"));
	lbl.setOpaque(false);
	JLabel icon = new JLabel(XDMIconMap.getIcon("YT_ICON"));
	icon.setMaximumSize(new Dimension(75, 75));
	b1.add(icon);
	b1.add(Box.createRigidArea(new Dimension(10, 10)));
	b1.add(lbl);
	ytaddr = new JTextField();
	ytaddr.setMaximumSize(new Dimension(ytaddr.getMaximumSize().width,
			ytaddr.getPreferredSize().height));
	p11.add(b1);
	Box b2 = Box.createHorizontalBox();
	b2.add(ytaddr);
	b2.setBackground(Color.white);
	b2.setOpaque(true);
	b2.setBorder(new EmptyBorder(10, 15, 15, 15));
	p11.add(b2);
	p11.add(Box.createVerticalStrut(20));

	p1.add(p11);

	Box b3 = Box.createHorizontalBox();
	get_video = new JButton(StringResource.getString("YT_LBL4"));
	btnDim = get_video.getPreferredSize();
	get_video.setName("YT_LBL4");
	get_video.addActionListener(this);
	cancel = new JButton(StringResource.getString("CANCEL"));
	cancel.setName("CANCEL");
	cancel.addActionListener(this);
	cancel.setPreferredSize(btnDim);
	b3.add(Box.createHorizontalGlue());
	b3.add(get_video);
	b3.add(Box.createRigidArea(new Dimension(10, 10)));
	b3.add(cancel);
	b3.setBorder(new EmptyBorder(10, 15, 10, 15));
	b3.setOpaque(true);
	b3.setBackground(StaticResource.titleColor);

	p1.add(b3, BorderLayout.SOUTH);
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:51,代码来源:YoutubeGrabberDlg.java


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