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


Java JLabel.setForeground方法代码示例

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


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

示例1: Splash

import javax.swing.JLabel; //导入方法依赖的package包/类
public Splash(String splashText) throws InterruptedException, IOException{
		BufferedImage image;
		image = ImageIO.read(this.getClass().getClassLoader().getResourceAsStream("lang/jpn/Jupiter.jpg"));
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		label = new JLabel(new ImageIcon(image));
		label.setSize(408, 48);
		text = new JLabel(splashText);
		text.setSize(200, 30);
		text.setBackground(Color.BLACK);
		text.setForeground(Color.WHITE);
		text.setFont(new Font("MS Pゴシック", Font.PLAIN, 20));
		this.setSize(screenSize.width, 48);
		this.setLocation(0, 0);
		this.getContentPane().setBackground(Color.BLACK);
		this.setLayout(new BorderLayout());
		this.getContentPane().add(label, BorderLayout.CENTER);
		this.getContentPane().add(text, BorderLayout.EAST);
		this.setResizable(false);
		this.setUndecorated(true);
		this.setVisible(true);
		Thread.sleep(2000);
		this.setVisible(false);
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:24,代码来源:Splash.java

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

示例3: createServerList

import javax.swing.JLabel; //导入方法依赖的package包/类
private JComponent createServerList()
{
	JLabel profileLabel = new JLabel("Choose a Server:");

	configureLink = new JLabel("Configure...");
	configureLink.setForeground(Color.BLUE);
	configureLink.addMouseListener(this);

	profileChoice = new JComboBox();
	profileChoice.addActionListener(this);
	profileChoice.setRenderer(new DefaultListCellRenderer()
	{
		@Override
		public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
			boolean cellHasFocus)
		{
			super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
			ServerProfile p = (ServerProfile) value;
			if( p != null )
			{
				setText(p.getName() + " - " + p.getServer());
			}
			return this;
		}
	});

	final int height1 = profileChoice.getPreferredSize().height;
	final int width1 = configureLink.getPreferredSize().width;

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

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.add(profileLabel, new Rectangle(0, 0, 1, 1));
	all.add(configureLink, new Rectangle(1, 0, 1, 1));
	all.add(profileChoice, new Rectangle(0, 1, 2, 1));

	return all;
}
 
开发者ID:equella,项目名称:Equella,代码行数:40,代码来源:ClientLauncher.java

示例4: stampaCartaCoperta

