Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » why cannot change foreground color?(java foregroundcolor)
why cannot change foreground color? [message #1088627] Sat, 17 August 2013 11:07 Go to next message
J kids is currently offline J kidsFriend
Messages: 1
Registered: August 2013
Junior Member
package q2sept2011;
import javax.swing.*;
import java.awt.*;
import java.awt.Color.*;
import java.awt.Font.*;

public class Q2sept2011 extends JFrame{

public static void main(String[] args) {
Q2sept2011 frame = new Q2sept2011();
frame.setTitle("Changging the front style");


// TODO code application logic here
public Q2sept2011(){
String[]font ={"Times Roman","Verdana","Courier"};

String[]size ={"15","20","25"};

JComboBox c1=new JComboBox(font);
JComboBox c2=new JComboBox(size);
JPanel p1= new JPanel();
setLayout(new BorderLayout());
p1.setLayout(new GridLayout(1,3));
p1.add(new JLabel("Font Name"));
p1.add(new JComboBox(font));
p1.add(new JLabel("Font Size"));
p1.add(new JComboBox(size));

JPanel p2= new JPanel();

p2.add(new JLabel("Good!"));
/*the "good" still in black.while running the program.*/

Re: why cannot change foreground color? [message #1090256 is a reply to message #1088627] Mon, 19 August 2013 23:03 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4005
Registered: July 2009
Senior Member

This question doesn't actually have anything to do with Eclipse. You'll reach a wider, and more appropriate, audience at another site like

Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Mon, 19 August 2013 23:03]

Report message to a moderator

Previous Topic:kernel error occur
Next Topic:closing perspective
Goto Forum:

Current Time: Mon Mar 08 17:21:13 GMT 2021

Powered by FUDForum. Page generated in 0.02738 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top