本文整理汇总了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;
}
示例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
}
示例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);
}
示例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;
}
示例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
}
示例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"));
}
}