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


Java JTextArea.setForeground方法代码示例

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


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

示例1: getReportUI

import javax.swing.JTextArea; //导入方法依赖的package包/类
public JFrame getReportUI() {
	JFrame frame = new JFrame("Network Statistics Report Beta");

	frame.setSize(300, 400);
	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

	JTextArea text = new JTextArea(getReport());
	Font font = new Font("Monospaced", Font.BOLD, 12);
	text.setEditable(false);
	text.setFont(font);
	text.setForeground(Color.darkGray);

	frame.add(text);

	return frame;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:17,代码来源:NetworkStatistics.java

示例2: MBTracks

import javax.swing.JTextArea; //导入方法依赖的package包/类
public MBTracks( XMap map, int size ) {
		this.map = map;
		control = null;
	//	tracks = new MBTrack[size];
		cruises = new Vector();
		this.size = 0;
		plot = false;
		selectedCruise = -1;
		selectedTrack = -1;
		mbSel = new MBSelection(this);
		enabled = false;
		loaded = false;
		display = new JTextArea("none selected");
		display.setForeground(Color.black);

//		***** GMA 1.6.0: Add button to bring up selected ping file in datalink
		retrievePingFile = new JButton("Download selected ping file");
		retrievePingFile.addMouseListener(this);
		trackInfoAndButton = new JPanel(new BorderLayout());
		trackInfoAndButton.add(display, BorderLayout.NORTH);
		trackInfoAndButton.add(retrievePingFile, BorderLayout.EAST);
//		***** GMA 1.6.0
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:24,代码来源:MBTracks.java

示例3: Controls

import javax.swing.JTextArea; //导入方法依赖的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

示例4: createMessageArea

import javax.swing.JTextArea; //导入方法依赖的package包/类
private JScrollPane createMessageArea()
{
	messages = new JTextArea();
	messages.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	messages.setBackground(Color.black);
	messages.setForeground(Color.green);
	messages.setRows(10);
	messages.setLineWrap(true);

	scroller = new JScrollPane(messages);

	return scroller;
}
 
开发者ID:equella,项目名称:Equella,代码行数:14,代码来源:ProgressWindow.java

示例5: initComponents

import javax.swing.JTextArea; //导入方法依赖的package包/类
private void initComponents() {
    cardsPanel = new JPanel(new CardLayout());

    errorLabel = new JLabel();
    errorLabel.setForeground(ERROR_COLOR);
    errorLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(
            "org/netbeans/modules/bugtracking/ui/resources/error.gif")));   //NOI18N
    errorText = new JTextArea();
    errorText.setForeground(ERROR_COLOR);
    errorText.setBackground(errorLabel.getBackground());
    errorText.setEditable(false);
    
    errorScrollPane = new javax.swing.JScrollPane();
    errorScrollPane.setBorder(null);
    errorScrollPane.setViewportView(errorText);
    
    updateErrorMessage(" ");                                        //NOI18N
    
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    
    int height = errorText.getFont().getSize() * 3;
    
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(errorLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(errorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGap(6, 14, 14)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(errorScrollPane, height, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(errorLabel))
            )
    );
    layout.setHonorsVisibility(false);  //keep space for errorLabel
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:RepositoryFormPanel.java

示例6: installUI

import javax.swing.JTextArea; //导入方法依赖的package包/类
@Override
public void installUI(JComponent c) {
    super.installUI(c);

    jta = (JTextArea) c;

    JTextArea editor = jta;

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();
    Font f = editor.getFont();
    if ((f == null) || (f instanceof UIResource)) {
        editor.setFont(uidefaults.getFont(prefix + ".font"));
    }

    Color bg = editor.getBackground();
    if ((bg == null) || (bg instanceof UIResource)) {
        editor.setBackground(uidefaults.getColor(prefix + ".background"));
    }

    Color fg = editor.getForeground();
    if ((fg == null) || (fg instanceof UIResource)) {
        editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
    }

    Color color = editor.getCaretColor();
    if ((color == null) || (color instanceof UIResource)) {
        editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
    }

    Color s = editor.getSelectionColor();
    if ((s == null) || (s instanceof UIResource)) {
        editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
    }

    Color sfg = editor.getSelectedTextColor();
    if ((sfg == null) || (sfg instanceof UIResource)) {
        editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
    }

    Color dfg = editor.getDisabledTextColor();
    if ((dfg == null) || (dfg instanceof UIResource)) {
        editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
    }

    Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
    editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
        b,new EmptyBorder(2, 2, 2, 2)));

    Insets margin = editor.getMargin();
    if (margin == null || margin instanceof UIResource) {
        editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:XTextAreaPeer.java


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