當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。