import javax.swing.JLabel; //导入方法依赖的package包/类
private void stampaCartaCoperta() {
    int nGiocatori = model.getGiocatori().size();
    sfondo.removeAll();
    sfondo.repaint();
    for(int i = 0; i < nGiocatori; i++)
        stampaNomeFiches(model.getGiocatori().get(i));
    
    pausa(pausa_breve);
    
    Font font = new Font("Carte Coperte msg", Font.BOLD, 70);
    JLabel messaggioCartaCoperta = new JLabel("Distribuisco carta coperta...");
    messaggioCartaCoperta.setFont(font);
    messaggioCartaCoperta.setForeground(Color.black);
    int strWidth = messaggioCartaCoperta.getFontMetrics(font).stringWidth("Distribuisco carta coperta...");
    messaggioCartaCoperta.setBounds(this.getWidth()/2 - strWidth/2, this.getHeight()/2 - 60, strWidth, 90);
    
    sfondo.add(messaggioCartaCoperta);
    sfondo.repaint();
    
    for(int i = 0; i < nGiocatori; i++) {
        if(i != nGiocatori - 1)
            carteCoperteBots.add(stampaCarta((this.getWidth()*(2*i+1))/((nGiocatori-1)*2) - 125, 180, "retroCarta"));
        else {
                stampaCarta(this.getWidth()/2 - 125, 3*this.getHeight()/4 - 60, model.getGiocatori().get(i).getCartaCoperta().toString());
            valoriMano.put(model.getGiocatoreLocale().getNome(), stampaValoreMano(model.getGiocatoreLocale()));
        }
        pausa(pausa_breve);
    }
    
    sfondo.remove(messaggioCartaCoperta);
    sfondo.add(esci);
    sfondo.repaint();
    
    needCartaCoperta = false;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-A,代码行数:36,代码来源:PartitaOfflineGuiView.java

示例5: makePauseLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
public void makePauseLabel()
{
	pauseLabel = new JLabel("PAUSE");
	pauseLabel.setForeground(GameConstants.PAUSE_FG_COLOR);
	pauseLabel.setBounds(0, 0, getWidth(), 2*getHeight()/3);
	pauseLabel.setHorizontalAlignment(SwingConstants.CENTER);
	add(pauseLabel);
}
 
开发者ID:D4RK0V3RL0RD676,项目名称:apcs_final,代码行数:9,代码来源:PauseMenu.java

示例6: createLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JLabel createLabel( String text ) {
    JLabel res = new JLabel(text);
    if( GTK ) {
        Color foreground = UIManager.getColor( "MenuItem.foreground"); //NOI18N
        if( null != foreground ) {
            res.setForeground( new Color(foreground.getRGB()) );
        }
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:BrowserMenu.java

示例7: getErrorLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JLabel getErrorLabel() {
    if (this.errorLabel == null) {
        JLabel result = this.errorLabel = new JLabel();
        result.setForeground(Color.RED);
        result.setMinimumSize(getOkButton().getPreferredSize());
    }
    return this.errorLabel;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:9,代码来源:FreshNameDialog.java

示例8: stylizeInfoLabel_Bold

import javax.swing.JLabel; //导入方法依赖的package包/类
public void stylizeInfoLabel_Bold(JLabel l){
	l.setHorizontalAlignment(SwingConstants.LEFT);
	l.setForeground(new Color(234, 201, 87));
	l.setFont(font_16_bold);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:6,代码来源:TrnControllerGUI.java

示例9: createNonCountedLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JLabel createNonCountedLabel(int otherAmateurs) {
    JLabel label = createNumberLabel(otherAmateurs,
                                     "report.labour.notCounted.tooltip");
    label.setForeground(Color.GRAY);
    return label;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:7,代码来源:CompactLabourReport.java

示例10: GestionUsuarios

import javax.swing.JLabel; //导入方法依赖的package包/类
public GestionUsuarios(Connection conn,JFrame principal) {
	super();
	this.conn=conn;		// Recibimos la conexi�n de Biblioteca
	this.principal=principal;
	this.principal.setEnabled(false);
	this.principal.setVisible(false);
	setTitle("Gesti�n de usuarios");
	
	txtApellido1 = new JTextField();
	txtApellido1.setEditable(false);
	txtApellido1.setHorizontalAlignment(SwingConstants.CENTER);
	txtApellido1.setBounds(14, 78, 110, 20);
	getContentPane().add(txtApellido1);
	txtApellido1.setColumns(10);
	
	txtApellido2 = new JTextField();
	txtApellido2.setEditable(false);
	txtApellido2.setHorizontalAlignment(SwingConstants.CENTER);
	txtApellido2.setBounds(138, 78, 110, 20);
	getContentPane().add(txtApellido2);
	txtApellido2.setColumns(10);
	
	txtNombre = new JTextField();
	txtNombre.setEditable(false);
	txtNombre.setHorizontalAlignment(SwingConstants.CENTER);
	txtNombre.setBounds(262, 78, 110, 20);
	getContentPane().add(txtNombre);
	txtNombre.setColumns(10);
	
	JLabel lblApellido = new JLabel("Apellido 1");
	lblApellido.setHorizontalAlignment(SwingConstants.CENTER);
	lblApellido.setBounds(41, 53, 56, 14);
	getContentPane().add(lblApellido);
	
	JLabel lblApellido_1 = new JLabel("Apellido 2");
	lblApellido_1.setHorizontalAlignment(SwingConstants.CENTER);
	lblApellido_1.setBounds(165, 53, 56, 14);
	getContentPane().add(lblApellido_1);
	
	JLabel lblNombre = new JLabel("Nombre");
	lblNombre.setHorizontalAlignment(SwingConstants.CENTER);
	lblNombre.setBounds(289, 53, 56, 14);
	getContentPane().add(lblNombre);
	
	txtCodigoUser = new JTextField();
	txtCodigoUser.setEditable(false);
	txtCodigoUser.setHorizontalAlignment(SwingConstants.CENTER);
	txtCodigoUser.setBounds(153, 136, 86, 20);
	getContentPane().add(txtCodigoUser);
	txtCodigoUser.setColumns(10);
	
	lblCodigo = new JLabel("Codigo");
	lblCodigo.setHorizontalAlignment(SwingConstants.CENTER);
	lblCodigo.setBounds(173, 111, 46, 14);
	getContentPane().add(lblCodigo);
	
	lblGestinDeUsuario = new JLabel("Gesti\u00F3n de usuario");
	lblGestinDeUsuario.setHorizontalAlignment(SwingConstants.CENTER);
	lblGestinDeUsuario.setForeground(Color.BLUE);
	lblGestinDeUsuario.setBounds(137, 11, 111, 14);
	getContentPane().add(lblGestinDeUsuario);
}
 
开发者ID:JuandeLS3,项目名称:Library-app,代码行数:63,代码来源:GestionUsuarios.java

示例11: DifferenceRenderer

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Create the renderer using a particular font, if given.
 */
public DifferenceRenderer()
{
	super();

	colorA = new Color(210, 150, 0);
	colorB = new Color(0, 140, 160);

	//setOpaque(true);
	setLayout(new MigLayout("debug 100, fill, ins 1 10 1 10, gap 1", "[grow 0, right][grow 100, center][grow 0, right]"));

	Font fix = new Font("fixed", Font.PLAIN, 18);
	Font lblfont = new Font("serif", Font.PLAIN, 18);
	Font msgfont = new Font("serif", Font.PLAIN, 20);

	overleft = new JLabel();
	overleft.setFont(fix);

	overlbl = new JLabel();
	overlbl.setFont(lblfont);

	overright = new JLabel();
	overright.setFont(fix);

	coverleft = new JLabel();
	coverleft.setFont(fix);

	coverlbl = new JLabel();
	coverlbl.setFont(lblfont);

	coverright = new JLabel();
	coverright.setFont(fix);

	newdialleft = new JLabel();
	newdialleft.setFont(fix);
	newdialleft.setForeground(Color.RED);

	newdiallbl = new JLabel();
	newdiallbl.setFont(lblfont);

	newdialright = new JLabel();
	newdialright.setFont(fix);
	newdialright.setForeground(Color.RED);

	msg1 = new JLabel();
	msg1.setFont(msgfont);

	msg2 = new JLabel();
	msg2.setFont(msgfont);

	add(overleft, "");
	add(overlbl, "");
	add(overright, "wrap");

	add(coverleft, "");
	add(coverlbl, "");
	add(coverright, "wrap");

	add(newdialleft, "");
	add(newdiallbl, "");
	add(newdialright, "wrap");

	add(msg1, "alignx center, spanx 3, wrap"); 
	add(msg2, "alignx center, spanx 3, wrap");
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:68,代码来源:DifferenceRenderer.java

示例12: display

import javax.swing.JLabel; //导入方法依赖的package包/类
private JLabel display(String text, Color col) {
    JLabel comp = new JLabel(text);
    comp.setForeground(col);
    return comp;
}
 
开发者ID:The-Retired-Programmer,项目名称:nbreleaseplugin,代码行数:6,代码来源:ViewerPanel.java

示例13: getBaseMap

import javax.swing.JLabel; //导入方法依赖的package包/类
public int getBaseMap() {
	ButtonGroup bg = new ButtonGroup();
	mapsTB = new JToggleButton[MapApp.SUPPORTED_MAPS.size()];
	maps = new int[MapApp.SUPPORTED_MAPS.size()];
	JPanel panel2 = new JPanel( new FlowLayout() );

	UIManager.put("ToggleButton.shadow", Color.decode("#7EA5C6"));
	UIManager.put ("ToggleButton.select",
			(Color) UIManager.get ("ToggleButton.shadow"));
	int i = 0;
	for (Iterator<Integer> iter = MapApp.SUPPORTED_MAPS.iterator(); iter.hasNext();) {
		int map = iter.next().intValue();
		mapsTB[i] = getMapToggleButton(map);
		maps[i] = map;

		bg.add(mapsTB[i]);
		mapsTB[i].addActionListener( this);
		panel2.add( mapsTB[i] );
		i++;
	}

	mapsTB[initialMapSelection].setSelected(true);
	JPanel panel = new JPanel( new BorderLayout() );
	panel.add(panel2);

	JLabel label = new JLabel( "Choose a Base Map Projection:  ");
	label.setForeground( Color.black);

	selected = new JLabel( NAMES.get(new Integer(maps[initialMapSelection])).toString() + " Selected" + '\n');
	selected.setForeground( Color.decode("#496781"));

	JPanel panelN = new JPanel( new BorderLayout() );
	panelN.add(label, "West");
	panelN.add(selected);
	panelN.add(new JLabel("version " + haxby.map.MapApp.VERSION), "East");
	panel.add( panelN,"North" );

	JPanel southPanel1 = new JPanel( new GridLayout(0,1) );

	infoLabel = new JLabel("<html>Created By: William F. Haxby <font size=2>('03-'06)</font>, William B.F. Ryan <font size=2>('03-present)</font></font>" +
			"<br>Developers: Neville Shane <font size=2>('16-present)</font>, Justin Coplan <font size=2>('04-'11)</font>, Sze-Man(Samantha) Chan <font size=2>('09-'15)</font>, Andrew K. Melkonian <font size=2>('06-'09)</font>,<br>&#09; Donald E. Pomeroy <font size=2>('11-'12)</font>" +
			"<br>Funded By: National Science Foundation & Trustees of Columbia University" +
			"<br><br><center><font color=#CC3333>The Displayed Maps, Images, Data Tables are not to be used for Navigation Purposes.</font></center></html>");
	southPanel1.add(infoLabel);

	JPanel panelS = new JPanel( new BorderLayout() );
	panelS.add(southPanel1,"North");

	panel.add(panelS,"South");
	// Control over button dialogs. Default to Agree Selection
	Object[] options = {"Agree","Cancel"};
	
	// Signify if running in Development Mode
	String devText = "";
	if(MapApp.BASE_URL.matches(MapApp.DEV_URL))
		 devText = "**DEVELOPMENT MODE** ";
	
	int ok = JOptionPane.showOptionDialog( null, panel, devText + "Choose a Base Map Projection",
			JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null,
			options,
			options[0]);
	if(ok == JOptionPane.YES_OPTION) {
		for (i = 0; i < mapsTB.length; i++) {
			if (mapsTB[i].isSelected())
				ok = maps[i];
			mapsTB[i] = null;
		}
	}else {
		ok = -1;
	}
	return ok;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:73,代码来源:BaseMapSelect.java

示例14: stylizeInfoLabel_Small

import javax.swing.JLabel; //导入方法依赖的package包/类
public void stylizeInfoLabel_Small(JLabel l){
	l.setHorizontalAlignment(SwingConstants.LEFT);
	l.setForeground(UIManager.getColor("Button.disabledToolBarBorderBackground"));
	l.setFont(font_14_bold);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:6,代码来源:SimulatorGui.java

示例15: getStylizedLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JLabel getStylizedLabel(String text) {
	JLabel label = new JLabel(text);
	label.setFont(defaultFont);
	label.setForeground(DEFAULT_SNAKE_COLOR);
	return label;
}
 
开发者ID:cyberpirate92,项目名称:snake-game,代码行数:7,代码来源:MainWindow.java


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