當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。