本文整理了Java中javax.swing.JButton.setForeground()
方法的一些代码示例,展示了JButton.setForeground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setForeground()
方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setForeground
暂无
代码示例来源:origin: runelite/runelite
@Override
public void mouseExited(MouseEvent mouseEvent)
{
clearButton.setForeground(ColorScheme.PROGRESS_ERROR_COLOR);
textField.dispatchEvent(mouseEvent);
}
});
代码示例来源:origin: runelite/runelite
@Override
public void mouseEntered(MouseEvent mouseEvent)
{
clearButton.setForeground(Color.PINK);
textField.dispatchEvent(mouseEvent);
}
代码示例来源:origin: kiegroup/optaplanner
private JButton createButton(Exam exam, Color color, String toolTip) {
JButton button = SwingUtils.makeSmallButton(new JButton(new ExamAction(exam)));
button.setBackground(color);
button.setToolTipText(toolTip);
if (exam instanceof FollowingExam) {
button.setForeground(TangoColorFactory.ALUMINIUM_5);
}
return button;
}
代码示例来源:origin: wildfly/wildfly
public void go() throws Exception {
if(!no_channel && !use_state)
channel.connect(cluster_name);
mainFrame=new JFrame();
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
panel=new DrawPanel(use_state);
panel.setBackground(background_color);
sub_panel=new JPanel();
mainFrame.getContentPane().add("Center", panel);
clear_button=new JButton("Clear");
clear_button.setFont(default_font);
clear_button.addActionListener(this);
leave_button=new JButton("Leave");
leave_button.setFont(default_font);
leave_button.addActionListener(this);
sub_panel.add("South", clear_button);
sub_panel.add("South", leave_button);
mainFrame.getContentPane().add("South", sub_panel);
mainFrame.setBackground(background_color);
clear_button.setForeground(Color.blue);
leave_button.setForeground(Color.blue);
mainFrame.pack();
mainFrame.setLocation(15, 25);
mainFrame.setBounds(new Rectangle(250, 250));
if(!no_channel && use_state) {
channel.connect(cluster_name, null, state_timeout);
}
mainFrame.setVisible(true);
setTitle();
}
代码示例来源:origin: wildfly/wildfly
mainFrame.getContentPane().add("South", sub_panel);
mainFrame.setBackground(background_color);
clear_button.setForeground(Color.blue);
leave_button.setForeground(Color.blue);
mainFrame.pack();
mainFrame.setLocation(15, 25);
代码示例来源:origin: kiegroup/optaplanner
public void addShiftAssignment(ShiftAssignment shiftAssignment) {
Shift shift = shiftAssignment.getShift();
JPanel shiftPanel = shiftPanelMap.get(shift);
JButton shiftAssignmentButton = SwingUtils.makeSmallButton(new JButton(new ShiftAssignmentAction(shiftAssignment)));
shiftAssignmentButton.setEnabled(shiftPanel.isEnabled());
if (employee != null) {
if (employee.getDayOffRequestMap().containsKey(shift.getShiftDate())
|| employee.getShiftOffRequestMap().containsKey(shift)) {
shiftAssignmentButton.setForeground(TangoColorFactory.SCARLET_1);
}
}
Color color = nurseRosteringPanel.determinePlanningEntityColor(shiftAssignment, shift.getShiftType());
shiftAssignmentButton.setBackground(color);
String toolTip = nurseRosteringPanel.determinePlanningEntityTooltip(shiftAssignment);
shiftAssignmentButton.setToolTipText(toolTip);
shiftPanel.add(shiftAssignmentButton);
shiftPanel.repaint();
shiftAssignmentButtonMap.put(shiftAssignment, shiftAssignmentButton);
}
代码示例来源:origin: runelite/runelite
clearButton.setPreferredSize(new Dimension(30, 0));
clearButton.setFont(FontManager.getRunescapeBoldFont());
clearButton.setForeground(ColorScheme.PROGRESS_ERROR_COLOR);
clearButton.setBorder(null);
clearButton.setBorderPainted(false);
代码示例来源:origin: stackoverflow.com
for(int i=1;i<=9;i++)
{
JButton btn = new JButton(String.valueOf(i));
btn.setBackground(Color.BLACK);
btn.setForeground(Color.GRAY);
p3.add(btn);
}
代码示例来源:origin: stackoverflow.com
private static JButton createSimpleButton(String text) {
JButton button = new JButton(text);
button.setForeground(Color.BLACK);
button.setBackground(Color.WHITE);
Border line = new LineBorder(Color.BLACK);
Border margin = new EmptyBorder(5, 15, 5, 15);
Border compound = new CompoundBorder(line, margin);
button.setBorder(compound);
return button;
}
代码示例来源:origin: stackoverflow.com
JButton addBtn = new JButton("+");
addBtn.setBounds(x_pos, y_pos, 30, 25);
addBtn.setBorder(new RoundedBorder(10)); //10 is the radius
addBtn.setForeground(Color.BLUE);
代码示例来源:origin: magefree/mage
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (hasFocus) {
renderButton.setForeground(table.getForeground());
renderButton.setBackground(UIManager.getColor("Button.background"));
} else if (isSelected) {
renderButton.setForeground(table.getSelectionForeground());
renderButton.setBackground(table.getSelectionBackground());
} else {
renderButton.setForeground(table.getForeground());
renderButton.setBackground(UIManager.getColor("Button.background"));
}
renderButton.setText((value == null) ? "" : value.toString());
return renderButton;
}
代码示例来源:origin: nodebox/nodebox
public DataControl(String nodePath, Port port) {
super(nodePath, port);
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
clearDataButton = new JButton("Clear");
clearDataButton.setMargin(new Insets(1, 0, 0, 0));
clearDataButton.putClientProperty("JButton.buttonType", "textured");
clearDataButton.putClientProperty("JComponent.sizeVariant", "small");
clearDataButton.setFont(Theme.SMALL_BOLD_FONT);
clearDataButton.setForeground(Theme.TEXT_NORMAL_COLOR);
clearDataButton.addActionListener(this);
add(clearDataButton);
/*showDataButton = new JButton("Show Data...");
showDataButton.setMargin(new Insets(1, 0, 0, 0));
showDataButton.putClientProperty("JButton.buttonType", "textured");
showDataButton.putClientProperty("JComponent.sizeVariant", "small");
showDataButton.setFont(Theme.SMALL_BOLD_FONT);
showDataButton.setForeground(Theme.TEXT_NORMAL_COLOR);
showDataButton.addActionListener(this);
add(showDataButton);*/
add(Box.createHorizontalGlue());
}
代码示例来源:origin: com.jidesoft/jide-oss
@Override
public void setForeground(Color fg) {
if (fg instanceof ColorUIResource) {
return;
}
super.setForeground(fg);
}
}
代码示例来源:origin: com.jalalkiswani/jk-desktop
@Override
public void setForeground(Color fg) {
if (fg != null) {
super.setForeground(fg);
}
}
代码示例来源:origin: stackoverflow.com
JButton aButton ...
aButton.setBackground(new Color(...));
aButton.setForeground(new Color(...));
aButton.setFont(new Font(...));
aButton.setBorder(null);
代码示例来源:origin: org.biojava.thirdparty/forester
void deactivateButtonToReturnToSuperTree() {
_return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
_return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
_return_to_super_tree.setEnabled( false );
}
代码示例来源:origin: com.github.tornaia/aott-desktop-client-core
private void styleDatePickerArrowButtons(JButton jButton) {
jButton.setFont(new JButton("").getFont().deriveFont(Font.PLAIN, 24));
jButton.setBackground(ColorConst.CONTENT_BACKGROUND);
jButton.setForeground(ColorConst.SIDENAV_TITLE_FOREGROUND);
jButton.setOpaque(false);
jButton.setBorder(BorderFactory.createLineBorder(ColorConst.CONTENT_BACKGROUND));
jButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
jButton.setPreferredSize(new Dimension(26, 26));
jButton.setFocusable(false);
}
}
代码示例来源:origin: MarginallyClever/Makelangelo-software
protected void openConnection() {
NetworkConnection s = gui.requestNewConnection();
if(s!=null) {
buttonConnect.setText(Translator.get("ButtonDisconnect"));
buttonConnect.setForeground(Color.RED);
robot.openConnection( s );
//updateMachineNumberPanel();
//updateButtonAccess();
isConnected=true;
}
}
代码示例来源:origin: freeplane/freeplane
private void updatePickColorButton() {
Color color = colors.get(index);
pickColor.setBackground(ColorUtils.makeNonTransparent(color));
final Color textColor = UITools.getTextColorForBackground(color);
pickColor.setForeground(textColor);
pickColor.setText(ColorUtils.colorToString(color));
}
private void removeFromPanel() {
代码示例来源:origin: jrtom/jung
public void actionPerformed(ActionEvent e) {
Color color =
JColorChooser.showDialog(
colorChooser, "Annotation Color", colorChooser.getForeground());
annotatingPlugin.setAnnotationColor(color);
colorChooser.setForeground(color);
}
});
内容来源于网络,如有侵权,请联系作者删除!