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


Java JLabel.setLayout方法代码示例

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


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

示例1: Controls

import javax.swing.JLabel; //导入方法依赖的package包/类
public Controls() {
	setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	setBorder(new EmptyBorder(1, 1, 1, 1));
	setBackground(Color.blue);

	JPanel t = new JPanel();
	t.setBorder(new EmptyBorder(5, 5, 5, 5));
	label = new JLabel();
	label.setLayout(new BorderLayout());
	t.add(label);
	t.setSize(1185, 50);
	add(t);
	JPanel p = new JPanel();
	start = new JButton("Start");
	start.addActionListener(this);
	p.add(start);
	processVoting = new JButton("ProcessVoting");
	processVoting.addActionListener(this);
	p.add(processVoting);
	add(p);

	textArea = new JPanel();
	screen = new JTextArea(17, 100);
	screen.setLineWrap(true);
	screen.setForeground(Color.blue);// set color for font
	screen.setBackground(Color.WHITE);// set background color
	// screen.setText("\n" + "Results from encryption and decryption");
	JScrollPane scrollingArea = new JScrollPane(screen);
	scrollingArea.setSize(15, 100);
	textArea.add(scrollingArea, BorderLayout.CENTER);
	add(textArea);

}
 
开发者ID:peterstefanov,项目名称:paillier,代码行数:34,代码来源:GUI.java

示例2: initTitlePanel

import javax.swing.JLabel; //导入方法依赖的package包/类
private void initTitlePanel(){
    preYear = new JLabel("<<", JLabel.CENTER);
    preMonth = new JLabel("<", JLabel.CENTER);
    center = new JLabel("", JLabel.CENTER);
    centercontainer = new JLabel("", JLabel.CENTER);
    nextMonth = new JLabel(">", JLabel.CENTER);
    nextYear = new JLabel(">>", JLabel.CENTER);
    
    preYear.setToolTipText("Last Year");
    preMonth.setToolTipText("Last Month");
    nextMonth.setToolTipText("Next Month");
    nextYear.setToolTipText("Next Year");
    
    preYear.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 10, 0, 0));
    preMonth.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 15, 0, 0));
    nextMonth.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 0, 0, 15));
    nextYear.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 0, 0, 10));
    
    centercontainer.setLayout(new java.awt.BorderLayout());
    centercontainer.add(preMonth,java.awt.BorderLayout.WEST);
    centercontainer.add(center,java.awt.BorderLayout.CENTER);
    centercontainer.add(nextMonth,java.awt.BorderLayout.EAST);
    
    this.add(preYear,java.awt.BorderLayout.WEST);
    this.add(centercontainer,java.awt.BorderLayout.CENTER);
    this.add(nextYear,java.awt.BorderLayout.EAST);
    this.setPreferredSize(new java.awt.Dimension(210, 25));
    
    updateDate();
    
    preYear.addMouseListener(new MyMouseAdapter(preYear, Calendar.YEAR, -1));
    preMonth.addMouseListener(new MyMouseAdapter(preMonth, Calendar.MONTH, -1));
    nextMonth.addMouseListener(new MyMouseAdapter(nextMonth, Calendar.MONTH, 1));
    nextYear.addMouseListener(new MyMouseAdapter(nextYear, Calendar.YEAR, 1));
}
 
开发者ID:sivanWu0222,项目名称:SimpleERP,代码行数:36,代码来源:Chooser.java


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