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


Java JLabel.setVerticalTextPosition方法代码示例

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


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

示例1: getLogo

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * @return the logo of the contributor company
 */
public JComponent getLogo() {
	switch (this) {
	case POLIMI:
		JLabel logo = new JLabel(GraphStartScreen.HTML_POLI);
		logo.setHorizontalTextPosition(SwingConstants.TRAILING);
		logo.setVerticalTextPosition(SwingConstants.CENTER);
		logo.setIconTextGap(10);
		logo.setIcon(JMTImageLoader.loadImage("logo", new Dimension(70, 70)));
		return logo;
	case ICL:
		return new JLabel(JMTImageLoader.loadImage("logo_icl", new Dimension(-1,40)));
	default:
		return null;
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:19,代码来源:AboutDialogFactory.java

示例2: LabelFrame

import javax.swing.JLabel; //导入方法依赖的package包/类
public LabelFrame()
{
   super("Testing JLabel");
   setLayout(new FlowLayout()); // set frame layout

   // JLabel constructor with a string argument
   label1 = new JLabel("Label with text");
   label1.setToolTipText("This is label1");
   add(label1); // add label1 to JFrame

   // JLabel constructor with string, Icon and alignment arguments
   Icon bug = new ImageIcon(getClass().getResource("bug1.png"));
   label2 = new JLabel("Label with text and icon", bug, 
      SwingConstants.LEFT);
   label2.setToolTipText("This is label2");
   add(label2); // add label2 to JFrame

   label3 = new JLabel(); // JLabel constructor no arguments
   label3.setText("Label with icon and text at bottom");
   label3.setIcon(bug); // add icon to JLabel
   label3.setHorizontalTextPosition(SwingConstants.CENTER);
   label3.setVerticalTextPosition(SwingConstants.BOTTOM);
   label3.setToolTipText("This is label3");
   add(label3); // add label3 to JFrame
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:26,代码来源:LabelFrame.java

示例3: initializeComponents

import javax.swing.JLabel; //导入方法依赖的package包/类
private void initializeComponents() {
	progressText = new JLabel(new ImageIcon(ImageTools.scaleToHeight(ImageTools.getResourceImage("iconsmall.png"), 50, false)));
	progressText.setForeground(Color.white);
	progressText.setVerticalTextPosition(JLabel.BOTTOM);
	progressText.setHorizontalTextPosition(JLabel.CENTER);
	cancelButton = new JButton("Cancel");
	
	setContentPane(new JPanel() {
		private static final long serialVersionUID = -8098561857624764691L;
		@Override
		public void paintComponent(Graphics g) {
			setOpaque(false);
			super.paintComponent(g);
			paintBG((Graphics2D) g);
		}
	});
	cancelButton.addActionListener(ae -> {if(onCancel != null) onCancel.actionPerformed(ae);});
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:19,代码来源:ProgressFrame.java

示例4: setupInstance

import javax.swing.JLabel; //导入方法依赖的package包/类
protected void setupInstance(JLabel instance) {
    super.setupInstance(instance);
    
    instance.setText(text);
    
    if (defaultIcon != null) instance.setIcon(defaultIcon.createInstance());
    
    instance.setVerticalAlignment(verticalAlignment);
    instance.setHorizontalAlignment(horizontalAlignment);
    instance.setVerticalTextPosition(verticalTextPosition);
    instance.setHorizontalTextPosition(horizontalTextPosition);
    instance.setIconTextGap(iconTextGap);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:JComponentBuilders.java

示例5: getNoSelectionComponent

import javax.swing.JLabel; //导入方法依赖的package包/类
protected Component getNoSelectionComponent()
{
	JLabel label = new JLabel(getNoSelectionText());

	// Centre it!
	label.setVerticalAlignment(SwingConstants.CENTER);
	label.setHorizontalAlignment(SwingConstants.CENTER);
	label.setVerticalTextPosition(SwingConstants.CENTER);
	label.setHorizontalTextPosition(SwingConstants.CENTER);

	return label;
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:AbstractListWithView.java

示例6: createProgressPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Creates a panel which displays the process animation and a stop button.
 *
 * @return the created panel
 */
private JPanel createProgressPanel() {
	JPanel panel = new JPanel(new GridBagLayout());

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 0.0;
	gbc.weighty = 0.0;
	gbc.insets = new Insets(0, 5, 5, 5);

	ImageIcon animation = SwingTools
			.createImage(I18N.getGUILabel("io.dataimport.step.store_data_to_repository.animation"));
	animationLabel = new JLabel(animation);
	animationLabel.setHorizontalTextPosition(JLabel.CENTER);
	animationLabel.setVerticalTextPosition(JLabel.BOTTOM);

	gbc.gridy += 1;
	panel.add(animationLabel, gbc);

	stopButton = new JButton(
			new ResourceAction(true, "io.dataimport.step.store_data_to_repository.stop_data_import_progress") {

				private static final long serialVersionUID = 1L;

				@Override
				public void actionPerformed(ActionEvent e) {
					if (backgroundJob != null) {
						setEnabled(false);
						backgroundJob.cancel();
						isImportCancelled = true;
					}
				}
			});

	gbc.insets = new Insets(40, 5, 5, 5);
	gbc.gridy += 1;
	panel.add(stopButton, gbc);

	return panel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:46,代码来源:AbstractToRepositoryStep.java

示例7: getListCellRendererComponent

import javax.swing.JLabel; //导入方法依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    JPanel panel = new JPanel() {
        private static final long serialVersionUID = 1L;

        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            if(d == null) {
                return d;
            } else {
                d.width = 10;
                return d;
            }
        }
    };
    JLabel label = new JLabel();
    panel.setLayout(new FlowLayout(0));
    panel.add(label);
    panel.setOpaque(true);
    if(isSelected && value instanceof PackageDescriptor) {
        panel.setBackground(Colors.TEXT_HIGHLIGHT_BACKGROUND);
    } else {
        panel.setBackground(Colors.TEXTFIELD_BACKGROUND);
    }

    String text = "";
    if(value instanceof PackageDescriptor) {
        PackageDescriptor desc = (PackageDescriptor)value;
        Icon packageIcon = this.getResizedIcon(this.getIcon(desc));
        text = "<html><body style=\'width: " + (packageIcon != null?300 - packageIcon.getIconWidth():314) + (this.textPixelSize > 0?";font-size:":"") + this.textPixelSize + "px;" + (packageIcon == null?"margin-left:40px;":"") + "\'>";
        text = text + "<div><strong>" + desc.getName() + "</strong> " + desc.getVersion();
        if(desc.isRestricted()) {
            text = text + "&nbsp;&nbsp;<img src=\'icon:///16/currency_euro.png\' style=\'vertical-align:middle;\'/>";
        }

        text = text + "</div>";
        text = text + "<div style=\'margin-top:5px;\'>" + this.getLicenseType(desc.getLicenseName()) + "</div>";
        if(this.dependecyMap != null && ((HashSet)this.dependecyMap.get(desc)).size() > 0) {
            text = text + "<div style=\'margin-top:5px;\'>" + this.getSourcePackages(desc) + "</div>";
        }

        text = text + "</body></html>";
        label.setIcon(packageIcon);
        label.setVerticalTextPosition(1);
        label.setForeground(Colors.TEXT_HIGHLIGHT_FOREGROUND);
        label.setText(text);
    }

    return panel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:50,代码来源:PackageListCellRenderer.java

示例8: CreditsFrame

import javax.swing.JLabel; //导入方法依赖的package包/类
public CreditsFrame() {
	super("Credits");
	setLayout(new GridBagLayout());
	GridBagConstraints gbc = ViewUtils.createGBC();
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.weighty=1;
	gbc.insets = new Insets(0, 10, 10, 10);
	
	JLabel logoLabel = new JLabel(new ImageIcon(ImageTools.scaleToHeight(ImageTools.getResourceImage("icon.png"), 100, false)));
	logoLabel.setText("<HTML>GIFKR &copy; 2017 Caleb Kussmaul");
	logoLabel.setHorizontalTextPosition(JLabel.CENTER);
	logoLabel.setVerticalTextPosition(JLabel.BOTTOM);
	
	add(logoLabel, gbc);
	
	gbc.gridy++;
	gbc.weighty=0;
	
	JTextPane dedicationPane = new JTextPane();
	
	dedicationPane.setText("Dedicated to my dad, Wes Kussmaul, for inspiring my passion for programming, creativity, and entrepreneurship.");
	dedicationPane.setOpaque(false);
	dedicationPane.setEditable(false);
	ViewUtils.centerText(dedicationPane);
	
	add(dedicationPane, gbc);
	gbc.gridy++;
	
	JTextPane copyrightPane = new JTextPane();
	copyrightPane.setText("Referenced libraries:\nOpen-Imaging under Apache 2.0\nJavaCV under Apache 2.0\nFFmpeg under LGPL 2.1");
	add(copyrightPane, gbc);
	gbc.gridy++;
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.CENTER;
	
	
	JCheckBox doNotShowBox = new JCheckBox("Do not show again", !GIFKRPrefs.showCreditsFrame());
	doNotShowBox.addChangeListener(ce -> {
		GIFKRPrefs.setShowCreditsFrame(!doNotShowBox.isSelected());
	});
	
	add(doNotShowBox, gbc);
	
	setSize(500, 350);
	setLocationRelativeTo(null);
	setAlwaysOnTop(true);
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:48,代码来源:CreditsFrame.java

示例9: setupGui

import javax.swing.JLabel; //导入方法依赖的package包/类
private void setupGui()
{
	JLabel groupIdLabel = new JLabel(
		CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.groupid")); //$NON-NLS-1$
	JLabel groupNameLabel = new JLabel(
		CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.groupname")); //$NON-NLS-1$
	JLabel descriptionLabel = new JLabel(
		CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.desc")); //$NON-NLS-1$
	JLabel usersLabel = new JLabel(
		CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.members")); //$NON-NLS-1$

	descriptionLabel.setVerticalTextPosition(SwingConstants.TOP);
	descriptionLabel.setVerticalAlignment(SwingConstants.TOP);

	groupId = new JTextField();
	groupId.setEditable(false);
	groupName = new JSmartTextField(100);
	description = new JTextArea();
	description.setLineWrap(true);
	description.setWrapStyleWord(true);

	users = new FilteredShuffleList<UserBean>(
		CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.search"), //$NON-NLS-1$
		new FilterUserBeanModel(userService), Format.USER_BEAN_COMPARATOR);
	users.setSearchText(getString("internal.groupdetailspanel.searchbutton")); //$NON-NLS-1$
	users.setRemoveText(getString("internal.groupdetailspanel.removebutton")); //$NON-NLS-1$

	JButton save = new JButton(saveAction);

	final int height1 = groupName.getPreferredSize().height;
	final int height2 = save.getPreferredSize().height;
	final int width1 = groupNameLabel.getPreferredSize().width;
	final int width2 = save.getPreferredSize().width;

	final int[] rows = {height1, height1, TableLayout.FILL, height1, TableLayout.TRIPLE_FILL, height2,};
	final int[] cols = {width1, TableLayout.FILL, width2,};

	setLayout(new TableLayout(rows, cols));

	add(groupIdLabel, new Rectangle(0, 0, 1, 1));
	add(groupId, new Rectangle(1, 0, 2, 1));
	add(groupNameLabel, new Rectangle(0, 1, 1, 1));
	add(groupName, new Rectangle(1, 1, 2, 1));
	add(descriptionLabel, new Rectangle(0, 2, 1, 1));
	add(new JScrollPane(description), new Rectangle(1, 2, 2, 1));

	add(usersLabel, new Rectangle(0, 3, 3, 1));
	add(users, new Rectangle(0, 4, 3, 1));
	add(save, new Rectangle(2, 5, 1, 1));

	changeDetector = new ChangeDetector();
	changeDetector.watch(groupName);
	changeDetector.watch(description);
	changeDetector.watch(users.getModel());

	saveAction.setEnabled(false);
}
 
开发者ID:equella,项目名称:Equella,代码行数:58,代码来源:GroupDetailsPanel.java


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