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


Java JLabel.setVerticalAlignment方法代码示例

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


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

示例1: buildContentLoadingLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JComponent buildContentLoadingLabel() {
    JLabel label = new JLabel( BundleSupport.getLabel( "ContentLoading" ) ); // NOI18N
    label.setHorizontalAlignment( JLabel.CENTER );
    label.setVerticalAlignment( JLabel.CENTER );
    label.setOpaque( false );
    Component header = getContentHeader();
    if( null != header ) {
        JPanel panel = new JPanel( new GridBagLayout() );
        panel.setOpaque( false );
        panel.add( header, new GridBagConstraints(0,0,1,1,1.0,1.0,
            GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
        panel.add( label, new GridBagConstraints(0,1,1,1,1.0,1.0,
            GridBagConstraints.CENTER,GridBagConstraints.BOTH,new Insets(0,0,0,0),0,0 ) );
        panel.setBorder( BorderFactory.createEmptyBorder(40, 0, 40, 0));
        return panel;
    }
    label.setBorder( BorderFactory.createEmptyBorder(40, 0, 40, 0));
    return label;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:RSSFeed.java

示例2: refreshSQL

import javax.swing.JLabel; //导入方法依赖的package包/类
public void refreshSQL() {
    try {
        String sqlText = "";
        if (jSplitPane1.getBottomComponent() != null) {
            SQLStatementGenerator stmtBldr = dataView.getSQLStatementGenerator();
            for (int i = 0; i < insertDataModel.getRowCount(); i++) {
                String sql = stmtBldr.generateRawInsertStatement(insertTable, getInsertValues(i));
                sqlText = sqlText + sql + "\n";
            }
            jEditorPane1.setEditorKit(CloneableEditorSupport.getEditorKit("text/x-sql")); // NOI18N
            jEditorPane1.setText(sqlText);
            jScrollPane2.setViewportView(jEditorPane1);
        }
    } catch (DBException ex) {
        JLabel errorLabel = new JLabel(
                "<html><body><font color=\"#FF0000\">" //NOI18N
                + ex.getMessage().replaceAll("\\n", "<br>") //NOI18N
                + "</font></body></html>"); //NOI18N
        errorLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
        errorLabel.setVerticalAlignment(SwingConstants.TOP);
        jScrollPane2.setViewportView(errorLabel);
        jScrollPane2.revalidate();
        jScrollPane2.repaint();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:InsertRecordDialog.java

示例3: makeInfoPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JPanel makeInfoPanel(String message, Icon icon) {
	JLabel infoIcon = new JLabel(icon);
	infoIcon.setVerticalAlignment(SwingConstants.TOP);
	JPanel infoPanel = new JPanel(new BorderLayout(20, 0));
	infoPanel.setBorder(BorderFactory.createEmptyBorder(12, 16, 16, 4));
	infoPanel.add(infoIcon, BorderLayout.WEST);
	int width;
	if (centerComponent != null) {
		width = (int) centerComponent.getPreferredSize().getWidth() - 88; // icon plus padding
		if (width < 420) {
			width = 420;
		}
	} else {
		width = 420;
	}

	infoTextLabel = new FixedWidthEditorPane(width, message);
	// set the background as for infoPanel such that infoTextLabel looks like a JLabel
	infoTextLabel.setBackground(infoPanel.getBackground());

	infoPanel.add(infoTextLabel, BorderLayout.CENTER);

	return infoPanel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:ButtonDialog.java

示例4: initGUI

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

    display = new JLabel("0", SwingConstants.RIGHT);
    display.setMinimumSize(new Dimension(75, 75));
    display.setVerticalAlignment(SwingConstants.BOTTOM);
    display.setBackground(Color.WHITE);
    display.setOpaque(false);
    display.setFont(new Font(display.getFont().toString(), Font.BOLD, 30));

    p.add(display, new RCPosition(1, 1));

    addNumberButtons(p);
    addOperatorButtons(p);
    addFunctionButtons(p);
    addControlButtons(p);
    getContentPane().add(p);
}
 
开发者ID:fgulan,项目名称:java-course,代码行数:23,代码来源:Calculator.java

示例5: openImagfile

import javax.swing.JLabel; //导入方法依赖的package包/类
private void openImagfile(ImageFile imageFile)
{
    // eanble scrolling
    editorScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    
    JLabel label = new JLabel();
    label.setIcon(new ImageIcon(imageFile.getAbsolutePath()));
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);
    label.setBackground(BloxsColors.$BACKGROUND);
    label.setOpaque(true);
    
    editorScroller.getViewport().add(label);
    editorScroller.getViewport().validate();
    editorScroller.repaint();
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:18,代码来源:MainFrame.java

示例6: openNothing

import javax.swing.JLabel; //导入方法依赖的package包/类
public void openNothing()
{
    // eanble scrolling
    editorScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    
    JLabel label = new JLabel();
    label.setText("");
    label.setFont(new Font("Monospaced", Font.BOLD, 20));
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);
    label.setBackground(BloxsColors.$BACKGROUND);
    label.setOpaque(true);
  
    editorScroller.getViewport().add(label);
    editorScroller.getViewport().validate();
    editorScroller.repaint();
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:19,代码来源:MainFrame.java

示例7: WarningFrame

import javax.swing.JLabel; //导入方法依赖的package包/类
public WarningFrame(String title, String... message) {
	super(title);
	JLabel warnText = new JLabel(String.join("\n",
			new String[] {
					"<html><div style=\"padding: 4px;\">",
					String.join("\n", message),
					"</div></html>"
			}));
	warnText.setVerticalAlignment(SwingConstants.NORTH);
	this.add(warnText);
	this.setMinimumSize(new Dimension(400, 200));
	this.setLocation(500, 500);
	this.setVisible(true);
}
 
开发者ID:fatmanspanda,项目名称:ALTTPMenuPractice,代码行数:15,代码来源:WarningFrame.java

示例8: 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

示例9: NoWebBrowserImpl

import javax.swing.JLabel; //导入方法依赖的package包/类
public NoWebBrowserImpl(String cause) {
    JLabel lbl = new JLabel(NbBundle.getMessage(NoWebBrowserImpl.class, "Err_CannotCreateBrowser", cause));
    lbl.setEnabled( false );
    lbl.setHorizontalAlignment( JLabel.CENTER );
    lbl.setVerticalAlignment( JLabel.CENTER );
    component = lbl;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NoWebBrowserImpl.java

示例10: JWatMainPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
public JWatMainPanel(MainJwatWizard parent) {
	this.parent = parent;
	this.help = parent.getHelp();
	this.setLayout(new BorderLayout());
	JPanel upper = new JPanel(new FlowLayout());
	JLabel upperLabel = new JLabel();
	upperLabel.setPreferredSize(new Dimension(300, 10));
	upper.add(upperLabel);

	JPanel bottom = new JPanel(new FlowLayout());
	JLabel bottomLabel = new JLabel();
	bottomLabel.setPreferredSize(new Dimension(300, 10));
	bottom.add(bottomLabel);

	this.add(upper, BorderLayout.NORTH);
	this.add(bottom, BorderLayout.SOUTH);

	JPanel eastPanel = new JPanel(new FlowLayout());
	eastPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
	JPanel buttonPanel = new JPanel(new GridLayout(buttonAction.length, 1, 2, 15));
	eastPanel.add(buttonPanel, BorderLayout.CENTER);
	for (AbstractAction element : buttonAction) {
		buttonPanel.add(createButton(element));
	}
	JLabel imageLabel = new JLabel();
	imageLabel.setBorder(BorderFactory.createEmptyBorder(BUTTONSIZE - 5, 1, 0, 0));
	//imageLabel.setIcon(new ImageIcon(image));
	imageLabel.setIcon(new ImageIcon(new ImageIcon(imageURL).getImage().getScaledInstance(400, 315, Image.SCALE_SMOOTH)));
	imageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
	imageLabel.setVerticalAlignment(SwingConstants.NORTH);

	//JLabel description = new JLabel("<html><body><h3>This is a simple<br>descirption added to this<br>page. Please do not mind it<br>will be replaced soon</h3></body></html>");
	//this.add(description,BorderLayout.WEST);
	this.add(imageLabel, BorderLayout.CENTER);
	this.add(eastPanel, BorderLayout.EAST);
	makeToolbar();
	makeMenubar();
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:39,代码来源:JWatMainPanel.java

示例11: initComponents

import javax.swing.JLabel; //导入方法依赖的package包/类
private void initComponents() {
	Container cp = getContentPane();
	cp.setLayout(new BorderLayout());
	JPanel butPane = new JPanel();
	butPane.add(new JButton(close), BorderLayout.SOUTH);
	cp.add(butPane, BorderLayout.SOUTH);
	JTabbedPane jtp = new JTabbedPane();

	JPanel general = new JPanel(new BorderLayout());
	JLabel ghelp = new JLabel(generalHelp);
	ghelp.setHorizontalAlignment(SwingConstants.CENTER);
	ghelp.setVerticalAlignment(SwingConstants.CENTER);
	JLabel icon = new JLabel(UIManager.getIcon("OptionPane.informationIcon"));
	Box lbox = Box.createHorizontalBox();
	lbox.add(Box.createHorizontalStrut(10));
	lbox.add(icon);
	lbox.add(Box.createHorizontalStrut(10));

	general.add(ghelp, BorderLayout.CENTER);
	general.add(lbox, BorderLayout.WEST);
	general.add(Box.createHorizontalStrut(10), BorderLayout.EAST);

	jtp.add("General", general);

	JPanel evaluator = new JPanel(new BorderLayout());

	HtmlPanel ehelp = new HtmlPanel(evalHelp);

	evaluator.add(Box.createHorizontalStrut(10), BorderLayout.WEST);
	evaluator.add(new JScrollPane(ehelp), BorderLayout.CENTER);
	evaluator.add(Box.createHorizontalStrut(10), BorderLayout.EAST);

	jtp.add("Evaluator", evaluator);

	cp.add(jtp, BorderLayout.CENTER);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:37,代码来源:LDHelpDialog.java

示例12: createSeparator

import javax.swing.JLabel; //导入方法依赖的package包/类
public static JPanel createSeparator(String text) {
	JLabel title = new JLabel(text);
	title.setVerticalAlignment(0);
	title.setHorizontalAlignment(JLabel.LEFT);
	title.setFont(UIManager.getFont(TITLE_FONT).deriveFont(12f));
	title.setForeground(UIManager.getColor(TITLE_FOREGROUND));
	return createSeparator(title);
}
 
开发者ID:kristian,项目名称:JDigitalSimulator,代码行数:9,代码来源:Guitilities.java

示例13: createCentre

import javax.swing.JLabel; //导入方法依赖的package包/类
private JComponent createCentre()
{
	dayGrid = new JPanel(new GridLayout(7, 7, 5, 5));
	dayGrid.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
	dayGrid.setBackground(Color.WHITE);
	dayGrid.addMouseListener(this);

	Map<TextAttribute, Float> dayAttributes = new HashMap<TextAttribute, Float>();
	dayAttributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
	Font dayFont = new Font(dayAttributes);

	for( int i = 0; i < DAYS.length; i++ )
	{
		JLabel day = new JLabel(DAYS[i]);
		day.setHorizontalAlignment(SwingConstants.CENTER);
		day.setVerticalAlignment(SwingConstants.CENTER);
		day.setFont(dayFont);

		dayGrid.add(day);
	}

	days = new DayLabel[6][7];
	for( int i = 0; i < days.length; i++ )
	{
		for( int j = 0; j < days[i].length; j++ )
		{
			days[i][j] = new DayLabel();
			days[i][j].setDay(0);
			dayGrid.add(days[i][j]);
		}
	}

	return dayGrid;
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:JCalendar.java

示例14: getDefaultLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
public static JLabel getDefaultLabel(String title, int width, int height, int align, int valign)
{
	JLabel label = new JLabel(" " + title + " ", align);
	label.setPreferredSize(new Dimension(width, height));
	label.setVerticalAlignment(valign);
	return label;
}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:8,代码来源:GUISettings.java

示例15: createFeedItemComponent

import javax.swing.JLabel; //导入方法依赖的package包/类
@Override
protected Component createFeedItemComponent(FeedItem item) {
    JPanel panel = new JPanel( new GridBagLayout() );
    panel.setOpaque(false);
    int row = 0;

    if( item.isValid() ) {
        if( item.enclosureUrl != null ) {
            panel.add( new ImageLabel( item.link, getImage( item.enclosureUrl ), item.description ),
                    new GridBagConstraints(0,row++,1,1,0.0,0.0,
                    GridBagConstraints.WEST,GridBagConstraints.NONE,
                    new Insets(0,0,5,5),0,0 ) );
        } else {
            JLabel label = new JLabel( BundleSupport.getLabel("NoScreenShot") ); //NOI18N
            label.setHorizontalAlignment( JLabel.CENTER );
            label.setVerticalAlignment( JLabel.CENTER );
            panel.add( label, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                    GridBagConstraints.CENTER,GridBagConstraints.NONE,
                    new Insets(0,0,5,5),0,0 ) );
        }

        WebLink linkButton = new WebLink( item.title, item.link, false );
        linkButton.getAccessibleContext().setAccessibleName(
                BundleSupport.getAccessibilityName( "WebLink", item.title ) ); //NOI18N
        linkButton.getAccessibleContext().setAccessibleDescription(
                BundleSupport.getAccessibilityDescription( "WebLink", item.link ) ); //NOI18N
        linkButton.setFont( BUTTON_FONT );
        panel.add( linkButton, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.WEST,GridBagConstraints.NONE,
                new Insets(0,0,5,5),0,0 ) );
    } else {
        panel.add( new JLabel(BundleSupport.getLabel("ErrLoadingFeed")),  // NOI18N
                new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
        JButton button = new JButton();
        Mnemonics.setLocalizedText( button, BundleSupport.getLabel( "Reload" ) );  // NOI18N
        button.setOpaque( false );
        button.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                lastReload = 0;
                reload();
            }
        });
        panel.add( button, new GridBagConstraints(0,row++,1,1,0.0,0.0,
                GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,10,10,5),0,0 ) );
    }
    
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:DemoPanel.java


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